X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolytest.c;h=8d81262196a5cea3b542f4105b7cce3388282ea9;hp=85b31282382b0d7bdfa0e51682fe021b469b741b;hb=32ff3cf2d7d7a5ae82f5ca400b320c67e6984ad6;hpb=b546d1a5227ee3a263447e279434842d230f700a diff --git a/src/polytest.c b/src/polytest.c index 85b3128..8d81262 100644 --- a/src/polytest.c +++ b/src/polytest.c @@ -9,6 +9,7 @@ #include "polyfill.h" /* just for struct pimage */ #include "cfgopt.h" #include "mesh.h" +#include "bsptree.h" static int init(void); static void destroy(void); @@ -28,6 +29,7 @@ static struct screen scr = { static float cam_theta, cam_phi = 25; static float cam_dist = 3; static struct g3d_mesh cube, torus; +static struct bsptree torus_bsp; static struct pimage tex; @@ -52,6 +54,12 @@ static int init(void) torus.varr[i].v *= 2.0; } + init_bsp(&torus_bsp); + if(bsp_add_mesh(&torus_bsp, &torus) == -1) { + fprintf(stderr, "failed to construct torus BSP tree\n"); + return -1; + } + gen_texture(&tex, 128, 128); #ifdef DEBUG_POLYFILL @@ -70,6 +78,7 @@ static void destroy(void) free(cube.varr); free(torus.varr); free(torus.iarr); + destroy_bsp(&torus_bsp); } static void start(long trans_time) @@ -115,6 +124,7 @@ static void draw(void) g3d_set_texture(tex.width, tex.height, tex.pixels); draw_mesh(&torus); + /*draw_bsp(&torus_bsp);*/ /*draw_mesh(&cube);*/ swap_buffers(fb_pixels);