您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

51 行
1.8 KiB

using System;
using System.Text;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
namespace UnityEngine.XR.ARFoundation.Samples
{
/// <summary>
/// This component tests for depth functionality and enables/disables
/// a text message on the screen reporting that depth is not suppoted.
/// </summary>
public class CheckRuntimeDepth : MonoBehaviour
{
[SerializeField]
[Tooltip("The AROcclusionManager which will manage depth functionality.")]
AROcclusionManager m_OcclusionManager;
/// <summary>
/// Get or set the <c>AROcclusionManager</c>.
/// </summary>
public AROcclusionManager occlusionManager
{
get { return m_OcclusionManager; }
set { m_OcclusionManager = value; }
}
[SerializeField]
Text m_DepthAvailabilityInfo;
/// <summary>
/// The UI Text used to display information about the availability of depth functionality.
/// </summary>
public Text depthAvailabilityInfo
{
get { return m_DepthAvailabilityInfo; }
set { m_DepthAvailabilityInfo = value; }
}
void Update()
{
Debug.Assert(m_OcclusionManager != null, "no occlusion manager");
Debug.Assert(m_DepthAvailabilityInfo != null, "no text box");
m_DepthAvailabilityInfo.enabled = ((m_OcclusionManager.descriptor?.supportsHumanSegmentationStencilImage == false)
&& (m_OcclusionManager.descriptor?.supportsHumanSegmentationDepthImage == false)
&& (m_OcclusionManager.descriptor?.supportsEnvironmentDepthImage == false));
}
}
}