From 440b292c39162284a447b34d3a692143af9fbc87 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 30 Oct 2025 17:21:22 -0700 Subject: - Replace SceneCamera with Camera. - Remove backpointer from scene types to node to decouple underlying types from the scene graph. --- src/scene/animation_impl.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/scene/animation_impl.h') diff --git a/src/scene/animation_impl.h b/src/scene/animation_impl.h index 4408158..ef1492c 100644 --- a/src/scene/animation_impl.h +++ b/src/scene/animation_impl.h @@ -12,7 +12,6 @@ #include #include -#include typedef struct Buffer Buffer; @@ -24,24 +23,24 @@ typedef struct Buffer Buffer; /// Joints are mutable and store the transform and joint matrices that result /// from animation, aside from the inverse bind matrix. typedef struct Joint { - joint_idx child; /// First child Joint; index into Anima's joints. - joint_idx next; /// Next sibling Joint; index into Anima's joints. - mat4 transform; /// Local transform relative to parent. - mat4 inv_bind_matrix; /// Transforms the mesh into the joint's local space. - mat4 joint_matrix; /// inv(global) * global joint transform * inv(bind). - aabb3 box; /// Bounding box of vertices affected by joint. + joint_idx child; // First child Joint; index into Anima's joints. + joint_idx next; // Next sibling Joint; index into Anima's joints. + mat4 transform; // Local transform relative to parent. + mat4 inv_bind_matrix; // Transforms the mesh into the joint's local space. + mat4 joint_matrix; // inv(global) * global joint transform * inv(bind). + aabb3 box; // Bounding box of vertices affected by joint. } Joint; /// Animation skeleton. typedef struct Skeleton { skeleton_idx next; size_t num_joints; - joint_idx joints[GFX_MAX_NUM_JOINTS]; /// Indices into Anima's joints array. + joint_idx joints[GFX_MAX_NUM_JOINTS]; // Indices into Anima's joints array. } Skeleton; /// A keyframe of animation. typedef struct Keyframe { - R time; /// Start time in [0, end animation time] + R time; // Start time in [0, end animation time] union { vec3 translation; quat rotation; @@ -50,7 +49,7 @@ typedef struct Keyframe { /// Animation channel. typedef struct Channel { - joint_idx target; /// Index into Anima's joints array. + joint_idx target; // Index into Anima's joints array. ChannelType type; AnimationInterpolation interpolation; size_t num_keyframes; @@ -89,10 +88,9 @@ typedef struct AnimationState { /// have no parent (a skeleton need not have its own root and can be a set of /// disjoint node hierarchies). typedef struct Anima { - node_idx parent; /// Parent SceneNode. - skeleton_idx skeleton; /// Index of first skeleton. - animation_idx animation; /// Index of first animation. - AnimationState state; /// Current animation state. - size_t num_joints; /// Number of actual joints in the array. - Joint joints[GFX_MAX_NUM_JOINTS]; /// Shared by all skeletons. + skeleton_idx skeleton; // Index of first skeleton. + animation_idx animation; // Index of first animation. + AnimationState state; // Current animation state. + size_t num_joints; // Number of actual joints in the array. + Joint joints[GFX_MAX_NUM_JOINTS]; // Shared by all skeletons. } Anima; -- cgit v1.2.3