C# Class Ovr.Hmd

Provides an interface to a CAPI HMD object. The ovrHmd instance is normally created by ovrHmd::Create, after which its other methods can be called. The typical process would involve calling: Setup: - Initialize() to initialize the OVR SDK. - Construct Hmd to create an ovrHmd. - Use hmd members and ovrHmd_GetFovTextureSize() to determine graphics configuration. - ConfigureTracking() to configure and initialize tracking. - ConfigureRendering() to setup graphics for SDK rendering, which is the preferred approach. - Please refer to "Client Distortion Rendering" below if you prefer to do that instead. - If ovrHmdCap_ExtendDesktop is not set, use ovrHmd_AttachToWindow to associate the window with an Hmd. - Allocate render textures as needed. Game Loop: - Call ovrHmd_BeginFrame() to get frame timing and orientation information. - Render each eye in between, using ovrHmd_GetEyePoses or ovrHmd_GetHmdPosePerEye to get the predicted hmd pose and each eye pose. - Call ovrHmd_EndFrame() to render distorted textures to the back buffer and present them on the Hmd. Shutdown: - Dispose the Hmd to release the ovrHmd. - ovr_Shutdown() to shutdown the OVR SDK.
Inheritance: IDisposable
Show file Open project: UCSDVR/Lucid-VR Class Usage Examples

Public Properties

Property Type Description
OVR_DEFAULT_CAMERA_POSITION float[]

Public Methods

Method Description
AttachToWindow ( Recti destMirrorRect, Recti sourceRenderTargetRect, IntPtr WindowPtr = default(IntPtr) ) : bool

Platform specific function to specify the application window whose output will be displayed on the HMD. Only used if the ovrHmdCap_ExtendDesktop flag is false. Windows: SwapChain associated with this window will be displayed on the HMD. Specify 'destMirrorRect' in window coordinates to indicate an area of the render target output that will be mirrored from 'sourceRenderTargetRect'. Null pointers mean "full size". @note Source and dest mirror rects are not yet implemented.

BeginFrame ( uint frameIndex ) : FrameTiming

Begins a frame, returning timing information. This should be called at the beginning of the game rendering loop (on the render thread). Pass 0 for the frame index if not using ovrHmd_GetFrameTiming.

BeginFrameTiming ( uint frameIndex ) : FrameTiming

Called at the beginning of the frame on the rendering thread. Pass frameIndex == 0 if ovrHmd_GetFrameTiming isn't being used. Otherwise, pass the same frame index as was used for GetFrameTiming on the main thread.

ConfigureRendering ( RenderAPIConfig &renderAPIConfig, FovPort eyeFovIn, uint distortionCaps ) : Ovr.EyeRenderDesc[]

Configures rendering and fills in computed render parameters. This function can be called multiple times to change rendering settings. eyeRenderDescOut is a pointer to an array of two EyeRenderDesc structs that are used to return complete rendering information for each eye. - apiConfig provides D3D/OpenGL specific parameters. Pass null to shutdown rendering and release all resources. - distortionCaps describe desired distortion settings.

ConfigureTracking ( uint supportedTrackingCaps, uint requiredTrackingCaps ) : bool

All tracking interface functions are thread-safe, allowing tracking state to be sampled from different threads. ConfigureTracking starts sensor sampling, enabling specified capabilities, described by ovrTrackingCaps. - supportedTrackingCaps specifies support that is requested. The function will succeed even if these caps are not available (i.e. sensor or camera is unplugged). Support will automatically be enabled if such device is plugged in later. Software should check ovrTrackingState.StatusFlags for real-time status. - requiredTrackingCaps specify sensor capabilities required at the time of the call. If they are not available, the function will fail. Pass 0 if only specifying supportedTrackingCaps. - Pass 0 for both supportedTrackingCaps and requiredTrackingCaps to disable tracking.

Create ( int index ) : Hmd

Creates a handle to an HMD which doubles as a description structure. Index can [0 .. ovrHmd_Detect()-1]. Index mappings can cange after each ovrHmd_Detect call.

CreateDebug ( HmdType type ) : Hmd

Creates a 'fake' HMD used for debugging only. This is not tied to specific hardware, but may be used to debug some of the related rendering.

CreateDistortionMesh ( Eye eye, FovPort fov, uint distortionCaps ) : DistortionMesh?

