-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVertex.cpp
More file actions
34 lines (28 loc) · 1.04 KB
/
Vertex.cpp
File metadata and controls
34 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "Vertex.hpp"
vk::VertexInputBindingDescription Vertex::getBindingDescription() {
vk::VertexInputBindingDescription bindingDescription{};
bindingDescription.binding = 0;
bindingDescription.stride = sizeof(Vertex);
bindingDescription.inputRate = vk::VertexInputRate::eVertex;
return bindingDescription;
}
std::array<vk::VertexInputAttributeDescription, 3>
Vertex::getAttributeDescriptions() {
const std::array attributeDescriptions{
vk::VertexInputAttributeDescription()
.setBinding(0)
.setLocation(0)
.setFormat(vk::Format::eR32G32B32Sfloat)
.setOffset(offsetof(Vertex, pos)),
vk::VertexInputAttributeDescription()
.setBinding(0)
.setLocation(1)
.setFormat(vk::Format::eR32G32B32Sfloat)
.setOffset(offsetof(Vertex, color)),
vk::VertexInputAttributeDescription()
.setBinding(0)
.setLocation(2)
.setFormat(vk::Format::eR32G32Sfloat)
.setOffset(offsetof(Vertex, texCoord))};
return attributeDescriptions;
}