dos3d

view src/scene.h @ 21:00d84ab1ef26

switched to wacom
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 21 Sep 2013 18:17:55 +0300
parents cb676ff89e69
children
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 int kd[3];
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 int ready;
29 struct material *matlist;
30 struct mesh *meshlist;
31 };
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* --- scene --- */
38 int scn_init(struct scene *scn);
39 void scn_destroy(struct scene *scn);
41 void scn_add_mesh(struct scene *scn, struct mesh *m);
42 void scn_add_material(struct scene *scn, struct material *m);
44 struct material *scn_find_material(struct scene *scn, const char *name);
46 int scn_load(struct scene *scn, const char *fname);
48 void scn_render(struct scene *scn);
50 /* --- material --- */
51 int mtl_init(struct material *mtl);
52 void mtl_destroy(struct material *mtl);
54 int mtl_set_name(struct material *mtl, const char *name);
56 /* --- mesh --- */
57 int mesh_init(struct mesh *m);
58 void mesh_destroy(struct mesh *m);
60 void mesh_add_vertex(struct mesh *m, vec3_t v);
61 void mesh_add_normal(struct mesh *m, vec3_t n);
62 void mesh_add_texcoord(struct mesh *m, vec2_t tc);
64 void mesh_draw(struct mesh *m);
66 #ifdef __cplusplus
67 }
68 #endif
70 #endif /* SCENE_H_ */