Skip to content

Commit

Permalink
create LocalFloorSpace (#2105)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast authored Dec 14, 2024
1 parent 8887411 commit 5aac73d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion Platforms/XR/.BlazorGL/ConcreteXRDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
Expand Down Expand Up @@ -36,6 +37,7 @@ internal class ConcreteXRDevice : XRDeviceStrategy
XRSession _xrsession;
XRReferenceSpace _localSpace;
XRReferenceSpace _localFloorSpace;
Task<XRReferenceSpace> _createLocalFloorSpaceTask;
XRWebGLLayer _glLayer;

int _xrAnimationHandle;
Expand Down Expand Up @@ -350,11 +352,35 @@ public override void TrackFloorLevelAsync(bool enable)
{
if (enable == true)
{
throw new NotImplementedException();
if (_createLocalFloorSpaceTask == null && _localFloorSpace == null)
{
try
{
_createLocalFloorSpaceTask = _currentXRSession.RequestReferenceSpace("local-floor");
}
catch
{
/* local-floor not supported */
_createLocalFloorSpaceTask = null;
}
}
else
{
if (_createLocalFloorSpaceTask.IsCompleted)
{
if (_createLocalFloorSpaceTask.IsCompletedSuccessfully)
{
_localFloorSpace = _createLocalFloorSpaceTask.Result;
_isTrackFloorLevelEnabled = true;
}
_createLocalFloorSpaceTask = null;
}
}
}
else
{
_isTrackFloorLevelEnabled = enable;
_createLocalFloorSpaceTask = null;
}
}

Expand Down

0 comments on commit 5aac73d

Please sign in to comment.