-
Notifications
You must be signed in to change notification settings - Fork 4
/
mesh.h
34 lines (28 loc) · 985 Bytes
/
mesh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef MESH_H
#define MESH_H
/*
* Mesh construction
*/
struct mesh *mesh_create(void);
void mesh_free(struct mesh *mesh);
void mesh_add_vertex(struct mesh *mesh, const float *v);
void mesh_add_normal(struct mesh *mesh, const float *n);
void mesh_begin_face(struct mesh *mesh);
void mesh_add_index(struct mesh *mesh, int vi, int ni);
void mesh_end_face(struct mesh *mesh);
void mesh_compute_normals(struct mesh *mesh);
/*
* Vertex buffer access
*/
int mesh_vertex_buffer(const struct mesh *mesh, const float **buf);
int mesh_normal_buffer(const struct mesh *mesh, const float **buf);
/*
* Face access
*/
int mesh_face_count(const struct mesh *mesh);
int mesh_face_vertex_count(const struct mesh *mesh, int face);
void mesh_face_vertex_index(const struct mesh *mesh, int face, int vert,
int *vertex_idx, int *normal_idx);
float *mesh_get_vertex(const struct mesh *mesh, int face, int vert);
float *mesh_get_normal(const struct mesh *mesh, int face, int vert);
#endif