adjust fov on aspect change master
authorJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 7 Nov 2022 23:49:06 +0000 (01:49 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Mon, 7 Nov 2022 23:49:06 +0000 (01:49 +0200)
src/main.c

index bbe64fd..bebba84 100644 (file)
@@ -82,7 +82,6 @@ int init(void)
                return -1;
        }
        vox_framebuf(vox, FB_W, FB_H, fb);
-       vox_proj(vox, 140, 45, 1, 300);
        vox_fog(vox, 260, COLOR_HORIZON);
        vox_filter(vox, hfilt, cfilt);
 
@@ -156,6 +155,10 @@ void idle(void)
 
 void reshape(int x, int y)
 {
+       float aspect = (float)x / y;
+
+       vox_proj(vox, 140, 40 * aspect, 1, 300);
+
        glViewport(0, 0, x, y);
 
        win_width = x;