rev |
line source |
nuclear@0
|
1 #ifndef TINYGI_H_
|
nuclear@0
|
2 #define TINYGI_H_
|
nuclear@0
|
3
|
nuclear@0
|
4 struct tgi_vec3 { float x, y, z; };
|
nuclear@0
|
5
|
nuclear@0
|
6 struct tinygi;
|
nuclear@0
|
7 struct tgi_object;
|
nuclear@0
|
8 struct tgi_shape;
|
nuclear@1
|
9 struct tgi_material;
|
nuclear@0
|
10
|
nuclear@0
|
11 struct tinygi *tgi_init(void);
|
nuclear@0
|
12 void tgi_destroy(struct tinygi *tgi);
|
nuclear@0
|
13
|
nuclear@0
|
14 void tgi_clear_scene(struct tinygi *tgi);
|
nuclear@0
|
15 int tgi_load_scene(struct tinygi *tgi, const char *fname);
|
nuclear@1
|
16 /* tinygi takes ownership of added objects */
|
nuclear@0
|
17 void tgi_add_object(struct tinygi *tgi, struct tgi_object *o);
|
nuclear@1
|
18 int tgi_remove_object(struct tinygi *tgi, struct tgi_object *o);
|
nuclear@0
|
19
|
nuclear@0
|
20 struct tgi_object *tgi_find_object(struct tinygi *tgi, const char *name);
|
nuclear@0
|
21 struct tgi_object *tgi_get_object(struct tinygi *tgi, int idx);
|
nuclear@0
|
22 int tgi_get_object_count(struct tinygi *tgi);
|
nuclear@0
|
23
|
nuclear@0
|
24 /* shapes */
|
nuclear@1
|
25 struct tgi_shape *tgi_create_sphere(float x, float y, float z, float rad);
|
nuclear@0
|
26 struct tgi_shape *tgi_create_box(float x0, float y0, float z0, float x1, float y1, float z1);
|
nuclear@0
|
27 void tgi_destroy_shape(struct tgi_shape *s);
|
nuclear@0
|
28
|
nuclear@0
|
29 /* objects */
|
nuclear@0
|
30 /* name can be null, in which case it's automatically generated */
|
nuclear@0
|
31 struct tgi_object *tgi_create_object(const char *name);
|
nuclear@0
|
32 void tgi_destroy_object(struct tgi_object *o);
|
nuclear@1
|
33 /* object takes ownership of the shape */
|
nuclear@0
|
34 void tgi_set_object_shape(struct tgi_object *o, struct tgi_shape *s);
|
nuclear@1
|
35 /* object takes ownership of the material */
|
nuclear@0
|
36 void tgi_set_object_mtl(struct tgi_object *o, struct tgi_material *m);
|
nuclear@0
|
37
|
nuclear@1
|
38 /* mat should point to an array of 16 floats (4x4 homogeneous transformation matrix) */
|
nuclear@1
|
39 void tgi_load_matrix(struct tgi_object *o, const float *mat);
|
nuclear@1
|
40 void tgi_mult_matrix(struct tgi_object *o, const float *mat);
|
nuclear@1
|
41 void tgi_load_identity(struct tgi_object *o);
|
nuclear@1
|
42 void tgi_translate(struct tgi_object *o, float x, float y, float z);
|
nuclear@1
|
43 void tgi_rotate(struct tgi_object *o, float angle, float x, float y, float z);
|
nuclear@1
|
44 void tgi_scale(struct tgi_object *o, float x, float y, float z);
|
nuclear@1
|
45 void tgi_lookat(struct tgi_object *o, float x, float y, float z,
|
nuclear@1
|
46 float tx, float ty, float tz, float ux, float uy, float uz);
|
nuclear@1
|
47
|
nuclear@1
|
48 /* materials */
|
nuclear@1
|
49 struct tgi_material *tgi_create_material(void);
|
nuclear@1
|
50 void tgi_destroy_material(struct tgi_material *mtl);
|
nuclear@1
|
51 /* TODO */
|
nuclear@1
|
52
|
nuclear@0
|
53 #endif /* TINYGI_H_ */
|