Torque3D Documentation / _generateds / oculusVRDevice.cpp

oculusVRDevice.cpp

Engine/source/platform/input/oculusVR/oculusVRDevice.cpp

More...

Public Functions

DefineEngineFunction(getOVRHMDCount , S32 , () , "@brief Get the number of HMD devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n\n</a>" "@return The number of Oculus VR HMD devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRHMDCurrentIPD , F32 , (S32 index) , "@brief Physical distance between the user's eye <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">centers.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">IPD.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRHMDDisplayDeviceId , S32 , (S32 index) , "@brief MacOS display <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ID.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The ID of the HMD display device, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">any.\n</a>" " @ingroup Game" )
DefineEngineFunction(getOVRHMDDisplayDeviceType , const char * , (S32 index) , "@brief Windows display device name used in EnumDisplaySettings/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CreateDC.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The name of the HMD display device, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">any.\n</a>" " @ingroup Game" )
DefineEngineFunction(getOVRHMDManufacturer , const char * , (S32 index) , "@brief Retrieves the HMD manufacturer <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The manufacturer of the HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">product.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRHMDProductName , const char * , (S32 index) , "@brief Retrieves the HMD product <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The name of the HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">product.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRHMDProfileIPD , F32 , (S32 index) , "@brief Physical distance between the user's eye centers as defined by the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">profile.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The profile <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">IPD.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRHMDResolution , Point2I , (S32 index) , "@brief Provides the OVR HMD screen <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resolution.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return A two component string with the screen's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resolution.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRHMDVersion , S32 , (S32 index) , "@brief Retrieves the HMD version <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">number.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The version number of the HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">product.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRSensorAcceleration , Point3F , (S32 index) , "@brief Get the acceleration values <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The acceleration values of the Oculus VR sensor, in m/s^2.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @ingroup Game" )
DefineEngineFunction(getOVRSensorAngVelocity , Point3F , (S32 index) , "@brief Get the angular velocity values <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The angular velocity values of the Oculus VR sensor, in degrees/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">s.\n</a>" " @ingroup Game" )
DefineEngineFunction(getOVRSensorCount , S32 , () , "@brief Get the number of sensor devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n\n</a>" "@return The number of Oculus VR sensor devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRSensorEulerRotation , Point3F , (S32 index) , "@brief Get the Euler rotation values <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The Euler rotation values of the Oculus VR sensor, in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">degrees.\n</a>" " @ingroup Game" )
DefineEngineFunction(getOVRSensorMagnetometerCalibrated , bool , (S32 index) , "@brief Get the magnetometer calibrated data state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> magnetometer calibration data is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">available.\n</a>" "@ingroup Game" )
DefineEngineFunction(getOVRSensorYawCorrection , bool , (S32 index) , "@brief Get the yaw correction state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> yaw correction (using magnetometer calibration data) is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n</a>" "@ingroup Game" )
DefineEngineFunction(isOculusVRDeviceActive , bool , () , "@brief Used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> determine <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Oculus VR input device is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active\n\n</a>" "The Oculus VR device is considered active when the library has been " "initialized and either <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> real of simulated HMD is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">present.\n\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Oculus VR input device is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n</a>" "@ingroup Game" )
DefineEngineFunction(ovrDismissWarnings , void , () , "@brief dismisses <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">warnings.\n\n</a>" "@ingroup Game" )
DefineEngineFunction(ovrDumpMetrics , String , (S32 idx) , (0) , "@brief dumps sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">metrics.\n\n</a>" "@ingroup Game" )
DefineEngineFunction(ovrIsDisplayingWarning , bool , () , "@brief returns is warning is being <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">displayed.\n\n</a>" "@ingroup Game" )
DefineEngineFunction(ovrResetAllSensors , void , () , "@brief Resets all Oculus VR <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sensors.\n\n</a>" "This resets all sensor orientations such that their 'normal' rotation " "is defined when this function is called. This defines an HMD's forwards " "and up direction, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example." " @ingroup Game" )
DefineEngineFunction(setOptimalOVRCanvasSize , bool , (GuiCanvas *canvas) , "@brief Sets the first HMD <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classgameconnection/">GameConnection</a>'s display <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device\n\n</a>" "@param conn The <a href="/coding/class/classgameconnection/">GameConnection</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/class/classgameconnection/">GameConnection</a> display device was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@ingroup Game" )
DefineEngineFunction(setOVRHMDAsGameConnectionDisplayDevice , bool , (GameConnection *conn) , "@brief Sets the first HMD <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classgameconnection/">GameConnection</a>'s display <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device\n\n</a>" "@param conn The <a href="/coding/class/classgameconnection/">GameConnection</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/class/classgameconnection/">GameConnection</a> display device was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@ingroup Game" )
DefineEngineFunction(setOVRHMDCurrentIPD , void , (S32 index, F32 ipd) , "@brief Set the physical distance between the user's eye <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">centers.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@param ipd The IPD <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@ingroup Game" )
DefineEngineFunction(setOVRSensorYawCorrection , void , (S32 index, bool state) , "@brief Set the yaw correction state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@param state The yaw correction state <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> change <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@note Yaw correction cannot be enabled <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the user has disabled it through " "the Oculus VR <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">panel.\n</a>" "@ingroup Game" )

Detailed Description

Public Variables

 MODULE_END 
 MODULE_INIT 
 MODULE_SHUTDOWN 
bool sOcculusEnabled 

Public Functions

DefineEngineFunction(getOVRHMDCount , S32 , () , "@brief Get the number of HMD devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n\n</a>" "@return The number of Oculus VR HMD devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRHMDCurrentIPD , F32 , (S32 index) , "@brief Physical distance between the user's eye <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">centers.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">IPD.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRHMDDisplayDeviceId , S32 , (S32 index) , "@brief MacOS display <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">ID.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The ID of the HMD display device, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">any.\n</a>" " @ingroup Game" )

DefineEngineFunction(getOVRHMDDisplayDeviceType , const char * , (S32 index) , "@brief Windows display device name used in EnumDisplaySettings/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CreateDC.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The name of the HMD display device, <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">any.\n</a>" " @ingroup Game" )

DefineEngineFunction(getOVRHMDManufacturer , const char * , (S32 index) , "@brief Retrieves the HMD manufacturer <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The manufacturer of the HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">product.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRHMDProductName , const char * , (S32 index) , "@brief Retrieves the HMD product <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">name.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The name of the HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">product.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRHMDProfileIPD , F32 , (S32 index) , "@brief Physical distance between the user's eye centers as defined by the current <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">profile.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The profile <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">IPD.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRHMDResolution , Point2I , (S32 index) , "@brief Provides the OVR HMD screen <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resolution.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return A two component string with the screen's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resolution.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRHMDVersion , S32 , (S32 index) , "@brief Retrieves the HMD version <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">number.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The version number of the HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">product.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRSensorAcceleration , Point3F , (S32 index) , "@brief Get the acceleration values <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The acceleration values of the Oculus VR sensor, in m/s^2.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @ingroup Game" )

DefineEngineFunction(getOVRSensorAngVelocity , Point3F , (S32 index) , "@brief Get the angular velocity values <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The angular velocity values of the Oculus VR sensor, in degrees/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">s.\n</a>" " @ingroup Game" )

DefineEngineFunction(getOVRSensorCount , S32 , () , "@brief Get the number of sensor devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n\n</a>" "@return The number of Oculus VR sensor devices that are currently <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">connected.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRSensorEulerRotation , Point3F , (S32 index) , "@brief Get the Euler rotation values <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return The Euler rotation values of the Oculus VR sensor, in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">degrees.\n</a>" " @ingroup Game" )

DefineEngineFunction(getOVRSensorMagnetometerCalibrated , bool , (S32 index) , "@brief Get the magnetometer calibrated data state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> magnetometer calibration data is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">available.\n</a>" "@ingroup Game" )

DefineEngineFunction(getOVRSensorYawCorrection , bool , (S32 index) , "@brief Get the yaw correction state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> yaw correction (using magnetometer calibration data) is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n</a>" "@ingroup Game" )

DefineEngineFunction(isOculusVRDeviceActive , bool , () , "@brief Used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> determine <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Oculus VR input device is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active\n\n</a>" "The Oculus VR device is considered active when the library has been " "initialized and either <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> real of simulated HMD is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">present.\n\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the Oculus VR input device is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n</a>" "@ingroup Game" )

DefineEngineFunction(ovrDismissWarnings , void , () , "@brief dismisses <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">warnings.\n\n</a>" "@ingroup Game" )

DefineEngineFunction(ovrDumpMetrics , String , (S32 idx) , (0) , "@brief dumps sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">metrics.\n\n</a>" "@ingroup Game" )

DefineEngineFunction(ovrIsDisplayingWarning , bool , () , "@brief returns is warning is being <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">displayed.\n\n</a>" "@ingroup Game" )

DefineEngineFunction(ovrResetAllSensors , void , () , "@brief Resets all Oculus VR <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sensors.\n\n</a>" "This resets all sensor orientations such that their 'normal' rotation " "is defined when this function is called. This defines an HMD's forwards " "and up direction, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> example." " @ingroup Game" )

DefineEngineFunction(setOptimalOVRCanvasSize , bool , (GuiCanvas *canvas) , "@brief Sets the first HMD <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classgameconnection/">GameConnection</a>'s display <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device\n\n</a>" "@param conn The <a href="/coding/class/classgameconnection/">GameConnection</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/class/classgameconnection/">GameConnection</a> display device was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@ingroup Game" )

DefineEngineFunction(setOVRHMDAsGameConnectionDisplayDevice , bool , (GameConnection *conn) , "@brief Sets the first HMD <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classgameconnection/">GameConnection</a>'s display <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device\n\n</a>" "@param conn The <a href="/coding/class/classgameconnection/">GameConnection</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the <a href="/coding/class/classgameconnection/">GameConnection</a> display device was <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">set.\n</a>" "@ingroup Game" )

DefineEngineFunction(setOVRHMDCurrentIPD , void , (S32 index, F32 ipd) , "@brief Set the physical distance between the user's eye <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">centers.\n\n</a>" "@param index The HMD <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@param ipd The IPD <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@ingroup Game" )

DefineEngineFunction(setOVRSensorYawCorrection , void , (S32 index, bool state) , "@brief Set the yaw correction state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n\n</a>" "@param index The sensor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">index.\n</a>" "@param state The yaw correction state <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> change <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "@note Yaw correction cannot be enabled <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the user has disabled it through " "the Oculus VR <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">panel.\n</a>" "@ingroup Game" )

if(OculusVRDevice::smEnableDevice )

registerDevice(OCULUSVRDEV )

   1
   2//-----------------------------------------------------------------------------
   3// Copyright (c) 2012 GarageGames, LLC
   4//
   5// Permission is hereby granted, free of charge, to any person obtaining a copy
   6// of this software and associated documentation files (the "Software"), to
   7// deal in the Software without restriction, including without limitation the
   8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   9// sell copies of the Software, and to permit persons to whom the Software is
  10// furnished to do so, subject to the following conditions:
  11//
  12// The above copyright notice and this permission notice shall be included in
  13// all copies or substantial portions of the Software.
  14//
  15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21// IN THE SOFTWARE.
  22//-----------------------------------------------------------------------------
  23
  24#include "platform/input/oculusVR/oculusVRDevice.h"
  25#include "platform/input/oculusVR/oculusVRSensorDevice.h"
  26#include "platform/platformInput.h"
  27#include "core/module.h"
  28#include "console/engineAPI.h"
  29#include "T3D/gameBase/gameConnection.h"
  30#include "gui/core/guiCanvas.h"
  31
  32bool sOcculusEnabled = false;
  33
  34MODULE_BEGIN( OculusVRDevice )
  35
  36   MODULE_INIT_AFTER( InputEventManager )
  37   MODULE_SHUTDOWN_BEFORE( InputEventManager )
  38
  39   MODULE_INIT
  40   {
  41      sOcculusEnabled = true; // TODO: init the dll
  42      OculusVRDevice::staticInit();
  43      ManagedSingleton< OculusVRDevice >::createSingleton();
  44      if(OculusVRDevice::smEnableDevice)
  45      {
  46         OCULUSVRDEV->enable();
  47      }
  48
  49      // Register the device with the Input Event Manager
  50      INPUTMGR->registerDevice(OCULUSVRDEV);
  51   }
  52   
  53   MODULE_SHUTDOWN
  54   {
  55      INPUTMGR->unregisterDevice(OCULUSVRDEV);
  56      ManagedSingleton< OculusVRDevice >::deleteSingleton();
  57      sOcculusEnabled = false;
  58   }
  59
  60MODULE_END;
  61
  62//-----------------------------------------------------------------------------
  63// OculusVRDevice
  64//-----------------------------------------------------------------------------
  65
  66bool OculusVRDevice::smEnableDevice = false;
  67
  68bool OculusVRDevice::smSimulateHMD = true;
  69
  70bool OculusVRDevice::smGenerateAngleAxisRotationEvents = true;
  71bool OculusVRDevice::smGenerateEulerRotationEvents = false;
  72bool OculusVRDevice::smGeneratePositionEvents = true;
  73
  74bool OculusVRDevice::smGenerateRotationAsAxisEvents = false;
  75F32 OculusVRDevice::smMaximumAxisAngle = 25.0f;
  76
  77bool OculusVRDevice::smGenerateSensorRawEvents = false;
  78
  79bool OculusVRDevice::smGenerateWholeFrameEvents = false;
  80
  81F32 OculusVRDevice::smDesiredPixelDensity = 1.0f;
  82
  83bool OculusVRDevice::smWindowDebug = false;
  84
  85F32 OculusVRDevice::smPositionTrackingScale = 1.0f;
  86
  87OculusVRDevice::OculusVRDevice()
  88{
  89   // From IInputDevice
  90   dStrcpy(mName, "oculusvr", 30);
  91   mDeviceType = INPUTMGR->getNextDeviceType();
  92
  93   //
  94   mEnabled = false;
  95   mActive = false;
  96   mActiveDeviceId = 0;
  97
  98   buildCodeTable();
  99   GFXDevice::getDeviceEventSignal().notify( this, &OculusVRDevice::_handleDeviceEvent );
 100}
 101
 102OculusVRDevice::~OculusVRDevice()
 103{
 104   GFXDevice::getDeviceEventSignal().remove( this, &OculusVRDevice::_handleDeviceEvent );
 105   cleanUp();
 106}
 107
 108void OculusVRDevice::staticInit()
 109{
 110   Con::addVariable("pref::OculusVR::EnableDevice", TypeBool, &smEnableDevice, 
 111      "@brief If true, the Oculus VR device will be enabled, if present.\n\n"
 112      "@ingroup Game");
 113
 114   Con::addVariable("OculusVR::GenerateAngleAxisRotationEvents", TypeBool, &smGenerateAngleAxisRotationEvents, 
 115      "@brief If true, broadcast sensor rotation events as angled axis.\n\n"
 116      "@ingroup Game");
 117   Con::addVariable("OculusVR::GenerateEulerRotationEvents", TypeBool, &smGenerateEulerRotationEvents, 
 118      "@brief If true, broadcast sensor rotation events as Euler angles about the X, Y and Z axis.\n\n"
 119      "@ingroup Game");
 120   Con::addVariable("OculusVR::GeneratePositionEvents", TypeBool, &smGeneratePositionEvents, 
 121      "@brief If true, broadcast sensor rotation events as Euler angles about the X, Y and Z axis.\n\n"
 122      "@ingroup Game");
 123
 124   Con::addVariable("OculusVR::GenerateRotationAsAxisEvents", TypeBool, &smGenerateRotationAsAxisEvents, 
 125      "@brief If true, broadcast sensor rotation as axis events.\n\n"
 126      "@ingroup Game");
 127   Con::addVariable("OculusVR::MaximumAxisAngle", TypeF32, &smMaximumAxisAngle, 
 128      "@brief The maximum sensor angle when used as an axis event as measured from a vector pointing straight up (in degrees).\n\n"
 129      "Should range from 0 to 90 degrees.\n\n"
 130      "@ingroup Game");
 131
 132   Con::addVariable("OculusVR::GenerateSensorRawEvents", TypeBool, &smGenerateSensorRawEvents, 
 133      "@brief If ture, broadcast sensor raw data: acceleration, angular velocity, magnetometer reading.\n\n"
 134      "@ingroup Game");
 135
 136   Con::addVariable("OculusVR::GenerateWholeFrameEvents", TypeBool, &smGenerateWholeFrameEvents, 
 137      "@brief Indicates that a whole frame event should be generated and frames should be buffered.\n\n"
 138      "@ingroup Game");
 139
 140   Con::addVariable("OculusVR::desiredPixelDensity", TypeF32, &smDesiredPixelDensity,
 141      "@brief Specifies the desired pixel density of the render target. \n\n"
 142      "@ingroup Game");
 143
 144   Con::addVariable("OculusVR::windowDebug", TypeBool, &smWindowDebug, 
 145      "@brief Specifies if the window should stay on the main display for debugging. \n\n"
 146      "@ingroup Game");
 147}
 148
 149void OculusVRDevice::cleanUp()
 150{
 151   disable();
 152}
 153
 154void OculusVRDevice::buildCodeTable()
 155{
 156   // Build the sensor device code table
 157   OculusVRSensorDevice::buildCodeTable();
 158}
 159
 160void OculusVRDevice::addHMDDevice(ovrHmd hmd, ovrGraphicsLuid luid)
 161{
 162   if(!hmd)
 163      return;
 164
 165   OculusVRHMDDevice* hmdd = new OculusVRHMDDevice();
 166   hmdd->set(hmd, luid, mHMDDevices.size());
 167   mHMDDevices.push_back(hmdd);
 168
 169   ovrHmdDesc desc = ovr_GetHmdDesc(hmd);
 170   Con::printf("   HMD found: %s by %s [v%d]", desc.ProductName, desc.Manufacturer, desc.Type);
 171}
 172
 173void OculusVRDevice::createSimulatedHMD()
 174{/* TOFIX
 175   OculusVRHMDDevice* hmdd = new OculusVRHMDDevice();
 176   ovrHmd hmd = ovr_CreateDebug(ovrHmd_DK2);
 177   hmdd->set(hmd,mHMDDevices.size());
 178   mHMDDevices.push_back(hmdd);
 179
 180   Con::printf("   HMD simulated: %s by %s [v%d]", hmdd->getProductName(), hmdd->getManufacturer(), hmdd->getVersion()); */
 181}
 182
 183bool OculusVRDevice::enable()
 184{
 185   // Start off with disabling the device if it is already enabled
 186   disable();
 187
 188   Con::printf("Oculus VR Device Init:");
 189
 190   if(sOcculusEnabled && OVR_SUCCESS(ovr_Initialize(0)))
 191   {
 192      mEnabled = true;
 193
 194      // Enumerate HMDs and pick the first one
 195      ovrHmd hmd;
 196      ovrGraphicsLuid luid;
 197      if(OVR_SUCCESS(ovr_Create(&hmd, &luid)))
 198      {
 199         // Add the HMD to our list
 200         addHMDDevice(hmd, luid);
 201
 202         setActive(true);
 203      }
 204      else
 205      {
 206         if(smSimulateHMD)
 207         {
 208            Con::printf("   Could not enumerate a HMD device.  Simulating a HMD.");
 209            createSimulatedHMD();
 210            setActive(true);
 211         }
 212         else
 213         {
 214            Con::printf("   Could not enumerate a HMD device.");
 215         }
 216      }
 217
 218   }
 219   else
 220   {
 221         if(smSimulateHMD)
 222         {
 223            Con::printf("   Could not enumerate a HMD device.  Simulating a HMD.");
 224            createSimulatedHMD();
 225            setActive(true);
 226         }
 227         else
 228         {
 229            Con::printf("   Could not enumerate a HMD device.");
 230         }
 231   }
 232
 233   Con::printf("   ");
 234
 235   return false;
 236}
 237
 238void OculusVRDevice::disable()
 239{
 240   for(U32 i=0; i<mHMDDevices.size(); ++i)
 241   {
 242      delete mHMDDevices[i];
 243   }
 244   mHMDDevices.clear();
 245
 246   if(mEnabled)
 247   {
 248      ovr_Shutdown();
 249   }
 250
 251   setActive(false);
 252   mEnabled = false;
 253}
 254
 255bool OculusVRDevice::process()
 256{
 257   if(!mEnabled)
 258      return false;
 259
 260   if(!getActive())
 261      return false;
 262
 263   //Build the maximum axis angle to be passed into the sensor process()
 264   F32 maxAxisRadius = mSin(mDegToRad(smMaximumAxisAngle));
 265
 266   // Process each sensor
 267   for(U32 i=0; i<mHMDDevices.size(); ++i)
 268   {
 269      mHMDDevices[i]->getSensorDevice()->process(mDeviceType, smGenerateAngleAxisRotationEvents, smGenerateEulerRotationEvents, smGenerateRotationAsAxisEvents, smGeneratePositionEvents, maxAxisRadius, smGenerateSensorRawEvents);
 270   }
 271
 272   return true;
 273}
 274
 275//-----------------------------------------------------------------------------
 276
 277bool OculusVRDevice::providesFrameEyePose() const
 278{
 279   if(!mHMDDevices.size())
 280      return false;
 281
 282   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 283   if(!hmd)
 284      return false;
 285
 286   return true;
 287}
 288
 289void OculusVRDevice::getFrameEyePose(DisplayPose *outPose, U32 eyeId) const
 290{
 291   if(!mHMDDevices.size())
 292      return;
 293
 294   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 295   if(!hmd)
 296      return;
 297
 298   hmd->getFrameEyePose(outPose, eyeId);
 299}
 300
 301
 302bool OculusVRDevice::providesEyeOffsets() const
 303{
 304   if(!mHMDDevices.size())
 305      return false;
 306
 307   return true;
 308}
 309
 310void OculusVRDevice::getEyeOffsets(Point3F *dest) const
 311{
 312   if(!mHMDDevices.size())
 313      return;
 314
 315   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 316   if(!hmd)
 317      return;
 318
 319   hmd->getEyeOffsets(dest);
 320}
 321
 322
 323void OculusVRDevice::getFovPorts(FovPort *out) const
 324{
 325   if(!mHMDDevices.size())
 326      return;
 327
 328   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 329   if(!hmd)
 330      return;
 331
 332   return hmd->getFovPorts(out);
 333}
 334
 335bool OculusVRDevice::providesProjectionOffset() const
 336{
 337   if(!mHMDDevices.size())
 338      return false;
 339
 340   return false;
 341}
 342
 343const Point2F& OculusVRDevice::getProjectionOffset() const
 344{
 345   if(!mHMDDevices.size())
 346      return Point2F::Zero;
 347
 348   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 349   if(!hmd)
 350      return Point2F::Zero;
 351
 352   return hmd->getProjectionCenterOffset();
 353}
 354
 355void OculusVRDevice::getStereoViewports(RectI *out) const
 356{
 357   if(!mHMDDevices.size())
 358      return;
 359
 360   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 361   if(!hmd)
 362      return;
 363
 364   hmd->getStereoViewports(out);
 365}
 366
 367void OculusVRDevice::getStereoTargets(GFXTextureTarget **out) const
 368{
 369   if(!mHMDDevices.size())
 370      return;
 371
 372   const OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 373   if(!hmd)
 374      return;
 375
 376   hmd->getStereoTargets(out);
 377}
 378
 379void OculusVRDevice::onStartFrame()
 380{
 381   _handleDeviceEvent(GFXDevice::deStartOfFrame);
 382}
 383
 384//-----------------------------------------------------------------------------
 385
 386OculusVRHMDDevice* OculusVRDevice::getHMDDevice(U32 index) const
 387{
 388   if(index >= mHMDDevices.size())
 389      return NULL;
 390
 391   return mHMDDevices[index];
 392}
 393
 394F32 OculusVRDevice::getHMDCurrentIPD(U32 index)
 395{
 396   if(index >= mHMDDevices.size())
 397      return -1.0f;
 398
 399   return mHMDDevices[index]->getIPD();
 400}
 401
 402void OculusVRDevice::setHMDCurrentIPD(U32 index, F32 ipd)
 403{
 404   if(index >= mHMDDevices.size())
 405      return;
 406
 407   return mHMDDevices[index]->setIPD(ipd);
 408}
 409
 410void OculusVRDevice::setOptimalDisplaySize(U32 index, GuiCanvas *canvas)
 411{
 412   if(index >= mHMDDevices.size())
 413      return;
 414
 415   mHMDDevices[index]->setOptimalDisplaySize(canvas);
 416}
 417
 418
 419//-----------------------------------------------------------------------------
 420
 421const OculusVRSensorDevice* OculusVRDevice::getSensorDevice(U32 index) const
 422{
 423   if(index >= mHMDDevices.size())
 424      return NULL;
 425
 426   return mHMDDevices[index]->getSensorDevice();
 427}
 428
 429EulerF OculusVRDevice::getSensorEulerRotation(U32 index)
 430{
 431   if(index >= mHMDDevices.size())
 432      return Point3F::Zero;
 433
 434   return mHMDDevices[index]->getSensorDevice()->getEulerRotation();
 435}
 436
 437VectorF OculusVRDevice::getSensorAcceleration(U32 index)
 438{
 439   if(index >= mHMDDevices.size())
 440      return Point3F::Zero;
 441
 442   return mHMDDevices[index]->getSensorDevice()->getAcceleration();
 443}
 444
 445EulerF OculusVRDevice::getSensorAngularVelocity(U32 index)
 446{
 447   if(index >= mHMDDevices.size())
 448      return Point3F::Zero;
 449
 450   return mHMDDevices[index]->getSensorDevice()->getAngularVelocity();
 451}
 452
 453bool OculusVRDevice::getSensorYawCorrection(U32 index)
 454{
 455   const OculusVRSensorDevice* sensor = getSensorDevice(index);
 456   if(!sensor || !sensor->isValid())
 457      return false;
 458
 459   return sensor->getYawCorrection();
 460}
 461
 462void OculusVRDevice::setSensorYawCorrection(U32 index, bool state)
 463{
 464   if(index >= mHMDDevices.size())
 465      return;
 466
 467   OculusVRSensorDevice* sensor = mHMDDevices[index]->getSensorDevice();
 468   if(!sensor->isValid())
 469      return;
 470
 471   sensor->setYawCorrection(state);
 472}
 473
 474bool OculusVRDevice::getSensorMagnetometerCalibrated(U32 index)
 475{
 476   const OculusVRSensorDevice* sensor = getSensorDevice(index);
 477   if(!sensor || !sensor->isValid())
 478      return false;
 479
 480   return sensor->getMagnetometerCalibrationAvailable();
 481}
 482
 483void OculusVRDevice::resetAllSensors()
 484{
 485   // Reset each sensor
 486   for(U32 i=0; i<mHMDDevices.size(); ++i)
 487   {
 488      mHMDDevices[i]->getSensorDevice()->reset();
 489   }
 490}
 491
 492bool OculusVRDevice::isDiplayingWarning()
 493{
 494   for(U32 i=0; i<mHMDDevices.size(); ++i)
 495   {
 496      if (mHMDDevices[i]->isDisplayingWarning())
 497         return true;
 498   }
 499
 500   return false;
 501}
 502
 503void OculusVRDevice::dismissWarning()
 504{
 505   for(U32 i=0; i<mHMDDevices.size(); ++i)
 506   {
 507      mHMDDevices[i]->dismissWarning();
 508   }
 509}
 510
 511String OculusVRDevice::dumpMetrics(U32 idx)
 512{
 513   return mHMDDevices[idx]->dumpMetrics();
 514}
 515
 516void OculusVRDevice::setDrawCanvas(GuiCanvas *canvas)
 517{
 518   if(!mHMDDevices.size())
 519      return;
 520
 521   OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 522   if(!hmd)
 523      return;
 524
 525   hmd->setDrawCanvas(canvas);
 526}
 527
 528
 529void OculusVRDevice::setCurrentConnection(GameConnection *connection)
 530{
 531   if(!mHMDDevices.size())
 532      return;
 533
 534   OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 535   if(!hmd)
 536      return;
 537
 538   hmd->setCurrentConnection(connection);
 539}
 540
 541GameConnection* OculusVRDevice::getCurrentConnection()
 542{
 543   if(!mHMDDevices.size())
 544      return NULL;
 545
 546   OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 547   if(!hmd)
 548      return NULL;
 549
 550   return hmd->getCurrentConnection();
 551}
 552
 553//-----------------------------------------------------------------------------
 554
 555GFXTexHandle OculusVRDevice::getPreviewTexture()
 556{
 557   if (!mHMDDevices.size())
 558      return NULL;
 559
 560   OculusVRHMDDevice* hmd = getHMDDevice(mActiveDeviceId);
 561   if (!hmd)
 562      return NULL;
 563
 564   return hmd->getPreviewTexture();
 565}
 566
 567//-----------------------------------------------------------------------------
 568
 569DefineEngineFunction(isOculusVRDeviceActive, bool, (),,
 570   "@brief Used to determine if the Oculus VR input device is active\n\n"
 571
 572   "The Oculus VR device is considered active when the library has been "
 573   "initialized and either a real of simulated HMD is present.\n\n"
 574
 575   "@return True if the Oculus VR input device is active.\n"
 576
 577   "@ingroup Game")
 578{
 579   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 580   {
 581      return false;
 582   }
 583
 584   return OCULUSVRDEV->getActive();
 585}
 586
 587//-----------------------------------------------------------------------------
 588
 589DefineEngineFunction(setOVRHMDAsGameConnectionDisplayDevice, bool, (GameConnection* conn),,
 590   "@brief Sets the first HMD to be a GameConnection's display device\n\n"
 591   "@param conn The GameConnection to set.\n"
 592   "@return True if the GameConnection display device was set.\n"
 593   "@ingroup Game")
 594{
 595   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 596   {
 597      Con::errorf("setOVRHMDAsGameConnectionDisplayDevice(): No Oculus VR Device present.");
 598      return false;
 599   }
 600
 601   if(!conn)
 602   {
 603      Con::errorf("setOVRHMDAsGameConnectionDisplayDevice(): Invalid GameConnection.");
 604      return false;
 605   }
 606
 607   conn->setDisplayDevice(OCULUSVRDEV);
 608   return true;
 609}
 610//-----------------------------------------------------------------------------
 611
 612DefineEngineFunction(setOptimalOVRCanvasSize, bool, (GuiCanvas* canvas),,
 613   "@brief Sets the first HMD to be a GameConnection's display device\n\n"
 614   "@param conn The GameConnection to set.\n"
 615   "@return True if the GameConnection display device was set.\n"
 616   "@ingroup Game")
 617{
 618   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 619   {
 620      Con::errorf("setOptimalOVRCanvasSize(): No Oculus VR Device present.");
 621      return false;
 622   }
 623
 624   if(!canvas)
 625   {
 626      Con::errorf("setOptimalOVRCanvasSize(): Invalid Canvas.");
 627      return false;
 628   }
 629
 630   OCULUSVRDEV->setOptimalDisplaySize(0, canvas);
 631   return true;
 632}
 633
 634//-----------------------------------------------------------------------------
 635
 636DefineEngineFunction(getOVRHMDCount, S32, (),,
 637   "@brief Get the number of HMD devices that are currently connected.\n\n"
 638   "@return The number of Oculus VR HMD devices that are currently connected.\n"
 639   "@ingroup Game")
 640{
 641   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 642   {
 643      return 0;
 644   }
 645
 646   return OCULUSVRDEV->getHMDCount();
 647}
 648
 649DefineEngineFunction(getOVRHMDProductName, const char*, (S32 index),,
 650   "@brief Retrieves the HMD product name.\n\n"
 651   "@param index The HMD index.\n"
 652   "@return The name of the HMD product.\n"
 653   "@ingroup Game")
 654{
 655   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 656   {
 657      return "";
 658   }
 659
 660   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 661   if(!hmd)
 662   {
 663      return "";
 664   }
 665
 666   return hmd->getProductName();
 667}
 668
 669DefineEngineFunction(getOVRHMDManufacturer, const char*, (S32 index),,
 670   "@brief Retrieves the HMD manufacturer name.\n\n"
 671   "@param index The HMD index.\n"
 672   "@return The manufacturer of the HMD product.\n"
 673   "@ingroup Game")
 674{
 675   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 676   {
 677      return "";
 678   }
 679
 680   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 681   if(!hmd)
 682   {
 683      return "";
 684   }
 685
 686   return hmd->getManufacturer();
 687}
 688
 689DefineEngineFunction(getOVRHMDVersion, S32, (S32 index),,
 690   "@brief Retrieves the HMD version number.\n\n"
 691   "@param index The HMD index.\n"
 692   "@return The version number of the HMD product.\n"
 693   "@ingroup Game")
 694{
 695   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 696   {
 697      return -1;
 698   }
 699
 700   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 701   if(!hmd)
 702   {
 703      return -1;
 704   }
 705
 706   return hmd->getVersion();
 707}
 708
 709DefineEngineFunction(getOVRHMDDisplayDeviceType, const char*, (S32 index),,
 710   "@brief Windows display device name used in EnumDisplaySettings/CreateDC.\n\n"
 711   "@param index The HMD index.\n"
 712   "@return The name of the HMD display device, if any.\n"
 713   "@ingroup Game")
 714{
 715   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 716   {
 717      return "";
 718   }
 719
 720   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 721   if(!hmd)
 722   {
 723      return "";
 724   }
 725
 726   return hmd->getDisplayDeviceType();
 727}
 728
 729DefineEngineFunction(getOVRHMDDisplayDeviceId, S32, (S32 index),,
 730   "@brief MacOS display ID.\n\n"
 731   "@param index The HMD index.\n"
 732   "@return The ID of the HMD display device, if any.\n"
 733   "@ingroup Game")
 734{
 735   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 736   {
 737      return -1;
 738   }
 739
 740   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 741   if(!hmd)
 742   {
 743      return -1;
 744   }
 745
 746   return hmd->getDisplayDeviceId();
 747}
 748
 749DefineEngineFunction(getOVRHMDResolution, Point2I, (S32 index),,
 750   "@brief Provides the OVR HMD screen resolution.\n\n"
 751   "@param index The HMD index.\n"
 752   "@return A two component string with the screen's resolution.\n"
 753   "@ingroup Game")
 754{
 755   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 756   {
 757      return Point2I(1280, 800);
 758   }
 759
 760   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 761   if(!hmd)
 762   {
 763      return Point2I(1280, 800);
 764   }
 765
 766   return hmd->getResolution();
 767}
 768
 769DefineEngineFunction(getOVRHMDProfileIPD, F32, (S32 index),,
 770   "@brief Physical distance between the user's eye centers as defined by the current profile.\n\n"
 771   "@param index The HMD index.\n"
 772   "@return The profile IPD.\n"
 773   "@ingroup Game")
 774{
 775   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 776   {
 777      return -1.0f;
 778   }
 779
 780   const OculusVRHMDDevice* hmd = OCULUSVRDEV->getHMDDevice(index);
 781   if(!hmd)
 782   {
 783      return -1.0f;
 784   }
 785
 786   return hmd->getProfileIPD();
 787}
 788
 789DefineEngineFunction(getOVRHMDCurrentIPD, F32, (S32 index),,
 790   "@brief Physical distance between the user's eye centers.\n\n"
 791   "@param index The HMD index.\n"
 792   "@return The current IPD.\n"
 793   "@ingroup Game")
 794{
 795   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 796   {
 797      return -1.0f;
 798   }
 799
 800   return OCULUSVRDEV->getHMDCurrentIPD(index);
 801}
 802
 803DefineEngineFunction(setOVRHMDCurrentIPD, void, (S32 index, F32 ipd),,
 804   "@brief Set the physical distance between the user's eye centers.\n\n"
 805   "@param index The HMD index.\n"
 806   "@param ipd The IPD to use.\n"
 807   "@ingroup Game")
 808{
 809   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 810   {
 811      return;
 812   }
 813
 814   OCULUSVRDEV->setHMDCurrentIPD(index, ipd);
 815}
 816
 817//-----------------------------------------------------------------------------
 818
 819DefineEngineFunction(getOVRSensorCount, S32, (),,
 820   "@brief Get the number of sensor devices that are currently connected.\n\n"
 821   "@return The number of Oculus VR sensor devices that are currently connected.\n"
 822   "@ingroup Game")
 823{
 824   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 825   {
 826      return 0;
 827   }
 828
 829   return OCULUSVRDEV->getSensorCount();
 830}
 831
 832DefineEngineFunction(getOVRSensorEulerRotation, Point3F, (S32 index),,
 833   "@brief Get the Euler rotation values for the given sensor index.\n\n"
 834   "@param index The sensor index.\n"
 835   "@return The Euler rotation values of the Oculus VR sensor, in degrees.\n"
 836   "@ingroup Game")
 837{
 838   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 839   {
 840      return Point3F::Zero;
 841   }
 842
 843   EulerF rot = OCULUSVRDEV->getSensorEulerRotation(index);
 844   return Point3F(mRadToDeg(rot.x), mRadToDeg(rot.y), mRadToDeg(rot.z));
 845}
 846
 847DefineEngineFunction(getOVRSensorAcceleration, Point3F, (S32 index),,
 848   "@brief Get the acceleration values for the given sensor index.\n\n"
 849   "@param index The sensor index.\n"
 850   "@return The acceleration values of the Oculus VR sensor, in m/s^2.\n"
 851   "@ingroup Game")
 852{
 853   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 854   {
 855      return Point3F::Zero;
 856   }
 857
 858   return OCULUSVRDEV->getSensorAcceleration(index);
 859}
 860
 861DefineEngineFunction(getOVRSensorAngVelocity, Point3F, (S32 index),,
 862   "@brief Get the angular velocity values for the given sensor index.\n\n"
 863   "@param index The sensor index.\n"
 864   "@return The angular velocity values of the Oculus VR sensor, in degrees/s.\n"
 865   "@ingroup Game")
 866{
 867   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 868   {
 869      return Point3F::Zero;
 870   }
 871
 872   EulerF rot = OCULUSVRDEV->getSensorAngularVelocity(index);
 873   return Point3F(mRadToDeg(rot.x), mRadToDeg(rot.y), mRadToDeg(rot.z));
 874}
 875
 876DefineEngineFunction(getOVRSensorYawCorrection, bool, (S32 index),,
 877   "@brief Get the yaw correction state for the given sensor index.\n\n"
 878   "@param index The sensor index.\n"
 879   "@return True if yaw correction (using magnetometer calibration data) is active.\n"
 880   "@ingroup Game")
 881{
 882   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 883   {
 884      return false;
 885   }
 886
 887   return OCULUSVRDEV->getSensorYawCorrection(index);
 888}
 889
 890DefineEngineFunction(setOVRSensorYawCorrection, void, (S32 index, bool state),,
 891   "@brief Set the yaw correction state for the given sensor index.\n\n"
 892   "@param index The sensor index.\n"
 893   "@param state The yaw correction state to change to.\n"
 894   "@note Yaw correction cannot be enabled if the user has disabled it through "
 895   "the Oculus VR control panel.\n"
 896   "@ingroup Game")
 897{
 898   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 899   {
 900      return;
 901   }
 902
 903   OCULUSVRDEV->setSensorYawCorrection(index, state);
 904}
 905
 906DefineEngineFunction(getOVRSensorMagnetometerCalibrated, bool, (S32 index),,
 907   "@brief Get the magnetometer calibrated data state for the given sensor index.\n\n"
 908   "@param index The sensor index.\n"
 909   "@return True if magnetometer calibration data is available.\n"
 910   "@ingroup Game")
 911{
 912   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 913   {
 914      return false;
 915   }
 916
 917   return OCULUSVRDEV->getSensorMagnetometerCalibrated(index);
 918}
 919
 920DefineEngineFunction(ovrResetAllSensors, void, (),,
 921   "@brief Resets all Oculus VR sensors.\n\n"
 922   "This resets all sensor orientations such that their 'normal' rotation "
 923   "is defined when this function is called.  This defines an HMD's forwards "
 924   "and up direction, for example."
 925   "@ingroup Game")
 926{
 927   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 928   {
 929      return;
 930   }
 931
 932   OCULUSVRDEV->resetAllSensors();
 933}
 934
 935DefineEngineFunction(ovrIsDisplayingWarning, bool, (),,
 936   "@brief returns is warning is being displayed.\n\n"
 937   "@ingroup Game")
 938{
 939   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 940   {
 941      return false;
 942   }
 943
 944   return OCULUSVRDEV->isDiplayingWarning();
 945}
 946
 947DefineEngineFunction(ovrDismissWarnings, void, (),,
 948   "@brief dismisses warnings.\n\n"
 949   "@ingroup Game")
 950{
 951   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 952   {
 953      return;
 954   }
 955
 956   OCULUSVRDEV->dismissWarning();
 957}
 958
 959DefineEngineFunction(ovrDumpMetrics, String, (S32 idx),(0),
 960   "@brief dumps sensor metrics.\n\n"
 961   "@ingroup Game")
 962{
 963   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 964   {
 965      return "";
 966   }
 967
 968   return OCULUSVRDEV->dumpMetrics(idx);
 969}
 970
 971bool OculusVRDevice::_handleDeviceEvent( GFXDevice::GFXDeviceEventType evt )
 972{
 973   if(!ManagedSingleton<OculusVRDevice>::instanceOrNull())
 974   {
 975      return true;
 976   }
 977
 978   switch( evt )
 979   {
 980      case GFXDevice::deStartOfFrame:
 981         
 982         for (U32 i=0; i<OCULUSVRDEV->mHMDDevices.size(); i++)
 983         {
 984            OCULUSVRDEV->mHMDDevices[i]->onStartFrame();
 985         }
 986
 987         // Fall through
 988         break;
 989
 990      case GFXDevice::dePostFrame:
 991         
 992         for (U32 i=0; i<OCULUSVRDEV->mHMDDevices.size(); i++)
 993         {
 994            OCULUSVRDEV->mHMDDevices[i]->onEndFrame();
 995         }
 996
 997         break;
 998
 999      case GFXDevice::deDestroy:
1000         
1001         for (U32 i=0; i<OCULUSVRDEV->mHMDDevices.size(); i++)
1002         {
1003            OCULUSVRDEV->mHMDDevices[i]->onDeviceDestroy();
1004         }
1005   
1006      default:
1007         break;
1008   }
1009
1010   return true;
1011}
1012