scenefile

annotate src/mesh.h @ 3:b30f83409769

foo
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sat, 21 Jan 2012 04:14:24 +0200
parents 38489ad82bf4
children
rev   line source
nuclear@0 1 #ifndef MESH_H_
nuclear@0 2 #define MESH_H_
nuclear@0 3
nuclear@1 4 struct mesh_vertattr;
nuclear@1 5 struct mesh_polyidx;
nuclear@1 6 struct mesh;
nuclear@0 7
nuclear@0 8 #ifdef __cplusplus
nuclear@0 9 extern "C" {
nuclear@0 10 #endif
nuclear@0 11
nuclear@1 12 /* --- vertex attributes --- */
nuclear@0 13
nuclear@1 14 int vattr_init(struct mesh_vertattr *ma, int elem_sz);
nuclear@1 15 void vattr_destroy(struct mesh_vertattr *ma);
nuclear@0 16
nuclear@1 17 int vattr_set_name(struct mesh_vertattr *ma, const char *name);
nuclear@1 18 const char *vattr_get_name(struct mesh_vertattr *ma);
nuclear@1 19
nuclear@1 20 int vattr_add_elem(struct mesh_vertattr *ma, void *elem);
nuclear@1 21
nuclear@1 22 void *vattr_pointer(struct mesh_vertattr *ma);
nuclear@1 23 int vattr_count(struct mesh_vertattr *ma);
nuclear@1 24 int vattr_elem_size(struct mesh_vertattr *ma);
nuclear@3 25 void *vattr_elem(struct mesh_vertattr *ma, int elem);
nuclear@1 26
nuclear@1 27 /* --- mesh --- */
nuclear@1 28
nuclear@1 29 int mesh_init(struct mesh *m, int nverts);
nuclear@0 30 void mesh_destroy(struct mesh *m);
nuclear@0 31
nuclear@0 32 int mesh_set_name(struct mesh *m, const char *name);
nuclear@1 33 const char *mesh_get_name(struct mesh *m);
nuclear@1 34
nuclear@3 35 /* 1 - points, 2 - lines, 3 - triangles, 4 - quads */
nuclear@3 36 int mesh_poly_type(struct mesh *m);
nuclear@3 37
nuclear@1 38 int mesh_add_attrib(struct mesh *m, struct mesh_vertattr *attr);
nuclear@3 39 int mesh_num_attribs(struct mesh *m);
nuclear@0 40 int mesh_find_attrib(struct mesh *m, const char *name);
nuclear@0 41
nuclear@3 42 struct mesh_vertattr *mesh_attrib(struct mesh *m, int loc);
nuclear@3 43 void *mesh_attrib_data(struct mesh *m, int loc);
nuclear@3 44 int *mesh_poly_data(struct mesh *m, int loc);
nuclear@3 45
nuclear@3 46 int mesh_attrib_count(struct mesh *m, int loc);
nuclear@1 47 int mesh_poly_count(struct mesh *m);
nuclear@1 48
nuclear@3 49 void *mesh_attrib_elem(struct mesh *m, int loc, int elem);
nuclear@3 50 int mesh_attrib_elem_size(struct mesh *m, int loc);
nuclear@3 51
nuclear@1 52 /* the variable arguments correspond to the N indices of the N-gon
nuclear@1 53 * for this particular vertex attribute (attr_loc, retrieved by
nuclear@1 54 * mesh_find_attrib)
nuclear@1 55 */
nuclear@1 56 int mesh_add_polyref(struct mesh *m, int attr_loc, ...);
nuclear@1 57
nuclear@0 58 #ifdef __cplusplus
nuclear@0 59 }
nuclear@0 60 #endif
nuclear@0 61
nuclear@0 62 #endif /* MESH_H_ */