Enumerations

enum
ovrButton {
ovrButton.ovrButton_A = 0x00000001, ovrButton.ovrButton_B = 0x00000002, ovrButton.ovrButton_RThumb = 0x00000004, ovrButton.ovrButton_RShoulder = 0x00000008, ovrButton.ovrButton_X = 0x00000100, ovrButton.ovrButton_Y = 0x00000200, ovrButton.ovrButton_LThumb = 0x00000400, ovrButton.ovrButton_LShoulder = 0x00000800, ovrButton.ovrButton_Up = 0x00010000, ovrButton.ovrButton_Down = 0x00020000, ovrButton.ovrButton_Left = 0x00040000, ovrButton.ovrButton_Right = 0x00080000, ovrButton.ovrButton_Enter = 0x00100000, ovrButton.ovrButton_Back = 0x00200000, ovrButton.ovrButton_VolUp = 0x00400000, ovrButton.ovrButton_VolDown = 0x00800000, ovrButton.ovrButton_Home = 0x01000000, ovrButton.ovrButton_GripTrigger = 0x04000000, ovrButton.ovrButton_Trigger = 0x20000000, ovrButton.ovrButton_Joystick = 0x80000000, ovrButton.ovrButton_EnumSize = 0x7fffffff
}
Describes button input types.
enum
ovrTouch {
}
Describes touch input types.
enum
ovrControllerType {
}
Specifies which controller is connected; multiple can be connected at once.
enum
ovrDeviceIdType {
}
enum
ovrControllerCapabilties {
ovrControllerCapabilties.ovrControllerCaps_HasOrientationTracking = 0x00000001, ovrControllerCapabilties.ovrControllerCaps_HasPositionTracking = 0x00000002, ovrControllerCapabilties.ovrControllerCaps_LeftHand = 0x00000004, ovrControllerCapabilties.ovrControllerCaps_RightHand = 0x00000008, ovrControllerCapabilties.ovrControllerCaps_ModelOculusGo = 0x00000010, ovrControllerCapabilties.ovrControllerCaps_HasAnalogIndexTrigger = 0x00000040, ovrControllerCapabilties.ovrControllerCaps_HasAnalogGripTrigger = 0x00000080, ovrControllerCapabilties.ovrControllerCaps_HasSimpleHapticVibration = 0x00000200, ovrControllerCapabilties.ovrControllerCaps_HasBufferedHapticVibration = 0x00000400, ovrControllerCapabilties.ovrControllerCaps_ModelGearVR = 0x00000800, ovrControllerCapabilties.ovrControllerCaps_HasTrackpad = 0x00001000, ovrControllerCapabilties.ovrControllerCaps_HasJoystick = 0x00002000, ovrControllerCapabilties.ovrControllerCaps_ModelOculusTouch = 0x00004000, ovrControllerCapabilties.ovrControllerCaps_EnumSize = 0x7fffffff
}
Specifies capabilites of a controller Note that left and right hand are non-exclusive (a two-handed controller could set both)
enum
ovrHandCapabilities {
}
enum
ovrHandStateCapabilities {
}
enum
ovrHandTrackingStatus {
}
enum
ovrHandFingers {
}
enum
ovrHandPinchStrength {
}
enum
ovrHandBone {
ovrHandBone.ovrHandBone_Invalid = -1, ovrHandBone.ovrHandBone_WristRoot = 0, ovrHandBone.ovrHandBone_ForearmStub = 1, ovrHandBone.ovrHandBone_Thumb0 = 2, ovrHandBone.ovrHandBone_Thumb1 = 3, ovrHandBone.ovrHandBone_Thumb2 = 4, ovrHandBone.ovrHandBone_Thumb3 = 5, ovrHandBone.ovrHandBone_Index1 = 6, ovrHandBone.ovrHandBone_Index2 = 7, ovrHandBone.ovrHandBone_Index3 = 8, ovrHandBone.ovrHandBone_Middle1 = 9, ovrHandBone.ovrHandBone_Middle2 = 10, ovrHandBone.ovrHandBone_Middle3 = 11, ovrHandBone.ovrHandBone_Ring1 = 12, ovrHandBone.ovrHandBone_Ring2 = 13, ovrHandBone.ovrHandBone_Ring3 = 14, ovrHandBone.ovrHandBone_Pinky0 = 15, ovrHandBone.ovrHandBone_Pinky1 = 16, ovrHandBone.ovrHandBone_Pinky2 = 17, ovrHandBone.ovrHandBone_Pinky3 = 18, ovrHandBone.ovrHandBone_ThumbMetacarpal = 2, ovrHandBone.ovrHandBone_ThumbProximal = 3, ovrHandBone.ovrHandBone_ThumbIntermediate = 4, ovrHandBone.ovrHandBone_ThumbDistal = 5, ovrHandBone.ovrHandBone_IndexProximal = 6, ovrHandBone.ovrHandBone_IndexIntermediate = 7, ovrHandBone.ovrHandBone_IndexDistal = 8, ovrHandBone.ovrHandBone_MiddleProximal = 9, ovrHandBone.ovrHandBone_MiddleIntermediate = 10, ovrHandBone.ovrHandBone_MiddleDistal = 11, ovrHandBone.ovrHandBone_RingProximal = 12, ovrHandBone.ovrHandBone_RingIntermediate = 13, ovrHandBone.ovrHandBone_RingDistal = 14, ovrHandBone.ovrHandBone_PinkyMetacarpal = 15, ovrHandBone.ovrHandBone_PinkyProximal = 16, ovrHandBone.ovrHandBone_PinkyIntermediate = 17, ovrHandBone.ovrHandBone_PinkyDistal = 18, ovrHandBone.ovrHandBone_MaxSkinnable = 19, ovrHandBone.ovrHandBone_ThumbTip = ovrHandBone_MaxSkinnable + 0, ovrHandBone.ovrHandBone_IndexTip = ovrHandBone_MaxSkinnable + 1, ovrHandBone.ovrHandBone_MiddleTip = ovrHandBone_MaxSkinnable + 2, ovrHandBone.ovrHandBone_RingTip = ovrHandBone_MaxSkinnable + 3, ovrHandBone.ovrHandBone_PinkyTip = ovrHandBone_MaxSkinnable + 4, ovrHandBone.ovrHandBone_Max = ovrHandBone_MaxSkinnable + 5, ovrHandBone.ovrHandBone_EnumSize = 0x7fff
}
enum
ovrConfidence {
}
enum
ovrHandVersion {
}
Unified version struct.
enum
ovrHandConstants {
}
enum
ovrInputStateHandStatus {
}

