X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolytest.c;h=826b0b0c5a5439a8a2df57f7d65d0ddf4bef53e7;hp=b81e9aa2c45e6e3896a1f8216b2b15768a4c0547;hb=dce48eb322ddf2a3c3622fc132ece21ba7653da3;hpb=3616caf014bccbf8814a67cf87ac012a91e7e968 diff --git a/src/polytest.c b/src/polytest.c index b81e9aa..826b0b0 100644 --- a/src/polytest.c +++ b/src/polytest.c @@ -49,9 +49,12 @@ static int init(void) gen_cube(&cube, 1.0); gen_torus(&torus, 1.0, 0.25, 24, 12); +#ifdef DEBUG_POLYFILL lowres_width = fb_width / LOWRES_SCALE; lowres_height = fb_height / LOWRES_SCALE; lowres_pixels = malloc(lowres_width * lowres_height * 2); + scr.draw = draw_debug; +#endif return 0; } @@ -79,7 +82,7 @@ static void update(void) static unsigned int prev_bmask; if(mouse_bmask) { - if(mouse_bmask ^ prev_bmask == 0) { + if((mouse_bmask ^ prev_bmask) == 0) { int dx = mouse_x - prev_mx; int dy = mouse_y - prev_my; @@ -97,10 +100,30 @@ static void update(void) prev_bmask = mouse_bmask; } + static void draw(void) { update(); + memset(fb_pixels, 0, fb_width * fb_height * 2); + + g3d_matrix_mode(G3D_MODELVIEW); + g3d_load_identity(); + g3d_translate(0, 0, -3); + g3d_rotate(phi, 1, 0, 0); + g3d_rotate(theta, 0, 1, 0); + + zsort(&torus); + draw_mesh(&torus); + + /*draw_mesh(&cube);*/ + swap_buffers(fb_pixels); +} + +static void draw_debug(void) +{ + update(); + memset(lowres_pixels, 0, lowres_width * lowres_height * 2); g3d_matrix_mode(G3D_MODELVIEW);