gba-x3dtest

diff 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 diff
     1.1 --- a/src/mesh.c	Mon Jun 23 06:44:04 2014 +0300
     1.2 +++ b/src/mesh.c	Mon Jun 23 08:28:28 2014 +0300
     1.3 @@ -6,17 +6,25 @@
     1.4  {
     1.5  	m->prim = X3D_TRIANGLES;
     1.6  	m->verts = 0;
     1.7 +	m->colors = 0;
     1.8  	m->nverts = 0;
     1.9  }
    1.10  
    1.11  void destroy_mesh(struct mesh *m)
    1.12  {
    1.13  	free(m->verts);
    1.14 +	free(m->colors);
    1.15  }
    1.16  
    1.17  void draw_mesh(struct mesh *m)
    1.18  {
    1.19  	x3d_vertex_array(m->nverts, m->verts);
    1.20 +	if(m->colors) {
    1.21 +		x3d_color_array(m->nverts, m->colors);
    1.22 +	}
    1.23 +
    1.24  	x3d_draw(m->prim, m->nverts);
    1.25 +
    1.26  	x3d_vertex_array(0, 0);
    1.27 +	x3d_color_array(0, 0);
    1.28  }