polyadvent

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

model.h (1114B)


      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 #include "static_resources.h"
     12 
     13 #define DEF_DYNAMIC_MODELS 128
     14 #define MAX_STATIC_MODELS 128
     15 #define MAX_DYNAMIC_MODELS 2048
     16 #define MAX_POSES 2
     17 
     18 typedef struct resource_id model_id;
     19 
     20 enum shading {
     21     SHADING_TERRAIN,
     22     SHADING_VERT_COLOR,
     23     SHADING_UI,
     24 };
     25 
     26 struct model {
     27     /* geometry_id geom_id; */
     28     geometry_id geom_id;
     29     enum shading shading;
     30     struct pose poses[MAX_POSES]; // TODO: separate animated_model buffer?
     31     int nposes;
     32     u32 texture;
     33 };
     34 
     35 struct model_def {
     36     u16 id;
     37     int loaded;
     38     char *file;
     39 };
     40 
     41 void init_model_manager();
     42 void init_model_id(model_id *id);
     43 struct model *init_model(struct model *model);
     44 struct model *get_model(model_id *);
     45 struct model *get_model_geom(model_id *, struct geometry **);
     46 struct model *new_model(model_id *);
     47 struct model *new_static_model(model_id *);
     48 void destroy_model(model_id *);
     49 
     50 bool is_static_model_loaded(enum static_model);
     51 
     52 model_id get_static_model(enum static_model, struct model**);
     53 
     54 #endif /* MODEL_H */