scenefile

view src/mesh.h @ 3:b30f83409769

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