浏览代码

Merge branch 'bugs'

/4.1
Tim Mowrer 5 年前
当前提交
e2069a60
共有 6 个文件被更改,包括 225 次插入184 次删除
  1. 9
      Assets/Scenes/ARFoundationMenu/Menu.unity
  2. 2
      Assets/Scripts/CpuImageSample.cs
  3. 277
      Assets/Scripts/UX/ARSceneSelectUI.cs
  4. 5
      Assets/Scripts/UX/BackButton.cs
  5. 108
      Assets/Scripts/UX/CheckAvailableFeatures.cs
  6. 8
      Packages/manifest.json

9
Assets/Scenes/ARFoundationMenu/Menu.unity


- component: {fileID: 340560480}
- component: {fileID: 340560483}
m_Layer: 5
m_Name: CameraImage
m_Name: CpuImages
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 774532498}
m_TargetAssemblyTypeName:
m_MethodName: CameraImageButtonPressed
m_MethodName: CpuImagesButtonPressed
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Camera Image
m_Text: CPU Images
--- !u!222 &356847840
CanvasRenderer:
m_ObjectHideFlags: 0

m_ImageTracking: {fileID: 1311724826}
m_Anchors: {fileID: 1905833466}
m_ARWorldMap: {fileID: 1817576787}
m_CameraImage: {fileID: 340560480}
m_CpuImages: {fileID: 340560480}
m_EnvironmentProbes: {fileID: 1761617832}
m_ARCollaborationData: {fileID: 1385680569}
m_ARKitCoachingOverlay: {fileID: 1091803571}

2
Assets/Scripts/CpuImageSample.cs


Texture2D m_CameraTexture;
}
}
}

277
Assets/Scripts/UX/ARSceneSelectUI.cs


