deepstone
diff 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 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/scene.h Tue Nov 29 07:23:57 2011 +0200 1.3 @@ -0,0 +1,69 @@ 1.4 +#ifndef SCENE_H_ 1.5 +#define SCENE_H_ 1.6 + 1.7 +#include "vmath.h" 1.8 +#include "texture.h" 1.9 + 1.10 + 1.11 +struct material { 1.12 + char *name; 1.13 + vec3_t kd; 1.14 + int kd_base; 1.15 + struct texture *tex; 1.16 + 1.17 + struct material *next; 1.18 +}; 1.19 + 1.20 +struct mesh { 1.21 + int nface; 1.22 + vec3_t *vert; 1.23 + vec3_t *norm; 1.24 + vec2_t *texcoord; 1.25 + struct material *mtl; 1.26 + 1.27 + struct mesh *next; 1.28 +}; 1.29 + 1.30 +struct scene { 1.31 + struct material *matlist; 1.32 + struct mesh *meshlist; 1.33 +}; 1.34 + 1.35 +#ifdef __cplusplus 1.36 +extern "C" { 1.37 +#endif 1.38 + 1.39 +/* --- scene --- */ 1.40 +int scn_init(struct scene *scn); 1.41 +void scn_destroy(struct scene *scn); 1.42 + 1.43 +void scn_add_mesh(struct scene *scn, struct mesh *m); 1.44 +void scn_add_material(struct scene *scn, struct material *m); 1.45 + 1.46 +struct material *scn_find_material(struct scene *scn, const char *name); 1.47 + 1.48 +int scn_load(struct scene *scn, const char *fname); 1.49 + 1.50 +void scn_render(struct scene *scn); 1.51 + 1.52 +/* --- material --- */ 1.53 +int mtl_init(struct material *mtl); 1.54 +void mtl_destroy(struct material *mtl); 1.55 + 1.56 +int mtl_set_name(struct material *mtl, const char *name); 1.57 + 1.58 +/* --- mesh --- */ 1.59 +int mesh_init(struct mesh *m); 1.60 +void mesh_destroy(struct mesh *m); 1.61 + 1.62 +void mesh_add_vertex(struct mesh *m, vec3_t v); 1.63 +void mesh_add_normal(struct mesh *m, vec3_t n); 1.64 +void mesh_add_texcoord(struct mesh *m, vec2_t tc); 1.65 + 1.66 +void mesh_draw(struct mesh *m); 1.67 + 1.68 +#ifdef __cplusplus 1.69 +} 1.70 +#endif 1.71 + 1.72 +#endif /* SCENE_H_ */