X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=regis;a=blobdiff_plain;f=x3d.c;h=1e9a8d08e528bffbae8f497e7822077ec714cc30;hp=53faa9b1252fb8ffe9c83d8d16b615a4bfba825c;hb=bf31f77d497cefcc3f04d559f762a07ef9e5d3e5;hpb=4ac276ea513d4460f9db8c43b4dbde5ebad652b5 diff --git a/x3d.c b/x3d.c index 53faa9b..1e9a8d0 100644 --- a/x3d.c +++ b/x3d.c @@ -45,6 +45,9 @@ static const int32_t *vertex_array; static unsigned short vertex_count; static uint8_t im_color_index; +static int32_t im_vertex[4 * 3]; +static short im_vcount; +static short im_mode; void x3d_projection(int fov, int32_t aspect, int32_t nearz, int32_t farz) @@ -241,6 +244,30 @@ static void proc_vertex(const int32_t *vin, pvec3 *vout) vout->z = tvert[2]; } +void x3d_begin(int mode) +{ + im_mode = mode; + im_vcount = 0; +} + +void x3d_end(void) +{ +} + +void x3d_vertex(int32_t x, int32_t y, int32_t z) +{ + int32_t *vptr = im_vertex + im_vcount * 3; + vptr[0] = x; + vptr[1] = y; + vptr[2] = z; + + im_vcount = (im_vcount + 1) % im_mode; + if(!im_vcount) { + x3d_vertex_array(im_mode, im_vertex); + x3d_draw(im_mode, im_mode); + } +} + void x3d_color_index(int cidx) { im_color_index = cidx; @@ -250,12 +277,12 @@ void x3d_color_index(int cidx) void draw_poly(int num, const pvec3 *verts, int color) { int i; - regis_abspos(verts[0].x, verts[0].y); + regis_abspos(verts[0].x >> 16, verts[0].y >> 16); regis_begin_vector(REGIS_BOUNDED); for(i=0; ix, verts->y); + regis_absv(verts->x >> 16, verts->y >> 16); } regis_end_vector(); }