deepstone
annotate src/scene.h @ 39:f9b1ff21fd62
merged
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 10 Mar 2014 17:28:28 +0200 |
parents | cb676ff89e69 |
children |
rev | line source |
---|---|
nuclear@16 | 1 #ifndef SCENE_H_ |
nuclear@16 | 2 #define SCENE_H_ |
nuclear@16 | 3 |
nuclear@16 | 4 #include "vmath.h" |
nuclear@16 | 5 #include "texture.h" |
nuclear@16 | 6 |
nuclear@16 | 7 |
nuclear@16 | 8 struct material { |
nuclear@16 | 9 char *name; |
nuclear@17 | 10 int kd[3]; |
nuclear@16 | 11 int kd_base; |
nuclear@16 | 12 struct texture *tex; |
nuclear@16 | 13 |
nuclear@16 | 14 struct material *next; |
nuclear@16 | 15 }; |
nuclear@16 | 16 |
nuclear@16 | 17 struct mesh { |
nuclear@16 | 18 int nface; |
nuclear@16 | 19 vec3_t *vert; |
nuclear@16 | 20 vec3_t *norm; |
nuclear@16 | 21 vec2_t *texcoord; |
nuclear@16 | 22 struct material *mtl; |
nuclear@16 | 23 |
nuclear@16 | 24 struct mesh *next; |
nuclear@16 | 25 }; |
nuclear@16 | 26 |
nuclear@16 | 27 struct scene { |
nuclear@17 | 28 int ready; |
nuclear@16 | 29 struct material *matlist; |
nuclear@16 | 30 struct mesh *meshlist; |
nuclear@16 | 31 }; |
nuclear@16 | 32 |
nuclear@16 | 33 #ifdef __cplusplus |
nuclear@16 | 34 extern "C" { |
nuclear@16 | 35 #endif |
nuclear@16 | 36 |
nuclear@16 | 37 /* --- scene --- */ |
nuclear@16 | 38 int scn_init(struct scene *scn); |
nuclear@16 | 39 void scn_destroy(struct scene *scn); |
nuclear@16 | 40 |
nuclear@16 | 41 void scn_add_mesh(struct scene *scn, struct mesh *m); |
nuclear@16 | 42 void scn_add_material(struct scene *scn, struct material *m); |
nuclear@16 | 43 |
nuclear@16 | 44 struct material *scn_find_material(struct scene *scn, const char *name); |
nuclear@16 | 45 |
nuclear@16 | 46 int scn_load(struct scene *scn, const char *fname); |
nuclear@16 | 47 |
nuclear@16 | 48 void scn_render(struct scene *scn); |
nuclear@16 | 49 |
nuclear@16 | 50 /* --- material --- */ |
nuclear@16 | 51 int mtl_init(struct material *mtl); |
nuclear@16 | 52 void mtl_destroy(struct material *mtl); |
nuclear@16 | 53 |
nuclear@16 | 54 int mtl_set_name(struct material *mtl, const char *name); |
nuclear@16 | 55 |
nuclear@16 | 56 /* --- mesh --- */ |
nuclear@16 | 57 int mesh_init(struct mesh *m); |
nuclear@16 | 58 void mesh_destroy(struct mesh *m); |
nuclear@16 | 59 |
nuclear@16 | 60 void mesh_add_vertex(struct mesh *m, vec3_t v); |
nuclear@16 | 61 void mesh_add_normal(struct mesh *m, vec3_t n); |
nuclear@16 | 62 void mesh_add_texcoord(struct mesh *m, vec2_t tc); |
nuclear@16 | 63 |
nuclear@16 | 64 void mesh_draw(struct mesh *m); |
nuclear@16 | 65 |
nuclear@16 | 66 #ifdef __cplusplus |
nuclear@16 | 67 } |
nuclear@16 | 68 #endif |
nuclear@16 | 69 |
nuclear@16 | 70 #endif /* SCENE_H_ */ |