vrfileman

view src/user.cc @ 4:85e26116ba5a

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 02 Feb 2015 21:11:23 +0200
parents 2cbf85690e03
children d487181ee1d9
line source
1 #include "user.h"
3 void PosRot::move(float dfwd, float dright, float dup)
4 {
5 Vector3 dir = Vector3(dright, dup, -dfwd);
6 dir.transform(rot);
7 pos += dir;
8 }
10 void PosRot::rotate(float dhoriz, float dvert)
11 {
12 rot.rotate(Vector3(1, 0, 0), dvert);
13 rot.rotate(Vector3(0, 1, 0), dhoriz);
14 }
16 void PosRot::calc_matrix(Matrix4x4 *res) const
17 {
18 Matrix4x4 rmat = rot.get_rotation_matrix();
19 Matrix4x4 tmat;
20 tmat.set_translation(pos);
22 *res = tmat * rmat;
23 }
25 void PosRot::calc_inv_matrix(Matrix4x4 *res) const
26 {
27 calc_matrix(res);
28 *res = res->inverse();
29 // TODO: optimize
30 }