tinygi
diff 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 diff
1.1 --- a/src/tinygi.h Sun Jul 19 18:30:29 2015 +0300 1.2 +++ b/src/tinygi.h Mon Jul 20 04:38:53 2015 +0300 1.3 @@ -6,21 +6,23 @@ 1.4 struct tinygi; 1.5 struct tgi_object; 1.6 struct tgi_shape; 1.7 +struct tgi_material; 1.8 1.9 struct tinygi *tgi_init(void); 1.10 void tgi_destroy(struct tinygi *tgi); 1.11 1.12 void tgi_clear_scene(struct tinygi *tgi); 1.13 int tgi_load_scene(struct tinygi *tgi, const char *fname); 1.14 +/* tinygi takes ownership of added objects */ 1.15 void tgi_add_object(struct tinygi *tgi, struct tgi_object *o); 1.16 -int tgi_del_object(struct tinygi *tgi, struct tgi_object *o); 1.17 +int tgi_remove_object(struct tinygi *tgi, struct tgi_object *o); 1.18 1.19 struct tgi_object *tgi_find_object(struct tinygi *tgi, const char *name); 1.20 struct tgi_object *tgi_get_object(struct tinygi *tgi, int idx); 1.21 int tgi_get_object_count(struct tinygi *tgi); 1.22 1.23 /* shapes */ 1.24 -struct tgi_shape *tgi_create_sphere(float rad); 1.25 +struct tgi_shape *tgi_create_sphere(float x, float y, float z, float rad); 1.26 struct tgi_shape *tgi_create_box(float x0, float y0, float z0, float x1, float y1, float z1); 1.27 void tgi_destroy_shape(struct tgi_shape *s); 1.28 1.29 @@ -28,7 +30,24 @@ 1.30 /* name can be null, in which case it's automatically generated */ 1.31 struct tgi_object *tgi_create_object(const char *name); 1.32 void tgi_destroy_object(struct tgi_object *o); 1.33 +/* object takes ownership of the shape */ 1.34 void tgi_set_object_shape(struct tgi_object *o, struct tgi_shape *s); 1.35 +/* object takes ownership of the material */ 1.36 void tgi_set_object_mtl(struct tgi_object *o, struct tgi_material *m); 1.37 1.38 +/* mat should point to an array of 16 floats (4x4 homogeneous transformation matrix) */ 1.39 +void tgi_load_matrix(struct tgi_object *o, const float *mat); 1.40 +void tgi_mult_matrix(struct tgi_object *o, const float *mat); 1.41 +void tgi_load_identity(struct tgi_object *o); 1.42 +void tgi_translate(struct tgi_object *o, float x, float y, float z); 1.43 +void tgi_rotate(struct tgi_object *o, float angle, float x, float y, float z); 1.44 +void tgi_scale(struct tgi_object *o, float x, float y, float z); 1.45 +void tgi_lookat(struct tgi_object *o, float x, float y, float z, 1.46 + float tx, float ty, float tz, float ux, float uy, float uz); 1.47 + 1.48 +/* materials */ 1.49 +struct tgi_material *tgi_create_material(void); 1.50 +void tgi_destroy_material(struct tgi_material *mtl); 1.51 +/* TODO */ 1.52 + 1.53 #endif /* TINYGI_H_ */