X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fscr%2Fpolytest.c;h=ca04256776e29242f15baf502a8c0bfca2959e6e;hp=0b0531372d640dfa653c9376226428e721279b80;hb=650644eccabcdceb974c17d5fd19c0546eb753d3;hpb=ba648ddfc62fc6d3f47294aa8bfc10ea6ca3f479 diff --git a/src/scr/polytest.c b/src/scr/polytest.c index 0b05313..ca04256 100644 --- a/src/scr/polytest.c +++ b/src/scr/polytest.c @@ -10,6 +10,7 @@ #include "cfgopt.h" #include "mesh.h" #include "bsptree.h" +#include "util.h" static int init(void); static void destroy(void); @@ -66,11 +67,11 @@ static int init(void) } */ - gen_texture(&tex, 128, 128); + gen_texture(&tex, 64, 64); #ifdef DEBUG_POLYFILL - lowres_width = fb_width / LOWRES_SCALE; - lowres_height = fb_height / LOWRES_SCALE; + 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 @@ -101,6 +102,8 @@ static void start(long trans_time) g3d_polygon_mode(G3D_GOURAUD); g3d_enable(G3D_TEXTURE_2D); + + g3d_enable(G3D_DEPTH_TEST); } static void update(void) @@ -116,7 +119,9 @@ static void draw(void) update(); - memset(fb_pixels, 0, fb_width * fb_height * 2); + //memset16(fb_pixels, PACK_RGB16(20, 30, 50), FB_WIDTH * FB_HEIGHT); + g3d_clear_color(20, 30, 50); + g3d_clear(G3D_COLOR_BUFFER_BIT | G3D_DEPTH_BUFFER_BIT); g3d_matrix_mode(G3D_MODELVIEW); g3d_load_identity(); @@ -128,9 +133,8 @@ static void draw(void) g3d_rotate(cam_theta, 0, 1, 0); } - g3d_light_pos(0, -10, 10, 20); - - g3d_mtl_diffuse(0.4, 0.7, 1.0); + g3d_light_dir(0, -10, 10, 10); + g3d_mtl_diffuse(1.0, 1.0, 1.0); g3d_set_texture(tex.width, tex.height, tex.pixels); if(use_bsp) { @@ -143,10 +147,18 @@ static void draw(void) draw_bsp(&torus_bsp, vdir[0], vdir[1], vdir[2]); } else { - zsort_mesh(&torus); + //zsort_mesh(&torus); draw_mesh(&torus); } + /*{ + int i; + for(i=0; i