uint32_t | ovrDeviceID ( ) |
int16_t | ovrVertexIndex ( ) |
int16_t | ovrHandBoneIndex ( ) |
ovrResult | vrapi_GetHandPose ( ovrMobile * ovr, const ovrDeviceID deviceID, const double absTimeInSeconds, ovrHandPoseHeader * header ) |
ovrResult | vrapi_GetHandSkeleton ( ovrMobile * ovr, const ovrHandedness handedness, ovrHandSkeletonHeader * header ) |
ovrResult | |
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 Go Controller, menu // button on Left Quest Controller ovrButton_Back = 0x00200000, //< Back button on the Go Controller (only set when // a short press comes up) ovrButton_VolUp = 0x00400000, //< + button on the Gear VR Controller and headset, but never sent // to applications ovrButton_VolDown = 0x00800000, //< - button on the Gear VR Controller and headset, but never // sent to applications ovrButton_Home = 0x01000000, //< Home button on the Gear VR Controller and headset, but never // sent to applications // 0x02000000 // was ovrButton_CapTrigger deprecated in 1.19 ovrButton_GripTrigger = 0x04000000, //< grip trigger engaged // 0x08000000 // was ovrButton_IndexPointing deprecated in 1.19 // 0x10000000 // was ovrButton_ThumbUp deprecated in 1.19 ovrButton_Trigger = 0x20000000, //< Index Trigger engaged // 0x40000000, // was ovrButton_Menu deprecated in 1.19 since // touch now uses ovrButton_Enter for that (likely never used) 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_ThumbRest = 0x00001000, // Thumb Rest 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), // 1 << 3 was ovrControllerType_Headset ovrControllerType_Gamepad = (1 << 4), //< Xbox in CAPI ovrControllerType_Hand = (1 << 5), ovrControllerType_TrackedKeyboard = (1 << 6), // GoCompatibility needs a way to get the full controller data even on low VrApi versions // where ovrControllerType_TrackedRemote would return more limited structures. ovr_controllerType_TrackedRemote_CurrentAPIVersion = (1 << 29), ovrControllerType_GenericDevice = (1 << 30), // For prototyping of generic devices until specific needs are developed 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 // = 0x00000020, //< was // ovrControllerCaps_ModelDeprecatedOculusQuest removed in 1.21 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 // = 0x00000100 //< was // ovrControllerCaps_ModelGearVRPlus removed in 1.19 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; //----------------------------------------------------------------- // Tracked Remote Capabilities //----------------------------------------------------------------- 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 ovrInputGamepadCapabilities_ { ovrInputCapabilityHeader Header; uint32_t ControllerCapabilities; uint32_t ButtonCapabilities; // Reserved for future use. uint64_t Reserved[20]; } ovrInputGamepadCapabilities; #define VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH 20 typedefstruct ovrInputGenericDeviceCapabilities_ { ovrInputCapabilityHeader Header; uint32_t ControllerCapabilities; // specific information we may not want to expose to third party apps? int32_t ModelId; int32_t Version; char ManufacturerName[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char ProductName[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char RevisionName[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char SerialNumber[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char Extra[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; // Reserved for future use. uint64_t Reserved[20]; } ovrInputGenericDeviceCapabilities; typedefstruct ovrInputTrackedKeyboardCapabilities_ { ovrInputCapabilityHeader Header; uint32_t ControllerCapabilities; // specific information we may not want to expose to third party apps? int32_t ModelId; int32_t Version; char ManufacturerName[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char ProductName[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char RevisionName[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char SerialNumber[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; char Extra[VRAPI_GENERIC_DEVICE_CAPABILITIES_STRING_LENGTH]; // Reserved for future use. uint64_t Reserved[20]; } ovrInputTrackedKeyboardCapabilities; 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; uint32_t Touches; uint32_t Reserved5a; // Analog values from -1.0 - 1.0 // 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; typedefenum ovrInputStateType_ { ovrInputStateType_InputStateHeader2 } ovrInputStateType; typedefstruct ovrInputStateHeader2_ { // Type of structure ovrInputStateType Type; // Type of controller ovrControllerType ControllerType; // System time when the controller state was last updated. double TimeInSeconds; } ovrInputStateHeader2; typedefstruct ovrInputStateTrackedRemote2_ { ovrInputStateHeader2 Header; // Values for buttons described by ovrButton. uint32_t Buttons; // Finger contact status for trackpad // true = finger is on trackpad, false = finger is off trackpad uint32_t TrackpadStatus; // X and Y coordinates of the Trackpad ovrVector2f TrackpadPosition; // The percentage of max battery charge remaining. uint8_t BatteryPercentRemaining; // Increments every time the remote is recentered. If this changes, the application may need // to adjust its arm model accordingly. uint8_t RecenterCount; // Reserved for future use. uint16_t Reserved; // Analog value from 0.0 - 1.0 of the pull of the Index Trigger float IndexTrigger; // Analog value from 0.0 - 1.0 of the pull of the Grip Trigger float GripTrigger; // Reserved for future use. uint64_t Reserved2; } ovrInputStateTrackedRemote2; 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; typedefstruct ovrInputStateGenericDevice_ { ovrInputStateHeader Header; // Reserved for future use. uint64_t Reserved[20]; } ovrInputStateGenericDevice; typedefstruct ovrInputStateTrackedKeyboard_ { ovrInputStateHeader Header; // Reserved for future use. uint64_t Reserved[20]; } ovrInputStateTrackedKeyboard; //----------------------------------------------------------------- // Hand tracking //----------------------------------------------------------------- //----------------------------------------------------------------- // Hand capabilities typedefenum ovrHandCapabilities_ { ovrHandCaps_LeftHand = (1 << 0), // if set, this is the left hand ovrHandCaps_RightHand = (1 << 1), // if set, this is the right hand ovrHandCaps_EnumSize = 0x7fffffff } ovrHandCapabilities; typedefenum ovrHandStateCapabilities_ { ovrHandStateCaps_PinchIndex = (1 << 0), // if set, index finger pinch is supported ovrHandStateCaps_PinchMiddle = (1 << 1), // if set, middle finger pinch is supported ovrHandStateCaps_PinchRing = (1 << 2), // if set, ring finger pinch is supported ovrHandStateCaps_PinchPinky = (1 << 3), // if set, pinky finger pinch is supported ovrHandStateCaps_EnumSize = 0x7fffffff } ovrHandStateCapabilities; typedefstruct ovrInputHandCapabilities_ { ovrInputCapabilityHeader Header; // Mask of hand capabilities described by ovrHandCapabilities uint32_t HandCapabilities; // Mask of hand state capabilities described by ovrInputHandStateCapabilities uint32_t StateCapabilities; } ovrInputHandCapabilities; typedefenum ovrHandTrackingStatus_ { ovrHandTrackingStatus_Untracked = 0, // not tracked ovrHandTrackingStatus_Tracked = 1, // tracked ovrHandTrackingStatus_EnumSize = 0x7fffffff } ovrHandTrackingStatus; //----------------------------------------------------------------- // Hand state typedefenum ovrHandFingers_ { ovrHandFinger_Thumb = 0, ovrHandFinger_Index = 1, ovrHandFinger_Middle = 2, ovrHandFinger_Ring = 3, ovrHandFinger_Pinky = 4, ovrHandFinger_Max, ovrHandFinger_EnumSize = 0x7fffffff } ovrHandFingers; typedefenum ovrHandPinchStrength_ { ovrHandPinchStrength_Index = 0, // hand is in the index finger pinch state ovrHandPinchStrength_Middle = 1, // hand is in the middle finger pinch state ovrHandPinchStrength_Ring = 2, // hand is in the ring finger pinch state ovrHandPinchStrength_Pinky = 3, // hand is in the pinky finger pinch state ovrHandPinchStrength_Max = 4, ovrHandPinchStrength_EnumSize = 0x7fffffff } ovrHandPinchStrength; typedef int16_t ovrVertexIndex; typedefenum ovrHandBone_ { ovrHandBone_Invalid = -1, ovrHandBone_WristRoot = 0, // root frame of the hand, where the wrist is located ovrHandBone_ForearmStub = 1, // frame for user's forearm ovrHandBone_Thumb0 = 2, // thumb trapezium bone ovrHandBone_Thumb1 = 3, // thumb metacarpal bone ovrHandBone_Thumb2 = 4, // thumb proximal phalange bone ovrHandBone_Thumb3 = 5, // thumb distal phalange bone ovrHandBone_Index1 = 6, // index proximal phalange bone ovrHandBone_Index2 = 7, // index intermediate phalange bone ovrHandBone_Index3 = 8, // index distal phalange bone ovrHandBone_Middle1 = 9, // middle proximal phalange bone ovrHandBone_Middle2 = 10, // middle intermediate phalange bone ovrHandBone_Middle3 = 11, // middle distal phalange bone ovrHandBone_Ring1 = 12, // ring proximal phalange bone ovrHandBone_Ring2 = 13, // ring intermediate phalange bone ovrHandBone_Ring3 = 14, // ring distal phalange bone ovrHandBone_Pinky0 = 15, // pinky metacarpal bone ovrHandBone_Pinky1 = 16, // pinky proximal phalange bone ovrHandBone_Pinky2 = 17, // pinky intermediate phalange bone ovrHandBone_Pinky3 = 18, // pinky distal phalange bone ovrHandBone_ThumbMetacarpal = 2, // THIS ENUM NAME IS INCORRECT, this is really the thumb trapezium bone! ovrHandBone_ThumbProximal = 3, // THIS ENUM NAME IS INCORRECT, this is really the thumb metacarpal bone! ovrHandBone_ThumbIntermediate = 4, // THIS ENUM NAME IS INCORRECT, this is really the thumb proximal phalange bone! ovrHandBone_ThumbDistal = 5, // thumb distal phalange bone. ovrHandBone_IndexProximal = 6, // index proximal phalange bone ovrHandBone_IndexIntermediate = 7, // index intermediate phalange bone ovrHandBone_IndexDistal = 8, // index distal phalange bone ovrHandBone_MiddleProximal = 9, // middle proximal phalange bone ovrHandBone_MiddleIntermediate = 10, // middle intermediate phalange bone ovrHandBone_MiddleDistal = 11, // middle distal phalange bone ovrHandBone_RingProximal = 12, // ring proximal phalange bone ovrHandBone_RingIntermediate = 13, // ring intermediate phalange bone ovrHandBone_RingDistal = 14, // ring distal phalange bone ovrHandBone_PinkyMetacarpal = 15, // pinky metacarpal phalange bone ovrHandBone_PinkyProximal = 16, // pinky proximal phalange bone ovrHandBone_PinkyIntermediate = 17, // pinky intermediate phalange bone ovrHandBone_PinkyDistal = 18, // pinky distal phalange bone ovrHandBone_MaxSkinnable = 19, // Bone tips are position only. They are not used for skinning but useful for hit-testing. // NOTE: ovrHandBone_ThumbTip == ovrHandBone_MaxSkinnable since the extended tips need to be // contiguous ovrHandBone_ThumbTip = ovrHandBone_MaxSkinnable + 0, // tip of the thumb ovrHandBone_IndexTip = ovrHandBone_MaxSkinnable + 1, // tip of the index finger ovrHandBone_MiddleTip = ovrHandBone_MaxSkinnable + 2, // tip of the middle finger ovrHandBone_RingTip = ovrHandBone_MaxSkinnable + 3, // tip of the ring finger ovrHandBone_PinkyTip = ovrHandBone_MaxSkinnable + 4, // tip of the pinky ovrHandBone_Max = ovrHandBone_MaxSkinnable + 5, ovrHandBone_EnumSize = 0x7fff } ovrHandBone; typedef int16_t ovrHandBoneIndex; typedefenum ovrConfidence_ { ovrConfidence_LOW = 0x00000000, ovrConfidence_HIGH = 0x3f800000 } ovrConfidence; typedefenum ovrHandVersion_ { ovrHandVersion_1 = 0xdf000001, ovrHandVersion_1_RR = 0xdf300001, ovrHandVersion_EnumSize = 0x7fffffff } ovrHandVersion; // ovrBoneCapsule // _---_ // -" "- // / \ // |----A----| // | | | // | | | // | |-r->| // | | | // | | | // |----B----| // \ / // -. .- // '---' typedefstruct ovrBoneCapsule_ { // Index of the bone this capsule is on. ovrHandBoneIndex BoneIndex; // Points at either end of the cylinder inscribed in the capsule. Also the center points for // spheres at either end of the capsule. Points A and B in the diagram above. ovrVector3f Points[2]; // The radius of the capsule cylinder and of the half-sphere caps on the ends of the capsule. float Radius; } ovrBoneCapsule; typedefenum ovrHandConstants_ { ovrHand_MaxVertices = 3000, ovrHand_MaxIndices = ovrHand_MaxVertices * 6, ovrHand_MaxFingers = ovrHandFinger_Max, ovrHand_MaxPinchStrengths = ovrHandPinchStrength_Max, ovrHand_MaxSkinnableBones = ovrHandBone_MaxSkinnable, ovrHand_MaxBones = ovrHandBone_Max, ovrHand_MaxCapsules = 19, ovrHand_MaxConstraints = 22, ovrHand_MaxDoFPerBone = 2, ovrHand_MaxConstraintIndices = ovrHand_MaxBones * ovrHand_MaxDoFPerBone, ovrHand_EnumSize = 0x7fffffff } ovrHandConstants; typedefenum ovrInputStateHandStatus_ { ovrInputStateHandStatus_PointerValid = (1 << 1), // if this is set the PointerPose and PinchStrength contain valid data, otherwise // they should not be used. ovrInputStateHandStatus_IndexPinching = (1 << 2), // if this is set the pinch gesture for that finger is on ovrInputStateHandStatus_MiddlePinching = (1 << 3), // if this is set the pinch gesture for that finger is on ovrInputStateHandStatus_RingPinching = (1 << 4), // if this is set the pinch gesture for that finger is on ovrInputStateHandStatus_PinkyPinching = (1 << 5), // if this is set the pinch gesture for that finger is on ovrInputStateHandStatus_SystemGestureProcessing = (1 << 6), // if this is set the hand is currently processing a system gesture ovrInputStateHandStatus_EnumSize = 0x7fffffff } ovrInputStateHandStatus; // Pass this structure to vrapi_GetCurrentInputState() with a device id for a hand to get the // current, second-order state of the hand. typedefstruct ovrInputStateHand_ { ovrInputStateHeader Header; // For each pinch type, indicates how far the fingers are into that pinch state. Range 0.0 // to 1.0, where 1.0 is fully pinching. Indexable via the ovrHandPinchStrength enums. float PinchStrength[ovrHandPinchStrength_Max]; // World space position and orientation of the pointer attached to the hand. This describes // a pointing ray useful for UI interactions. // Note that the pointer pose is not valid unless the ovrInputStateHandStatus_PointerValid flag // is set in the InputStateStatus field. ovrPosef PointerPose; // Status flags for this hand's input state. Mask of ovrInputStateHandStatus flags. uint32_t InputStateStatus; } ovrInputStateHand; //----------------------------------------------------------------- // Hand pose // Header for all hand pose structures. typedefstruct ovrHandPoseHeader_ { // The version number of the Pose structure. // When requesting a pose with vrapi_GetHandPose this MUST be set to the proper version. // If this is not set to a known version, or if the version it is set to is no longer // supported for the current SDK, ovr_GetHand* functions will return ovrError_InvalidParameter. ovrHandVersion Version; double Reserved; } ovrHandPoseHeader; // Pass this structure to vrapi_GetHandPose() to get the pose of the hand at a particular time. typedefstruct ovrHandPose_ { ovrHandPoseHeader Header; // Status of tracking for this pose. This is not a bit field, but an exclusive state. ovrHandTrackingStatus Status; // Root pose of the hand in world space. Not to be confused with the root bone's transform. // The root bone can still be offset from this by the skeleton's rest pose. ovrPosef RootPose; // Current rotation of each bone. ovrQuatf BoneRotations[ovrHandBone_Max]; // Time stamp for the pose that was requested in global system time. double RequestedTimeStamp; // Time stamp of the captured sample that the pose was extrapolated from. double SampleTimeStamp; // Tracking confidence. // This is the amount of confidence that the system has that the entire hand pose is correct. ovrConfidence HandConfidence; // Scale of the hand relative to the original hand model. This value may change at any time // based on the size of the hand being tracked. The default is 1.0. float HandScale; // Per-finger tracking confidence. // This is the amount of confidence the system has that the individual finger poses are correct. ovrConfidence FingerConfidences[ovrHandFinger_Max]; } ovrHandPose; typedefstruct ovrHandPoseInternalFields_ { // Current angle of each joint. // To get the current constraint angle for a bone use: // const ovrHandBone boneIndex = ovrHandBone_IndexDistal; // const int firstConstraintIndex = skeleton.BoneInfos[boneIndex].ConstraintIndices[0]; // const float firstConstraintAngle = handPose.ConstraintAngles[firstConstraintIndex]; // const int secondConstraintIndex = skeleton.BoneInfos[boneIndex].ConstraintIndices[1]; // note than a constraint index may be < 0 if there are less than 2 constraints for a bone. // const float secondConstraintAngle = ( secondConstraintIndex >= 0 ) ? // handPose.ConstraintAngles[secondConstraintIndex] : 0.0f; float ConstraintAngles[ovrHand_MaxConstraints]; // Raw full-hand confidence float HandConfidenceRaw; // Raw per-finger confidence float FingerConfidencesRaw[ovrHandFinger_Max]; } ovrHandPoseInternalFields; typedefstruct ovrHandPoseRR_ { ovrHandPose PublicHandPose; ovrHandPoseInternalFields Internal; } ovrHandPoseRR; OVR_VRAPI_EXPORT ovrResult vrapi_HandGetPose( ovrMobile* ovr, const ovrDeviceID deviceID, constdouble absTimeInSeconds, ovrHandPoseHeader* header); OVR_VRAPI_EXPORT ovrResult vrapi_GetHandPose( ovrMobile* ovr, const ovrDeviceID deviceID, constdouble absTimeInSeconds, ovrHandPoseHeader* header); //----------------------------------------------------------------- // Hand skeleton // Header for all mesh structures. typedefstruct ovrHandSkeletonHeader_ { // The version number of the skeleton structure. ovrHandVersion Version; } ovrHandSkeletonHeader; typedefstruct ovrHandSkeleton_V1_ { // Version of the mesh structure. ovrHandSkeletonHeader Header; // The number of bones in this skeleton. uint32_t NumBones; // The number of capsules on this skeleton. uint32_t NumCapsules; // reserved for future use uint32_t Reserved[5]; // An array of count NumBones transforms for each bone in local (parent) space. ovrPosef BonePoses[ovrHand_MaxBones]; // An array of count NumBones indicating the parent bone index for each bone. ovrHandBoneIndex BoneParentIndices[ovrHand_MaxBones]; // An array of count NumCapsules ovrHandCapsules. Note that the number of capsules // is not necessarily the same as the number of bones. ovrBoneCapsule Capsules[ovrHand_MaxCapsules]; } ovrHandSkeleton; typedefstruct ovrFingerConstraint_ { // The rotation axis of the constraint. ovrVector3f Axis; // The min and max angular limits of the constraint. ovrVector2f AngleLimits; } ovrFingerConstraint; typedefstruct ovrHandSkeletonInternalFields_ { // Internal only. An array of count ovrHandConstraints_Max ovrFingerConstraints. ovrFingerConstraint Constraints[ovrHand_MaxConstraints]; // Internal only: indices of joint constraints for each bone. // We do not put these in BoneInfos so that we can do a direct memcopy of the BoneInfos // array to the public structure, and more easily static_assert if the public and // internal bone infos arrays are out of sync. // // There are ovrHand_MaxDoFPerBone joint constraints per bone, so to the layout in the // array is: // [0] = bone 0, constraint 0 // [1] = bone 0, constraint 1 // [2] = bone 1, constraint 0 // [3] = bone 1, constraint 1 // ... // [n * ovrHand_MaxDofPerBone + i] = bone n, constraint i // // To find the index of the second constraint for the third bone: // // const int32_t boneIndex = 3; // const int32_t constraintIndex = 1; // const int16_t constraintIndex = ConstraintIndices[ boneIndex * ovrHand_MaxDoFPerBone + // constraintIndex] or // int16_t ConstraintIndices[ovrHand_MaxConstraintIndices]; } ovrHandSkeletonInternalFields; typedefstruct ovrHandSkeleton_V1_RR_ { ovrHandSkeleton PublicSkeleton; ovrHandSkeletonInternalFields Internal; } ovrHandSkeletonRR; OVR_VRAPI_EXPORT ovrResult vrapi_HandGetSkeleton(ovrMobile* ovr, const ovrDeviceID deviceID, ovrHandSkeletonHeader* header); OVR_VRAPI_EXPORT ovrResult vrapi_GetSkeletonForHand( ovrMobile* ovr, const ovrHandedness handedness, ovrHandSkeletonHeader* header); OVR_VRAPI_EXPORT ovrResult vrapi_GetHandSkeleton( ovrMobile* ovr, const ovrHandedness handedness, ovrHandSkeletonHeader* header); //----------------------------------------------------------------- // Hand mesh // Header for all mesh structures. typedefstruct ovrHandMeshHeader_ { // The version number of the mesh structure. ovrHandVersion Version; } ovrHandMeshHeader; typedefstruct ovrHandMesh_V1_ { // All mesh structures will start with this header and the version. ovrHandMeshHeader Header; // Number of unique vertices in the mesh. uint32_t NumVertices; // Number of unique indices in the mesh. uint32_t NumIndices; // Reserved for future use uint32_t Reserved[13]; // An array of count NumVertices positions for each vertex. ovrVector3f VertexPositions[ovrHand_MaxVertices]; // An array of count NumIndices of vertex indices specifying triangles that make up the mesh. ovrVertexIndex Indices[ovrHand_MaxIndices]; // An array of count NumVertices of normals for each vertex. ovrVector3f VertexNormals[ovrHand_MaxVertices]; // An array of count NumVertices of texture coordinates for each vertex. ovrVector2f VertexUV0[ovrHand_MaxVertices]; // An array of count NumVertices of blend indices for each of the bones that each vertex is // weighted to. Always valid. An index of < 0 means no blend weight. ovrVector4s BlendIndices[ovrHand_MaxVertices]; // An array of count NumVertices of weights for each of the bones affecting each vertex. ovrVector4f BlendWeights[ovrHand_MaxVertices]; } ovrHandMesh; OVR_VRAPI_EXPORT ovrResult vrapi_HandGetMesh(ovrMobile* ovr, const ovrDeviceID deviceID, ovrHandMeshHeader* header); OVR_VRAPI_EXPORT ovrResult vrapi_GetMeshForHand(ovrMobile* ovr, const ovrHandedness handedness, ovrHandMeshHeader* header); OVR_VRAPI_EXPORT ovrResult vrapi_GetHandMesh(ovrMobile* ovr, const ovrHandedness handedness, ovrHandMeshHeader* header); // Tracked Object Support #define VRAPI_TRACKED_OBJECT_NAME_LENGTH 20 typedefstruct TrackedObjectInfo_ { // A unique identifier for this specific object type uint64_t ObjectTypeID; // A localized, human-readable name for the object. char Name[VRAPI_TRACKED_OBJECT_NAME_LENGTH]; // The physical dimensions of this object in meters {x-axis, y-axis, z-axis} ovrVector3f Dimensions; } TrackedObjectInfo; // named _V1 for iteration purposes. final api's will not have that. OVR_VRAPI_EXPORT ovrResult vrapi_EnumerateSupportedTrackedObjectTypes_V1( ovrMobile* ovr, const uint32_t index, TrackedObjectInfo* objectInfo); OVR_VRAPI_EXPORT ovrResult vrapi_StartTrackingObjectType_V1(ovrMobile* ovr, const uint64_t type); OVR_VRAPI_EXPORT ovrResult vrapi_StopTrackingObjectType_V1(ovrMobile* ovr, const uint64_t type); // END Tracked Object Support #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_SetHapticVibrationBufferChannel( ovrMobile* ovr, const ovrDeviceID deviceID, const ovrHapticBuffer* hapticBuffer, const uint8_t channel); OVR_VRAPI_EXPORT ovrResult vrapi_GetCurrentInputState( ovrMobile* ovr, const ovrDeviceID deviceID, ovrInputStateHeader* inputState); OVR_VRAPI_DEPRECATED(OVR_VRAPI_EXPORT ovrResult vrapi_GetCurrentInputState2( ovrMobile* ovr, const ovrDeviceID deviceID, ovrInputStateHeader2* 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