SDEngine
Game Engine
Loading...
Searching...
No Matches
Vertex.hpp
Go to the documentation of this file.
1#pragma once
2#include <VLA/Vector.hpp>
3#include <vulkan/vulkan.hpp>
4
5#include "core/types.hpp"
6namespace sd {
7
8struct VertexPNUV {
9 VLA::Vector3f position;
10 VLA::Vector3f normal;
11 VLA::Vector2f uv;
12
13 static constexpr std::array<vk::VertexInputBindingDescription, 1> binding_descriptions() {
14 return {
15 {{.binding = 0, .stride = sizeof(VertexPNUV), .inputRate = vk::VertexInputRate::eVertex}}};
16 }
17
18 static constexpr std::array<vk::VertexInputAttributeDescription, 3> attribute_descriptions() {
19 return {
20 {
21 {
22 .location = 0,
23 .binding = 0,
24 .format = vk::Format::eR32G32B32Sfloat,
25 .offset = static_cast<U32>(offsetof(VertexPNUV, position)),
26 }, {
27 .location = 1,
28 .binding = 0,
29 .format = vk::Format::eR32G32B32Sfloat,
30 .offset = static_cast<U32>(offsetof(VertexPNUV, normal)),
31 }, {
32 .location = 2,
33 .binding = 0,
34 .format = vk::Format::eR32G32Sfloat,
35 .offset = static_cast<U32>(offsetof(VertexPNUV, uv)),
36 }, }
37 };
38 };
39};
40} // namespace sd
Definition Application.hpp:22
Definition Vertex.hpp:8
static constexpr std::array< vk::VertexInputAttributeDescription, 3 > attribute_descriptions()
Definition Vertex.hpp:18
VLA::Vector2f uv
Definition Vertex.hpp:11
VLA::Vector3f position
Definition Vertex.hpp:9
VLA::Vector3f normal
Definition Vertex.hpp:10
static constexpr std::array< vk::VertexInputBindingDescription, 1 > binding_descriptions()
Definition Vertex.hpp:13
consteval U64 type_id_of()
Definition type_id.hpp:6
std::uint32_t U32
Definition types.hpp:15