Typedefs

uint32_t
int16_t
int16_t

Functions

ovrResult
vrapi_GetHandPose ( ovrMobile * ovr, const ovrDeviceID deviceID, const double absTimeInSeconds, ovrHandPoseHeader * header )
ovrResult
ovrResult
vrapi_GetHandMesh ( ovrMobile * ovr, const ovrHandedness handedness, ovrHandMeshHeader * header )
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
vrapi_SetRemoteEmulation ( ovrMobile * ovr, const bool emulationOn )
Enable or disable emulation for the GearVR Controller.

Enumeration Type Documentation

enum VrApi_Input.h.ovrButton
Describes button input types.
Enumerator
ovrButton_A= 0x00000001
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
ovrButton_Back= 0x00200000
ovrButton_VolUp
ovrButton_VolDown= 0x00800000
ovrButton_Home= 0x01000000
ovrButton_GripTrigger
ovrButton_Trigger
ovrButton_Joystick
ovrButton_EnumSize= 0x7fffffff
enum VrApi_Input.h.ovrTouch
Describes touch input types.
Enumerator
ovrTouch_A= 0x00000001
ovrTouch_B= 0x00000002
ovrTouch_X= 0x00000004
ovrTouch_Y= 0x00000008
ovrTouch_TrackPad= 0x00000010
ovrTouch_Joystick= 0x00000020
ovrTouch_IndexTrigger= 0x00000040
ovrTouch_ThumbUp= 0x00000100
ovrTouch_IndexPointing= 0x00000200
ovrTouch_BaseState= 0x00000300
ovrTouch_LThumb= 0x00000400
ovrTouch_RThumb= 0x00000800
OvrTouch_ThumbRest
ovrTouch_EnumSize
enum VrApi_Input.h.ovrControllerType
Specifies which controller is connected; multiple can be connected at once.
Enumerator
ovrControllerType_None= 0
ovrControllerType_Reserved0= (1 << 0)
ovrControllerType_Reserved1= (1 << 1)
ovrControllerType_TrackedRemote= (1 << 2)
ovrControllerType_Gamepad
ovrControllerType_Hand= (1 << 5)
ovrControllerType_TrackedKeyboard
ovr_controllerType_TrackedRemote_CurrentAPIVersion= (1 << 29)
ovrControllerType_GenericDevice= (1 << 30)
ovrControllerType_EnumSize
enum VrApi_Input.h.ovrDeviceIdType
Enumerator
ovrDeviceIdType_Invalid= 0x7fffffff
enum VrApi_Input.h.ovrControllerCapabilties
Specifies capabilites of a controller Note that left and right hand are non-exclusive (a two-handed controller could set both)
Enumerator
ovrControllerCaps_HasOrientationTracking= 0x00000001
ovrControllerCaps_HasPositionTracking= 0x00000002
ovrControllerCaps_LeftHand= 0x00000004
ovrControllerCaps_RightHand= 0x00000008
ovrControllerCaps_ModelOculusGo= 0x00000010
ovrControllerCaps_HasAnalogIndexTrigger
ovrControllerCaps_HasAnalogGripTrigger= 0x00000080
ovrControllerCaps_HasSimpleHapticVibration
ovrControllerCaps_HasBufferedHapticVibration= 0x00000400
ovrControllerCaps_ModelGearVR= 0x00000800
ovrControllerCaps_HasTrackpad= 0x00001000
ovrControllerCaps_HasJoystick= 0x00002000
ovrControllerCaps_ModelOculusTouch= 0x00004000
ovrControllerCaps_EnumSize
enum VrApi_Input.h.ovrHandCapabilities
Enumerator
ovrHandCaps_LeftHand= (1 << 0)
ovrHandCaps_RightHand= (1 << 1)
ovrHandCaps_EnumSize= 0x7fffffff
enum VrApi_Input.h.ovrHandStateCapabilities
Enumerator
ovrHandStateCaps_PinchIndex= (1 << 0)
ovrHandStateCaps_PinchMiddle= (1 << 1)
ovrHandStateCaps_PinchRing= (1 << 2)
ovrHandStateCaps_PinchPinky= (1 << 3)
ovrHandStateCaps_EnumSize= 0x7fffffff
enum VrApi_Input.h.ovrHandTrackingStatus
Enumerator
ovrHandTrackingStatus_Untracked= 0
ovrHandTrackingStatus_Tracked= 1
ovrHandTrackingStatus_EnumSize= 0x7fffffff
enum VrApi_Input.h.ovrHandFingers
Enumerator
ovrHandFinger_Thumb= 0
ovrHandFinger_Index= 1
ovrHandFinger_Middle= 2
ovrHandFinger_Ring= 3
ovrHandFinger_Pinky= 4
ovrHandFinger_Max
ovrHandFinger_EnumSize= 0x7fffffff
enum VrApi_Input.h.ovrHandPinchStrength
Enumerator
ovrHandPinchStrength_Index= 0
ovrHandPinchStrength_Middle= 1
ovrHandPinchStrength_Ring= 2
ovrHandPinchStrength_Pinky= 3
ovrHandPinchStrength_Max= 4
ovrHandPinchStrength_EnumSize= 0x7fffffff
enum VrApi_Input.h.ovrHandBone
Enumerator
ovrHandBone_Invalid= -1
ovrHandBone_WristRoot= 0
ovrHandBone_ForearmStub= 1
ovrHandBone_Thumb0= 2
ovrHandBone_Thumb1= 3
ovrHandBone_Thumb2= 4
ovrHandBone_Thumb3= 5
ovrHandBone_Index1= 6
ovrHandBone_Index2= 7
ovrHandBone_Index3= 8
ovrHandBone_Middle1= 9
ovrHandBone_Middle2= 10
ovrHandBone_Middle3= 11
ovrHandBone_Ring1= 12
ovrHandBone_Ring2= 13
ovrHandBone_Ring3= 14
ovrHandBone_Pinky0= 15
ovrHandBone_Pinky1= 16
ovrHandBone_Pinky2= 17
ovrHandBone_Pinky3= 18
ovrHandBone_ThumbMetacarpal
ovrHandBone_ThumbProximal= 3
ovrHandBone_ThumbIntermediate= 4
ovrHandBone_ThumbDistal= 5
ovrHandBone_IndexProximal= 6
ovrHandBone_IndexIntermediate= 7
ovrHandBone_IndexDistal= 8
ovrHandBone_MiddleProximal= 9
ovrHandBone_MiddleIntermediate= 10
ovrHandBone_MiddleDistal= 11
ovrHandBone_RingProximal= 12
ovrHandBone_RingIntermediate= 13
ovrHandBone_RingDistal= 14
ovrHandBone_PinkyMetacarpal= 15
ovrHandBone_PinkyProximal= 16
ovrHandBone_PinkyIntermediate= 17
ovrHandBone_PinkyDistal= 18
ovrHandBone_MaxSkinnable
ovrHandBone_ThumbTip= ovrHandBone_MaxSkinnable + 0
ovrHandBone_IndexTip= ovrHandBone_MaxSkinnable + 1
ovrHandBone_MiddleTip= ovrHandBone_MaxSkinnable + 2
ovrHandBone_RingTip= ovrHandBone_MaxSkinnable + 3
ovrHandBone_PinkyTip= ovrHandBone_MaxSkinnable + 4
ovrHandBone_Max= ovrHandBone_MaxSkinnable + 5
ovrHandBone_EnumSize= 0x7fff
enum VrApi_Input.h.ovrConfidence
Enumerator
ovrConfidence_LOW= 0x00000000
ovrConfidence_HIGH= 0x3f800000
enum VrApi_Input.h.ovrHandVersion
Unified version struct.
Enumerator
ovrHandVersion_1= 0xdf000001
ovrHandVersion_1_RR
Current.
ovrHandVersion_EnumSize
v1 internal interface for Remote Rendering
enum VrApi_Input.h.ovrHandConstants
Enumerator
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
ovrHand_MaxDoFPerBone= 2
ovrHand_MaxConstraintIndices= ovrHand_MaxBones * ovrHand_MaxDoFPerBone
ovrHand_EnumSize
enum VrApi_Input.h.ovrInputStateHandStatus
Enumerator
ovrInputStateHandStatus_PointerValid= (1 << 1)
ovrInputStateHandStatus_IndexPinching= (1 << 2)
ovrInputStateHandStatus_MiddlePinching= (1 << 3)
ovrInputStateHandStatus_RingPinching= (1 << 4)
ovrInputStateHandStatus_PinkyPinching= (1 << 5)
ovrInputStateHandStatus_SystemGestureProcessing= (1 << 6)
ovrInputStateHandStatus_EnumSize= 0x7fffffff

