Extracted vertex into separate class with easy component to Vulkan vertex attribute mappings
Load vertex colors if present Added flag to pre-transform vertices
This commit is contained in:
parent
424de5fab3
commit
107aa35b9e
2 changed files with 86 additions and 18 deletions
|
|
@ -221,17 +221,15 @@ public:
|
|||
VkPipelineDynamicStateCreateInfo dynamicStateCI = vks::initializers::pipelineDynamicStateCreateInfo(dynamicStateEnables.data(), static_cast<uint32_t>(dynamicStateEnables.size()), 0);
|
||||
|
||||
// Vertex bindings and attributes
|
||||
const std::vector<VkVertexInputBindingDescription> vertexInputBindings = {
|
||||
vks::initializers::vertexInputBindingDescription(0, sizeof(vkglTF::Model::Vertex), VK_VERTEX_INPUT_RATE_VERTEX),
|
||||
};
|
||||
VkVertexInputBindingDescription vertexInputBinding = vkglTF::Vertex::inputBindingDescription(0);
|
||||
const std::vector<VkVertexInputAttributeDescription> vertexInputAttributes = {
|
||||
vks::initializers::vertexInputAttributeDescription(0, 0, VK_FORMAT_R32G32B32_SFLOAT, 0), // Location 0: Position
|
||||
vks::initializers::vertexInputAttributeDescription(0, 1, VK_FORMAT_R32G32B32_SFLOAT, sizeof(float) * 3), // Location 1: Normal
|
||||
vks::initializers::vertexInputAttributeDescription(0, 2, VK_FORMAT_R32G32_SFLOAT, sizeof(float) * 6), // Location 2: UV
|
||||
vkglTF::Vertex::inputAttributeDescription(0, 0, vkglTF::VertexComponent::Position),
|
||||
vkglTF::Vertex::inputAttributeDescription(0, 1, vkglTF::VertexComponent::Normal),
|
||||
vkglTF::Vertex::inputAttributeDescription(0, 2, vkglTF::VertexComponent::UV)
|
||||
};
|
||||
VkPipelineVertexInputStateCreateInfo vertexInputState = vks::initializers::pipelineVertexInputStateCreateInfo();
|
||||
vertexInputState.vertexBindingDescriptionCount = static_cast<uint32_t>(vertexInputBindings.size());
|
||||
vertexInputState.pVertexBindingDescriptions = vertexInputBindings.data();
|
||||
vertexInputState.vertexBindingDescriptionCount = 1;
|
||||
vertexInputState.pVertexBindingDescriptions = &vertexInputBinding;
|
||||
vertexInputState.vertexAttributeDescriptionCount = static_cast<uint32_t>(vertexInputAttributes.size());
|
||||
vertexInputState.pVertexAttributeDescriptions = vertexInputAttributes.data();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue