// // /*===============================================================================
// // 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 System.Collections.Generic;
using Phantom.XRMOD.ActionNotification.Runtime;
using Phantom.XRMOD.Core.Runtime;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
namespace Phantom.XRMOD.QuestModule.Runtime
{
///
/// Runtime data model for the Quest module.
///
/// Stores the state of the AR session, availability, visualizers, feature decorators, and other runtime context information.
///
///
public class XRRuntimeContextDataModel
{
///
/// Bindable property for AR availability status.
///
public BindableProperty ARAvailability { get; private set; }
///
/// Bindable property for the current AR session state.
///
public BindableProperty ARSessionState { get; private set; }
///
/// Bindable property for enabling HDR.
///
public BindableProperty EnableHDR { get; private set; }
///
/// Bindable property for the current camera frame texture.
///
public BindableProperty FrameTexture { get; private set; }
///
/// Bindable property triggered when a marker is recognized.
///
public BindableProperty OnMarkerRecognized;
///
/// Bindable property for the frame getter decorator.
///
public BindableProperty FrameGetter;
///
/// Reference to the plane visualizer GameObject.
///
public GameObject PlaneVisualizer { get; set; }
///
/// Reference to the mesh visualizer GameObject.
///
public GameObject MeshVisualizer { get; set; }
///
/// Reference to the point cloud visualizer GameObject.
///
public GameObject PointCloudVisualizer { get; set; }
///
/// Current space type (e.g., Local, Global).
///
public SpaceType SpaceType { get; set; }
///
/// Texture conversion type.
///
public ConversionType ConversionType { get; set; }
///
/// Format of the camera texture.
///
public TextureFormat TextureFormat { get; set; }
///
/// Flag to indicate if the AR module should stop.
///
public bool StopARModule { get; set; }
///
/// Availability of AR collaboration.
///
public bool IsARCollaborationAvailability = false;
///
/// Availability of ARKit coaching overlay.
///
public bool ARKitCoachingOverlayAvailability = false;
///
/// Path to save the ARKit world map.
///
public string ARKitWordMapSavePath = $"{Application.temporaryCachePath}/ARKitWordMap.bytes";
///
/// Dictionary of active feature decorators grouped by project name.
///
public Dictionary> FeatureDecoratorsAtRuntime = new();
///
/// Initializes a new instance of the class.
///
public XRRuntimeContextDataModel()
{
Initialize();
}
///
/// Initializes bindable properties.
///
public void Initialize()
{
FrameGetter = new BindableProperty();
OnMarkerRecognized = new BindableProperty();
FrameTexture = new BindableProperty();
ARAvailability = new BindableProperty();
EnableHDR = new BindableProperty();
ARSessionState = new BindableProperty();
}
///
/// Releases resources and unbinds events.
///
public void Release()
{
ARAvailability.OnValueChanged = null;
EnableHDR.OnValueChanged = null;
ARSessionState.OnValueChanged = null;
FrameGetter.OnValueChanged = null;
OnMarkerRecognized.OnValueChanged = null;
StopARModule = false;
}
}
}