@@ -10,22 +10,25 @@ vk::VertexInputBindingDescription Vertex::getBindingDescription() {
1010
1111std::array<vk::VertexInputAttributeDescription, 3 >
1212Vertex::getAttributeDescriptions () {
13- std::array<vk::VertexInputAttributeDescription, 3 > attributeDescriptions{};
13+ const std::array attributeDescriptions{
14+ vk::VertexInputAttributeDescription ()
15+ .setBinding (0 )
16+ .setLocation (0 )
17+ .setFormat (vk::Format::eR32G32Sfloat)
18+ .setOffset (offsetof (Vertex, pos)),
1419
15- attributeDescriptions[0 ].binding = 0 ;
16- attributeDescriptions[0 ].location = 0 ;
17- attributeDescriptions[0 ].format = vk::Format::eR32G32Sfloat;
18- attributeDescriptions[0 ].offset = offsetof (Vertex, pos);
20+ vk::VertexInputAttributeDescription ()
21+ .setBinding (0 )
22+ .setLocation (1 )
23+ .setFormat (vk::Format::eR32G32B32Sfloat)
24+ .setOffset (offsetof (Vertex, color)),
1925
20- attributeDescriptions[1 ].binding = 0 ;
21- attributeDescriptions[1 ].location = 1 ;
22- attributeDescriptions[1 ].format = vk::Format::eR32G32B32Sfloat;
23- attributeDescriptions[1 ].offset = offsetof (Vertex, color);
26+ vk::VertexInputAttributeDescription ()
27+ .setBinding (0 )
28+ .setLocation (2 )
29+ .setFormat (vk::Format::eR32G32Sfloat)
30+ .setOffset (offsetof (Vertex, texCoord))};
2431
25- attributeDescriptions[2 ].binding = 0 ;
26- attributeDescriptions[2 ].location = 2 ;
27- attributeDescriptions[2 ].format = vk::Format::eR32G32Sfloat;
28- attributeDescriptions[2 ].offset = offsetof (Vertex, texCoord);
2932
3033 return attributeDescriptions;
3134}
0 commit comments