Animation trees
This commit is contained in:
70
src/k3anim.h
Normal file
70
src/k3anim.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
#include<cglm/mat4.h>
|
||||
#include<cglm/quat.h>
|
||||
#include<stdint.h>
|
||||
#include<stddef.h>
|
||||
|
||||
struct k3AnimationBone {
|
||||
vec4 translation;
|
||||
versor rotation;
|
||||
};
|
||||
|
||||
enum k3AnimationOp {
|
||||
k3_ANIM_BASIC,
|
||||
k3_ANIM_BLEND,
|
||||
k3_ANIM_ADD,
|
||||
};
|
||||
|
||||
struct k3AnimationFountain {
|
||||
float fps;
|
||||
size_t frameCount;
|
||||
size_t bones;
|
||||
uint16_t id;
|
||||
_Alignas(16) struct k3AnimationBone frames[];
|
||||
};
|
||||
|
||||
struct k3Animation {
|
||||
enum k3AnimationOp op;
|
||||
size_t bones;
|
||||
struct k3AnimationBone *cache;
|
||||
size_t ref;
|
||||
};
|
||||
|
||||
struct k3AnimationBasic {
|
||||
enum k3AnimationOp op;
|
||||
size_t bones;
|
||||
struct k3AnimationBone *cache;
|
||||
size_t ref;
|
||||
|
||||
struct k3AnimationFountain *fountain;
|
||||
bool loop;
|
||||
};
|
||||
|
||||
struct k3AnimationBlend {
|
||||
enum k3AnimationOp op;
|
||||
size_t bones;
|
||||
struct k3AnimationBone *cache;
|
||||
size_t ref;
|
||||
|
||||
size_t children;
|
||||
float *offsets;
|
||||
float *speeds;
|
||||
float *weights;
|
||||
struct k3Animation **subs;
|
||||
};
|
||||
|
||||
struct k3AnimationAdd {
|
||||
enum k3AnimationOp op;
|
||||
size_t bones;
|
||||
struct k3AnimationBone *cache;
|
||||
size_t ref;
|
||||
|
||||
struct k3Animation *sub1;
|
||||
struct k3Animation *sub2;
|
||||
|
||||
float scale;
|
||||
};
|
||||
|
||||
bool k3AnimationUpdate(struct k3Animation *anim, float time);
|
||||
void k3AnimationFree(struct k3Animation *anim);
|
||||
Reference in New Issue
Block a user