using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.XR.ARFoundation;
namespace UnityEngine.XR.ARFoundation.Samples
{

}
}
public void SimpleARButtonPressed()
{
SceneManager.LoadScene("SimpleAR", LoadSceneMode.Single);
}
static void LoadScene(string sceneName)
{
LoaderUtility.Initialize();
SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
}
public void ImageTrackableButtonPressed()
{
SceneManager.LoadScene("ImageTracking", LoadSceneMode.Single);
}
public void SimpleARButtonPressed()
{
LoadScene("SimpleAR");
}
public void ImageTrackableButtonPressed()
{
LoadScene("ImageTracking");
}
public void AnchorsButtonPressed()
{
SceneManager.LoadScene("Anchors", LoadSceneMode.Single);
}
public void AnchorsButtonPressed()
{
LoadScene("Anchors");
}
public void ARCollaborationDataButtonPressed()
{
SceneManager.LoadScene("ARCollaborationDataExample", LoadSceneMode.Single);
}
public void ARCollaborationDataButtonPressed()
{
LoadScene("ARCollaborationDataExample");
}
public void ARKitCoachingOverlayButtonPressed()
{
SceneManager.LoadScene("ARKitCoachingOverlay", LoadSceneMode.Single);
}
public void ARKitCoachingOverlayButtonPressed()
{
LoadScene("ARKitCoachingOverlay");
}
public void ARWorldMapButtonPressed()
{
SceneManager.LoadScene("ARWorldMap", LoadSceneMode.Single);
}
public void ARWorldMapButtonPressed()
{
LoadScene("ARWorldMap");
}
public void CameraImageButtonPressed()
{
SceneManager.LoadScene("CameraImage", LoadSceneMode.Single);
}
public void CpuImagesButtonPressed()
{
LoadScene("CpuImages");
}
public void CheckSupportButtonPressed()
{
SceneManager.LoadScene("Check Support", LoadSceneMode.Single);
}
public void CheckSupportButtonPressed()
{
LoadScene("Check Support");
}
public void EnvironmentProbesButtonPressed()
{
SceneManager.LoadScene("EnvironmentProbes", LoadSceneMode.Single);
}
public void EnvironmentProbesButtonPressed()
{
LoadScene("EnvironmentProbes");
}
public void ObjectTrackingButtonPressed()
{
SceneManager.LoadScene("ObjectTracking", LoadSceneMode.Single);
}
public void ObjectTrackingButtonPressed()
{
LoadScene("ObjectTracking");
}
public void PlaneOcclusionButtonPressed()
{
SceneManager.LoadScene("PlaneOcclusion", LoadSceneMode.Single);
}
public void PlaneOcclusionButtonPressed()
{
LoadScene("PlaneOcclusion");
}
public void PointCloudButtonPressed()
{
SceneManager.LoadScene("AllPointCloudPoints", LoadSceneMode.Single);
}
public void PointCloudButtonPressed()
{
LoadScene("AllPointCloudPoints");
}
public void ScaleButtonPressed()
{
SceneManager.LoadScene("Scale", LoadSceneMode.Single);
}
public void ScaleButtonPressed()
{
LoadScene("Scale");
}
public void SampleUXButtonPressed()
{
SceneManager.LoadScene("SampleUXScene", LoadSceneMode.Single);
}
public void SampleUXButtonPressed()
{
LoadScene("SampleUXScene");
}
public void FaceTrackingMenuButtonPressed()
{
ActiveMenu.currentMenu = MenuType.FaceTracking;
m_FaceTrackingMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
public void ARCoreFaceRegionsButtonPressed()
{
SceneManager.LoadScene("ARCoreFaceRegions", LoadSceneMode.Single);
}
public void ARKitFaceBlendShapesButtonPressed()
{
SceneManager.LoadScene("ARKitFaceBlendShapes", LoadSceneMode.Single);
}
public void EyeLasersButtonPressed()
{
SceneManager.LoadScene("EyeLasers", LoadSceneMode.Single);
}
public void EyePosesButtonPressed()
{
SceneManager.LoadScene("EyePoses", LoadSceneMode.Single);
}
public void FaceTrackingMenuButtonPressed()
{
ActiveMenu.currentMenu = MenuType.FaceTracking;
m_FaceTrackingMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
public void ARCoreFaceRegionsButtonPressed()
{
LoadScene("ARCoreFaceRegions");
}
public void ARKitFaceBlendShapesButtonPressed()
{
LoadScene("ARKitFaceBlendShapes");
}
public void EyeLasersButtonPressed()
{
LoadScene("EyeLasers");
}
public void EyePosesButtonPressed()
{
LoadScene("EyePoses");
}
public void FaceMeshButtonPressed()
{
SceneManager.LoadScene("FaceMesh", LoadSceneMode.Single);
}
public void FaceMeshButtonPressed()
{
LoadScene("FaceMesh");
}
public void FacePoseButtonPressed()
{
SceneManager.LoadScene("FacePose", LoadSceneMode.Single);
}
public void FacePoseButtonPressed()
{
LoadScene("FacePose");
}
public void FixationPointButtonPressed()
{
SceneManager.LoadScene("FixationPoint", LoadSceneMode.Single);
}
public void FixationPointButtonPressed()
{
LoadScene("FixationPoint");
}
public void RearCameraWithFrontCameraFaceMeshButtonPressed()
{
SceneManager.LoadScene("WorldCameraWithUserFacingFaceTracking", LoadSceneMode.Single);
}
public void RearCameraWithFrontCameraFaceMeshButtonPressed()
{
LoadScene("WorldCameraWithUserFacingFaceTracking");
}
public void HumanSegmentationMenuButtonPressed()
{
ActiveMenu.currentMenu = MenuType.HumanSegmentation;
m_HumanSegmentationMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
public void HumanSegmentation2DButtonPressed()
{
SceneManager.LoadScene("HumanBodyTracking2D", LoadSceneMode.Single);
}
public void HumanSegmentation3DButtonPressed()
{
SceneManager.LoadScene("HumanBodyTracking3D", LoadSceneMode.Single);
}
public void HumanSegmentationImagesButtonPressed()
{
SceneManager.LoadScene("HumanSegmentationImages", LoadSceneMode.Single);
}
public void HumanSegmentationMenuButtonPressed()
{
ActiveMenu.currentMenu = MenuType.HumanSegmentation;
m_HumanSegmentationMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
public void HumanSegmentation2DButtonPressed()
{
LoadScene("HumanBodyTracking2D");
}
public void HumanSegmentation3DButtonPressed()
{
LoadScene("HumanBodyTracking3D");
}
public void HumanSegmentationImagesButtonPressed()
{
LoadScene("HumanSegmentationImages");
}
public void LightEstimationButtonPressed()
{
SceneManager.LoadScene("LightEstimation", LoadSceneMode.Single);
}
public void LightEstimationButtonPressed()
{
LoadScene("LightEstimation");
}
public void PlaneDetectionMenuButtonPressed()
{
ActiveMenu.currentMenu = MenuType.PlaneDetection;
m_PlaneDetectionMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
public void FeatheredPlanesButtonPressed()
{
SceneManager.LoadScene("FeatheredPlanes", LoadSceneMode.Single);
}
public void PlaneDetectionMenuButtonPressed()
{
ActiveMenu.currentMenu = MenuType.PlaneDetection;
m_PlaneDetectionMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
public void FeatheredPlanesButtonPressed()
{
LoadScene("FeatheredPlanes");
}
public void PlaneClassificationButtonPressed()
{
SceneManager.LoadScene("PlaneClassification", LoadSceneMode.Single);
}
public void PlaneClassificationButtonPressed()
{
LoadScene("PlaneClassification");
}
public void TogglePlaneDetectionButtonPressed()
{
SceneManager.LoadScene("TogglePlaneDetection", LoadSceneMode.Single);
}
public void TogglePlaneDetectionButtonPressed()
{
LoadScene("TogglePlaneDetection");
}
public void BackButtonPressed()

m_AllMenu.SetActive(true);
}
}
}
}

5
Assets/Scripts/UX/BackButton.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.Management;
namespace UnityEngine.XR.ARFoundation.Samples
{

public void BackButtonPressed()
{
SceneManager.LoadScene("Menu", LoadSceneMode.Single);
LoaderUtility.Deinitialize();
}
}

108
Assets/Scripts/UX/CheckAvailableFeatures.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

set { m_ARWorldMap = value; }
}
Button m_CameraImage;
public Button cameraImage
Button m_CpuImages;
public Button cpuImages
get { return m_CameraImage; }
set { m_CameraImage = value; }
get { return m_CpuImages; }
set { m_CpuImages = value; }
}
[SerializeField]

