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-09-04 01:20:55 -05:00
|
|
|
#include "sokol/sokol_gfx.h"
|
|
|
|
|
2023-05-12 13:22:05 -05:00
|
|
|
extern HMM_Vec3 eye;
|
2022-11-19 17:13:57 -06:00
|
|
|
struct shader;
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-09-04 01:20:55 -05:00
|
|
|
struct mesh {
|
|
|
|
sg_bindings bind;
|
|
|
|
uint32_t face_count;
|
|
|
|
};
|
|
|
|
|
2022-11-19 17:13:57 -06:00
|
|
|
struct model {
|
2023-05-12 13:22:05 -05:00
|
|
|
struct mesh *meshes;
|
2021-11-30 21:29:18 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Get the model at a path, or create and return if it doesn't exist */
|
2022-11-19 17:13:57 -06:00
|
|
|
struct model *GetExistingModel(const char *path);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
/* Make a Model struct */
|
2022-11-19 17:13:57 -06:00
|
|
|
struct model *MakeModel(const char *path);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
/* Load a model from memory into the GPU */
|
2022-11-19 17:13:57 -06:00
|
|
|
void loadmodel(struct model *model);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-05-12 13:22:05 -05:00
|
|
|
void model_init();
|
|
|
|
|
|
|
|
void draw_model(struct model *model, HMM_Mat4 amodel, HMM_Mat4 lsm);
|
2023-04-24 17:22:18 -05:00
|
|
|
void draw_models(struct model *model, struct shader *shader);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
|
|
|
#endif
|