Загрузка PICO Unity OpenXR Integration SDK
This commit is contained in:
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Unity.XR.CoreUtils;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
using UnityEngine.XR.OpenXR.Features;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.XR.OpenXR.Features;
|
||||
#endif
|
||||
|
||||
|
||||
namespace Unity.XR.OpenXR.Features.PICOSupport
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[OpenXRFeature(UiName = "PICO Scene Capture",
|
||||
Hidden = false,
|
||||
BuildTargetGroups = new[] { UnityEditor.BuildTargetGroup.Android },
|
||||
Company = "PICO",
|
||||
OpenxrExtensionStrings = extensionString,
|
||||
Version = "1.0.0",
|
||||
FeatureId = featureId)]
|
||||
#endif
|
||||
public class PICOSceneCapture: OpenXRFeature
|
||||
{
|
||||
public const string featureId = "com.pico.openxr.feature.scenecapture";
|
||||
public const string extensionString = "XR_PICO_scene_capture XR_PICO_spatial_sensing XR_EXT_future";
|
||||
public static bool isEnable => OpenXRRuntime.IsExtensionEnabled("XR_PICO_scene_capture");
|
||||
protected override void OnSessionCreate(ulong xrSession)
|
||||
{
|
||||
base.OnSessionCreate(xrSession);
|
||||
PXR_Plugin.MixedReality.UPxr_CreateSceneCaptureSenseDataProvider();
|
||||
}
|
||||
|
||||
protected override void OnSessionExiting(ulong xrSession)
|
||||
{
|
||||
PXR_MixedReality.GetSenseDataProviderState(PxrSenseDataProviderType.SceneCapture, out var providerState);
|
||||
if (providerState == PxrSenseDataProviderState.Running)
|
||||
{
|
||||
PXR_MixedReality.StopSenseDataProvider(PxrSenseDataProviderType.SceneCapture);
|
||||
}
|
||||
|
||||
PXR_Plugin.MixedReality.UPxr_DestroySenseDataProvider(
|
||||
PXR_Plugin.MixedReality.UPxr_GetSenseDataProviderHandle(PxrSenseDataProviderType.SceneCapture));
|
||||
|
||||
base.OnSessionExiting(xrSession);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0b5403262c64d5888bf5672e1e1f3bb
|
||||
timeCreated: 1721806849
|
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Unity.XR.CoreUtils;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
#if AR_FOUNDATION
|
||||
using UnityEngine.XR.ARSubsystems;
|
||||
#endif
|
||||
using UnityEngine.XR.OpenXR;
|
||||
using UnityEngine.XR.OpenXR.Features;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.XR.OpenXR.Features;
|
||||
#endif
|
||||
|
||||
|
||||
namespace Unity.XR.OpenXR.Features.PICOSupport
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[OpenXRFeature(UiName = "PICO Spatial Anchor",
|
||||
Hidden = false,
|
||||
BuildTargetGroups = new[] { UnityEditor.BuildTargetGroup.Android },
|
||||
Company = "PICO",
|
||||
OpenxrExtensionStrings = extensionString,
|
||||
Version = "1.0.0",
|
||||
FeatureId = featureId)]
|
||||
#endif
|
||||
public class PICOSpatialAnchor: OpenXRFeature
|
||||
{
|
||||
public const string featureId = "com.pico.openxr.feature.spatialanchor";
|
||||
public const string extensionString = "XR_PICO_spatial_anchor XR_PICO_spatial_sensing XR_EXT_future";
|
||||
|
||||
public static bool isEnable => OpenXRRuntime.IsExtensionEnabled("XR_PICO_spatial_anchor");
|
||||
|
||||
protected override void OnSessionCreate(ulong xrSession)
|
||||
{
|
||||
base.OnSessionCreate(xrSession);
|
||||
PXR_Plugin.MixedReality.UPxr_CreateSpatialAnchorSenseDataProvider();
|
||||
}
|
||||
protected override void OnSessionExiting(ulong xrSession)
|
||||
{
|
||||
PXR_MixedReality.GetSenseDataProviderState(PxrSenseDataProviderType.SpatialAnchor, out var providerState);
|
||||
if (providerState == PxrSenseDataProviderState.Running)
|
||||
{
|
||||
PXR_MixedReality.StopSenseDataProvider(PxrSenseDataProviderType.SpatialAnchor);
|
||||
}
|
||||
|
||||
PXR_Plugin.MixedReality.UPxr_DestroySenseDataProvider(
|
||||
PXR_Plugin.MixedReality.UPxr_GetSenseDataProviderHandle(PxrSenseDataProviderType.SpatialAnchor));
|
||||
|
||||
base.OnSessionExiting(xrSession);
|
||||
}
|
||||
|
||||
#if AR_FOUNDATION
|
||||
public bool isAnchorSubsystem=true;
|
||||
static List<XRAnchorSubsystemDescriptor> anchorSubsystemDescriptors = new List<XRAnchorSubsystemDescriptor>();
|
||||
protected override void OnSubsystemCreate()
|
||||
{
|
||||
base.OnSubsystemCreate();
|
||||
if (isAnchorSubsystem)
|
||||
{
|
||||
CreateSubsystem<XRAnchorSubsystemDescriptor, XRAnchorSubsystem>(
|
||||
anchorSubsystemDescriptors,
|
||||
PICOAnchorSubsystem.k_SubsystemId);
|
||||
}
|
||||
|
||||
}
|
||||
protected override void OnSubsystemStart()
|
||||
{
|
||||
if (isAnchorSubsystem)
|
||||
{
|
||||
StartSubsystem<XRAnchorSubsystem>();
|
||||
}
|
||||
}
|
||||
protected override void OnSubsystemStop()
|
||||
{
|
||||
if (isAnchorSubsystem)
|
||||
{
|
||||
StopSubsystem<XRAnchorSubsystem>();
|
||||
}
|
||||
}
|
||||
protected override void OnSubsystemDestroy()
|
||||
{
|
||||
if (isAnchorSubsystem)
|
||||
{
|
||||
DestroySubsystem<XRAnchorSubsystem>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8b7731b990240c0b289e41fb880787b
|
||||
timeCreated: 1721806849
|
@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Unity.XR.CoreUtils;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
using UnityEngine.XR.OpenXR.Features;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.XR.OpenXR.Features;
|
||||
#endif
|
||||
|
||||
|
||||
namespace Unity.XR.OpenXR.Features.PICOSupport
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[OpenXRFeature(UiName = "PICO Spatial Mesh",
|
||||
Hidden = false,
|
||||
BuildTargetGroups = new[] { UnityEditor.BuildTargetGroup.Android },
|
||||
Company = "PICO",
|
||||
OpenxrExtensionStrings = extensionString,
|
||||
Version = "1.0.0",
|
||||
FeatureId = featureId)]
|
||||
#endif
|
||||
public class PICOSpatialMesh: OpenXRFeature
|
||||
{
|
||||
public const string featureId = "com.pico.openxr.feature.spatialmesh";
|
||||
public const string extensionString = "XR_PICO_spatial_mesh XR_PICO_spatial_sensing XR_EXT_future";
|
||||
private static List<XRMeshSubsystemDescriptor> meshSubsystemDescriptors = new List<XRMeshSubsystemDescriptor>();
|
||||
|
||||
public PxrMeshLod LOD;
|
||||
|
||||
private XRMeshSubsystem subsystem;
|
||||
public static bool isEnable => OpenXRRuntime.IsExtensionEnabled("XR_PICO_spatial_mesh");
|
||||
protected override void OnSubsystemCreate()
|
||||
{
|
||||
base.OnSubsystemCreate();
|
||||
PXR_Plugin.MixedReality.Pxr_SetMeshLOD(Convert.ToUInt16(LOD));
|
||||
|
||||
}
|
||||
|
||||
protected override void OnSessionCreate(ulong xrSession)
|
||||
{
|
||||
base.OnSessionCreate(xrSession);
|
||||
CreateSubsystem<XRMeshSubsystemDescriptor, XRMeshSubsystem>(meshSubsystemDescriptors, "PICO Mesh");
|
||||
}
|
||||
|
||||
protected override void OnSubsystemStop()
|
||||
{
|
||||
base.OnSubsystemStop();
|
||||
StopSubsystem<XRMeshSubsystem>();
|
||||
|
||||
}
|
||||
|
||||
protected override void OnSubsystemDestroy()
|
||||
{
|
||||
base.OnSubsystemDestroy();
|
||||
PXR_Plugin.MixedReality.UPxr_DisposeMesh();
|
||||
DestroySubsystem<XRMeshSubsystem>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1248416ce414cd0a788c5240bec5766
|
||||
timeCreated: 1721806849
|
Reference in New Issue
Block a user