2#include <vulkan/vulkan.h>
31 Vertex(
const glm::vec3& pos = {},
const glm::vec3& n = {},
const glm::vec2& u = {},
32 const glm::ivec4& bones = glm::ivec4(0),
const glm::vec4& weights = glm::vec4(0.0f))
42 VkVertexInputBindingDescription binding{};
44 binding.stride =
sizeof(
Vertex);
45 binding.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
55 std::vector<VkVertexInputAttributeDescription> attributes(5);
58 attributes[0].binding = 0;
59 attributes[0].location = 0;
60 attributes[0].format = VK_FORMAT_R32G32B32_SFLOAT;
64 attributes[1].binding = 0;
65 attributes[1].location = 1;
66 attributes[1].format = VK_FORMAT_R32G32B32_SFLOAT;
70 attributes[2].binding = 0;
71 attributes[2].location = 2;
72 attributes[2].format = VK_FORMAT_R32G32_SFLOAT;
73 attributes[2].offset = offsetof(
Vertex,
uv);
76 attributes[3].binding = 0;
77 attributes[3].location = 3;
78 attributes[3].format = VK_FORMAT_R32G32B32A32_SINT;
82 attributes[4].binding = 0;
83 attributes[4].location = 4;
84 attributes[4].format = VK_FORMAT_R32G32B32A32_SFLOAT;
139 const std::vector<Vertex>& verts = {},
140 const std::vector<uint32_t>& inds = {},
141 VkBuffer vBuf = VK_NULL_HANDLE,
142 VkDeviceMemory vMem = VK_NULL_HANDLE,
143 VkBuffer iBuf = VK_NULL_HANDLE,
144 VkDeviceMemory iMem = VK_NULL_HANDLE
VkBuffer vertexBuffer
Vulkan buffer holding the vertex data.
Definition Mesh.hpp:115
std::string parentBoneName
Name of the parent bone/joint in glTF.
Definition Mesh.hpp:107
std::vector< uint32_t > indices
CPU-side index data.
Definition Mesh.hpp:112
std::vector< Vertex > vertices
CPU-side vertex data.
Definition Mesh.hpp:110
VkDeviceMemory indexBufferMemory
GPU memory backing the index data.
Definition Mesh.hpp:121
uint32_t id
Unique identifier for this mesh.
Definition Mesh.hpp:98
std::string gltfPath
Target glTF/glb file path.
Definition Mesh.hpp:101
int primitiveIndex
Index of the primitive submesh in glTF.
Definition Mesh.hpp:103
VkBuffer indexBuffer
Vulkan buffer holding the index data.
Definition Mesh.hpp:119
bool isSkinned
Whether this mesh has skin weights and is deformed on GPU.
Definition Mesh.hpp:124
Mesh(const std::vector< Vertex > &verts={}, const std::vector< uint32_t > &inds={}, VkBuffer vBuf=VK_NULL_HANDLE, VkDeviceMemory vMem=VK_NULL_HANDLE, VkBuffer iBuf=VK_NULL_HANDLE, VkDeviceMemory iMem=VK_NULL_HANDLE)
Construct a new Mesh object.
Definition Mesh.hpp:138
bool visible
Whether this mesh should be rendered.
Definition Mesh.hpp:127
VkDeviceMemory vertexBufferMemory
GPU memory backing the vertex buffer.
Definition Mesh.hpp:117
std::string nodeName
Name of the node associated with this mesh.
Definition Mesh.hpp:105
glm::vec3 position
Position of the vertex in 3D space.
Definition Mesh.hpp:13
glm::ivec4 boneIDs
Bone IDs that influence this vertex (Max 4).
Definition Mesh.hpp:19
glm::vec3 normal
Normal vector of the vertex for lighting calculations.
Definition Mesh.hpp:15
Vertex(const glm::vec3 &pos={}, const glm::vec3 &n={}, const glm::vec2 &u={}, const glm::ivec4 &bones=glm::ivec4(0), const glm::vec4 &weights=glm::vec4(0.0f))
Construct a new Vertex object.
Definition Mesh.hpp:31
glm::vec2 uv
Texture coordinate (UV) of the vertex.
Definition Mesh.hpp:17
static std::vector< VkVertexInputAttributeDescription > getAttributeDescriptions()
Retrieves the Vulkan vertex input attribute descriptions.
Definition Mesh.hpp:54
glm::vec4 boneWeights
Bone weight influences (sums to 1.0).
Definition Mesh.hpp:21
static VkVertexInputBindingDescription getBindingDescription()
Retrieves the Vulkan vertex input binding description.
Definition Mesh.hpp:41
return false
Definition ufbx.cpp:28341