interpolation
[voxscape] / src / main.c
index f0c89eb..bcf2250 100644 (file)
@@ -34,6 +34,7 @@ int win_width, win_height;
 unsigned int fb[FB_W * FB_H];
 
 int mouse_x, mouse_y, mwarp, mbstate[3];
+int hfilt = VOX_LINEAR, cfilt = VOX_LINEAR;
 
 unsigned int input;
 int32_t pos[2], angle;
@@ -82,6 +83,7 @@ int init(void)
        vox_framebuf(vox, FB_W, FB_H, fb, -1);
        vox_proj(vox, 45, 1, 300);
        vox_fog(vox, 260, COLOR_HORIZON);
+       vox_filter(vox, hfilt, cfilt);
 
        glfb_setup(FB_W, FB_H, GLFB_RGBA32, FB_W * 4);
        return 0;
@@ -186,6 +188,20 @@ void keyb(unsigned char key, int x, int y)
                input |= INP_RTURN;
                break;
 
+       case 'h':
+               hfilt ^= 1;
+               printf("filtering: height(%s) color(%s)\n", hfilt ? "linear" : "nearest",
+                               cfilt ? "linear" : "nearest");
+               vox_filter(vox, hfilt, cfilt);
+               break;
+
+       case 'c':
+               cfilt ^= 1;
+               vox_filter(vox, hfilt, cfilt);
+               printf("filtering: height(%s) color(%s)\n", hfilt ? "linear" : "nearest",
+                               cfilt ? "linear" : "nearest");
+               break;
+
        default:
                break;
        }