vrfileman
diff src/user.cc @ 3:2cbf85690e03
more stuff
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 01 Feb 2015 20:56:16 +0200 |
parents | 282da6123fd4 |
children | 85e26116ba5a |
line diff
1.1 --- a/src/user.cc Sun Feb 01 12:51:10 2015 +0200 1.2 +++ b/src/user.cc Sun Feb 01 20:56:16 2015 +0200 1.3 @@ -2,16 +2,28 @@ 1.4 1.5 void PosRot::move(float dfwd, float dright, float dup) 1.6 { 1.7 + Vector3 dir = Vector3(dright, dup, dfwd); 1.8 + dir.transform(rot); 1.9 + pos += dir; 1.10 } 1.11 1.12 void PosRot::rotate(float dhoriz, float dvert) 1.13 { 1.14 + rot.rotate(Vector3(1, 0, 0), dvert); 1.15 + rot.rotate(Vector3(0, 1, 0), dhoriz); 1.16 } 1.17 1.18 void PosRot::calc_matrix(Matrix4x4 *res) const 1.19 { 1.20 + Matrix4x4 rmat = rot.get_rotation_matrix(); 1.21 + Matrix4x4 tmat; 1.22 + tmat.set_translation(pos); 1.23 + 1.24 + *res = tmat * rmat; 1.25 } 1.26 1.27 void PosRot::calc_inv_matrix(Matrix4x4 *res) const 1.28 { 1.29 + calc_matrix(res); 1.30 + *res = res->inverse(); 1.31 }