prosperon/source/engine/anim.h

39 lines
566 B
C
Raw Normal View History

2022-12-27 17:54:39 -06:00
#ifndef ANIM_H
#define ANIM_H
2023-12-04 13:38:37 -06:00
#include "HandmadeMath.h"
2022-12-27 17:54:39 -06:00
struct keyframe {
2023-05-12 13:22:05 -05:00
double time;
double val;
2022-12-27 17:54:39 -06:00
};
2023-12-04 13:38:37 -06:00
#define LINEAR 0
#define STEP 1
#define CUBICSPLINE 2
2024-01-01 17:30:42 -06:00
#define SLERP 3
2023-12-04 13:38:37 -06:00
typedef struct sampler {
float *times;
HMM_Vec4 *data;
int type;
} sampler;
struct anim_channel {
2024-04-26 16:04:31 -05:00
HMM_Vec4 *target;
int comps;
2023-12-04 13:38:37 -06:00
sampler *sampler;
};
struct animation {
char *name;
double time;
struct anim_channel *channels;
2024-04-26 16:04:31 -05:00
sampler *samplers;
2022-12-27 17:54:39 -06:00
};
2024-04-26 16:04:31 -05:00
void animation_run(struct animation *anim, float now);
2023-12-04 13:38:37 -06:00
HMM_Vec4 sample_sampler(sampler *sampler, float time);
2022-12-27 17:54:39 -06:00
2023-12-04 13:38:37 -06:00
#endif