oculus1
diff src/camera.cc @ 11:39ec672a5158
added simple head model to the VR camera
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 20 Sep 2013 07:00:18 +0300 |
parents | b2abb08c8f94 |
children |
line diff
1.1 --- a/src/camera.cc Fri Sep 20 06:49:39 2013 +0300 1.2 +++ b/src/camera.cc Fri Sep 20 07:00:18 2013 +0300 1.3 @@ -195,6 +195,30 @@ 1.4 1.5 1.6 // --- VR additions --- 1.7 +VRFpsCamera::VRFpsCamera() 1.8 +{ 1.9 + neck_eye_dist = 0.14; // default neck->eye distance 14cm 1.10 +} 1.11 + 1.12 +void VRFpsCamera::calc_matrix(Matrix4x4 *mat) const 1.13 +{ 1.14 + mat->reset_identity(); 1.15 + mat->translate(Vector3(pos.x, pos.y, pos.z)); 1.16 + mat->rotate(Vector3(0, theta, 0)); 1.17 + mat->rotate(Vector3(phi, 0, 0)); 1.18 + mat->rotate(Vector3(0, 0, roll)); 1.19 + mat->translate(Vector3(0, neck_eye_dist, 0)); 1.20 +} 1.21 + 1.22 +void VRFpsCamera::calc_inv_matrix(Matrix4x4 *mat) const 1.23 +{ 1.24 + mat->reset_identity(); 1.25 + mat->translate(Vector3(0, -neck_eye_dist, 0)); 1.26 + mat->rotate(Vector3(0, 0, roll)); 1.27 + mat->rotate(Vector3(phi, 0, 0)); 1.28 + mat->rotate(Vector3(0, theta, 0)); 1.29 + mat->translate(Vector3(-pos.x, -pos.y, -pos.z)); 1.30 +} 1.31 1.32 void VRFpsCamera::track_vr() 1.33 {