Generate distortion mesh per eye. Distortion capabilities will depend on 'distortionCaps' flags. Users should render using the appropriate shaders based on their settings. Distortion mesh data will be allocated and written into the ovrDistortionMesh data structure, which should be explicitly freed with ovrHmd_DestroyDistortionMesh. Users should call ovrHmd_GetRenderScaleAndOffset to get uvScale and Offset values for rendering. The function shouldn't fail unless theres is a configuration or memory error, in which case ovrDistortionMesh values will be set to null. This is the only function in the SDK reliant on eye relief, currently imported from profiles, or overridden here.

Detect ( ) : int

Detects or re-detects HMDs and reports the total number detected. Users can get information about each HMD by calling ovrHmd_Create with an index.

DismissHSWDisplay ( ) : bool
EndFrame ( Posef renderPose, Texture eyeTexture ) : void

Ends a frame, submitting the rendered textures to the frame buffer. - RenderViewport within each eyeTexture can change per frame if necessary. - 'renderPose' will typically be the value returned from ovrHmd_GetEyePoses, ovrHmd_GetHmdPosePerEye but can be different if a different head pose was used for rendering. - This may perform distortion and scaling internally, assuming is it not delegated to another thread. - Must be called on the same thread as BeginFrame. - *** This Function will call Present/SwapBuffers and potentially wait for GPU Sync ***.

EndFrameTiming ( ) : void

Marks the end of client distortion rendered frame, tracking the necessary timing information. This function must be called immediately after Present/SwapBuffers + GPU sync. GPU sync is important before this call to reduce latency and ensure proper timing.

GetBool ( string propertyName, bool defaultVal = false ) : bool

Get boolean property. Returns first element if property is a boolean array. Returns defaultValue if property doesn't exist.

GetDesc ( ) : HmdDesc

Returns an ovrHmdDesc, which provides a complete description for the HMD

GetEnabledCaps ( ) : uint

Returns capability bits that are enabled at this time as described by ovrHmdCaps. Note that this value is different font ovrHmdDesc::HmdCaps, which describes what capabilities are available for that HMD.

GetEyePoses ( uint frameIndex ) : Ovr.Posef[]

Returns predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses as an atomic operation. Caller need not worry about applying HmdToEyeViewOffset to the returned outEyePoses variables. - Thread-safe function where caller should increment frameIndex with every frame and pass the index where applicable to functions called on the rendering thread. - hmdToEyeViewOffset[2] can be EyeRenderDesc.HmdToEyeViewOffset returned from ovrHmd_ConfigureRendering or ovrHmd_GetRenderDesc. For monoscopic rendering, use a vector that is the average of the two vectors for both eyes. - If frameIndex is not being used, pass in 0. - Assuming outEyePoses are used for rendering, it should be passed into ovrHmd_EndFrame. - If called doesn't need outHmdTrackingState, it can be NULL

GetEyeTimewarpMatrices ( Eye eye, Posef renderPose ) : Ovr.Matrix4f[]

Computes timewarp matrices used by distortion mesh shader, these are used to adjust for head orientation change since the last call to ovrHmd_GetEyePoses when rendering this eye. The ovrDistortionVertex::TimeWarpFactor is used to blend between the matrices, usually representing two different sides of the screen. Must be called on the same thread as ovrHmd_BeginFrameTiming.

GetFloat ( string propertyName, float defaultVal = 0.0f ) : float

Get float property. Returns first element if property is a float array. Returns defaultValue if property doesn't exist.

GetFloatArray ( string propertyName, float values ) : float[]

Get float[] property. Returns the number of elements filled in, 0 if property doesn't exist. Maximum of arraySize elements will be written.

GetFovTextureSize ( Eye eye, FovPort fov, float pixelsPerDisplayPixel = 1.0f ) : Sizei

Calculates the recommended texture size for rendering a given eye within the HMD with a given FOV cone. Higher FOV will generally require larger textures to maintain quality. - pixelsPerDisplayPixel specifies the ratio of the number of render target pixels to display pixels at the center of distortion. 1.0 is the default value. Lower values can improve performance.

GetFrameTiming ( uint frameIndex ) : FrameTiming

Thread-safe timing function for the main thread. Caller should increment frameIndex with every frame and pass the index where applicable to functions called on the rendering thread.

GetHSWDisplayState ( ) : HSWDisplayState

Returns the current state of the HSW display. If the application is doing the rendering of the HSW display then this function serves to indicate that the warning should be currently displayed. If the application is using SDK-based eye rendering then the SDK by default automatically handles the drawing of the HSW display. An application that uses application-based eye rendering should use this function to know when to start drawing the HSW display itself and can optionally use it in conjunction with ovrhmd_DismissHSWDisplay as described below. Example usage for application-based rendering: bool HSWDisplayCurrentlyDisplayed = false; // global or class member variable ovrHSWDisplayState hswDisplayState = hmd.GetHSWDisplayState(); if (hswDisplayState.Displayed && !HSWDisplayCurrentlyDisplayed) { HSWDisplayCurrentlyDisplayed = true; }

