erebus

diff liberebus/src/camera.cc @ 34:d15ee526daa6

- changed the UI font, made it a bit smaller - fixed the text positioning in the status bar - added ThreadPool::clear to remove all pending jobs - fixed the TargetCamera matrix calculation to avoid singularities when the camera looks straight up or down. - fixed ommited normalization in TargetCamera's matrix calculation - added paths/sec display in the status bar
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 08 Jun 2014 08:12:05 +0300
parents e2d9bf168a41
children c4d48a21bc4a
line diff
     1.1 --- a/liberebus/src/camera.cc	Sat Jun 07 14:21:56 2014 +0300
     1.2 +++ b/liberebus/src/camera.cc	Sun Jun 08 08:12:05 2014 +0300
     1.3 @@ -108,9 +108,14 @@
     1.4  
     1.5  void TargetCamera::calc_matrix(Matrix4x4 *mat) const
     1.6  {
     1.7 -	Vector3 up(0, 1, 0);
     1.8 +	Vector3 up{0, 1, 0};
     1.9  	Vector3 dir = (target - pos).normalized();
    1.10 -	Vector3 right = cross_product(up, dir);
    1.11 +
    1.12 +	if(1.0 - fabs(dot_product(dir, up)) < 1e-4) {
    1.13 +		up = Vector3(0, 0, 1);
    1.14 +	}
    1.15 +
    1.16 +	Vector3 right = cross_product(up, dir).normalized();
    1.17  	up = cross_product(dir, right);
    1.18  
    1.19  	*mat = Matrix4x4(