My Project
Loading...
Searching...
No Matches
chai3d::cOculusDevice Class Reference

This class implements support for the Oculus Rift DK2. More...

#include <COculusDevice.h>

Classes

struct  OVRBuffer
 

Public Member Functions

 cOculusDevice ()
 Constructor of cOculusDevice.
 
 ~cOculusDevice ()
 Destructor of cOculusDevice.
 
bool initialize (cCamera *a_camera=NULL, bool a_useMirrorWindow=true, double a_mirrorDisplayScaleFactor=1.0)
 This method initializes the display.
 
void setCamera (cCamera *a_camera)
 This method sets a camera.
 
cCamera * getCamera ()
 This method return a pointer to the camera.
 
void setUseMirror (bool a_useMirrorWindow)
 This method enables or disables the rendering in a mirrored window.
 
bool getUseMirror ()
 This method returns true if the mirrored window is rendered, false otherwise.
 
int getResolutionWidth ()
 This method returns the resolution width of the display.
 
int getResolutionHeight ()
 This method returns the resolution height of display.
 
int getWindowWidth ()
 This method returns the mirrored window display width.
 
int getWindowHeight ()
 This method returns the mirrored window display height.
 
void setUseMSAA (bool a_useMSAA)
 This method enables or disables the use of MSAA.
 
bool getUseMSAA () const
 This method returns true if MSAA is enabled, false otherwise.
 
void render ()
 This method renders the camera scene to the Oculus display.
 
void recenterPose ()
 This method recenters the position of user in the scene.
 

Protected Member Functions

bool initVR ()
 
bool initVRBuffers (int windowWidth, int windowHeight)
 
bool initNonDistortMirror (int windowWidth, int windowHeight)
 
void destroyVR ()
 
const ovrSizei getResolution () const
 
void onRenderStart ()
 
const OVR::Matrix4f onEyeRender (int eyeIndex)
 
void onEyeRender (int eyeIndex, cTransform &a_projectionMatrix, cTransform &a_modelViewMatrix)
 
void onEyeRenderFinish (int eyeIndex)
 
const OVR::Matrix4f getEyeMVPMatrix (int eyeIdx) const
 
void submitFrame ()
 
void blitMirror (ovrEyeType numEyes=ovrEye_Count, int offset=0)
 
void onNonDistortMirrorStart ()
 
void blitNonDistortMirror (int offset)
 
void renderTrackerFrustum ()
 
bool isDebugHMD () const
 
bool isDK2 () const
 
void showPerfStats (ovrPerfHudMode statsMode)
 
ovrSizei getEyeTextureSize (int a_index)
 

Protected Attributes

cCamera * m_camera
 CHAI3D camera.
 
int m_resolutionWidth
 Width resolution of oculus display.
 
int m_resolutionHeight
 Height resolution of oculus display.
 
int m_windowWidth
 Width of mirrored display.
 
int m_windowHeight
 Height of mirrored display.
 
bool m_useMirrorWindow
 Flag which indicates if mirrored display should be rendered.
 
ovrSession m_hmdSession
 
ovrHmdDesc m_hmdDesc
 
ovrEyeRenderDesc m_eyeRenderDesc [ovrEye_Count]
 
ovrPosef m_eyeRenderPose [ovrEye_Count]
 
ovrPosef m_hmdToEyeOffset [ovrEye_Count]
 
OVRBuffer * m_eyeBuffers [ovrEye_Count]
 
OVR::Matrix4f m_projectionMatrix [ovrEye_Count]
 
OVR::Matrix4f m_eyeViewOffset [ovrEye_Count]
 
OVR::Matrix4f m_eyeOrientation [ovrEye_Count]
 
OVR::Matrix4f m_eyePose [ovrEye_Count]
 
double m_frameTiming
 
ovrTrackingState m_trackingState
 
ovrMirrorTexture m_mirrorTexture
 
ovrMirrorTextureDesc m_mirrorDesc
 
GLuint m_nonDistortTexture
 
GLuint m_nonDistortDepthBuffer
 
GLuint m_mirrorFBO
 
GLuint m_nonDistortFBO
 
int m_nonDistortViewPortWidth
 
