31 #ifndef __H3D_OCULUSRIFTHANDLER_H__
32 #define __H3D_OCULUSRIFTHANDLER_H__
37 #include <OVR_CAPI_GL.h>
38 #include <Extras/OVR_Math.h>
67 bool initVRBuffers(
int window_width,
int window_height);
79 void onEyeRender(
int eye_index, H3D::Matrix4f &view_matrix, H3D::Matrix4f &projection_matrix );
83 void onEyeRenderFinish(
int eye_index);
91 void blitMirror(ovrEyeType num_eyes = ovrEye_Count,
int offset = 0);
97 void recenterTracking();
99 void setControllerVibration( ovrControllerType type,
float frequency,
float amplitude );
101 void showPerfStats(ovrPerfHudMode statsMode);
104 const ovrSizei getResolution()
const;
106 inline const ovrHmdDesc &getHMDDesc() {
return m_hmdDesc; }
107 inline const ovrEyeRenderDesc &getLeftEyeRenderDesc() {
return m_eyeRenderDesc[0]; }
108 inline const ovrEyeRenderDesc &getRightEyeRenderDesc() {
return m_eyeRenderDesc[1]; }
109 inline const ovrTrackingState &getTrackingState() {
return m_trackingState; }
110 inline double getFrameTiming() {
return m_frameTiming; }
111 inline const ovrInputState &getInputState() {
return m_inputState; }
115 H3D::Matrix4f getEyeMVPMatrix(
int eye_index)
const;
118 inline void setMSAA(
bool val) { m_msaaEnabled = val; }
131 OVRBuffer(
const ovrSession &session,
int eyeIdx);
133 void onRenderFinish();
136 void onRenderMSAAFinish();
137 void destroy(
const ovrSession &session);
139 ovrSizei m_eyeTextureSize;
141 GLuint m_eyeTexId = 0;
142 GLuint m_depthBuffer = 0;
144 GLuint m_msaaEyeFbo = 0;
145 GLuint m_eyeTexMSAA = 0;
146 GLuint m_depthTexMSAA = 0;
148 ovrTextureSwapChain m_swapTextureChain =
nullptr;
152 ovrSession m_hmdSession;
153 ovrHmdDesc m_hmdDesc;
154 ovrEyeRenderDesc m_eyeRenderDesc[ovrEye_Count];
155 ovrPosef m_eyeRenderPose[ovrEye_Count];
156 ovrVector3f m_hmdToEyeOffset[ovrEye_Count];
157 OVRBuffer *m_eyeBuffers[ovrEye_Count];
159 OVR::Matrix4f m_projectionMatrix[ovrEye_Count];
160 OVR::Matrix4f m_eyeOrientation[ovrEye_Count];
161 OVR::Matrix4f m_eyePose[ovrEye_Count];
165 double m_frameTiming;
166 ovrTrackingState m_trackingState;
167 ovrInputState m_inputState;
170 ovrMirrorTexture m_mirrorTexture;
171 ovrMirrorTextureDesc m_mirrorDesc;
175 long long m_frameIndex;
176 double m_sensorSampleTime;
177 bool m_isInitialized;
Header file for Sphere, X3D scene-graph node.
The OculusRiftHandler class provides support for the Oculus Rift VR device.
Definition: OculusRiftHandler.h:49
bool MSAAEnabled() const
Get current status of multi-sample anti-aliasing.
Definition: OculusRiftHandler.h:122
bool isInitialized()
Definition: OculusRiftHandler.h:57
void setMSAA(bool val)
Toggle multi-sample anti-aliasing.
Definition: OculusRiftHandler.h:118