tinygi

view src/tinygi.h @ 1:bc64090fe3d1

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