runs in VR
[vrtris] / src / game.c
index d4a7fe3..05bdc95 100644 (file)
@@ -12,7 +12,6 @@
 static void calc_framerate(void);
 static void print_framerate(void);
 
-static float view_matrix[16], proj_matrix[16];
 static int should_swap;
 static unsigned long framerate;
 
@@ -35,11 +34,17 @@ int game_init(int argc, char **argv)
                        return -1;
                }
                goatvr_set_origin_mode(GOATVR_HEAD);
+               goatvr_set_units_scale(10.0f);
 
                goatvr_startvr();
                should_swap = goatvr_should_swap();
        }
 
+       glEnable(GL_DEPTH_TEST);
+       glEnable(GL_CULL_FACE);
+       glEnable(GL_LIGHTING);
+       glEnable(GL_LIGHT0);
+
        return 0;
 }
 
@@ -104,7 +109,7 @@ void game_display(void)
                /* non-VR mode */
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-               cgm_mperspective(proj_matrix, cgm_deg_to_rad(50.0), win_aspect, 0.5, 500.0);
+               cgm_mperspective(proj_matrix, cgm_deg_to_rad(40.0), win_aspect, 0.5, 500.0);
                glMatrixMode(GL_PROJECTION);
                glLoadMatrixf(proj_matrix);
 
@@ -150,6 +155,12 @@ void game_keyboard(int key, int pressed)
                        }
                        break;
 
+               case KEY_HOME:
+                       if(opt.flags & OPT_VR) {
+                               goatvr_recenter();
+                       }
+                       break;
+
                default:
                        break;
                }