This website uses cookies to improve our services and deliver relevant ads.
By interacting with this site, you agree to this use. For more information, see our Cookies Policy
| uint32_t | ovrDeviceID ( ) |
| ovrResult | vrapi_EnumerateInputDevices ( ovrMobile * ovr, const uint32_t index, ovrInputCapabilityHeader * capsHeader ) Enumerates the input devices connected to the system Start with index=0 and counting up. |
| ovrResult | Returns the capabilities of the input device for the corresponding device ID. |
| ovrResult | vrapi_SetHapticVibrationSimple ( ovrMobile * ovr, const ovrDeviceID deviceID, const float intensity ) Sets the vibration level of a haptic device. |
| ovrResult | vrapi_SetHapticVibrationBuffer ( ovrMobile * ovr, const ovrDeviceID deviceID, const ovrHapticBuffer * hapticBuffer ) Fills the haptic vibration buffer of a haptic device there should only be one call to vrapi_SetHapticVibrationSimple or vrapi_SetHapticVibrationBuffer per frame additional calls of either will return ovrError_InvalidOperation and have undefined behavior Input: ovr, deviceID, pointer to a hapticBuffer with filled in data. |
| ovrResult | vrapi_GetCurrentInputState ( ovrMobile * ovr, const ovrDeviceID deviceID, ovrInputStateHeader * inputState ) Returns the current input state for controllers, without positional tracking info. |
| ovrResult | vrapi_GetInputTrackingState ( ovrMobile * ovr, const ovrDeviceID deviceID, const double absTimeInSeconds, ovrTracking * tracking ) Returns the predicted input state based on the specified absolute system time in seconds. |
OVR_VRAPI_DEPRECATED ( void vrapi_RecenterInputPose ) Can be called from any thread while in VR mode. | |
| ovrResult | Enable or disable emulation for the GearVR Controller. |
ovrInputCapabilityHeader capsHeader;
if ( vrapi_EnumerateInputDevices( ovr, deviceIndex, &capsHeader ) >= 0 ) {
if ( capsHeader.Type == ovrDeviceType_TrackedRemote ) {
ovrInputTrackedRemoteCapabilities remoteCaps;
remoteCaps.Header = capsHeader;
vrapi_GetInputDeviceCapabilities( ovr, &remoteCaps.Header ); /************************************************************************************
Filename : VrApi_Input.h
Content : Input API
Created : Feb 9, 2016
Authors : Jonathan E. Wright
Language : C99
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*************************************************************************************/
#ifndef OVR_VrApi_Input_h
#define OVR_VrApi_Input_h
#include <stddef.h>
#include <stdint.h>
#include "VrApi_Config.h"
#include "VrApi_Types.h"
typedefenum ovrButton_
{
ovrButton_A = 0x00000001, // Set for trigger pulled on the Gear VR and Go Controllers
ovrButton_B = 0x00000002,
ovrButton_RThumb = 0x00000004,
ovrButton_RShoulder = 0x00000008,
ovrButton_X = 0x00000100,
ovrButton_Y = 0x00000200,
ovrButton_LThumb = 0x00000400,
ovrButton_LShoulder = 0x00000800,
ovrButton_Up = 0x00010000,
ovrButton_Down = 0x00020000,
ovrButton_Left = 0x00040000,
ovrButton_Right = 0x00080000,
ovrButton_Enter = 0x00100000, //< Set for touchpad click on the Gear VR and Go Controllers
ovrButton_Back = 0x00200000, //< Back button on the headset or Gear VR Controller (only set when a short press comes up)
ovrButton_GripTrigger = 0x04000000, //< grip trigger engaged
ovrButton_Trigger = 0x20000000, //< Index Trigger engaged
ovrButton_Menu = 0x40000000, //< Menu button on Oculus Touch for Oculus Quest
ovrButton_Joystick = 0x80000000, //< Click of the Joystick
ovrButton_EnumSize = 0x7fffffff
} ovrButton;
typedefenum ovrTouch_
{
ovrTouch_A = 0x00000001, //< The A button has a finger resting on it.
ovrTouch_B = 0x00000002, //< The B button has a finger resting on it.
ovrTouch_X = 0x00000004, //< The X button has a finger resting on it.
ovrTouch_Y = 0x00000008, //< The Y button has a finger resting on it.
ovrTouch_TrackPad = 0x00000010, //< The TrackPad has a finger resting on it.
ovrTouch_Joystick = 0x00000020, //< The Joystick has a finger resting on it.
ovrTouch_IndexTrigger = 0x00000040, //< The Index Trigger has a finger resting on it.
ovrTouch_ThumbUp = 0x00000100, //< None of A, B, X, Y, or Joystick has a finger/thumb in proximity to it
ovrTouch_IndexPointing = 0x00000200, //< The finger is sufficiently far away from the trigger to not be considered in proximity to it.
ovrTouch_BaseState = 0x00000300, //< No buttons touched or in proximity. finger pointing and thumb up.
ovrTouch_LThumb = 0x00000400, //< The Left controller Joystick has a finger/thumb resting on it.
ovrTouch_RThumb = 0x00000800, //< The Right controller Joystick has a finger/thumb resting on it.
ovrTouch_EnumSize
} ovrTouch;
typedefenum ovrControllerType_
{
ovrControllerType_None = 0,
ovrControllerType_Reserved0 = ( 1 << 0 ), //< LTouch in CAPI
ovrControllerType_Reserved1 = ( 1 << 1 ), //< RTouch in CAPI
ovrControllerType_TrackedRemote = ( 1 << 2 ),
ovrControllerType_Headset = ( 1 << 3 ),
ovrControllerType_Gamepad = ( 1 << 4 ), //< Xbox in CAPI
ovrControllerType_EnumSize = 0x7fffffff
} ovrControllerType;
typedef uint32_t ovrDeviceID;
typedefenum ovrDeviceIdType_
{
ovrDeviceIdType_Invalid = 0x7fffffff
} ovrDeviceIdType;
typedefstruct ovrInputCapabilityHeader_
{
ovrControllerType Type;
ovrDeviceID DeviceID;
} ovrInputCapabilityHeader;
typedefenum ovrControllerCapabilities_
{
ovrControllerCaps_HasOrientationTracking = 0x00000001,
ovrControllerCaps_HasPositionTracking = 0x00000002,
ovrControllerCaps_LeftHand = 0x00000004, //< Controller is configured for left hand
ovrControllerCaps_RightHand = 0x00000008, //< Controller is configured for right hand
ovrControllerCaps_ModelOculusGo = 0x00000010, //< Controller for Oculus Go devices
ovrControllerCaps_HasAnalogIndexTrigger = 0x00000040, //< Controller has an analog index trigger vs. a binary one
ovrControllerCaps_HasAnalogGripTrigger = 0x00000080, //< Controller has an analog grip trigger vs. a binary one
ovrControllerCaps_HasSimpleHapticVibration = 0x00000200, //< Controller supports simple haptic vibration
ovrControllerCaps_HasBufferedHapticVibration = 0x00000400, //< Controller supports buffered haptic vibration
ovrControllerCaps_ModelGearVR = 0x00000800, //< Controller is the Gear VR Controller
ovrControllerCaps_HasTrackpad = 0x00001000, //< Controller has a trackpad
ovrControllerCaps_HasJoystick = 0x00002000, //< Controller has a joystick.
ovrControllerCaps_ModelOculusTouch = 0x00004000, //< Oculus Touch Controller For Oculus Quest
ovrControllerCaps_EnumSize = 0x7fffffff
} ovrControllerCapabilties;
typedefstruct ovrInputTrackedRemoteCapabilities_
{
ovrInputCapabilityHeader Header;
uint32_t ControllerCapabilities;
uint32_t ButtonCapabilities;
uint16_t TrackpadMaxX;
uint16_t TrackpadMaxY;
float TrackpadSizeX;
float TrackpadSizeY;
uint32_t HapticSamplesMax;
uint32_t HapticSampleDurationMS;
uint32_t TouchCapabilities;
uint32_t Reserved4;
uint32_t Reserved5;
} ovrInputTrackedRemoteCapabilities;
typedefstruct ovrInputHeadsetCapabilities_
{
ovrInputCapabilityHeader Header;
uint32_t ControllerCapabilities;
uint32_t ButtonCapabilities;
uint16_t TrackpadMaxX;
uint16_t TrackpadMaxY;
float TrackpadSizeX;
float TrackpadSizeY;
} ovrInputHeadsetCapabilities;
typedefstruct ovrInputGamepadCapabilities_
{
ovrInputCapabilityHeader Header;
uint32_t ControllerCapabilities;
uint32_t ButtonCapabilities;
// Reserved for future use.
uint64_t Reserved[20];
} ovrInputGamepadCapabilities;
typedefstruct ovrHapticBuffer_
{
double BufferTime;
uint32_t NumSamples;
// True if this is the end of the buffers being sent
bool Terminated;
uint8_t * HapticBuffer;
} ovrHapticBuffer;
typedefstruct ovrInputStateHeader_
{
ovrControllerType ControllerType;
double TimeInSeconds;
} ovrInputStateHeader;
typedefstruct ovrInputStateTrackedRemote_
{
ovrInputStateHeader Header;
uint32_t Buttons;
uint32_t TrackpadStatus;
ovrVector2f TrackpadPosition;
uint8_t BatteryPercentRemaining;
uint8_t RecenterCount;
uint16_t Reserved;
// Analog values from 0.0 - 1.0 of the pull of the triggers
float IndexTrigger;
float GripTrigger;
// Analog values from -1.0 - 1.0
uint32_t Touches;
uint32_t Reserved5a;
// The value is set to 0.0 on Joystick, if the magnitude of the vector is < 0.1f
ovrVector2f Joystick;
// JoystickNoDeadZone does change the raw values of the data.
ovrVector2f JoystickNoDeadZone;
} ovrInputStateTrackedRemote;
typedefstruct ovrInputStateHeadset_
{
ovrInputStateHeader Header;
uint32_t Buttons;
uint32_t TrackpadStatus;
ovrVector2f TrackpadPosition;
} ovrInputStateHeadset;
typedefstruct ovrInputStateGamepad_
{
ovrInputStateHeader Header;
uint32_t Buttons;
// Analog value from 0.0 - 1.0 of the pull of the Left Trigger
float LeftTrigger;
// Analog value from 0.0 - 1.0 of the pull of the Right Trigger
float RightTrigger;
ovrVector2f LeftJoystick;
ovrVector2f RightJoystick;
// Reserved for future use.
uint64_t Reserved[20];
} ovrInputStateGamepad;
#if defined( __cplusplus )
extern"C" {
#endif
OVR_VRAPI_EXPORT ovrResult vrapi_EnumerateInputDevices( ovrMobile * ovr, const uint32_t index, ovrInputCapabilityHeader * capsHeader );
OVR_VRAPI_EXPORT ovrResult vrapi_GetInputDeviceCapabilities( ovrMobile * ovr, ovrInputCapabilityHeader * capsHeader );
OVR_VRAPI_EXPORT ovrResult vrapi_SetHapticVibrationSimple( ovrMobile * ovr, const ovrDeviceID deviceID, constfloat intensity );
OVR_VRAPI_EXPORT ovrResult vrapi_SetHapticVibrationBuffer( ovrMobile * ovr, const ovrDeviceID deviceID, const ovrHapticBuffer * hapticBuffer );
OVR_VRAPI_EXPORT ovrResult vrapi_GetCurrentInputState( ovrMobile * ovr, const ovrDeviceID deviceID, ovrInputStateHeader * inputState );
OVR_VRAPI_EXPORT ovrResult vrapi_GetInputTrackingState( ovrMobile * ovr, const ovrDeviceID deviceID,
constdouble absTimeInSeconds, ovrTracking * tracking );
OVR_VRAPI_DEPRECATED( OVR_VRAPI_EXPORT void vrapi_RecenterInputPose( ovrMobile * ovr, const ovrDeviceID deviceID ) );
OVR_VRAPI_EXPORT ovrResult vrapi_SetRemoteEmulation( ovrMobile * ovr, constbool emulationOn );
#if defined( __cplusplus )
} // extern "C"
#endif
#endif // OVR_VrApi_Input_h