int m_nonDistortViewPortHeight
 
bool m_useMSAA
 
long long m_frameIndex
 
double m_sensorSampleTime
 

Detailed Description

This class implements support for the Oculus Rift DK2. The implementation uses SDK 0.8.0 (beta)

Constructor & Destructor Documentation

◆ cOculusDevice()

chai3d::cOculusDevice::cOculusDevice ( )

Constructor of cOculusDevice.

◆ ~cOculusDevice()

chai3d::cOculusDevice::~cOculusDevice ( )

Destructor of cOculusDevice.

Member Function Documentation

◆ initialize()

bool chai3d::cOculusDevice::initialize ( cCamera *  a_camera = NULL,
bool  a_useMirrorWindow = true,
double  a_mirrorDisplayScaleFactor = 1.0 
)

This method initializes the oculus display.

Parameters
a_cameraCamera.
a_useMirrorWindowIf true then mirrored image is displayed, false otherwise.
a_mirrorDisplayScaleFactorScale factor of displayed mirrored image.
Returns
true if operation succeeds, false otherwise.

◆ setCamera()

void chai3d::cOculusDevice::setCamera ( cCamera *  a_camera)
inline

◆ getCamera()

cCamera * chai3d::cOculusDevice::getCamera ( )
inline

◆ setUseMirror()

void chai3d::cOculusDevice::setUseMirror ( bool  a_useMirrorWindow)
inline

◆ getUseMirror()

bool chai3d::cOculusDevice::getUseMirror ( )
inline

◆ getResolutionWidth()

int chai3d::cOculusDevice::getResolutionWidth ( )
inline

◆ getResolutionHeight()

int chai3d::cOculusDevice::getResolutionHeight ( )
inline

◆ getWindowWidth()

int chai3d::cOculusDevice::getWindowWidth ( )
inline

◆ getWindowHeight()

int chai3d::cOculusDevice::getWindowHeight ( )
inline

◆ setUseMSAA()

void chai3d::cOculusDevice::setUseMSAA ( bool  a_useMSAA)
inline

◆ getUseMSAA()

bool chai3d::cOculusDevice::getUseMSAA ( ) const
inline

◆ render()

void chai3d::cOculusDevice::render ( )

Render scene from camera.

◆ recenterPose()

void chai3d::cOculusDevice::recenterPose ( )
inline

◆ initVR()

bool chai3d::cOculusDevice::initVR ( )
protected

◆ initVRBuffers()

bool chai3d::cOculusDevice::initVRBuffers ( int  windowWidth,
int  windowHeight 
)
protected

◆ initNonDistortMirror()

bool chai3d::cOculusDevice::initNonDistortMirror ( int  windowWidth,
int  windowHeight 
)
protected

◆ destroyVR()

void chai3d::cOculusDevice::destroyVR ( )
protected

◆ getResolution()

const ovrSizei chai3d::cOculusDevice::getResolution ( ) const
protected

◆ onRenderStart()

void chai3d::cOculusDevice::onRenderStart ( )
protected

◆ onEyeRender() [1/2]

const OVR::Matrix4f chai3d::cOculusDevice::onEyeRender ( int  eyeIndex)
protected

◆ onEyeRender() [2/2]

void chai3d::cOculusDevice::onEyeRender ( int  eyeIndex,
cTransform &  a_projectionMatrix,
cTransform &  a_modelViewMatrix 
)
protected

◆ onEyeRenderFinish()

void chai3d::cOculusDevice::onEyeRenderFinish ( int  eyeIndex)
protected

◆ getEyeMVPMatrix()

const OVR::Matrix4f chai3d::cOculusDevice::getEyeMVPMatrix ( int  eyeIdx) const
protected

◆ submitFrame()

void chai3d::cOculusDevice::submitFrame ( )
protected

◆ blitMirror()

void chai3d::cOculusDevice::blitMirror ( ovrEyeType  numEyes = ovrEye_Count,
int  offset = 0 
)
protected

◆ onNonDistortMirrorStart()

void chai3d::cOculusDevice::onNonDistortMirrorStart ( )
protected

◆ blitNonDistortMirror()

void chai3d::cOculusDevice::blitNonDistortMirror ( int  offset)
protected