// Start is called before the first frame update
void Start()
{
List<XRPlaneSubsystemDescriptor> planeDescriptors = new List<XRPlaneSubsystemDescriptor>();
var planeDescriptors = new List<XRPlaneSubsystemDescriptor>();
List<XRRaycastSubsystemDescriptor> rayCastDescriptors = new List<XRRaycastSubsystemDescriptor>();
var rayCastDescriptors = new List<XRRaycastSubsystemDescriptor>();
List<XRFaceSubsystemDescriptor> faceDescriptors = new List<XRFaceSubsystemDescriptor>();
var faceDescriptors = new List<XRFaceSubsystemDescriptor>();
List<XRImageTrackingSubsystemDescriptor> imageDescriptors = new List<XRImageTrackingSubsystemDescriptor>();
var imageDescriptors = new List<XRImageTrackingSubsystemDescriptor>();
List<XREnvironmentProbeSubsystemDescriptor> envDescriptors = new List<XREnvironmentProbeSubsystemDescriptor>();
var envDescriptors = new List<XREnvironmentProbeSubsystemDescriptor>();
List<XRAnchorSubsystemDescriptor> anchorDescriptors = new List<XRAnchorSubsystemDescriptor>();
var anchorDescriptors = new List<XRAnchorSubsystemDescriptor>();
List<XRObjectTrackingSubsystemDescriptor> objectDescriptors = new List<XRObjectTrackingSubsystemDescriptor>();
var objectDescriptors = new List<XRObjectTrackingSubsystemDescriptor>();
List<XRParticipantSubsystemDescriptor> participantDescriptors = new List<XRParticipantSubsystemDescriptor>();
var participantDescriptors = new List<XRParticipantSubsystemDescriptor>();
List<XRDepthSubsystemDescriptor> depthDescriptors = new List<XRDepthSubsystemDescriptor>();
var depthDescriptors = new List<XRDepthSubsystemDescriptor>();
List<XROcclusionSubsystemDescriptor> occlusionDescriptors = new List<XROcclusionSubsystemDescriptor>();
var occlusionDescriptors = new List<XROcclusionSubsystemDescriptor>();
List<XRCameraSubsystemDescriptor> cameraDescriptors = new List<XRCameraSubsystemDescriptor>();
var cameraDescriptors = new List<XRCameraSubsystemDescriptor>();
List<XRSessionSubsystemDescriptor> sessionDescriptors = new List<XRSessionSubsystemDescriptor>();
var sessionDescriptors = new List<XRSessionSubsystemDescriptor>();
SubsystemManager.GetSubsystemDescriptors<XRSessionSubsystemDescriptor>(sessionDescriptors);
if(planeDescriptors.Count > 0 && rayCastDescriptors.Count > 0)

}
#if UNITY_IOS
#if UNITY_IOS
#endif
#endif
}
if(occlusionDescriptors.Count > 0)
{
foreach(var occlusionDescriptor in occlusionDescriptors)
{
m_SimpleAR.interactable = true;
m_Scale.interactable = true;
}
if(faceDescriptors.Count > 0)
{
m_FaceTracking.interactable = true;
#if UNITY_IOS
m_FaceBlendShapes.interactable = true;
#endif
if(occlusionDescriptors.Count > 0)
{
foreach(XROcclusionSubsystemDescriptor occlusionDescriptor in occlusionDescriptors)

}
}
}
}
if(cameraDescriptors.Count > 0)
{
foreach(var cameraDescriptor in cameraDescriptors)

cameraDescriptor.supportsCameraImage)
{
m_LightEstimation.interactable = true;
}
if((cameraDescriptor.supportsAverageBrightness || cameraDescriptor.supportsAverageIntensityInLumens) &&
cameraDescriptor.supportsAverageColorTemperature && cameraDescriptor.supportsCameraConfigurations &&
cameraDescriptor.supportsCameraImage)
{
m_LightEstimation.interactable = true;
}
}
if(envDescriptors.Count > 0)
{
m_EnvironmentProbes.interactable = true;

m_PlaneDetection.interactable = true;
foreach(var planeDescriptor in planeDescriptors)
{
if(planeDescriptor.supportsClassification)
m_PlaneDetection.interactable = true;
foreach(var planeDescriptor in planeDescriptors)
m_PlaneClassification.interactable = true;
break;
if(planeDescriptor.supportsClassification)
{
m_PlaneClassification.interactable = true;
break;
}
if(cameraDescriptor.supportsCameraImage)
foreach(var cameraDescriptor in cameraDescriptors)
m_CameraImage.interactable = true;
m_CpuImages.interactable = true;
#if UNITY_IOS
if(sessionDescriptors.Count > 0 && ARKitSessionSubsystem.worldMapSupported)
{
m_ARWorldMap.interactable = true;
}
#if UNITY_IOS
#if UNITY_IOS
if(planeDescriptors.Count > 0 && rayCastDescriptors.Count > 0 && participantDescriptors.Count > 0 && ARKitSessionSubsystem.supportsCollaboration)
if(sessionDescriptors.Count > 0 && ARKitSessionSubsystem.coachingOverlaySupported)
m_ARCollaborationData.interactable = true;
m_ARKitCoachingOverlay.interactable = true;
}
if(sessionDescriptors.Count > 0 && ARKitSessionSubsystem.coachingOverlaySupported)

#endif
#endif
if(depthDescriptors.Count > 0)
if(planeDescriptors.Count > 0)
m_PointCloud.interactable = true;
m_PlaneOcclusion.interactable = true;
}
if(planeDescriptors.Count > 0)

}
}

8
Packages/manifest.json


"com.unity.test-framework": "1.1.14",
"com.unity.textmeshpro": "2.0.1",
"com.unity.ugui": "1.0.0",
"com.unity.xr.arcore": "4.0.0-preview.3",
"com.unity.xr.arfoundation": "4.0.0-preview.3",
"com.unity.xr.arkit": "4.0.0-preview.3",
"com.unity.xr.arkit-face-tracking": "4.0.0-preview.3",
"com.unity.xr.arcore": "4.0.0",
"com.unity.xr.arfoundation": "4.0.0",
"com.unity.xr.arkit": "4.0.0",
"com.unity.xr.arkit-face-tracking": "4.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",

正在加载...
取消
保存