Skip to content

Commit 6f5e8ea

Browse files
author
lawwong
committed
Now OculusVRModule support submodule
1 parent 0de89dd commit 6f5e8ea

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Assets/HTC.UnityPlugin/VRModule/Modules/OculusVRModule.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ private bool IsHand()
264264
private string m_systemHeadsetName;
265265
private OVRPlugin.TrackingOrigin m_prevTrackingSpace;
266266

267+
private VRModule.SubmoduleBase.Collection submodules = new VRModule.SubmoduleBase.Collection();
268+
269+
public override uint reservedDeviceIndex { get { return (uint)(s_index2node.Length - 1); } }
270+
267271
#if VIU_OCULUSVR_20_0_OR_NEWER
268272
private struct SkeletonData
269273
{
@@ -366,12 +370,16 @@ public override bool ShouldActiveModule()
366370
return XRSettings.enabled && XRSettings.loadedDeviceName == "Oculus";
367371
#endif
368372
#pragma warning restore 0162
373+
374+
submodules.ActivateAllModules();
369375
}
370376

371377
public override void OnActivated()
372378
{
373379
Debug.Log("OculusVRModule activated.");
374380

381+
submodules.DeactivateAllModules();
382+
375383
m_systemHeadsetType = OVRPlugin.GetSystemHeadsetType();
376384
m_systemHeadsetName = m_systemHeadsetType.ToString();
377385
m_prevTrackingSpace = OVRPlugin.GetTrackingOriginType();
@@ -480,7 +488,7 @@ public override void BeforeRenderUpdate()
480488
{
481489
FlushDeviceState();
482490

483-
for (uint i = 0u, imax = GetDeviceStateLength(); i < imax; ++i)
491+
for (uint i = 0u, imax = (uint)s_index2node.Length; i < imax; ++i)
484492
{
485493
var node = s_index2node[i];
486494
var deviceClass = s_index2class[i];
@@ -840,6 +848,10 @@ public override void BeforeRenderUpdate()
840848
//}
841849
}
842850

851+
submodules.UpdateAllModulesActivity();
852+
submodules.UpdateModulesDeviceConnectionAndPoses();
853+
submodules.UpdateModulesDeviceInput();
854+
843855
ProcessConnectedDeviceChanged();
844856
ProcessDevicePoseChanged();
845857
ProcessDeviceInputChanged();

0 commit comments

Comments
 (0)