gba-trycatch

view src/mesh.c @ 15:b755fb002f17

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 25 Jun 2014 17:02:48 +0300
parents 2070a81127f2
children
line source
1 #include <stdlib.h>
2 #include "mesh.h"
3 #include "x3d.h"
5 void init_mesh(struct mesh *m)
6 {
7 m->prim = X3D_TRIANGLES;
8 m->verts = 0;
9 m->colors = 0;
10 m->texcoords = 0;
11 m->nverts = 0;
12 }
14 void destroy_mesh(struct mesh *m)
15 {
16 free(m->verts);
17 free(m->colors);
18 free(m->texcoords);
19 }
21 void draw_mesh(struct mesh *m)
22 {
23 x3d_vertex_array(m->nverts, m->verts);
24 if(m->colors) {
25 x3d_color_array(m->nverts, m->colors);
26 }
27 if(m->texcoords) {
28 x3d_texcoord_array(m->nverts, m->texcoords);
29 }
31 x3d_draw(m->prim, m->nverts);
33 x3d_vertex_array(0, 0);
34 x3d_color_array(0, 0);
35 x3d_texcoord_array(0, 0);
36 }