vrfileman

view 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 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 }