backporting...
[dosdemo] / src / mesh.h
1 #ifndef MESH_H_
2 #define MESH_H_
3
4 #include "inttypes.h"
5
6 struct g3d_mesh {
7         int prim;
8         struct g3d_vertex *varr;
9         uint16_t *iarr;
10         int vcount, icount;
11 };
12
13 void free_mesh(struct g3d_mesh *mesh);
14 void destroy_mesh(struct g3d_mesh *mesh);
15
16 int copy_mesh(struct g3d_mesh *dest, struct g3d_mesh *src);
17
18 int load_mesh(struct g3d_mesh *mesh, const char *fname);
19 int save_mesh(struct g3d_mesh *mesh, const char *fname);
20
21 void zsort_mesh(struct g3d_mesh *mesh);
22 void draw_mesh(struct g3d_mesh *mesh);
23
24 void apply_mesh_xform(struct g3d_mesh *mesh, const float *xform);
25 int append_mesh(struct g3d_mesh *ma, struct g3d_mesh *mb);
26 int indexify_mesh(struct g3d_mesh *mesh);
27
28 void normalize_mesh_normals(struct g3d_mesh *mesh);
29
30 int gen_sphere_mesh(struct g3d_mesh *mesh, float rad, int usub, int vsub);
31 int gen_plane_mesh(struct g3d_mesh *mesh, float width, float height, int usub, int vsub);
32 int gen_cube_mesh(struct g3d_mesh *mesh, float sz, int sub);
33 int gen_torus_mesh(struct g3d_mesh *mesh, float rad, float ringrad, int usub, int vsub);
34
35 #endif  /* MESH_H_ */