goat3d

view src/goat3d.h @ 11:d1cebaf1d5c9

ok wtf
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 26 Aug 2013 05:42:30 +0300
parents 04bb114fcf05
children 798df5111b56
line source
1 #ifndef GOAT3D_H_
2 #define GOAT3D_H_
4 #include <stdio.h>
5 #include <stdlib.h>
7 struct goat3d;
9 struct goat3d_io {
10 void *cls; /* closure data */
12 long (*read)(void *buf, size_t bytes, void *uptr);
13 long (*write)(void *buf, size_t bytes, void *uptr);
14 long (*seek)(long offs, int whence, void *uptr);
15 };
17 struct goat3d_vec3 { float x, y, z; };
18 struct goat3d_vec4 { float x, y, z, w; };
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 /* construction/destruction */
26 struct goat3d *goat3d_create();
27 void goat3d_free(struct goat3d *g);
29 /* load/save */
30 int goat3d_load(struct goat3d *g, const char *fname);
31 int goat3d_save(const struct goat3d *g, const char *fname);
33 int goat3d_load_file(struct goat3d *g, FILE *fp);
34 int goat3d_save_file(const struct goat3d *g, FILE *fp);
36 int goat3d_load_io(struct goat3d *g, struct goat3d_io *io);
37 int goat3d_save_io(const struct goat3d *g, struct goat3d_io *io);
39 /* misc scene properties */
40 int goat3d_set_name(struct goat3d *g, const char *name);
41 const char *goat3d_get_name(const struct goat3d *g);
43 void goat3d_set_ambient(struct goat3d *g, float x, float y, float z);
45 /* helpers */
46 struct goat3d_vec3 goat3d_vec3(float x, float y, float z);
47 struct goat3d_vec4 goat3d_vec4(float x, float y, float z, float w);
50 #ifdef __cplusplus
51 }
52 #endif
54 #endif /* GOAT3D_H_ */