45 lines
732 B
C
45 lines
732 B
C
#ifndef MODEL_H
|
|
#define MODEL_H
|
|
|
|
#include "linear_alg.h"
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef uint16_t index_t;
|
|
|
|
typedef struct {
|
|
vec3_t position;
|
|
vec3_t normal;
|
|
u16_vec4_t bones;
|
|
vec4_t weights;
|
|
} vertex_t;
|
|
|
|
typedef struct {
|
|
vec3_t translation;
|
|
vec4_t rotation;
|
|
} bone_t;
|
|
|
|
typedef struct {
|
|
uint32_t *times_us;
|
|
bone_t *keyframes;
|
|
size_t length_us, keyframe_count;
|
|
} animation_t;
|
|
|
|
typedef struct {
|
|
vertex_t *vertices;
|
|
index_t *indices;
|
|
bone_t *bones;
|
|
uint32_t *bone_parents;
|
|
mat4_t *inverse_bind_matrices;
|
|
animation_t animation;
|
|
size_t vertex_count;
|
|
size_t index_count;
|
|
size_t bone_count;
|
|
} model_t;
|
|
|
|
model_t model_init(size_t vertex_count, size_t index_count);
|
|
void model_cleanup(model_t *m);
|
|
|
|
#endif
|