GetHmdPosePerEye ( Eye eye ) : Posef

Function was previously called ovrHmd_GetEyePose Returns the predicted head pose to use when rendering the specified eye. - Important: Caller must apply HmdToEyeViewOffset before using ovrPosef for rendering - Must be called between ovrHmd_BeginFrameTiming and ovrHmd_EndFrameTiming. - If the pose is used for rendering the eye, it should be passed to ovrHmd_EndFrame. - Parameter 'eye' is used for prediction timing only

GetInt ( string propertyName, int defaultVal ) : int

Get integer property. Returns first element if property is an integer array. Returns defaultValue if property doesn't exist.

GetLastError ( ) : string

Returns last error for HMD state. Returns null for no error. String is valid until next call or GetLastError or HMD is destroyed.

GetLatencyTest2DrawColor ( ) : byte[]

Returns the latency testing color in rgbColorOut to render when using a DK2 Returns false if this feature is disabled or not-applicable (e.g. using a DK1)

GetLatencyTestResult ( ) : string

Returns non-null string once with latency test result, when it is available. Buffer is valid until next call.

GetOrthoSubProjection ( Matrix4f projection, Vector2f orthoScale, float orthoDistance, float hmdToEyeViewOffsetX ) : Matrix4f

Used for 2D rendering, Y is down orthoScale = 1.0f / pixelsPerTanAngleAtCenter orthoDistance = distance from camera, such as 0.8m

GetProjection ( FovPort fov, float znear, float zfar, bool rightHanded ) : Matrix4f

Used to generate projection from ovrEyeDesc::Fov.

GetRenderDesc ( Eye eyeType, FovPort fov ) : EyeRenderDesc

Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye. This can be used instead of ovrHmd_ConfigureRendering to do setup for client rendered distortion.

GetRenderScaleAndOffset ( FovPort fov, Sizei textureSize, Recti renderViewport ) : Ovr.Vector2f[]

Computes updated 'uvScaleOffsetOut' to be used with a distortion if render target size or viewport changes after the fact. This can be used to adjust render size every frame if desired.

GetString ( string propertyName, string defaultVal = null ) : string

Get string property. Returns first element if property is a string array. Returns defaultValue if property doesn't exist. String memory is guaranteed to exist until next call to GetString or GetStringArray, or HMD is destroyed.

GetTimeInSeconds ( ) : double

Returns global, absolute high-resolution time in seconds. This is the same value as used in sensor messages.

GetTrackingState ( double absTime = 0.0d ) : TrackingState

Returns tracking state reading based on the specified absolute system time. Pass an absTime value of 0.0 to request the most recent sensor reading. In this case both PredictedPose and SamplePose will have the same value. ovrHmd_GetEyePoses relies on this function internally. This may also be used for more refined timing of FrontBuffer rendering logic, etc.

GetVersionString ( ) : string

Returns version string representing libOVR version.

Hmd ( IntPtr hmdPtr ) : System
Initialize ( ) : bool

Initializes all Oculus functionality.

InitializeRenderingShim ( ) : void
ProcessLatencyTest ( ) : byte[]

Does latency test processing and returns 'TRUE' if specified rgb color should be used to clear the screen.

RecenterPose ( ) : void

Re-centers the sensor orientation. Normally this will recenter the (x,y,z) translational components and the yaw component of orientation.

ResetFrameTiming ( uint frameIndex ) : void

Initializes and resets frame time tracking. This is typically not necessary, but is helpful if game changes vsync state or video mode. vsync is assumed to be on if this isn't called. Resets internal frame index to the specified number.

SetBool ( string propertyName, bool val ) : bool

Modify bool property; false if property doesn't exist or is readonly.

SetEnabledCaps ( uint capsBits ) : void

Modifies capability bits described by ovrHmdCaps that can be modified, such as ovrHmdCap_LowPersistance.

SetFloat ( string propertyName, float val ) : bool

Modify float property; false if property doesn't exist or is readonly.

SetFloatArray ( string propertyName, float values ) : bool

Modify float[] property; false if property doesn't exist or is readonly.

SetInt ( string propertyName, int val ) : bool

Modify integer property; false if property doesn't exist or is readonly.

