This repository was archived by the owner on Aug 4, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -155,4 +155,22 @@ VRControllerHost::VRControllerHost(VRDeviceType aType)
155
155
VRControllerHost::~VRControllerHost ()
156
156
{
157
157
MOZ_COUNT_DTOR (VRControllerHost);
158
+ }
159
+
160
+ const VRControllerInfo&
161
+ VRControllerHost::GetControllerInfo () const
162
+ {
163
+ return mControllerInfo ;
164
+ }
165
+
166
+ void
167
+ VRControllerHost::SetIndex (uint32_t aIndex)
168
+ {
169
+ mIndex = aIndex;
170
+ }
171
+
172
+ uint32_t
173
+ VRControllerHost::GetIndex ()
174
+ {
175
+ return mIndex ;
158
176
}
Original file line number Diff line number Diff line change @@ -87,13 +87,17 @@ class VRControllerHost {
87
87
public:
88
88
NS_INLINE_DECL_THREADSAFE_REFCOUNTING (VRControllerHost)
89
89
90
- const VRControllerInfo& GetControllerInfo () const { return mControllerInfo ; }
90
+ const VRControllerInfo& GetControllerInfo () const ;
91
+ void SetIndex (uint32_t aIndex);
92
+ uint32_t GetIndex ();
91
93
92
94
protected:
93
95
explicit VRControllerHost (VRDeviceType aType);
94
96
virtual ~VRControllerHost ();
95
97
96
98
VRControllerInfo mControllerInfo ;
99
+ // The controller index in VRControllerManager.
100
+ uint32_t mIndex ;
97
101
};
98
102
99
103
} // namespace gfx
Original file line number Diff line number Diff line change @@ -455,6 +455,18 @@ VRControllerOpenVR::~VRControllerOpenVR()
455
455
MOZ_COUNT_DTOR_INHERITED (VRControllerOpenVR, VRControllerHost);
456
456
}
457
457
458
+ void
459
+ VRControllerOpenVR::SetTrackedIndex (uint32_t aTrackedIndex)
460
+ {
461
+ mTrackedIndex = aTrackedIndex;
462
+ }
463
+
464
+ uint32_t
465
+ VRControllerOpenVR::GetTrackedIndex ()
466
+ {
467
+ return mTrackedIndex ;
468
+ }
469
+
458
470
VRControllerManagerOpenVR::VRControllerManagerOpenVR ()
459
471
: mOpenVRInstalled(false ), mVRSystem(nullptr )
460
472
{
@@ -573,6 +585,8 @@ VRControllerManagerOpenVR::ScanForDevices()
573
585
}
574
586
575
587
RefPtr<VRControllerOpenVR> openVRController = new VRControllerOpenVR ();
588
+ openVRController->SetIndex (mControllerCount );
589
+ openVRController->SetTrackedIndex (trackedDevice);
576
590
mOpenVRController .AppendElement (openVRController);
577
591
578
592
// Not already present, add it.
Original file line number Diff line number Diff line change @@ -92,9 +92,14 @@ class VRControllerOpenVR : public VRControllerHost
92
92
{
93
93
public:
94
94
explicit VRControllerOpenVR ();
95
+ void SetTrackedIndex (uint32_t aTrackedIndex);
96
+ uint32_t GetTrackedIndex ();
95
97
96
98
protected:
97
99
virtual ~VRControllerOpenVR ();
100
+
101
+ // The index of tracked devices from vr::IVRSystem.
102
+ uint32_t mTrackedIndex ;
98
103
};
99
104
100
105
} // namespace impl
You can’t perform that action at this time.
0 commit comments