polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

model.h (1046B)


      1 
      2 
      3 #ifndef MODEL_H
      4 #define MODEL_H
      5 
      6 
      7 #include "shader.h"
      8 #include "geometry.h"
      9 #include "common.h"
     10 #include "animation.h"
     11 
     12 #define DEF_DYNAMIC_MODELS 128
     13 #define MAX_DYNAMIC_MODELS 2048
     14 #define MAX_POSES 2
     15 
     16 struct model_id {
     17 	struct resource_id id;
     18 };
     19 
     20 struct model {
     21     /* geometry_id geom_id; */
     22     struct geometry_id geom_id;
     23     struct pose poses[MAX_POSES]; // TODO: separate animated_model buffer?
     24     int shader;
     25     int nposes;
     26     u32 texture;
     27     u32 name_hash;
     28     const char *name;
     29 };
     30 
     31 struct model_def {
     32     u16 id;
     33     int loaded;
     34     char *file;
     35 };
     36 
     37 void init_model_manager();
     38 void init_model_id(struct model_id *id);
     39 struct model *init_model(struct model *model);
     40 struct model_id get_model_by_name(const char *name, struct model **);
     41 struct model *get_model(struct model_id *model_id);
     42 struct model *get_model_geom(struct model_id *, struct geometry **);
     43 struct model *new_model(struct model_id *, const char *name);
     44 struct model *new_static_model(struct model_id *);
     45 void destroy_model(struct model_id *);
     46 
     47 #endif /* MODEL_H */