diff options
Diffstat (limited to 'src/scene/animation_impl.h')
| -rw-r--r-- | src/scene/animation_impl.h | 30 | 
1 files changed, 14 insertions, 16 deletions
| 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 @@ | |||
| 12 | #include <math/vec3.h> | 12 | #include <math/vec3.h> | 
| 13 | 13 | ||
| 14 | #include <stddef.h> | 14 | #include <stddef.h> | 
| 15 | #include <stdint.h> | ||
| 16 | 15 | ||
| 17 | typedef struct Buffer Buffer; | 16 | typedef struct Buffer Buffer; | 
| 18 | 17 | ||
| @@ -24,24 +23,24 @@ typedef struct Buffer Buffer; | |||
| 24 | /// Joints are mutable and store the transform and joint matrices that result | 23 | /// Joints are mutable and store the transform and joint matrices that result | 
| 25 | /// from animation, aside from the inverse bind matrix. | 24 | /// from animation, aside from the inverse bind matrix. | 
| 26 | typedef struct Joint { | 25 | typedef struct Joint { | 
| 27 | joint_idx child; /// First child Joint; index into Anima's joints. | 26 | joint_idx child; // First child Joint; index into Anima's joints. | 
| 28 | joint_idx next; /// Next sibling Joint; index into Anima's joints. | 27 | joint_idx next; // Next sibling Joint; index into Anima's joints. | 
| 29 | mat4 transform; /// Local transform relative to parent. | 28 | mat4 transform; // Local transform relative to parent. | 
| 30 | mat4 inv_bind_matrix; /// Transforms the mesh into the joint's local space. | 29 | mat4 inv_bind_matrix; // Transforms the mesh into the joint's local space. | 
| 31 | mat4 joint_matrix; /// inv(global) * global joint transform * inv(bind). | 30 | mat4 joint_matrix; // inv(global) * global joint transform * inv(bind). | 
| 32 | aabb3 box; /// Bounding box of vertices affected by joint. | 31 | aabb3 box; // Bounding box of vertices affected by joint. | 
| 33 | } Joint; | 32 | } Joint; | 
| 34 | 33 | ||
| 35 | /// Animation skeleton. | 34 | /// Animation skeleton. | 
| 36 | typedef struct Skeleton { | 35 | typedef struct Skeleton { | 
| 37 | skeleton_idx next; | 36 | skeleton_idx next; | 
| 38 | size_t num_joints; | 37 | size_t num_joints; | 
| 39 | joint_idx joints[GFX_MAX_NUM_JOINTS]; /// Indices into Anima's joints array. | 38 | joint_idx joints[GFX_MAX_NUM_JOINTS]; // Indices into Anima's joints array. | 
| 40 | } Skeleton; | 39 | } Skeleton; | 
| 41 | 40 | ||
| 42 | /// A keyframe of animation. | 41 | /// A keyframe of animation. | 
| 43 | typedef struct Keyframe { | 42 | typedef struct Keyframe { | 
| 44 | R time; /// Start time in [0, end animation time] | 43 | R time; // Start time in [0, end animation time] | 
| 45 | union { | 44 | union { | 
| 46 | vec3 translation; | 45 | vec3 translation; | 
| 47 | quat rotation; | 46 | quat rotation; | 
| @@ -50,7 +49,7 @@ typedef struct Keyframe { | |||
| 50 | 49 | ||
| 51 | /// Animation channel. | 50 | /// Animation channel. | 
| 52 | typedef struct Channel { | 51 | typedef struct Channel { | 
| 53 | joint_idx target; /// Index into Anima's joints array. | 52 | joint_idx target; // Index into Anima's joints array. | 
| 54 | ChannelType type; | 53 | ChannelType type; | 
| 55 | AnimationInterpolation interpolation; | 54 | AnimationInterpolation interpolation; | 
| 56 | size_t num_keyframes; | 55 | size_t num_keyframes; | 
| @@ -89,10 +88,9 @@ typedef struct AnimationState { | |||
| 89 | /// have no parent (a skeleton need not have its own root and can be a set of | 88 | /// have no parent (a skeleton need not have its own root and can be a set of | 
| 90 | /// disjoint node hierarchies). | 89 | /// disjoint node hierarchies). | 
| 91 | typedef struct Anima { | 90 | typedef struct Anima { | 
| 92 | node_idx parent; /// Parent SceneNode. | 91 | skeleton_idx skeleton; // Index of first skeleton. | 
| 93 | skeleton_idx skeleton; /// Index of first skeleton. | 92 | animation_idx animation; // Index of first animation. | 
| 94 | animation_idx animation; /// Index of first animation. | 93 | AnimationState state; // Current animation state. | 
| 95 | AnimationState state; /// Current animation state. | 94 | size_t num_joints; // Number of actual joints in the array. | 
| 96 | size_t num_joints; /// Number of actual joints in the array. | 95 | Joint joints[GFX_MAX_NUM_JOINTS]; // Shared by all skeletons. | 
| 97 | Joint joints[GFX_MAX_NUM_JOINTS]; /// Shared by all skeletons. | ||
| 98 | } Anima; | 96 | } Anima; | 
