From f5dbf162a7cf559eb8e4f0d220f918fe233d421f Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sat, 25 Apr 2020 17:09:31 +0200 Subject: [PATCH] Added helper function to get vertex input attribute descriptions from requested vertexattributes as a vector That vector can directly be used for a pipeline's vertex attribute setup --- base/VulkanglTFModel.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/base/VulkanglTFModel.hpp b/base/VulkanglTFModel.hpp index e5e4feeb..294739cc 100644 --- a/base/VulkanglTFModel.hpp +++ b/base/VulkanglTFModel.hpp @@ -534,11 +534,22 @@ namespace vkglTF return VkVertexInputAttributeDescription({ location, binding, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(Vertex, joint0) }); case VertexComponent::Weight0: return VkVertexInputAttributeDescription({ location, binding, VK_FORMAT_R32G32B32A32_SFLOAT, offsetof(Vertex, weight0) }); + default: + return VkVertexInputAttributeDescription({}); } } + static std::vector inputAttributeDescriptions(uint32_t binding, const std::vector components) { + std::vector result; + uint32_t location = 0; + for (VertexComponent component : components) { + result.push_back(Vertex::inputAttributeDescription(binding, location, component)); + location++; + } + return result; + } }; - typedef enum FileLoadingFlags { + enum FileLoadingFlags { None = 0x00000000, PreTransformVertices = 0x00000001, PreMultiplyVertexColors = 0x00000002,