Typedef Documentation

typedef uint32_t ovrDeviceID ( )
typedef int16_t ovrVertexIndex ( )
typedef int16_t ovrHandBoneIndex ( )

Function Documentation

OVR_VRAPI_EXPORT ovrResult vrapi_GetHandPose ( ovrMobile * ovr, const ovrDeviceID deviceID, const double absTimeInSeconds, ovrHandPoseHeader * header )
OVR_VRAPI_EXPORT ovrResult vrapi_GetHandSkeleton ( ovrMobile * ovr, const ovrHandedness handedness, ovrHandSkeletonHeader * header )
OVR_VRAPI_EXPORT ovrResult vrapi_GetHandMesh ( ovrMobile * ovr, const ovrHandedness handedness, ovrHandMeshHeader * header )
OVR_VRAPI_EXPORT 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.
Stop when ovrResult is < 0
Input: ovrMobile, device index, and a capabilities header The capabilities header does not need to have any fields set before calling. Output: capabilitiesHeader with information for that enumeration index
OVR_VRAPI_EXPORT ovrResult vrapi_GetInputDeviceCapabilities ( ovrMobile * ovr, ovrInputCapabilityHeader * capsHeader )
Returns the capabilities of the input device for the corresponding device ID.
Input: ovr, pointer to a capabilities structure Output: capabilities will be filled with information for the deviceID Example: The Type field of the capabilitiesHeader must be set when calling this function. Normally the capabilitiesHeader is obtained from the vrapi_EnumerateInputDevices API The Type field in the header should match the structure type that is passed.
ovrInputCapabilityHeader capsHeader;
if ( vrapi_EnumerateInputDevices( ovr, deviceIndex, &capsHeader ) >= 0 ) {
    if ( capsHeader.Type == ovrDeviceType_TrackedRemote ) {
        ovrInputTrackedRemoteCapabilities remoteCaps;
        remoteCaps.Header = capsHeader;
        vrapi_GetInputDeviceCapabilities( ovr, &remoteCaps.Header );  
OVR_VRAPI_EXPORT ovrResult vrapi_SetHapticVibrationSimple ( ovrMobile * ovr, const ovrDeviceID deviceID, const float intensity )
Sets the vibration level 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, intensity: 0.0 - 1.0
OVR_VRAPI_EXPORT 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.
OVR_VRAPI_EXPORT ovrResult vrapi_GetCurrentInputState ( ovrMobile * ovr, const ovrDeviceID deviceID, ovrInputStateHeader * inputState )
Returns the current input state for controllers, without positional tracking info.
Input: ovr, deviceID, pointer to a capabilities structure (with Type field set) Output: Upon return the inputState structure will be set to the device's current input state Example: The Type field of the passed ovrInputStateHeader must be set to the type that corresponds to the type of structure being passed. The pointer to the ovrInputStateHeader should be a pointer to a Header field in structure matching the value of the Type field.
ovrInputStateTrackedRemote state; state.Header.Type = ovrControllerType_TrackedRemote; if ( vrapi_GetCurrentInputState( ovr, remoteDeviceID, &state.Header ) >= 0 ) {
OVR_VRAPI_EXPORT 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.
Pass absTime value of 0.0 to request the most recent sensor reading. Input: ovr, device ID, prediction time Output: ovrTracking structure containing the device's predicted tracking state.
OVR_VRAPI_DEPRECATED ( void vrapi_RecenterInputPose )
Can be called from any thread while in VR mode.
Recenters the tracked remote to the current yaw of the headset. Input: ovr, device ID Output: None
OVR_VRAPI_EXPORT ovrResult vrapi_SetRemoteEmulation ( ovrMobile * ovr, const bool emulationOn )
Enable or disable emulation for the GearVR Controller.
Emulation is false by default. If emulationOn == true, then the back button and touch events on the GearVR Controller will be sent through the Android dispatchKeyEvent and dispatchTouchEvent path as if they were from the headset back button and touchpad. Applications that are intentionally enumerating the controller will likely want to turn emulation off in order to differentiate between controller and headset input events.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
52
53
54
55
56
57
58
60
62
63
65
67
68
70
71
72
73
74
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
95
97
98
99
101
102
103
104
105
107
109
110
111
113
114
115
116
117
118
120
121
122
123
124
125
126
129
130
131
133
134
135
138
139
140
141
142
143
144
145
147
148
150
151
152
153
155
156
158
159
160
161
162
163
164
165
166
167
168
169
171
173
174
175
176
177
178
179
180
182
183
184
186
187
189
190
193
194
195
197
198
199
202
204
206
207
208
209
210
212
213
214
216
217
219
220
221
222
223
224
226
227
228
229
230
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
252
253
254
255
256
257
258
259
260
261
262
263
264
265
267
269
271
272
274
275
276
277
278
279
280
281
284
286
287
289
290
291
295
296
297
299
300
303
304
306
307
309
312
314
315
317
318
319
320
322
323
324
325
326
327
328
329
330
331
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
378
380
381
382
384
385
386
387
388
389
390
392
394
395
396
397
398
399
401
402
403
404
405
406
407
408
409
410
411
412
413
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
540
541
542
544
545
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
583
584
585
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
697
699
700
701
702
703
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
784
786
787
788
789
790
791
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
835
836
837
838
840
841
842
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
864
865
866
867
868
875
876
877
878
879
895
896
897
903
904
905
911
912
913
914
915
917
918
919
920
921
923
937
938
939
940
941
955
956
957
958
960
965
966
967
968
969
970
973
974
975
983
984
985
986
987
988
989
/************************************************************************************

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
The documentation for this file was generated from the following file: Include/VrApi_Input.h