X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolytest.c;h=0b0531372d640dfa653c9376226428e721279b80;hp=207fb31557f925017a86e21acbf93739633fbe3c;hb=5f36e95f19ad8d7a5a1dd546ffeb54ce95d51749;hpb=8cee0ffb00cce3d81487f1161286ac299db7d044 diff --git a/src/polytest.c b/src/polytest.c index 207fb31..0b05313 100644 --- a/src/polytest.c +++ b/src/polytest.c @@ -9,12 +9,14 @@ #include "polyfill.h" /* just for struct pimage */ #include "cfgopt.h" #include "mesh.h" +#include "bsptree.h" static int init(void); static void destroy(void); static void start(long trans_time); static void draw(void); static void draw_lowres_raster(void); +static void keypress(int key); static int gen_texture(struct pimage *img, int xsz, int ysz); static struct screen scr = { @@ -22,15 +24,19 @@ static struct screen scr = { init, destroy, start, 0, - draw + draw, + keypress }; 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; +static int use_bsp = 0; + #define LOWRES_SCALE 10 static uint16_t *lowres_pixels; static int lowres_width, lowres_height; @@ -44,14 +50,22 @@ static int init(void) { int i; - gen_cube(&cube, 1.0, 0); - gen_torus(&torus, 1.0, 0.25, 24, 12); + gen_cube_mesh(&cube, 1.0, 0); + gen_torus_mesh(&torus, 1.0, 0.25, 24, 12); /* scale texcoords */ for(i=0; i