SetString ( string propertyName, string val ) : bool

Set string property

Shutdown ( ) : void

Shuts down all Oculus functionality.

StartPerfLog ( string fileName, string userData1 ) : bool

Start performance logging. guid is optional and if included is written with each file entry. If called while logging is already active with the same filename, only the guid will be updated If called while logging is already active with a different filename, ovrHmd_StopPerfLog() will be called, followed by ovrHmd_StartPerfLog()

StopPerfLog ( ) : bool

Stop performance logging.

WaitTillTime ( double absTime ) : double

Waits until the specified absolute time.

Private Methods

Method Description
ovrHmd_AttachToWindow ( IntPtr hmd, IntPtr window, Recti destMirrorRect, Recti sourceRenderTargetRect ) : sbyte
ovrHmd_BeginFrame ( IntPtr hmd, uint frameIndex ) : FrameTiming_Raw
ovrHmd_BeginFrameTiming ( IntPtr hmd, uint frameIndex ) : FrameTiming_Raw
ovrHmd_ConfigureRendering ( IntPtr hmd, RenderAPIConfig_Raw &apiConfig, uint distortionCaps, [ eyeFovIn, [ eyeRenderDescOut ) : sbyte
ovrHmd_ConfigureTracking ( IntPtr hmd, uint supportedTrackingCaps, uint requiredTrackingCaps ) : sbyte
ovrHmd_Create ( int index ) : IntPtr
ovrHmd_CreateDebug ( HmdType type ) : IntPtr
ovrHmd_CreateDistortionMesh ( IntPtr hmd, Eye eye, FovPort fov, uint distortionCaps, [ meshData ) : sbyte
ovrHmd_Destroy ( IntPtr hmd ) : void
ovrHmd_DestroyDistortionMesh ( DistortionMesh_Raw &meshData ) : void
ovrHmd_Detect ( ) : int
ovrHmd_DismissHSWDisplay ( IntPtr hmd ) : sbyte
ovrHmd_EndFrame ( IntPtr hmd, [ renderPose, [ eyeTexture ) : void
ovrHmd_EndFrameTiming ( IntPtr hmd ) : void
ovrHmd_GetBool ( IntPtr hmd, [ propertyName, bool defaultVal ) : sbyte
ovrHmd_GetEnabledCaps ( IntPtr hmd ) : uint
ovrHmd_GetEyePoses ( IntPtr hmd, uint frameIndex, [ hmdToEyeViewOffset, [ eyePosesOut, [ hmdTrackingStateOut ) : void
ovrHmd_GetEyeTimewarpMatrices ( IntPtr hmd, Eye eye, Posef renderPose, [ SizeConst = 2)][Out]Matrix4f_Raw[]twnOut ) : void
ovrHmd_GetFloat ( IntPtr hmd, [ propertyName, float defaultVal ) : float
ovrHmd_GetFloatArray ( IntPtr hmd, [ propertyName, float values, uint arraySize ) : uint
ovrHmd_GetFovTextureSize ( IntPtr hmd, Eye eye, FovPort fov, float pixelsPerDisplayPixel ) : Sizei
ovrHmd_GetFrameTiming ( IntPtr hmd, uint frameIndex ) : FrameTiming_Raw
ovrHmd_GetHSWDisplayState ( IntPtr hmd, [ hasWarningState ) : void
ovrHmd_GetHmdPosePerEye ( IntPtr hmd, Eye eye ) : Posef
ovrHmd_GetInt ( IntPtr hmd, [ propertyName, int defaultVal ) : int
ovrHmd_GetLastError ( IntPtr hmd ) : string
ovrHmd_GetLatencyTest2DrawColor ( IntPtr hmd, [ SizeConst = 3)][Out]byte[]rgbColorOut ) : sbyte
ovrHmd_GetLatencyTestResult ( IntPtr hmd ) : IntPtr
ovrHmd_GetRenderDesc ( IntPtr hmd, Eye eye, FovPort fov ) : EyeRenderDesc
ovrHmd_GetRenderScaleAndOffset ( FovPort fov, Sizei textureSize, Recti renderViewport, [ SizeConst = 2)][Out]Vector2f[]uvScaleOffsetOut ) : void
ovrHmd_GetString ( IntPtr hmd, [ propertyName, [ defaultVal ) : IntPtr
ovrHmd_GetTrackingState ( IntPtr hmd, double absTime ) : TrackingState
ovrHmd_ProcessLatencyTest ( IntPtr hmd, [ SizeConst = 3)][Out]byte[]rgbColorOut ) : sbyte
ovrHmd_RecenterPose ( IntPtr hmd ) : void
ovrHmd_ResetFrameTiming ( IntPtr hmd, uint frameIndex ) : void
ovrHmd_SetBool ( IntPtr hmd, [ propertyName, bool val ) : sbyte
ovrHmd_SetEnabledCaps ( IntPtr hmd, uint capsBits ) : void
ovrHmd_SetFloat ( IntPtr hmd, [ propertyName, float val ) : sbyte
ovrHmd_SetFloatArray ( IntPtr hmd, [ propertyName, float values, uint arraySize ) : sbyte
ovrHmd_SetInt ( IntPtr hmd, [ propertyName, int val ) : sbyte
ovrHmd_SetString ( IntPtr hmd, [ propertyName, [ val ) : sbyte
ovrHmd_StartPerfLog ( IntPtr hmd, [ fileName, [ userData1 ) : sbyte
ovrHmd_StopPerfLog ( IntPtr hmd ) : sbyte
ovrMatrix4f_OrthoSubProjection ( Matrix4f projection, Vector2f orthoScale, float orthoDistance, float hmdToEyeViewOffsetX ) : Matrix4f_Raw
ovrMatrix4f_Projection ( FovPort fov, float znear, float zfar, bool rightHanded ) : Matrix4f_Raw
ovr_GetTimeInSeconds ( ) : double
ovr_GetVersionString ( ) : IntPtr
ovr_Initialize ( ) : sbyte
ovr_InitializeRenderingShim ( ) : void
ovr_Shutdown ( ) : void
ovr_WaitTillTime ( double absTime ) : double

Method Details

AttachToWindow() public method

Platform specific function to specify the application window whose output will be displayed on the HMD. Only used if the ovrHmdCap_ExtendDesktop flag is false. Windows: SwapChain associated with this window will be displayed on the HMD. Specify 'destMirrorRect' in window coordinates to indicate an area of the render target output that will be mirrored from 'sourceRenderTargetRect'. Null pointers mean "full size". @note Source and dest mirror rects are not yet implemented.
public AttachToWindow ( Recti destMirrorRect, Recti sourceRenderTargetRect, IntPtr WindowPtr = default(IntPtr) ) : bool
destMirrorRect Recti
sourceRenderTargetRect Recti
WindowPtr System.IntPtr
return bool

BeginFrame() public method

Begins a frame, returning timing information. This should be called at the beginning of the game rendering loop (on the render thread). Pass 0 for the frame index if not using ovrHmd_GetFrameTiming.
public BeginFrame ( uint frameIndex ) : FrameTiming
frameIndex uint
return FrameTiming

BeginFrameTiming() public method

Called at the beginning of the frame on the rendering thread. Pass frameIndex == 0 if ovrHmd_GetFrameTiming isn't being used. Otherwise, pass the same frame index as was used for GetFrameTiming on the main thread.
public BeginFrameTiming ( uint frameIndex ) : FrameTiming
frameIndex uint
return FrameTiming

ConfigureRendering() public method

Configures rendering and fills in computed render parameters. This function can be called multiple times to change rendering settings. eyeRenderDescOut is a pointer to an array of two EyeRenderDesc structs that are used to return complete rendering information for each eye. - apiConfig provides D3D/OpenGL specific parameters. Pass null to shutdown rendering and release all resources. - distortionCaps describe desired distortion settings.
public ConfigureRendering ( RenderAPIConfig &renderAPIConfig, FovPort eyeFovIn, uint distortionCaps ) : Ovr.EyeRenderDesc[]
renderAPIConfig RenderAPIConfig
eyeFovIn FovPort
distortionCaps uint
return Ovr.EyeRenderDesc[]

ConfigureTracking() public method

All tracking interface functions are thread-safe, allowing tracking state to be sampled from different threads. ConfigureTracking starts sensor sampling, enabling specified capabilities, described by ovrTrackingCaps. - supportedTrackingCaps specifies support that is requested. The function will succeed even if these caps are not available (i.e. sensor or camera is unplugged). Support will automatically be enabled if such device is plugged in later. Software should check ovrTrackingState.StatusFlags for real-time status. - requiredTrackingCaps specify sensor capabilities required at the time of the call. If they are not available, the function will fail. Pass 0 if only specifying supportedTrackingCaps. - Pass 0 for both supportedTrackingCaps and requiredTrackingCaps to disable tracking.
public ConfigureTracking ( uint supportedTrackingCaps, uint requiredTrackingCaps ) : bool
supportedTrackingCaps uint
requiredTrackingCaps uint
return bool

Create() public static method

Creates a handle to an HMD which doubles as a description structure. Index can [0 .. ovrHmd_Detect()-1]. Index mappings can cange after each ovrHmd_Detect call.
public static Create ( int index ) : Hmd
index int
return Hmd

CreateDebug() public static method

Creates a 'fake' HMD used for debugging only. This is not tied to specific hardware, but may be used to debug some of the related rendering.
public static CreateDebug ( HmdType type ) : Hmd
type HmdType
return Hmd

CreateDistortionMesh() public method

Generate distortion mesh per eye. Distortion capabilities will depend on 'distortionCaps' flags. Users should render using the appropriate shaders based on their settings. Distortion mesh data will be allocated and written into the ovrDistortionMesh data structure, which should be explicitly freed with ovrHmd_DestroyDistortionMesh. Users should call ovrHmd_GetRenderScaleAndOffset to get uvScale and Offset values for rendering. The function shouldn't fail unless theres is a configuration or memory error, in which case ovrDistortionMesh values will be set to null. This is the only function in the SDK reliant on eye relief, currently imported from profiles, or overridden here.
public CreateDistortionMesh ( Eye eye, FovPort fov, uint distortionCaps ) : DistortionMesh?
eye Eye
fov FovPort
distortionCaps uint
return DistortionMesh?

Detect() public static method

Detects or re-detects HMDs and reports the total number detected. Users can get information about each HMD by calling ovrHmd_Create with an index.
public static Detect ( ) : int
return int

DismissHSWDisplay() public method

public DismissHSWDisplay ( ) : bool
return bool

EndFrame() public method

Ends a frame, submitting the rendered textures to the frame buffer. - RenderViewport within each eyeTexture can change per frame if necessary. - 'renderPose' will typically be the value returned from ovrHmd_GetEyePoses, ovrHmd_GetHmdPosePerEye but can be different if a different head pose was used for rendering. - This may perform distortion and scaling internally, assuming is it not delegated to another thread. - Must be called on the same thread as BeginFrame. - *** This Function will call Present/SwapBuffers and potentially wait for GPU Sync ***.
public EndFrame ( Posef renderPose, Texture eyeTexture ) : void
renderPose Posef
eyeTexture Texture
return void

EndFrameTiming() public method

Marks the end of client distortion rendered frame, tracking the necessary timing information. This function must be called immediately after Present/SwapBuffers + GPU sync. GPU sync is important before this call to reduce latency and ensure proper timing.
public EndFrameTiming ( ) : void
return void

GetBool() public method

Get boolean property. Returns first element if property is a boolean array. Returns defaultValue if property doesn't exist.
public GetBool ( string propertyName, bool defaultVal = false ) : bool
propertyName string
defaultVal bool
return bool

GetDesc() public method

Returns an ovrHmdDesc, which provides a complete description for the HMD
public GetDesc ( ) : HmdDesc
return HmdDesc

GetEnabledCaps() public method

Returns capability bits that are enabled at this time as described by ovrHmdCaps. Note that this value is different font ovrHmdDesc::HmdCaps, which describes what capabilities are available for that HMD.
public GetEnabledCaps ( ) : uint
return uint

GetEyePoses() public method

Returns predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses as an atomic operation. Caller need not worry about applying HmdToEyeViewOffset to the returned outEyePoses variables. - Thread-safe function where caller should increment frameIndex with every frame and pass the index where applicable to functions called on the rendering thread. - hmdToEyeViewOffset[2] can be EyeRenderDesc.HmdToEyeViewOffset returned from ovrHmd_ConfigureRendering or ovrHmd_GetRenderDesc. For monoscopic rendering, use a vector that is the average of the two vectors for both eyes. - If frameIndex is not being used, pass in 0. - Assuming outEyePoses are used for rendering, it should be passed into ovrHmd_EndFrame. - If called doesn't need outHmdTrackingState, it can be NULL
public GetEyePoses ( uint frameIndex ) : Ovr.Posef[]
frameIndex uint
return Ovr.Posef[]

GetEyeTimewarpMatrices() public method

Computes timewarp matrices used by distortion mesh shader, these are used to adjust for head orientation change since the last call to ovrHmd_GetEyePoses when rendering this eye. The ovrDistortionVertex::TimeWarpFactor is used to blend between the matrices, usually representing two different sides of the screen. Must be called on the same thread as ovrHmd_BeginFrameTiming.
public GetEyeTimewarpMatrices ( Eye eye, Posef renderPose ) : Ovr.Matrix4f[]
eye Eye
renderPose Posef
return Ovr.Matrix4f[]

GetFloat() public method

Get float property. Returns first element if property is a float array. Returns defaultValue if property doesn't exist.
public GetFloat ( string propertyName, float defaultVal = 0.0f ) : float
propertyName string
defaultVal float
return float

GetFloatArray() public method

Get float[] property. Returns the number of elements filled in, 0 if property doesn't exist. Maximum of arraySize elements will be written.
public GetFloatArray ( string propertyName, float values ) : float[]
propertyName string
values float
return float[]

GetFovTextureSize() public method

Calculates the recommended texture size for rendering a given eye within the HMD with a given FOV cone. Higher FOV will generally require larger textures to maintain quality. - pixelsPerDisplayPixel specifies the ratio of the number of render target pixels to display pixels at the center of distortion. 1.0 is the default value. Lower values can improve performance.
public GetFovTextureSize ( Eye eye, FovPort fov, float pixelsPerDisplayPixel = 1.0f ) : Sizei
eye Eye
fov FovPort
pixelsPerDisplayPixel float
return Sizei

GetFrameTiming() public method

Thread-safe timing function for the main thread. Caller should increment frameIndex with every frame and pass the index where applicable to functions called on the rendering thread.
public GetFrameTiming ( uint frameIndex ) : FrameTiming
frameIndex uint
return FrameTiming

GetHSWDisplayState() public method

Returns the current state of the HSW display. If the application is doing the rendering of the HSW display then this function serves to indicate that the warning should be currently displayed. If the application is using SDK-based eye rendering then the SDK by default automatically handles the drawing of the HSW display. An application that uses application-based eye rendering should use this function to know when to start drawing the HSW display itself and can optionally use it in conjunction with ovrhmd_DismissHSWDisplay as described below. Example usage for application-based rendering: bool HSWDisplayCurrentlyDisplayed = false; // global or class member variable ovrHSWDisplayState hswDisplayState = hmd.GetHSWDisplayState(); if (hswDisplayState.Displayed && !HSWDisplayCurrentlyDisplayed) { HSWDisplayCurrentlyDisplayed = true; }
public GetHSWDisplayState ( ) : HSWDisplayState
return HSWDisplayState

GetHmdPosePerEye() public method

Function was previously called ovrHmd_GetEyePose Returns the predicted head pose to use when rendering the specified eye. - Important: Caller must apply HmdToEyeViewOffset before using ovrPosef for rendering - Must be called between ovrHmd_BeginFrameTiming and ovrHmd_EndFrameTiming. - If the pose is used for rendering the eye, it should be passed to ovrHmd_EndFrame. - Parameter 'eye' is used for prediction timing only
public GetHmdPosePerEye ( Eye eye ) : Posef
eye Eye
return Posef

GetInt() public method

Get integer property. Returns first element if property is an integer array. Returns defaultValue if property doesn't exist.
public GetInt ( string propertyName, int defaultVal ) : int
propertyName string
defaultVal int
return int

GetLastError() public method

Returns last error for HMD state. Returns null for no error. String is valid until next call or GetLastError or HMD is destroyed.
public GetLastError ( ) : string
return string

GetLatencyTest2DrawColor() public method

Returns the latency testing color in rgbColorOut to render when using a DK2 Returns false if this feature is disabled or not-applicable (e.g. using a DK1)
public GetLatencyTest2DrawColor ( ) : byte[]
return byte[]

GetLatencyTestResult() public method

Returns non-null string once with latency test result, when it is available. Buffer is valid until next call.
public GetLatencyTestResult ( ) : string
return string

GetOrthoSubProjection() public static method

Used for 2D rendering, Y is down orthoScale = 1.0f / pixelsPerTanAngleAtCenter orthoDistance = distance from camera, such as 0.8m
public static GetOrthoSubProjection ( Matrix4f projection, Vector2f orthoScale, float orthoDistance, float hmdToEyeViewOffsetX ) : Matrix4f
projection Matrix4f
orthoScale Vector2f
orthoDistance float
hmdToEyeViewOffsetX float
return Matrix4f

GetProjection() public static method

Used to generate projection from ovrEyeDesc::Fov.
public static GetProjection ( FovPort fov, float znear, float zfar, bool rightHanded ) : Matrix4f
fov FovPort
znear float
zfar float
rightHanded bool
return Matrix4f

GetRenderDesc() public method

Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye. This can be used instead of ovrHmd_ConfigureRendering to do setup for client rendered distortion.
public GetRenderDesc ( Eye eyeType, FovPort fov ) : EyeRenderDesc
eyeType Eye
fov FovPort
return EyeRenderDesc

GetRenderScaleAndOffset() public method

Computes updated 'uvScaleOffsetOut' to be used with a distortion if render target size or viewport changes after the fact. This can be used to adjust render size every frame if desired.
public GetRenderScaleAndOffset ( FovPort fov, Sizei textureSize, Recti renderViewport ) : Ovr.Vector2f[]
fov FovPort
textureSize Sizei
renderViewport Recti
return Ovr.Vector2f[]

GetString() public method

Get string property. Returns first element if property is a string array. Returns defaultValue if property doesn't exist. String memory is guaranteed to exist until next call to GetString or GetStringArray, or HMD is destroyed.
public GetString ( string propertyName, string defaultVal = null ) : string
propertyName string
defaultVal string
return string

GetTimeInSeconds() public static method

Returns global, absolute high-resolution time in seconds. This is the same value as used in sensor messages.
public static GetTimeInSeconds ( ) : double
return double

GetTrackingState() public method

Returns tracking state reading based on the specified absolute system time. Pass an absTime value of 0.0 to request the most recent sensor reading. In this case both PredictedPose and SamplePose will have the same value. ovrHmd_GetEyePoses relies on this function internally. This may also be used for more refined timing of FrontBuffer rendering logic, etc.
public GetTrackingState ( double absTime = 0.0d ) : TrackingState
absTime double
return TrackingState

GetVersionString() public static method

Returns version string representing libOVR version.
public static GetVersionString ( ) : string
return string

Hmd() public method

public Hmd ( IntPtr hmdPtr ) : System
hmdPtr System.IntPtr
return System

Initialize() public static method

Initializes all Oculus functionality.
public static Initialize ( ) : bool
return bool

InitializeRenderingShim() public static method

public static InitializeRenderingShim ( ) : void
return void

ProcessLatencyTest() public method

Does latency test processing and returns 'TRUE' if specified rgb color should be used to clear the screen.
public ProcessLatencyTest ( ) : byte[]
return byte[]

RecenterPose() public method

Re-centers the sensor orientation. Normally this will recenter the (x,y,z) translational components and the yaw component of orientation.
public RecenterPose ( ) : void
return void

ResetFrameTiming() public method

Initializes and resets frame time tracking. This is typically not necessary, but is helpful if game changes vsync state or video mode. vsync is assumed to be on if this isn't called. Resets internal frame index to the specified number.
public ResetFrameTiming ( uint frameIndex ) : void
frameIndex uint
return void

SetBool() public method

Modify bool property; false if property doesn't exist or is readonly.
public SetBool ( string propertyName, bool val ) : bool
propertyName string
val bool
return bool

SetEnabledCaps() public method

Modifies capability bits described by ovrHmdCaps that can be modified, such as ovrHmdCap_LowPersistance.
public SetEnabledCaps ( uint capsBits ) : void
capsBits uint
return void

SetFloat() public method

Modify float property; false if property doesn't exist or is readonly.
public SetFloat ( string propertyName, float val ) : bool
propertyName string
val float
return bool

SetFloatArray() public method

Modify float[] property; false if property doesn't exist or is readonly.
public SetFloatArray ( string propertyName, float values ) : bool
propertyName string
values float
return bool

SetInt() public method

Modify integer property; false if property doesn't exist or is readonly.
public SetInt ( string propertyName, int val ) : bool
propertyName string
val int
return bool

SetString() public method

Set string property
public SetString ( string propertyName, string val ) : bool
propertyName string
val string
return bool

Shutdown() public static method

Shuts down all Oculus functionality.
public static Shutdown ( ) : void
return void

StartPerfLog() public method

Start performance logging. guid is optional and if included is written with each file entry. If called while logging is already active with the same filename, only the guid will be updated If called while logging is already active with a different filename, ovrHmd_StopPerfLog() will be called, followed by ovrHmd_StartPerfLog()
public StartPerfLog ( string fileName, string userData1 ) : bool
fileName string
userData1 string
return bool

StopPerfLog() public method

Stop performance logging.
public StopPerfLog ( ) : bool
return bool

WaitTillTime() public static method

Waits until the specified absolute time.
public static WaitTillTime ( double absTime ) : double
absTime double
return double

Property Details

OVR_DEFAULT_CAMERA_POSITION public property

public float[] OVR_DEFAULT_CAMERA_POSITION
return float[]