rayzor

diff src/vmath.cc @ 17:79609d482762

the renderer renders, also fixed an unnoticed matrix conversion problem between scenegraph and min3d
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 14 Apr 2014 07:34:45 +0300
parents d94a69933a71
children
line diff
     1.1 --- a/src/vmath.cc	Sun Apr 13 09:54:51 2014 +0300
     1.2 +++ b/src/vmath.cc	Mon Apr 14 07:34:45 2014 +0300
     1.3 @@ -8,13 +8,17 @@
     1.4  	Vector3 vi = normalize(cross(vk, vj));
     1.5  	vj = cross(vi, vk);
     1.6  
     1.7 -	Matrix4x4 m(
     1.8 +	Matrix4x4 rm(
     1.9  			vi.x, vi.y, vi.z, 0,
    1.10  			vj.x, vj.y, vj.z, 0,
    1.11  			-vk.x, -vk.y, -vk.z, 0,
    1.12  			0, 0, 0, 1);
    1.13 -	translate(-pos.x, -pos.y, -pos.z);
    1.14 -	*this = *this * m;
    1.15 +	Matrix4x4 tm(
    1.16 +			1, 0, 0, -pos.x,
    1.17 +			0, 1, 0, -pos.y,
    1.18 +			0, 0, 1, -pos.z,
    1.19 +			0, 0, 0, 1);
    1.20 +	*this = *this * (rm * tm);
    1.21  }
    1.22  
    1.23  void Matrix4x4::transpose()