vrshoot

diff src/scr_game.cc @ 1:e7ca128b8713

looks nice :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 00:35:22 +0200
parents b2f14e535253
children
line diff
     1.1 --- a/src/scr_game.cc	Sat Feb 01 19:58:19 2014 +0200
     1.2 +++ b/src/scr_game.cc	Sun Feb 02 00:35:22 2014 +0200
     1.3 @@ -10,9 +10,10 @@
     1.4  static int win_width, win_height;
     1.5  static bool bnstate[32];
     1.6  static int prev_x, prev_y;
     1.7 -static float cam_theta, cam_phi = 20, cam_dist = 10;
     1.8 +static float cam_theta, cam_phi = 23, cam_dist = 0;
     1.9  static Object *floor_obj;
    1.10  static Level *level;
    1.11 +static unsigned long msec;
    1.12  
    1.13  const char *GameScreen::get_name() const
    1.14  {
    1.15 @@ -24,11 +25,6 @@
    1.16  	glEnable(GL_LIGHTING);
    1.17  	glEnable(GL_LIGHT0);
    1.18  
    1.19 -	floor_obj = new Object;
    1.20 -	floor_obj->set_mesh(new Mesh);
    1.21 -	gen_plane(floor_obj->get_mesh(), 10, 10, 4, 4);
    1.22 -	floor_obj->set_rotation(Quaternion(Vector3(1, 0, 0), -DEG_TO_RAD(90)));
    1.23 -
    1.24  	level = new Level;
    1.25  
    1.26  	return true;
    1.27 @@ -40,6 +36,7 @@
    1.28  
    1.29  void GameScreen::update(unsigned long tmsec)
    1.30  {
    1.31 +	msec = tmsec;
    1.32  }
    1.33  
    1.34  void GameScreen::display() const
    1.35 @@ -48,14 +45,13 @@
    1.36  	matrix.translate(Vector3(0, 0, -cam_dist));
    1.37  	matrix.rotate(Vector3(1, 0, 0), DEG_TO_RAD(cam_phi));
    1.38  	matrix.rotate(Vector3(0, 1, 0), DEG_TO_RAD(cam_theta));
    1.39 +	matrix.translate(Vector3(0, -2, 0));
    1.40  	set_view_matrix(matrix);
    1.41  
    1.42  	//glUseProgram(0);
    1.43  
    1.44  	bind_shader(defsdr);
    1.45 -	//floor_obj->draw();
    1.46 -
    1.47 -	level->draw();
    1.48 +	level->draw(msec);
    1.49  }
    1.50  
    1.51  void GameScreen::reshape(int x, int y)