X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrfileman;a=blobdiff_plain;f=src%2Fapp.cc;h=f5b98947a863a2ea5d9e07a533bbcc91be85e41e;hp=6ed9b8e3a7e432d8d01bf32cbf26a12ce1dc7b90;hb=d032f000a796aab8654fa13bcb84f2393f16cb65;hpb=de5bcfb5aaa126539e927ab9359a7de2bbfa3392 diff --git a/src/app.cc b/src/app.cc index 6ed9b8e..f5b9894 100644 --- a/src/app.cc +++ b/src/app.cc @@ -26,6 +26,8 @@ static float cam_height = 1.65; static bool bnstate[16]; static int prev_x, prev_y; +static float fov = 60.0; + bool app_init(int argc, char **argv) { if(!init_options(argc, argv, "vrfileman.conf")) { @@ -120,6 +122,11 @@ void app_draw() // regular monoscopic mode glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + Mat4 mat; + mat.perspective(deg_to_rad(fov), win_aspect, 0.1, 200.0); + glMatrixMode(GL_PROJECTION); + glLoadMatrixf(mat[0]); + view_matrix = Mat4::identity; view_matrix.pre_rotate_x(deg_to_rad(cam_phi)); view_matrix.pre_rotate_y(deg_to_rad(cam_theta)); @@ -146,12 +153,6 @@ void app_reshape(int x, int y) { glViewport(0, 0, x, y); - Mat4 mat; - mat.perspective(deg_to_rad(60), win_aspect, 0.1, 200.0); - - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(mat[0]); - if(opt.vr) { goatvr_set_fb_size(x, y, 1.0); } @@ -181,6 +182,16 @@ void app_keyboard(int key, bool pressed) goatvr_recenter(); } break; + + case '-': + fov += 1.0; + if(fov > 160.0) fov = 160.0; + break; + + case '=': + fov -= 1.0; + if(fov < 0.0) fov = 0.0; + break; } } }