Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
Skeleton.hpp
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <vector>
4#include <glm/glm.hpp>
5#include <glm/gtc/quaternion.hpp>
6#include <memory>
7#include <vulkan/vulkan.h>
8
9
10class VulkanBuffer;
11
16struct Joint {
18 std::string name;
20 int parentIndex = -1;
22 glm::mat4 inverseBindMatrix = glm::mat4(1.0f);
24 glm::mat4 localTransform = glm::mat4(1.0f);
25
26 // Bind pose local TRS components
27 glm::vec3 bindTranslation = glm::vec3(0.0f);
28 glm::quat bindRotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
29 glm::vec3 bindScale = glm::vec3(1.0f);
30};
31
36// [ReflectClass]
38
40 std::vector<Joint> joints;
42 std::vector<glm::mat4> jointMatrices;
43
44 std::shared_ptr<VulkanBuffer> gpuBuffer;
45 VkDescriptorSet descriptorSet = VK_NULL_HANDLE;
46};
47
50
51
#define REGISTER_COMPONENT(Type, MenuPath)
Definition ComponentReflection.hpp:156
Inline wrapper class for managing a Vulkan buffer and its associated device memory.
Definition Buffer.hpp:10
Describes a single bone node in the skeleton joint hierarchy.
Definition Skeleton.hpp:16
std::string name
Joint name identifier.
Definition Skeleton.hpp:18
glm::mat4 localTransform
Local animation pose transform (Translation * Rotation * Scale).
Definition Skeleton.hpp:24
glm::quat bindRotation
Definition Skeleton.hpp:28
int parentIndex
Parent joint array index (-1 if root).
Definition Skeleton.hpp:20
glm::vec3 bindTranslation
Definition Skeleton.hpp:27
glm::mat4 inverseBindMatrix
Inverse bind transform matrix mapping geometry to bone local space.
Definition Skeleton.hpp:22
glm::vec3 bindScale
Definition Skeleton.hpp:29
Component managing the list of joints and generating the offset matrices palette.
Definition Skeleton.hpp:37
std::shared_ptr< VulkanBuffer > gpuBuffer
Definition Skeleton.hpp:44
std::vector< Joint > joints
List of joints forming the skeleton hierarchy.
Definition Skeleton.hpp:40
VkDescriptorSet descriptorSet
Definition Skeleton.hpp:45
std::vector< glm::mat4 > jointMatrices
Calculated final joint offsets list uploaded to VRAM descriptors.
Definition Skeleton.hpp:42