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"
|
2023-09-04 01:20:55 -05:00
|
|
|
|
2023-05-12 13:22:05 -05:00
|
|
|
extern HMM_Vec3 eye;
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-12-04 13:38:37 -06:00
|
|
|
typedef struct material {
|
2024-01-14 10:24:31 -06:00
|
|
|
|
2023-12-04 13:38:37 -06:00
|
|
|
} material;
|
|
|
|
|
|
|
|
struct model;
|
|
|
|
|
2023-11-03 08:31:06 -05:00
|
|
|
/* A single mesh */
|
2023-12-04 13:38:37 -06:00
|
|
|
typedef struct mesh {
|
|
|
|
sg_bindings bind; /* Encapsulates material, norms, etc */
|
2023-12-19 15:34:36 -06:00
|
|
|
uint32_t idx_count;
|
2023-12-04 13:38:37 -06:00
|
|
|
} mesh;
|
2023-09-04 01:20:55 -05:00
|
|
|
|
2023-11-03 08:31:06 -05:00
|
|
|
/* A collection of meshes which create a full figure */
|
2023-12-04 13:38:37 -06:00
|
|
|
typedef struct model {
|
2023-05-12 13:22:05 -05:00
|
|
|
struct mesh *meshes;
|
2023-12-04 13:38:37 -06:00
|
|
|
HMM_Mat4 matrix;
|
|
|
|
} model;
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-11-30 10:47:59 -06:00
|
|
|
typedef struct bone {
|
|
|
|
transform3d t;
|
|
|
|
struct bone *children;
|
|
|
|
} bone;
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
/* Make a Model struct */
|
2024-04-20 12:55:20 -05:00
|
|
|
struct model *model_make(const char *path);
|
|
|
|
void model_free(model *m);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2024-04-20 12:55:20 -05:00
|
|
|
void model_draw_go(model *m, gameobject *go, gameobject *cam);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-05-12 13:22:05 -05:00
|
|
|
void model_init();
|
|
|
|
|
2024-01-14 10:24:31 -06:00
|
|
|
material *material_make();
|
|
|
|
void material_free(material *mat);
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#endif
|