summaryrefslogtreecommitdiff
path: root/src/animation.h
blob: 43712796ffb3e425ffd46b4745601ad17c11040e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once

#include "darray.h"
#include "defines.h"
#include "maths_types.h"

KITC_DECL_TYPED_ARRAY(f32)

typedef enum Interpolation { INTERPOLATION_LINEAR, INTERPOLATION_COUNT } Interpolation;

typedef enum KeyframeKind {
  KEYFRAME_ROTATION,
  KEYFRAME_TRANSLATION,
  KEYFRAME_SCALE,
  KEYFRAME_WEIGHTS,
} KeyframeKind;

// typedef union keyframe {
//   quat rotation;
//   vec3 translation;
//   vec3 scale;
//   float* weights;
// } keyframe;

// typedef struct keyframes {
//   keyframe_kind kind;
//   keyframe* values;
//   size_t count;
// } keyframes;

// typedef struct joint {
//   char* name;  // optional
//   transform transform_components;
//   mat4 inverse_bind_matrix;
//   mat4 local_transform;
// } joint;

// typedef struct animation_spline {
//   f32* timestamps;
//   size_t n_timestamps;
//   keyframes values;
//   interpolation interpolation;
// } animation_spline;

// typedef struct animation_sampler {
//   int current_index;
//   f32 min;
//   f32 max;
//   animation_spline animation;
// } animation_sampler;

// /** @brief Sample an animation at a given time `t` */
// keyframe animation_sample(animation_sampler* sampler, f32 t);

// typedef struct animation_clip {
//   // A clip contains one or more animation curves
//   // for now I think we can just enumerate all of the properties (assuming *only* one per type is in
//   // a clip) NULL = this property is not animated in this clip
//   animation_sampler* rotation;
//   animation_sampler* translation;
//   animation_sampler* scale;
//   animation_sampler* weights;
// } animation_clip;

// typedef struct skinned_animation {
//   mat4* joint_matrices;
//   size_t n_joints;
// } skinned_animation;

// // void animation_update_joint_matrices(animation_clip* )

// void animation_play(animation_clip* clip);