vrfileman

diff src/app.cc @ 5:d487181ee1d9

fixed movement
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 03 Feb 2015 03:35:14 +0200
parents 85e26116ba5a
children
line diff
     1.1 --- a/src/app.cc	Mon Feb 02 21:11:23 2015 +0200
     1.2 +++ b/src/app.cc	Tue Feb 03 03:35:14 2015 +0200
     1.3 @@ -9,7 +9,7 @@
     1.4  static User user;
     1.5  static float eye_level = 1.6;
     1.6  
     1.7 -static const float walk_speed = 4.0;
     1.8 +static const float walk_speed = 5.0;
     1.9  
    1.10  static int win_width, win_height;
    1.11  static bool keystate[256];
    1.12 @@ -45,15 +45,15 @@
    1.13  		redisplay();
    1.14  	}
    1.15  	if(keystate['d'] || keystate['D']) {
    1.16 -		right += walk_speed * 0.5 * dt;
    1.17 +		right += walk_speed * 0.7 * dt;
    1.18  		redisplay();
    1.19  	}
    1.20  	if(keystate['a'] || keystate['A']) {
    1.21 -		right -= walk_speed * 0.5 * dt;
    1.22 +		right -= walk_speed * 0.7 * dt;
    1.23  		redisplay();
    1.24  	}
    1.25  
    1.26 -	user.posrot.move(fwd, right);
    1.27 +	user.move(fwd, right);
    1.28  }
    1.29  
    1.30  void app_display()
    1.31 @@ -67,7 +67,7 @@
    1.32  	glLoadIdentity();
    1.33  
    1.34  	Matrix4x4 viewmat;
    1.35 -	user.posrot.calc_inv_matrix(&viewmat);
    1.36 +	user.calc_inv_matrix(&viewmat);
    1.37  	glLoadTransposeMatrixf(viewmat.m[0]);
    1.38  	glTranslatef(0, -eye_level, 0);
    1.39  
    1.40 @@ -128,7 +128,7 @@
    1.41  
    1.42  void app_mouse_motion(int x, int y)
    1.43  {
    1.44 -	static const float rot_speed = 10.0;
    1.45 +	static const float rot_speed = 250.0;
    1.46  
    1.47  	float dx = (float)(x - prev_x) / (float)win_width;
    1.48  	float dy = (float)(y - prev_y) / (float)win_height;
    1.49 @@ -136,7 +136,7 @@
    1.50  	prev_y = y;
    1.51  
    1.52  	if(bnstate[0]) {
    1.53 -		user.posrot.rotate(dx * rot_speed, dy * rot_speed);
    1.54 +		user.rotate(dx * rot_speed, dy * rot_speed);
    1.55  		redisplay();
    1.56  	}
    1.57  }
    1.58 @@ -156,7 +156,7 @@
    1.59  static void draw_grid(int num, float sep)
    1.60  {
    1.61  	int hnum = num / 2;
    1.62 -	float max_dist = hnum * sep;
    1.63 +	float max_dist = (hnum - 1) * sep;
    1.64  
    1.65  	glBegin(GL_LINES);
    1.66  	glColor3f(0.4, 0.4, 0.4);