goat3d

diff src/goat3d.h @ 41:da3f335e0069

revamped the visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 01 Dec 2013 01:31:53 +0200
parents a5c5cec3cb88
children 1dcbe87b6a5d
line diff
     1.1 --- a/src/goat3d.h	Sun Oct 13 10:14:19 2013 +0300
     1.2 +++ b/src/goat3d.h	Sun Dec 01 01:31:53 2013 +0200
     1.3 @@ -4,6 +4,12 @@
     1.4  #include <stdio.h>
     1.5  #include <stdlib.h>
     1.6  
     1.7 +#ifdef WIN32
     1.8 +#define GOAT3DAPI	__declspec(dllexport)
     1.9 +#else
    1.10 +#define 
    1.11 +#endif
    1.12 +
    1.13  #define GOAT3D_MAT_ATTR_DIFFUSE			"diffuse"
    1.14  #define GOAT3D_MAT_ATTR_SPECULAR		"specular"
    1.15  #define GOAT3D_MAT_ATTR_SHININESS		"shininess"
    1.16 @@ -66,65 +72,65 @@
    1.17  #endif
    1.18  
    1.19  /* construction/destruction */
    1.20 -struct goat3d *goat3d_create(void);
    1.21 -void goat3d_free(struct goat3d *g);
    1.22 +GOAT3DAPI struct goat3d *goat3d_create(void);
    1.23 +GOAT3DAPI void goat3d_free(struct goat3d *g);
    1.24  
    1.25 -void goat3d_setopt(struct goat3d *g, enum goat3d_option opt, int val);
    1.26 -int goat3d_getopt(const struct goat3d *g, enum goat3d_option opt);
    1.27 +GOAT3DAPI void goat3d_setopt(struct goat3d *g, enum goat3d_option opt, int val);
    1.28 +GOAT3DAPI int goat3d_getopt(const struct goat3d *g, enum goat3d_option opt);
    1.29  
    1.30  /* load/save */
    1.31 -int goat3d_load(struct goat3d *g, const char *fname);
    1.32 -int goat3d_save(const struct goat3d *g, const char *fname);
    1.33 +GOAT3DAPI int goat3d_load(struct goat3d *g, const char *fname);
    1.34 +GOAT3DAPI 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 +GOAT3DAPI int goat3d_load_file(struct goat3d *g, FILE *fp);
    1.39 +GOAT3DAPI int goat3d_save_file(const struct goat3d *g, FILE *fp);
    1.40  
    1.41 -int goat3d_load_io(struct goat3d *g, struct goat3d_io *io);
    1.42 -int goat3d_save_io(const struct goat3d *g, struct goat3d_io *io);
    1.43 +GOAT3DAPI int goat3d_load_io(struct goat3d *g, struct goat3d_io *io);
    1.44 +GOAT3DAPI int goat3d_save_io(const struct goat3d *g, struct goat3d_io *io);
    1.45  
    1.46  /* misc scene properties */
    1.47 -int goat3d_set_name(struct goat3d *g, const char *name);
    1.48 -const char *goat3d_get_name(const struct goat3d *g);
    1.49 +GOAT3DAPI int goat3d_set_name(struct goat3d *g, const char *name);
    1.50 +GOAT3DAPI const char *goat3d_get_name(const struct goat3d *g);
    1.51  
    1.52 -void goat3d_set_ambient(struct goat3d *g, const float *ambient);
    1.53 -void goat3d_set_ambient3f(struct goat3d *g, float ar, float ag, float ab);
    1.54 -const float *goat3d_get_ambient(const struct goat3d *g);
    1.55 +GOAT3DAPI void goat3d_set_ambient(struct goat3d *g, const float *ambient);
    1.56 +GOAT3DAPI void goat3d_set_ambient3f(struct goat3d *g, float ar, float ag, float ab);
    1.57 +GOAT3DAPI const float *goat3d_get_ambient(const struct goat3d *g);
    1.58  
    1.59  /* materials */
    1.60 -void goat3d_add_mtl(struct goat3d *g, struct goat3d_material *mtl);
    1.61 +GOAT3DAPI void goat3d_add_mtl(struct goat3d *g, struct goat3d_material *mtl);
    1.62  
    1.63 -struct goat3d_material *goat3d_create_mtl(void);
    1.64 -void goat3d_destroy_mtl(struct goat3d_material *mtl);
    1.65 +GOAT3DAPI struct goat3d_material *goat3d_create_mtl(void);
    1.66 +GOAT3DAPI void goat3d_destroy_mtl(struct goat3d_material *mtl);
    1.67  
    1.68 -void goat3d_set_mtl_name(struct goat3d_material *mtl, const char *name);
    1.69 -const char *goat3d_get_mtl_name(const struct goat3d_material *mtl);
    1.70 +GOAT3DAPI void goat3d_set_mtl_name(struct goat3d_material *mtl, const char *name);
    1.71 +GOAT3DAPI const char *goat3d_get_mtl_name(const struct goat3d_material *mtl);
    1.72  
    1.73 -void goat3d_set_mtl_attrib(struct goat3d_material *mtl, const char *attrib, const float *val);
    1.74 -void goat3d_set_mtl_attrib1f(struct goat3d_material *mtl, const char *attrib, float val);
    1.75 -void goat3d_set_mtl_attrib3f(struct goat3d_material *mtl, const char *attrib, float r, float g, float b);
    1.76 -void goat3d_set_mtl_attrib4f(struct goat3d_material *mtl, const char *attrib, float r, float g, float b, float a);
    1.77 -const float *goat3d_get_mtl_attrib(struct goat3d_material *mtl, const char *attrib);
    1.78 +GOAT3DAPI void goat3d_set_mtl_attrib(struct goat3d_material *mtl, const char *attrib, const float *val);
    1.79 +GOAT3DAPI void goat3d_set_mtl_attrib1f(struct goat3d_material *mtl, const char *attrib, float val);
    1.80 +GOAT3DAPI void goat3d_set_mtl_attrib3f(struct goat3d_material *mtl, const char *attrib, float r, float g, float b);
    1.81 +GOAT3DAPI void goat3d_set_mtl_attrib4f(struct goat3d_material *mtl, const char *attrib, float r, float g, float b, float a);
    1.82 +GOAT3DAPI const float *goat3d_get_mtl_attrib(struct goat3d_material *mtl, const char *attrib);
    1.83  
    1.84 -void goat3d_set_mtl_attrib_map(struct goat3d_material *mtl, const char *attrib, const char *mapname);
    1.85 -const char *goat3d_get_mtl_attrib_map(struct goat3d_material *mtl, const char *attrib);
    1.86 +GOAT3DAPI void goat3d_set_mtl_attrib_map(struct goat3d_material *mtl, const char *attrib, const char *mapname);
    1.87 +GOAT3DAPI const char *goat3d_get_mtl_attrib_map(struct goat3d_material *mtl, const char *attrib);
    1.88  
    1.89  /* meshes */
    1.90 -void goat3d_add_mesh(struct goat3d *g, struct goat3d_mesh *mesh);
    1.91 -int goat3d_get_mesh_count(struct goat3d *g);
    1.92 -struct goat3d_mesh *goat3d_get_mesh(struct goat3d *g, int idx);
    1.93 -struct goat3d_mesh *goat3d_get_mesh_by_name(struct goat3d *g, const char *name);
    1.94 +GOAT3DAPI void goat3d_add_mesh(struct goat3d *g, struct goat3d_mesh *mesh);
    1.95 +GOAT3DAPI int goat3d_get_mesh_count(struct goat3d *g);
    1.96 +GOAT3DAPI struct goat3d_mesh *goat3d_get_mesh(struct goat3d *g, int idx);
    1.97 +GOAT3DAPI struct goat3d_mesh *goat3d_get_mesh_by_name(struct goat3d *g, const char *name);
    1.98  
    1.99 -struct goat3d_mesh *goat3d_create_mesh(void);
   1.100 -void goat3d_destroy_mesh(struct goat3d_mesh *mesh);
   1.101 +GOAT3DAPI struct goat3d_mesh *goat3d_create_mesh(void);
   1.102 +GOAT3DAPI void goat3d_destroy_mesh(struct goat3d_mesh *mesh);
   1.103  
   1.104 -void goat3d_set_mesh_name(struct goat3d_mesh *mesh, const char *name);
   1.105 -const char *goat3d_get_mesh_name(const struct goat3d_mesh *mesh);
   1.106 +GOAT3DAPI void goat3d_set_mesh_name(struct goat3d_mesh *mesh, const char *name);
   1.107 +GOAT3DAPI const char *goat3d_get_mesh_name(const struct goat3d_mesh *mesh);
   1.108  
   1.109 -void goat3d_set_mesh_mtl(struct goat3d_mesh *mesh, struct goat3d_material *mtl);
   1.110 -struct goat3d_material *goat3d_get_mesh_mtl(struct goat3d_mesh *mesh);
   1.111 +GOAT3DAPI void goat3d_set_mesh_mtl(struct goat3d_mesh *mesh, struct goat3d_material *mtl);
   1.112 +GOAT3DAPI struct goat3d_material *goat3d_get_mesh_mtl(struct goat3d_mesh *mesh);
   1.113  
   1.114 -int goat3d_get_mesh_attrib_count(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib);
   1.115 -int goat3d_get_mesh_face_count(struct goat3d_mesh *mesh);
   1.116 +GOAT3DAPI int goat3d_get_mesh_attrib_count(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib);
   1.117 +GOAT3DAPI int goat3d_get_mesh_face_count(struct goat3d_mesh *mesh);
   1.118  
   1.119  /* sets all the data for a single vertex attribute array in one go.
   1.120   * vnum is the number of *vertices* to be set, not the number of floats, ints or whatever
   1.121 @@ -137,91 +143,91 @@
   1.122   *  - GOAT3D_MESH_ATTR_SKIN_MATRIX  - 4 ints per vertex
   1.123   *  - GOAT3D_MESH_ATTR_COLOR        - 4 floats per vertex
   1.124   */
   1.125 -void goat3d_set_mesh_attribs(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib,
   1.126 +GOAT3DAPI void goat3d_set_mesh_attribs(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib,
   1.127  		const void *data, int vnum);
   1.128 -void goat3d_add_mesh_attrib1f(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib, float val);
   1.129 -void goat3d_add_mesh_attrib3f(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib,
   1.130 -		float x, float y, float z);
   1.131 -void goat3d_add_mesh_attrib4f(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib,
   1.132 -		float x, float y, float z, float w);
   1.133 +GOAT3DAPI void goat3d_add_mesh_attrib1f(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib, float val);
   1.134 +GOAT3DAPI void goat3d_add_mesh_attrib3f(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib,
   1.135 + 		float x, float y, float z);
   1.136 +GOAT3DAPI void goat3d_add_mesh_attrib4f(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib,
   1.137 + 		float x, float y, float z, float w);
   1.138  /* returns a pointer to the beginning of the requested mesh attribute array */
   1.139 -void *goat3d_get_mesh_attribs(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib);
   1.140 +GOAT3DAPI void *goat3d_get_mesh_attribs(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib);
   1.141  /* returns a pointer to the requested mesh attribute */
   1.142 -void *goat3d_get_mesh_attrib(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib, int idx);
   1.143 +GOAT3DAPI void *goat3d_get_mesh_attrib(struct goat3d_mesh *mesh, enum goat3d_mesh_attrib attrib, int idx);
   1.144  
   1.145  /* sets all the faces in one go. data is an array of 3 int vertex indices per face */
   1.146 -void goat3d_set_mesh_faces(struct goat3d_mesh *mesh, const int *data, int fnum);
   1.147 -void goat3d_add_mesh_face(struct goat3d_mesh *mesh, int a, int b, int c);
   1.148 +GOAT3DAPI void goat3d_set_mesh_faces(struct goat3d_mesh *mesh, const int *data, int fnum);
   1.149 +GOAT3DAPI void goat3d_add_mesh_face(struct goat3d_mesh *mesh, int a, int b, int c);
   1.150  /* returns a pointer to the beginning of the face index array */
   1.151 -int *goat3d_get_mesh_faces(struct goat3d_mesh *mesh);
   1.152 +GOAT3DAPI int *goat3d_get_mesh_faces(struct goat3d_mesh *mesh);
   1.153  /* returns a pointer to a face index */
   1.154 -int *goat3d_get_mesh_face(struct goat3d_mesh *mesh, int idx);
   1.155 +GOAT3DAPI int *goat3d_get_mesh_face(struct goat3d_mesh *mesh, int idx);
   1.156  
   1.157  /* immediate mode OpenGL-like interface for setting mesh data
   1.158   *  NOTE: using this interface will result in no vertex sharing between faces
   1.159   * NOTE2: the immedate mode interface is not thread-safe, either use locks, or don't
   1.160   *        use it at all in multithreaded situations.
   1.161   */
   1.162 -void goat3d_begin(struct goat3d_mesh *mesh, enum goat3d_im_primitive prim);
   1.163 -void goat3d_end(void);
   1.164 -void goat3d_vertex3f(float x, float y, float z);
   1.165 -void goat3d_normal3f(float x, float y, float z);
   1.166 -void goat3d_tangent3f(float x, float y, float z);
   1.167 -void goat3d_texcoord2f(float x, float y);
   1.168 -void goat3d_skin_weight4f(float x, float y, float z, float w);
   1.169 -void goat3d_skin_matrix4i(int x, int y, int z, int w);
   1.170 -void goat3d_color3f(float x, float y, float z);
   1.171 -void goat3d_color4f(float x, float y, float z, float w);
   1.172 +GOAT3DAPI void goat3d_begin(struct goat3d_mesh *mesh, enum goat3d_im_primitive prim);
   1.173 +GOAT3DAPI void goat3d_end(void);
   1.174 +GOAT3DAPI void goat3d_vertex3f(float x, float y, float z);
   1.175 +GOAT3DAPI void goat3d_normal3f(float x, float y, float z);
   1.176 +GOAT3DAPI void goat3d_tangent3f(float x, float y, float z);
   1.177 +GOAT3DAPI void goat3d_texcoord2f(float x, float y);
   1.178 +GOAT3DAPI void goat3d_skin_weight4f(float x, float y, float z, float w);
   1.179 +GOAT3DAPI void goat3d_skin_matrix4i(int x, int y, int z, int w);
   1.180 +GOAT3DAPI void goat3d_color3f(float x, float y, float z);
   1.181 +GOAT3DAPI void goat3d_color4f(float x, float y, float z, float w);
   1.182  
   1.183  /* lights */
   1.184 -void goat3d_add_light(struct goat3d *g, struct goat3d_light *lt);
   1.185 -int goat3d_get_light_count(struct goat3d *g);
   1.186 -struct goat3d_light *goat3d_get_light(struct goat3d *g, int idx);
   1.187 -struct goat3d_light *goat3d_get_light_by_name(struct goat3d *g, const char *name);
   1.188 +GOAT3DAPI void goat3d_add_light(struct goat3d *g, struct goat3d_light *lt);
   1.189 +GOAT3DAPI int goat3d_get_light_count(struct goat3d *g);
   1.190 +GOAT3DAPI struct goat3d_light *goat3d_get_light(struct goat3d *g, int idx);
   1.191 +GOAT3DAPI struct goat3d_light *goat3d_get_light_by_name(struct goat3d *g, const char *name);
   1.192  
   1.193 -struct goat3d_light *goat3d_create_light(void);
   1.194 -void goat3d_destroy_light(struct goat3d_light *lt);
   1.195 +GOAT3DAPI struct goat3d_light *goat3d_create_light(void);
   1.196 +GOAT3DAPI void goat3d_destroy_light(struct goat3d_light *lt);
   1.197  
   1.198  /* cameras */
   1.199 -void goat3d_add_camera(struct goat3d *g, struct goat3d_camera *cam);
   1.200 -int goat3d_get_camera_count(struct goat3d *g);
   1.201 -struct goat3d_camera *goat3d_get_camera(struct goat3d *g, int idx);
   1.202 -struct goat3d_camera *goat3d_get_camera_by_name(struct goat3d *g, const char *name);
   1.203 +GOAT3DAPI void goat3d_add_camera(struct goat3d *g, struct goat3d_camera *cam);
   1.204 +GOAT3DAPI int goat3d_get_camera_count(struct goat3d *g);
   1.205 +GOAT3DAPI struct goat3d_camera *goat3d_get_camera(struct goat3d *g, int idx);
   1.206 +GOAT3DAPI struct goat3d_camera *goat3d_get_camera_by_name(struct goat3d *g, const char *name);
   1.207  
   1.208 -struct goat3d_camera *goat3d_create_camera(void);
   1.209 -void goat3d_destroy_camera(struct goat3d_camera *cam);
   1.210 +GOAT3DAPI struct goat3d_camera *goat3d_create_camera(void);
   1.211 +GOAT3DAPI void goat3d_destroy_camera(struct goat3d_camera *cam);
   1.212  
   1.213  /* nodes */
   1.214 -void goat3d_add_node(struct goat3d *g, struct goat3d_node *node);
   1.215 -int goat3d_get_node_count(struct goat3d *g);
   1.216 -struct goat3d_node *goat3d_get_node(struct goat3d *g, int idx);
   1.217 -struct goat3d_node *goat3d_get_node_by_name(struct goat3d *g, const char *name);
   1.218 +GOAT3DAPI void goat3d_add_node(struct goat3d *g, struct goat3d_node *node);
   1.219 +GOAT3DAPI int goat3d_get_node_count(struct goat3d *g);
   1.220 +GOAT3DAPI struct goat3d_node *goat3d_get_node(struct goat3d *g, int idx);
   1.221 +GOAT3DAPI struct goat3d_node *goat3d_get_node_by_name(struct goat3d *g, const char *name);
   1.222  
   1.223 -struct goat3d_node *goat3d_create_node(void);
   1.224 -void goat3d_destroy_node(struct goat3d_node *node);
   1.225 +GOAT3DAPI struct goat3d_node *goat3d_create_node(void);
   1.226 +GOAT3DAPI void goat3d_destroy_node(struct goat3d_node *node);
   1.227  
   1.228 -void goat3d_set_node_name(struct goat3d_node *node, const char *name);
   1.229 -const char *goat3d_get_node_name(const struct goat3d_node *node);
   1.230 +GOAT3DAPI void goat3d_set_node_name(struct goat3d_node *node, const char *name);
   1.231 +GOAT3DAPI const char *goat3d_get_node_name(const struct goat3d_node *node);
   1.232  
   1.233 -void goat3d_set_node_object(struct goat3d_node *node, enum goat3d_node_type type, void *obj);
   1.234 -void *goat3d_get_node_object(const struct goat3d_node *node);
   1.235 -enum goat3d_node_type goat3d_get_node_type(const struct goat3d_node *node);
   1.236 +GOAT3DAPI void goat3d_set_node_object(struct goat3d_node *node, enum goat3d_node_type type, void *obj);
   1.237 +GOAT3DAPI void *goat3d_get_node_object(const struct goat3d_node *node);
   1.238 +GOAT3DAPI enum goat3d_node_type goat3d_get_node_type(const struct goat3d_node *node);
   1.239  
   1.240 -void goat3d_add_node_child(struct goat3d_node *node, struct goat3d_node *child);
   1.241 -int goat3d_get_node_child_count(const struct goat3d_node *node);
   1.242 -struct goat3d_node *goat3d_get_node_child(const struct goat3d_node *node, int idx);
   1.243 +GOAT3DAPI void goat3d_add_node_child(struct goat3d_node *node, struct goat3d_node *child);
   1.244 +GOAT3DAPI int goat3d_get_node_child_count(const struct goat3d_node *node);
   1.245 +GOAT3DAPI struct goat3d_node *goat3d_get_node_child(const struct goat3d_node *node, int idx);
   1.246  
   1.247 -void goat3d_set_node_position(struct goat3d_node *node, float x, float y, float z, long tmsec);
   1.248 -void goat3d_set_node_rotation(struct goat3d_node *node, float qx, float qy, float qz, float qw, long tmsec);
   1.249 -void goat3d_set_node_scaling(struct goat3d_node *node, float sx, float sy, float sz, long tmsec);
   1.250 -void goat3d_set_node_pivot(struct goat3d_node *node, float px, float py, float pz);
   1.251 +GOAT3DAPI void goat3d_set_node_position(struct goat3d_node *node, float x, float y, float z, long tmsec);
   1.252 +GOAT3DAPI void goat3d_set_node_rotation(struct goat3d_node *node, float qx, float qy, float qz, float qw, long tmsec);
   1.253 +GOAT3DAPI void goat3d_set_node_scaling(struct goat3d_node *node, float sx, float sy, float sz, long tmsec);
   1.254 +GOAT3DAPI void goat3d_set_node_pivot(struct goat3d_node *node, float px, float py, float pz);
   1.255  
   1.256 -void goat3d_get_node_position(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr, long tmsec);
   1.257 -void goat3d_get_node_rotation(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr, float *wptr, long tmsec);
   1.258 -void goat3d_get_node_scaling(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr, long tmsec);
   1.259 -void goat3d_get_node_pivot(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr);
   1.260 +GOAT3DAPI void goat3d_get_node_position(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr, long tmsec);
   1.261 +GOAT3DAPI void goat3d_get_node_rotation(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr, float *wptr, long tmsec);
   1.262 +GOAT3DAPI void goat3d_get_node_scaling(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr, long tmsec);
   1.263 +GOAT3DAPI void goat3d_get_node_pivot(const struct goat3d_node *node, float *xptr, float *yptr, float *zptr);
   1.264  
   1.265 -void goat3d_get_node_matrix(const struct goat3d_node *node, float *matrix, long tmsec);
   1.266 +GOAT3DAPI void goat3d_get_node_matrix(const struct goat3d_node *node, float *matrix, long tmsec);
   1.267  
   1.268  #ifdef __cplusplus
   1.269  }