-
Notifications
You must be signed in to change notification settings - Fork 1.3k
IVRSystem_Overview
The vr::IVRSystem interface provides access to display configuration information, tracking data, distortion functions, controller state, events, and device properties. It is the main interface of OpenVR and can be initialized and retrieved with the openvr::VR_Init function.
Many functions in IVRSystem use a tracked device index to identify a specific device attached to the computer. This value is defined as follows:
typedef uint32_t TrackedDeviceIndex_t;
static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF;
static const uint32_t k_unMaxTrackedDeviceCount = 16;
static const uint32_t k_unTrackedDeviceIndex_Hmd = 0;
There will never be more than k_unMaxTrackedDeviceCount devices active in the system at any given time. Their indices will be 0 (for the HMD) and 1-15 for the other devices.
Each tracked device has a class that is one of:
- TrackedDeviceClass_Invalid - There is no device at this index
- TrackedDeviceClass_HMD - The device at this index is an HMD
- TrackedDeviceClass_Controller - The device is a controller
- TrackedDeviceClass_TrackingReference - The device is a camera, Lighthouse base station, or other device that supplies tracking ground truth.
The vr::IVRSystem interface contains the following functions:
- Display - Functions to figure out where to put a window, how to create viewports and render targets, and how to render into those surfaces.
- GetWindowBounds
- GetRecommendedRenderTargetSize
- GetEyeOutputViewport
- GetProjectionMatrix
- GetProjectionRaw
- virtual DistortionCoordinates_t ComputeDistortion( Hmd_Eye eEye, float fU, float fV )
- HmdMatrix34_t GetEyeToHeadTransform( Hmd_Eye eEye )
- bool GetTimeSinceLastVsync( float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter )
- int32_t GetD3D9AdapterIndex()
- void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex )
- bool AttachToWindow( void *hWnd )
- Tracking - Functions to compute the pose of tracked devices
- void GetDeviceToAbsoluteTrackingPose( TrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, VR_ARRAY_COUNT(unTrackedDevicePoseArrayCount) TrackedDevicePose_t *pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount )
- void ResetSeatedZeroPose()
- HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose()
- Render Model Functions - Access to models and textures that match the actual physical appearance of devices wherever possible.
- bool LoadRenderModel( const char *pchRenderModelName, RenderModel_t *pRenderModel )
- void FreeRenderModel( RenderModel_t *pRenderModel )
- Property functions - Access to non-tracking information about tracked devices
- TrackedDeviceClass GetTrackedDeviceClass( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0;
- bool IsTrackedDeviceConnected( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0;
- bool GetBoolTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, TrackedDeviceProperty prop, TrackedPropertyError *pError = 0L ) = 0;
- float GetFloatTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, TrackedDeviceProperty prop, TrackedPropertyError *pError = 0L ) = 0;
- int32_t GetInt32TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, TrackedDeviceProperty prop, TrackedPropertyError *pError = 0L ) = 0;
- uint64_t GetUint64TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, TrackedDeviceProperty prop, TrackedPropertyError *pError = 0L ) = 0;
- HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, TrackedDeviceProperty prop, TrackedPropertyError *pError = 0L ) = 0;
- uint32_t GetStringTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, TrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, TrackedPropertyError *pError = 0L ) = 0;
- const char *GetPropErrorNameFromEnum( TrackedPropertyError error ) = 0;
- Event Methods - Access to events generated by tracked devices or the system itself
- bool PollNextEvent( VREvent_t *pEvent ) = 0;
- bool PollNextEventWithPose( TrackingUniverseOrigin eOrigin, vr::VREvent_t *pEvent, vr::TrackedDevicePose_t *pTrackedDevicePose ) = 0;
- const char *GetEventTypeNameFromEnum( EVREventType eType ) = 0;
- Rendering Helper Methods - Utility functions that help with rendering
- HiddenAreaMesh_t GetHiddenAreaMesh( Hmd_Eye eEye )
- Controller Methods - Methods for interacting with controllers
- bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState ) = 0;
- bool GetControllerStateWithPose( TrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, TrackedDevicePose_t *pTrackedDevicePose ) = 0;
- void TriggerHapticPulse( vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec ) = 0;
- const char *GetButtonIdNameFromEnum( EVRButtonId eButtonId ) = 0;
- const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0;
- bool HandleControllerOverlayInteractionAsMouse( const vr::Compositor_OverlaySettings & overlaySettings, vr::HmdVector2_t vecWindowClientPositionOnScreen, vr::HmdVector2_t vecWindowClientSize, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::EVRControllerEventOutputType eOutputType )
- bool CaptureInputFocus() = 0;
- void ReleaseInputFocus() = 0;
- bool IsInputFocusCapturedByAnotherProcess() = 0;