gba-x3dtest

diff src/mesh.c @ 12:ecc022a21279

more tuff
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 23 Jun 2014 06:44:04 +0300
parents
children 2070a81127f2
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/mesh.c	Mon Jun 23 06:44:04 2014 +0300
     1.3 @@ -0,0 +1,22 @@
     1.4 +#include <stdlib.h>
     1.5 +#include "mesh.h"
     1.6 +#include "x3d.h"
     1.7 +
     1.8 +void init_mesh(struct mesh *m)
     1.9 +{
    1.10 +	m->prim = X3D_TRIANGLES;
    1.11 +	m->verts = 0;
    1.12 +	m->nverts = 0;
    1.13 +}
    1.14 +
    1.15 +void destroy_mesh(struct mesh *m)
    1.16 +{
    1.17 +	free(m->verts);
    1.18 +}
    1.19 +
    1.20 +void draw_mesh(struct mesh *m)
    1.21 +{
    1.22 +	x3d_vertex_array(m->nverts, m->verts);
    1.23 +	x3d_draw(m->prim, m->nverts);
    1.24 +	x3d_vertex_array(0, 0);
    1.25 +}