goat3d
diff src/goat3d.h @ 0:2918358f5e6d
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 17 Aug 2013 16:10:26 +0300 |
parents | |
children | 04bb114fcf05 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/goat3d.h Sat Aug 17 16:10:26 2013 +0300 1.3 @@ -0,0 +1,54 @@ 1.4 +#ifndef GOAT3D_H_ 1.5 +#define GOAT3D_H_ 1.6 + 1.7 +#include <stdio.h> 1.8 +#include <stdlib.h> 1.9 + 1.10 +struct goat3d; 1.11 + 1.12 +struct goat3d_io { 1.13 + void *cls; /* closure data */ 1.14 + 1.15 + size_t (*read)(void *buf, size_t bytes, void *uptr); 1.16 + size_t (*write)(void *buf, size_t bytes, void *uptr); 1.17 + long (*seek)(long offs, int whence, void *uptr); 1.18 +}; 1.19 + 1.20 +struct goat3d_vec3 { float x, y, z; }; 1.21 +struct goat3d_vec4 { float x, y, z, w; }; 1.22 + 1.23 + 1.24 +#ifdef __cplusplus 1.25 +extern "C" { 1.26 +#endif 1.27 + 1.28 +/* construction/destruction */ 1.29 +struct goat3d *goat3d_create(); 1.30 +void goat3d_free(struct goat3d *g); 1.31 + 1.32 +/* load/save */ 1.33 +int goat3d_load(struct goat3d *g, const char *fname); 1.34 +int goat3d_save(const struct goat3d *g, const char *fname); 1.35 + 1.36 +int goat3d_load_file(struct goat3d *g, FILE *fp); 1.37 +int goat3d_save_file(const struct goat3d *g, FILE *fp); 1.38 + 1.39 +int goat3d_load_io(struct goat3d *g, struct goat3d_io *io); 1.40 +int goat3d_save_io(const struct goat3d *g, struct goat3d_io *io); 1.41 + 1.42 +/* misc scene properties */ 1.43 +int goat3d_set_name(struct goat3d *g, const char *name); 1.44 +const char *goat3d_get_name(const struct goat3d *g); 1.45 + 1.46 +void goat3d_set_ambient(struct goat3d *g, float x, float y, float z); 1.47 + 1.48 +/* helpers */ 1.49 +struct goat3d_vec3 goat3d_vec3(float x, float y, float z); 1.50 +struct goat3d_vec4 goat3d_vec4(float x, float y, float z, float w); 1.51 + 1.52 + 1.53 +#ifdef __cplusplus 1.54 +} 1.55 +#endif 1.56 + 1.57 +#endif /* GOAT3D_H_ */