2021-11-30 21:29:18 -06:00
|
|
|
#ifndef MODEL_H
|
|
|
|
#define MODEL_H
|
|
|
|
|
2023-05-12 13:22:05 -05:00
|
|
|
#include "HandmadeMath.h"
|
2023-11-30 10:47:59 -06:00
|
|
|
#include "transform.h"
|
2023-09-04 01:20:55 -05:00
|
|
|
#include "sokol/sokol_gfx.h"
|
2023-12-11 08:36:45 -06:00
|
|
|
#include "gameobject.h"
|
2024-04-26 16:04:31 -05:00
|
|
|
#include "anim.h"
|
|
|
|
#include "texture.h"
|
2024-08-08 17:32:58 -05:00
|
|
|
#include "cgltf.h"
|
2024-04-26 16:04:31 -05:00
|
|
|
|
|
|
|
typedef struct md5joint {
|
|
|
|
struct md5joint *parent;
|
|
|
|
HMM_Vec4 pos;
|
|
|
|
HMM_Quat rot;
|
|
|
|
HMM_Vec4 scale;
|
|
|
|
HMM_Mat4 t;
|
|
|
|
} md5joint;
|
|
|
|
|
|
|
|
typedef struct skin {
|
2024-08-08 17:32:58 -05:00
|
|
|
md5joint *joints;
|
2024-04-26 16:04:31 -05:00
|
|
|
HMM_Mat4 *invbind;
|
|
|
|
HMM_Mat4 binds[50]; /* binds = joint * invbind */
|
|
|
|
} skin;
|
|
|
|
|
2024-08-08 17:32:58 -05:00
|
|
|
sg_buffer accessor2buffer(cgltf_accessor *a, int type);
|
|
|
|
skin *make_gltf_skin(cgltf_skin *skin);
|
|
|
|
void skin_calculate(skin *sk);
|
2024-05-06 21:59:22 -05:00
|
|
|
|
|
|
|
sg_buffer float_buffer(float *f, int v);
|
|
|
|
sg_buffer index_buffer(float *f, int verts);
|
|
|
|
sg_buffer texcoord_floats(float *f, int n);
|
|
|
|
sg_buffer par_idx_buffer(uint32_t *i, int v);
|
|
|
|
sg_buffer normal_floats(float *f, int n);
|
|
|
|
sg_buffer ubyten_buffer(float *f, int v);
|
|
|
|
sg_buffer ubyte_buffer(float *f, int v);
|
|
|
|
sg_buffer joint_buf(float *f, int v);
|
|
|
|
sg_buffer weight_buf(float *f, int v);
|
2024-01-14 10:24:31 -06:00
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#endif
|