◆ renderTrackerFrustum()

void chai3d::cOculusDevice::renderTrackerFrustum ( )
protected

◆ isDebugHMD()

bool chai3d::cOculusDevice::isDebugHMD ( ) const
inlineprotected

◆ isDK2()

bool chai3d::cOculusDevice::isDK2 ( ) const
inlineprotected

◆ showPerfStats()

void chai3d::cOculusDevice::showPerfStats ( ovrPerfHudMode  statsMode)
protected

◆ getEyeTextureSize()

ovrSizei chai3d::cOculusDevice::getEyeTextureSize ( int  a_index)
inlineprotected

Member Data Documentation

◆ m_camera

cCamera* chai3d::cOculusDevice::m_camera
protected

◆ m_resolutionWidth

int chai3d::cOculusDevice::m_resolutionWidth
protected

◆ m_resolutionHeight

int chai3d::cOculusDevice::m_resolutionHeight
protected

◆ m_windowWidth

int chai3d::cOculusDevice::m_windowWidth
protected

◆ m_windowHeight

int chai3d::cOculusDevice::m_windowHeight
protected

◆ m_useMirrorWindow

bool chai3d::cOculusDevice::m_useMirrorWindow
protected

◆ m_hmdSession

ovrSession chai3d::cOculusDevice::m_hmdSession
protected

◆ m_hmdDesc

ovrHmdDesc chai3d::cOculusDevice::m_hmdDesc
protected

◆ m_eyeRenderDesc

ovrEyeRenderDesc chai3d::cOculusDevice::m_eyeRenderDesc[ovrEye_Count]
protected

◆ m_eyeRenderPose

ovrPosef chai3d::cOculusDevice::m_eyeRenderPose[ovrEye_Count]
protected

◆ m_hmdToEyeOffset

ovrPosef chai3d::cOculusDevice::m_hmdToEyeOffset[ovrEye_Count]
protected

◆ m_eyeBuffers

OVRBuffer* chai3d::cOculusDevice::m_eyeBuffers[ovrEye_Count]
protected

◆ m_projectionMatrix

OVR::Matrix4f chai3d::cOculusDevice::m_projectionMatrix[ovrEye_Count]
protected

◆ m_eyeViewOffset

OVR::Matrix4f chai3d::cOculusDevice::m_eyeViewOffset[ovrEye_Count]
protected

◆ m_eyeOrientation

OVR::Matrix4f chai3d::cOculusDevice::m_eyeOrientation[ovrEye_Count]
protected

◆ m_eyePose

OVR::Matrix4f chai3d::cOculusDevice::m_eyePose[ovrEye_Count]
protected

◆ m_frameTiming

double chai3d::cOculusDevice::m_frameTiming
protected

◆ m_trackingState

ovrTrackingState chai3d::cOculusDevice::m_trackingState
protected

◆ m_mirrorTexture

ovrMirrorTexture chai3d::cOculusDevice::m_mirrorTexture
protected

◆ m_mirrorDesc

ovrMirrorTextureDesc chai3d::cOculusDevice::m_mirrorDesc
protected

◆ m_nonDistortTexture

GLuint chai3d::cOculusDevice::m_nonDistortTexture
protected

◆ m_nonDistortDepthBuffer

GLuint chai3d::cOculusDevice::m_nonDistortDepthBuffer
protected

◆ m_mirrorFBO

GLuint chai3d::cOculusDevice::m_mirrorFBO
protected

◆ m_nonDistortFBO

GLuint chai3d::cOculusDevice::m_nonDistortFBO
protected

◆ m_nonDistortViewPortWidth

int chai3d::cOculusDevice::m_nonDistortViewPortWidth
protected

◆ m_nonDistortViewPortHeight

int chai3d::cOculusDevice::m_nonDistortViewPortHeight
protected

◆ m_useMSAA

bool chai3d::cOculusDevice::m_useMSAA
protected

◆ m_frameIndex

long long chai3d::cOculusDevice::m_frameIndex
protected

◆ m_sensorSampleTime

double chai3d::cOculusDevice::m_sensorSampleTime
protected

The documentation for this class was generated from the following files: