nuclear@0: #ifndef GOAT3D_H_ nuclear@0: #define GOAT3D_H_ nuclear@0: nuclear@0: #include nuclear@0: #include nuclear@0: nuclear@0: struct goat3d; nuclear@0: nuclear@0: struct goat3d_io { nuclear@0: void *cls; /* closure data */ nuclear@0: nuclear@9: ssize_t (*read)(void *buf, size_t bytes, void *uptr); nuclear@9: ssize_t (*write)(void *buf, size_t bytes, void *uptr); nuclear@0: long (*seek)(long offs, int whence, void *uptr); nuclear@0: }; nuclear@0: nuclear@0: struct goat3d_vec3 { float x, y, z; }; nuclear@0: struct goat3d_vec4 { float x, y, z, w; }; nuclear@0: nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif nuclear@0: nuclear@0: /* construction/destruction */ nuclear@0: struct goat3d *goat3d_create(); nuclear@0: void goat3d_free(struct goat3d *g); nuclear@0: nuclear@0: /* load/save */ nuclear@0: int goat3d_load(struct goat3d *g, const char *fname); nuclear@0: int goat3d_save(const struct goat3d *g, const char *fname); nuclear@0: nuclear@0: int goat3d_load_file(struct goat3d *g, FILE *fp); nuclear@0: int goat3d_save_file(const struct goat3d *g, FILE *fp); nuclear@0: nuclear@0: int goat3d_load_io(struct goat3d *g, struct goat3d_io *io); nuclear@0: int goat3d_save_io(const struct goat3d *g, struct goat3d_io *io); nuclear@0: nuclear@0: /* misc scene properties */ nuclear@0: int goat3d_set_name(struct goat3d *g, const char *name); nuclear@0: const char *goat3d_get_name(const struct goat3d *g); nuclear@0: nuclear@0: void goat3d_set_ambient(struct goat3d *g, float x, float y, float z); nuclear@0: nuclear@0: /* helpers */ nuclear@0: struct goat3d_vec3 goat3d_vec3(float x, float y, float z); nuclear@0: struct goat3d_vec4 goat3d_vec4(float x, float y, float z, float w); nuclear@0: nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif nuclear@0: nuclear@0: #endif /* GOAT3D_H_ */