deepstone

view 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 source
1 #ifndef SCENE_H_
2 #define SCENE_H_
4 #include "vmath.h"
5 #include "texture.h"
8 struct material {
9 char *name;
10 vec3_t kd;
11 int kd_base;
12 struct texture *tex;
14 struct material *next;
15 };
17 struct mesh {
18 int nface;
19 vec3_t *vert;
20 vec3_t *norm;
21 vec2_t *texcoord;
22 struct material *mtl;
24 struct mesh *next;
25 };
27 struct scene {
28 struct material *matlist;
29 struct mesh *meshlist;
30 };
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 /* --- scene --- */
37 int scn_init(struct scene *scn);
38 void scn_destroy(struct scene *scn);
40 void scn_add_mesh(struct scene *scn, struct mesh *m);
41 void scn_add_material(struct scene *scn, struct material *m);
43 struct material *scn_find_material(struct scene *scn, const char *name);
45 int scn_load(struct scene *scn, const char *fname);
47 void scn_render(struct scene *scn);
49 /* --- material --- */
50 int mtl_init(struct material *mtl);
51 void mtl_destroy(struct material *mtl);
53 int mtl_set_name(struct material *mtl, const char *name);
55 /* --- mesh --- */
56 int mesh_init(struct mesh *m);
57 void mesh_destroy(struct mesh *m);
59 void mesh_add_vertex(struct mesh *m, vec3_t v);
60 void mesh_add_normal(struct mesh *m, vec3_t n);
61 void mesh_add_texcoord(struct mesh *m, vec2_t tc);
63 void mesh_draw(struct mesh *m);
65 #ifdef __cplusplus
66 }
67 #endif
69 #endif /* SCENE_H_ */