gba-x3dtest

annotate 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
rev   line source
nuclear@12 1 #include <stdlib.h>
nuclear@12 2 #include "mesh.h"
nuclear@12 3 #include "x3d.h"
nuclear@12 4
nuclear@12 5 void init_mesh(struct mesh *m)
nuclear@12 6 {
nuclear@12 7 m->prim = X3D_TRIANGLES;
nuclear@12 8 m->verts = 0;
nuclear@13 9 m->colors = 0;
nuclear@12 10 m->nverts = 0;
nuclear@12 11 }
nuclear@12 12
nuclear@12 13 void destroy_mesh(struct mesh *m)
nuclear@12 14 {
nuclear@12 15 free(m->verts);
nuclear@13 16 free(m->colors);
nuclear@12 17 }
nuclear@12 18
nuclear@12 19 void draw_mesh(struct mesh *m)
nuclear@12 20 {
nuclear@12 21 x3d_vertex_array(m->nverts, m->verts);
nuclear@13 22 if(m->colors) {
nuclear@13 23 x3d_color_array(m->nverts, m->colors);
nuclear@13 24 }
nuclear@13 25
nuclear@12 26 x3d_draw(m->prim, m->nverts);
nuclear@13 27
nuclear@12 28 x3d_vertex_array(0, 0);
nuclear@13 29 x3d_color_array(0, 0);
nuclear@12 30 }