GlobeEngine
VRCommon.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_VRCommon_h
10 #define GlobeEngine_VRCommon_h
11 
12 #include "OpenGL_Includes.h"
13 #include <iostream>
14 #include <vmmlib/matrix.hpp>
15 #include <openvr.h>
16 
17 namespace geVR {
18  static vmml::Matrix4f getMat4fForHmdMat34(const vr::HmdMatrix34_t &matPose)
19  {
20  vmml::Matrix4f res = vmml::Matrix4f::IDENTITY;
21  res[0][0] = matPose.m[0][0];
22  res[1][0] = matPose.m[1][0];
23  res[2][0] = matPose.m[2][0];
24  res[3][0] = 0.0;
25  res[0][1] = matPose.m[0][1];
26  res[1][1] = matPose.m[1][1];
27  res[2][1] = matPose.m[2][1];
28  res[3][1] = 0.0;
29  res[0][2] = matPose.m[0][2];
30  res[1][2] = matPose.m[1][2];
31  res[2][2] = matPose.m[2][2];
32  res[3][2] = 0.0;
33  res[0][3] = matPose.m[0][3];
34  res[1][3] = matPose.m[1][3];
35  res[2][3] = matPose.m[2][3];
36  res[3][3] = 1.0f;
37  return res;
38  }
39 
40  static vmml::Matrix4f getMat4fForHmdMat44(const vr::HmdMatrix44_t &matPose)
41  {
42  vmml::Matrix4f res = vmml::Matrix4f::IDENTITY;
43  res[0][0] = matPose.m[0][0];
44  res[1][0] = matPose.m[1][0];
45  res[2][0] = matPose.m[2][0];
46  res[3][0] = matPose.m[3][0];
47  res[0][1] = matPose.m[0][1];
48  res[1][1] = matPose.m[1][1];
49  res[2][1] = matPose.m[2][1];
50  res[3][1] = matPose.m[3][1];
51  res[0][2] = matPose.m[0][2];
52  res[1][2] = matPose.m[1][2];
53  res[2][2] = matPose.m[2][2];
54  res[3][2] = matPose.m[3][2];
55  res[0][3] = matPose.m[0][3];
56  res[1][3] = matPose.m[1][3];
57  res[2][3] = matPose.m[2][3];
58  res[3][3] = matPose.m[3][3];
59  return res;
60  }
61 
62 }
63 #endif
Definition: VRCommon.h:17