tinygi

annotate src/tinygi.h @ 2:72752a1b3dbe

images and shapes
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 21 Jul 2015 04:30:00 +0300
parents bc64090fe3d1
children
rev   line source
nuclear@0 1 #ifndef TINYGI_H_
nuclear@0 2 #define TINYGI_H_
nuclear@0 3
nuclear@0 4 struct tinygi;
nuclear@0 5 struct tgi_object;
nuclear@0 6 struct tgi_shape;
nuclear@1 7 struct tgi_material;
nuclear@0 8
nuclear@0 9 struct tinygi *tgi_init(void);
nuclear@0 10 void tgi_destroy(struct tinygi *tgi);
nuclear@0 11
nuclear@0 12 void tgi_clear_scene(struct tinygi *tgi);
nuclear@0 13 int tgi_load_scene(struct tinygi *tgi, const char *fname);
nuclear@1 14 /* tinygi takes ownership of added objects */
nuclear@0 15 void tgi_add_object(struct tinygi *tgi, struct tgi_object *o);
nuclear@1 16 int tgi_remove_object(struct tinygi *tgi, struct tgi_object *o);
nuclear@0 17
nuclear@0 18 struct tgi_object *tgi_find_object(struct tinygi *tgi, const char *name);
nuclear@0 19 struct tgi_object *tgi_get_object(struct tinygi *tgi, int idx);
nuclear@0 20 int tgi_get_object_count(struct tinygi *tgi);
nuclear@0 21
nuclear@0 22 /* shapes */
nuclear@1 23 struct tgi_shape *tgi_create_sphere(float x, float y, float z, float rad);
nuclear@0 24 struct tgi_shape *tgi_create_box(float x0, float y0, float z0, float x1, float y1, float z1);
nuclear@0 25 void tgi_destroy_shape(struct tgi_shape *s);
nuclear@0 26
nuclear@0 27 /* objects */
nuclear@0 28 /* name can be null, in which case it's automatically generated */
nuclear@0 29 struct tgi_object *tgi_create_object(const char *name);
nuclear@0 30 void tgi_destroy_object(struct tgi_object *o);
nuclear@1 31 /* object takes ownership of the shape */
nuclear@0 32 void tgi_set_object_shape(struct tgi_object *o, struct tgi_shape *s);
nuclear@0 33
nuclear@1 34 /* mat should point to an array of 16 floats (4x4 homogeneous transformation matrix) */
nuclear@1 35 void tgi_load_matrix(struct tgi_object *o, const float *mat);
nuclear@1 36 void tgi_mult_matrix(struct tgi_object *o, const float *mat);
nuclear@1 37 void tgi_load_identity(struct tgi_object *o);
nuclear@1 38 void tgi_translate(struct tgi_object *o, float x, float y, float z);
nuclear@1 39 void tgi_rotate(struct tgi_object *o, float angle, float x, float y, float z);
nuclear@1 40 void tgi_scale(struct tgi_object *o, float x, float y, float z);
nuclear@1 41 void tgi_lookat(struct tgi_object *o, float x, float y, float z,
nuclear@1 42 float tx, float ty, float tz, float ux, float uy, float uz);
nuclear@1 43
nuclear@2 44 /* rendering */
nuclear@2 45 float *tgi_begin(struct tinygi *tgi, int width, int height);
nuclear@2 46 float *tgi_expose(struct tinygi *tgi, float gamma);
nuclear@2 47
nuclear@2 48 void tgi_render_frame(struct tinygi *tgi, int num_samples);
nuclear@2 49 void tgi_render(struct tinygi *tgi, int sample_idx);
nuclear@2 50 void tgi_render_rect(struct tinygi *tgi, int x, int y, int xsz, int ysz, int sample_idx);
nuclear@2 51
nuclear@2 52
nuclear@1 53
nuclear@0 54 #endif /* TINYGI_H_ */