rev |
line source |
nuclear@0
|
1 #ifndef GOAT3D_H_
|
nuclear@0
|
2 #define GOAT3D_H_
|
nuclear@0
|
3
|
nuclear@0
|
4 #include <stdio.h>
|
nuclear@0
|
5 #include <stdlib.h>
|
nuclear@0
|
6
|
nuclear@0
|
7 struct goat3d;
|
nuclear@0
|
8
|
nuclear@0
|
9 struct goat3d_io {
|
nuclear@0
|
10 void *cls; /* closure data */
|
nuclear@0
|
11
|
nuclear@0
|
12 size_t (*read)(void *buf, size_t bytes, void *uptr);
|
nuclear@0
|
13 size_t (*write)(void *buf, size_t bytes, void *uptr);
|
nuclear@0
|
14 long (*seek)(long offs, int whence, void *uptr);
|
nuclear@0
|
15 };
|
nuclear@0
|
16
|
nuclear@0
|
17 struct goat3d_vec3 { float x, y, z; };
|
nuclear@0
|
18 struct goat3d_vec4 { float x, y, z, w; };
|
nuclear@0
|
19
|
nuclear@0
|
20
|
nuclear@0
|
21 #ifdef __cplusplus
|
nuclear@0
|
22 extern "C" {
|
nuclear@0
|
23 #endif
|
nuclear@0
|
24
|
nuclear@0
|
25 /* construction/destruction */
|
nuclear@0
|
26 struct goat3d *goat3d_create();
|
nuclear@0
|
27 void goat3d_free(struct goat3d *g);
|
nuclear@0
|
28
|
nuclear@0
|
29 /* load/save */
|
nuclear@0
|
30 int goat3d_load(struct goat3d *g, const char *fname);
|
nuclear@0
|
31 int goat3d_save(const struct goat3d *g, const char *fname);
|
nuclear@0
|
32
|
nuclear@0
|
33 int goat3d_load_file(struct goat3d *g, FILE *fp);
|
nuclear@0
|
34 int goat3d_save_file(const struct goat3d *g, FILE *fp);
|
nuclear@0
|
35
|
nuclear@0
|
36 int goat3d_load_io(struct goat3d *g, struct goat3d_io *io);
|
nuclear@0
|
37 int goat3d_save_io(const struct goat3d *g, struct goat3d_io *io);
|
nuclear@0
|
38
|
nuclear@0
|
39 /* misc scene properties */
|
nuclear@0
|
40 int goat3d_set_name(struct goat3d *g, const char *name);
|
nuclear@0
|
41 const char *goat3d_get_name(const struct goat3d *g);
|
nuclear@0
|
42
|
nuclear@0
|
43 void goat3d_set_ambient(struct goat3d *g, float x, float y, float z);
|
nuclear@0
|
44
|
nuclear@0
|
45 /* helpers */
|
nuclear@0
|
46 struct goat3d_vec3 goat3d_vec3(float x, float y, float z);
|
nuclear@0
|
47 struct goat3d_vec4 goat3d_vec4(float x, float y, float z, float w);
|
nuclear@0
|
48
|
nuclear@0
|
49
|
nuclear@0
|
50 #ifdef __cplusplus
|
nuclear@0
|
51 }
|
nuclear@0
|
52 #endif
|
nuclear@0
|
53
|
nuclear@0
|
54 #endif /* GOAT3D_H_ */
|