Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
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
10
class
VulkanBuffer
;
11
16
struct
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]
37
struct
SkeletonComponent
{
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
48
#include "
meta/ComponentReflection.hpp
"
49
REGISTER_COMPONENT
(
SkeletonComponent
,
"Animation/Skeleton"
);
50
51
ComponentReflection.hpp
REGISTER_COMPONENT
#define REGISTER_COMPONENT(Type, MenuPath)
Definition
ComponentReflection.hpp:156
VulkanBuffer
Inline wrapper class for managing a Vulkan buffer and its associated device memory.
Definition
Buffer.hpp:10
Joint
Describes a single bone node in the skeleton joint hierarchy.
Definition
Skeleton.hpp:16
Joint::name
std::string name
Joint name identifier.
Definition
Skeleton.hpp:18
Joint::localTransform
glm::mat4 localTransform
Local animation pose transform (Translation * Rotation * Scale).
Definition
Skeleton.hpp:24
Joint::bindRotation
glm::quat bindRotation
Definition
Skeleton.hpp:28
Joint::parentIndex
int parentIndex
Parent joint array index (-1 if root).
Definition
Skeleton.hpp:20
Joint::bindTranslation
glm::vec3 bindTranslation
Definition
Skeleton.hpp:27
Joint::inverseBindMatrix
glm::mat4 inverseBindMatrix
Inverse bind transform matrix mapping geometry to bone local space.
Definition
Skeleton.hpp:22
Joint::bindScale
glm::vec3 bindScale
Definition
Skeleton.hpp:29
SkeletonComponent
Component managing the list of joints and generating the offset matrices palette.
Definition
Skeleton.hpp:37
SkeletonComponent::gpuBuffer
std::shared_ptr< VulkanBuffer > gpuBuffer
Definition
Skeleton.hpp:44
SkeletonComponent::joints
std::vector< Joint > joints
List of joints forming the skeleton hierarchy.
Definition
Skeleton.hpp:40
SkeletonComponent::descriptorSet
VkDescriptorSet descriptorSet
Definition
Skeleton.hpp:45
SkeletonComponent::jointMatrices
std::vector< glm::mat4 > jointMatrices
Calculated final joint offsets list uploaded to VRAM descriptors.
Definition
Skeleton.hpp:42
engine
include
ecs
components
Skeleton.hpp
Generated by
1.17.0