deepstone
annotate src/scene.h @ 16:cb676ff89e69
added missing cvec and scene files
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 29 Nov 2011 07:23:57 +0200 |
parents | |
children | 1e9f0b3616fa |
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@16 | 10 vec3_t kd; |
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@16 | 28 struct material *matlist; |
nuclear@16 | 29 struct mesh *meshlist; |
nuclear@16 | 30 }; |
nuclear@16 | 31 |
nuclear@16 | 32 #ifdef __cplusplus |
nuclear@16 | 33 extern "C" { |
nuclear@16 | 34 #endif |
nuclear@16 | 35 |
nuclear@16 | 36 /* --- scene --- */ |
nuclear@16 | 37 int scn_init(struct scene *scn); |
nuclear@16 | 38 void scn_destroy(struct scene *scn); |
nuclear@16 | 39 |
nuclear@16 | 40 void scn_add_mesh(struct scene *scn, struct mesh *m); |
nuclear@16 | 41 void scn_add_material(struct scene *scn, struct material *m); |
nuclear@16 | 42 |
nuclear@16 | 43 struct material *scn_find_material(struct scene *scn, const char *name); |
nuclear@16 | 44 |
nuclear@16 | 45 int scn_load(struct scene *scn, const char *fname); |
nuclear@16 | 46 |
nuclear@16 | 47 void scn_render(struct scene *scn); |
nuclear@16 | 48 |
nuclear@16 | 49 /* --- material --- */ |
nuclear@16 | 50 int mtl_init(struct material *mtl); |
nuclear@16 | 51 void mtl_destroy(struct material *mtl); |
nuclear@16 | 52 |
nuclear@16 | 53 int mtl_set_name(struct material *mtl, const char *name); |
nuclear@16 | 54 |
nuclear@16 | 55 /* --- mesh --- */ |
nuclear@16 | 56 int mesh_init(struct mesh *m); |
nuclear@16 | 57 void mesh_destroy(struct mesh *m); |
nuclear@16 | 58 |
nuclear@16 | 59 void mesh_add_vertex(struct mesh *m, vec3_t v); |
nuclear@16 | 60 void mesh_add_normal(struct mesh *m, vec3_t n); |
nuclear@16 | 61 void mesh_add_texcoord(struct mesh *m, vec2_t tc); |
nuclear@16 | 62 |
nuclear@16 | 63 void mesh_draw(struct mesh *m); |
nuclear@16 | 64 |
nuclear@16 | 65 #ifdef __cplusplus |
nuclear@16 | 66 } |
nuclear@16 | 67 #endif |
nuclear@16 | 68 |
nuclear@16 | 69 #endif /* SCENE_H_ */ |