6#include "render/Material.h"
7#include "render/Mesh.h"
8#include "render/RenderQueue.h"
9#include "scene/GameObject.h"
10#include "scene/components/AnimationComponent.h"
16 const std::shared_ptr<Mesh> &
mesh,
17 const std::shared_ptr<Skeleton> &skeleton)
20 , m_skeleton(skeleton)
24 m_identityPalette.assign(m_skeleton->Size(), glm::mat4(1.0f));
30 if (!m_material || !m_mesh)
35 const std::vector<glm::mat4> *palette = &m_identityPalette;
38 const auto &live = m_paletteSource->
GetPalette();
45 if (!palette->empty())
47 m_material->SetParam(
"uBones", *palette);
52 command.
mesh = m_mesh.get();
70 m_skeleton = skeleton;
73 m_identityPalette.assign(m_skeleton->Size(), glm::mat4(1.0f));
79 m_paletteSource = anim;
Console logging macros for all engine and game code.
std::shared_ptr< Material > material
std::shared_ptr< Mesh > mesh
Bone hierarchy + bind/offset matrices for GPU-skinned meshes.
Renderable component for GPU-skinned meshes driven by a Skeleton.
Drives transform animation on a hierarchy of GameObjects.
const std::vector< glm::mat4 > & GetPalette() const
Read-only access to the bone palette computed at the last Update().
RenderQueue & GetRenderQueue()
Returns the per-frame command queue that batches and issues draw calls.
static Engine & GetInstance()
Returns the single Engine instance (created on first call).
mat4 GetWorldTransform() const
Compute the world transform by walking up the parent chain.
void Submit(const RenderCommand &command)
Add a draw command to the queue for this frame.
void SetMaterial(const std::shared_ptr< Material > &material)
SkinnedMeshComponent()=default
void SetPaletteSource(AnimationComponent *anim)
Plug an AnimationComponent (typically on the model root) as the live palette source.
void SetMesh(const std::shared_ptr< Mesh > &mesh)
void Update(f32 deltaTime) override
void SetSkeleton(const std::shared_ptr< Skeleton > &skeleton)
float f32
32-bit IEEE float — the standard GL scalar type.
One draw call unit: a Mesh + Material + world-space transform.
mat4 modelMatrix
Object → World transform for this draw call.
Mesh * mesh
Geometry to draw (non-owning raw pointer).
Material * material
Surface definition (non-owning raw pointer).