// // /*=============================================================================== // // Copyright (C) 2025 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the Phantom.XRMOD.QuestModule.Runtime. // // // // The XR-MOD cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact nswell@phantomsxr.com for licensing requests. // // ===============================================================================*/ using Phantom.XRMOD.ActionNotification.Runtime; using Phantom.XRMOD.Core.Runtime; using UnityEngine.XR.OpenXR.Features.Meta; namespace Phantom.XRMOD.QuestModule.Runtime { /// /// Feature decorator for triggering Meta Quest Scene Capture (Spatial Setup). /// /// Listens for a capture environment notification to request scene capture from the system. /// /// public class MetaQuestSceneCaptureDecorator : BaseMetaQuestFeatureDecorator { /// /// Initializes a new instance of the class. /// /// Subscribes to the "CaptureEnvironment" notification. /// /// public MetaQuestSceneCaptureDecorator() { ActionNotificationCenter.DefaultCenter.AddObserver(CaptureEnvironment, nameof(CaptureEnvironment)); } /// /// Requests scene capture via . /// /// Notification data (unused). private void CaptureEnvironment(BaseNotificationData _obj) { var tmp_ArchitectureComponentsModel = IocContainer.GetIoc.Resolve(); if (tmp_ArchitectureComponentsModel.ARSession.subsystem is MetaOpenXRSessionSubsystem tmp_SceneCapture) tmp_SceneCapture.TryRequestSceneCapture(); } /// /// Determines if this feature is supported. /// /// Always returns true. public override bool SupportThisFeature() { return true; } /// /// Pauses the algorithm. /// public override void PauseAlgorithm() { } /// /// Stops the algorithm and unsubscribes from notifications. /// public override void StopAlgorithm() { ActionNotificationCenter.DefaultCenter.RemoveObserver(nameof(CaptureEnvironment)); } } }