gba-x3dtest

view src/mesh.c @ 13:2070a81127f2

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 23 Jun 2014 08:28:28 +0300
parents ecc022a21279
children b755fb002f17
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->nverts = 0;
11 }
13 void destroy_mesh(struct mesh *m)
14 {
15 free(m->verts);
16 free(m->colors);
17 }
19 void draw_mesh(struct mesh *m)
20 {
21 x3d_vertex_array(m->nverts, m->verts);
22 if(m->colors) {
23 x3d_color_array(m->nverts, m->colors);
24 }
26 x3d_draw(m->prim, m->nverts);
28 x3d_vertex_array(0, 0);
29 x3d_color_array(0, 0);
30 }