switching polytest between zsorting and BSP for performance testing
[dosdemo] / src / polytest.c
index 2558389..bbc1c0b 100644 (file)
@@ -16,6 +16,7 @@ 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 = {
@@ -23,7 +24,8 @@ static struct screen scr = {
        init,
        destroy,
        start, 0,
-       draw
+       draw,
+       keypress
 };
 
 static float cam_theta, cam_phi = 25;
@@ -201,6 +203,16 @@ static void draw_lowres_raster(void)
        }
 }
 
+static void keypress(int key)
+{
+       switch(key) {
+       case 'b':
+               use_bsp = !use_bsp;
+               printf("drawing with %s\n", use_bsp ? "BSP tree" : "z-sorting");
+               break;
+       }
+}
+
 static int gen_texture(struct pimage *img, int xsz, int ysz)
 {
        int i, j;