Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed Assets/Resources/Controller/PICO 4U/.DS_Store
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Editor/Debugger/PXR_PicoDebuggerSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ static PXR_PicoDebuggerSetup()
static void Init_PXR_PicoDebuggerSetup()
{
string currentPanelPath = $"{PXR_DebuggerConst.sdkPackageName}Assets/Debugger/Prefabs/DebuggerPanel.prefab";
string targetPanelPath = "Assets/Resources/DebuggerPanel.prefab";
string targetPanelPath = "Assets/Resources/PXR_DebuggerPanel.prefab";
string currentEntryPath = $"{PXR_DebuggerConst.sdkPackageName}Assets/Debugger/Prefabs/PICODebugger.prefab";
string targetEntryPath = "Assets/Resources/PICODebugger.prefab";
string targetEntryPath = "Assets/Resources/PXR_PICODebugger.prefab";
if(!File.Exists(targetEntryPath)){
if (!Directory.Exists("Assets/Resources"))
{
Expand Down
5 changes: 4 additions & 1 deletion Editor/PXR_BuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ internal class PXR_BuildHooks : IPreprocessBuildWithReport, IPostprocessBuildWit
{
{ "xr-usable-core-mask-enabled", "1"},
{ "xr-require-backbuffer-textures", "0" },
{ "xr-hide-memoryless-render-texture", "1" }
{ "xr-hide-memoryless-render-texture", "1" },
{ "xr-vulkan-extension-fragment-density-map-enabled", "1"}
};

public void OnPreprocessBuild(BuildReport report)
Expand Down Expand Up @@ -330,6 +331,7 @@ public void OnPostGenerateGradleAndroidProject(string path)
#if PICO_OPENXR_SDK
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","use.pxr.sdk"}},new Dictionary<string, string>{{"value", "2"}});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","pvr.sdk.version"}},new Dictionary<string, string>{{"value","Unity OpenXR "+PXR_Constants.SDKVersion}});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","sdk.unity.version"}},new Dictionary<string, string>{{"value",Application.unityVersion}});
var settings = OpenXRSettings.GetSettingsForBuildTargetGroup(BuildTargetGroup.Android);
bool mrPermission = false;

Expand Down Expand Up @@ -479,6 +481,7 @@ public void OnPostGenerateGradleAndroidProject(string path)
var settings = PXR_XmlTools.GetSettings();
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","use.pxr.sdk"}},new Dictionary<string, string>{{"value", "1"}});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","pvr.sdk.version"}},new Dictionary<string, string>{{"value","XR Platform_"+PXR_Constants.SDKVersion}});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","sdk.unity.version"}},new Dictionary<string, string>{{"value",Application.unityVersion}});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","enable_cpt"}},new Dictionary<string, string>{{"value",PXR_ProjectSetting.GetProjectConfig().useContentProtect ? "1" : "0"}});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","Enable_AdaptiveHandModel"}},new Dictionary<string, string> {{"value",PXR_ProjectSetting.GetProjectConfig().adaptiveHand ? "1" : "0" }});
doc.InsertAttributeInTargetTag(metaDataTagPath,new Dictionary<string, string>{{"name","Hand_Tracking_HighFrequency"}},new Dictionary<string, string> {{"value",PXR_ProjectSetting.GetProjectConfig().highFrequencyHand ? "1" : "0" }});
Expand Down
4 changes: 4 additions & 0 deletions Editor/PXR_ManagerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ public override void OnInspectorGUI()
"MR safety, if you choose this option, your application will adopt MR safety policies during runtime. If not selected, it will continue to use VR safety policies by default.";
projectConfig.mrSafeguard = EditorGUILayout.Toggle(mrSafeguardContent, projectConfig.mrSafeguard);

var secureMRContent = new GUIContent();
secureMRContent.text = "SecureMR";
projectConfig.secureMR = EditorGUILayout.Toggle(secureMRContent, projectConfig.secureMR);

//Super Resolution
var superresolutionContent = new GUIContent();
superresolutionContent.text = "Super Resolution";
Expand Down
3 changes: 1 addition & 2 deletions Editor/PXR_Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ private class PXR_LoaderMetadata : IXRLoaderMetadata

private static readonly List<BuildTargetGroup> SupportedBuildTargets = new List<BuildTargetGroup>()
{
BuildTargetGroup.Android,
BuildTargetGroup.Standalone
BuildTargetGroup.Android
};
}

Expand Down
6 changes: 5 additions & 1 deletion Enterprise/Sample/CameraRendering/PXR/EnterpriseAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ private void Awake()
imgByte = new byte[width*height*4];
texture = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, false);
videoMaterial.SetTexture("_MainTex", texture);

PXR_Enterprise.InitEnterpriseService();
PXR_Enterprise.BindEnterpriseService(b =>
{
Debug.Log($"{tag} Bind enterprise service success={b}");
} );
}
public void OpenCamera()
{
Expand Down
4 changes: 3 additions & 1 deletion Enterprise/Scripts/PXR_Enterprise.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3841,6 +3841,7 @@ public static bool StartPreviewfor4U(IntPtr surfaceObj, PXRCaptureRenderMode mod
private static Action<Frame> onImageAvailable;
private static Action<bool> openCameraAsyncSuccess;
static Frame pxrFrame;
private static bool isGlobalPose = false;
/// <summary>
/// Sets a frame buffer for the camera. The frame buffer is used to store image data with specified width and height.
/// @note Only supported by PICO 4 Ultra Enterprise.
Expand All @@ -3866,7 +3867,7 @@ static void EventDataCapturelibCallBackFunction(int type)
if (onImageAvailable!=null)
{

SensorState a = GetPredictedMainSensorState(pxrFrame.timestamp / 1000000.0f);
SensorState a = GetPredictedMainSensorState(pxrFrame.timestamp / 1000000.0f,isGlobalPose);

pxrFrame.pose = a.pose;
pxrFrame.status=a.status;
Expand Down Expand Up @@ -4329,6 +4330,7 @@ public static PxrSensorState2 GetPredictedMainSensorState2(double predictTime)
/// </param>
public static void UseGlobalPose(bool flg)
{
isGlobalPose=flg;
PXR_Plugin.Boundary.UPxr_SetSeeThroughState(flg);
if (flg)
{
Expand Down
10 changes: 3 additions & 7 deletions Enterprise/Scripts/Plugin/PXR_EnterprisePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2982,7 +2982,7 @@ public static bool GetCameraExtrinsics(out double[] leftExtrinsics, out double[]
int rightCount = 0;
IntPtr leftHandle = IntPtr.Zero;
IntPtr rightHandle = IntPtr.Zero;
if (UPxr_GetToken())
// if (UPxr_GetToken())
{
bool ret = getCameraExtrinsics(ref leftCount, ref leftHandle, ref rightCount, ref rightHandle);
leftExtrinsics = new Double[leftCount];
Expand All @@ -2998,7 +2998,7 @@ public static double[] GetCameraIntrinsics(int width, int height, double h_fov,
double[] configArray = null;
int configCount = 0;
IntPtr configHandle = IntPtr.Zero;
if (UPxr_GetToken())
// if (UPxr_GetToken())
{
getCameraIntrinsics(width ,height,h_fov,v_fov,ref configCount, ref configHandle);
configArray = new Double[configCount];
Expand Down Expand Up @@ -3026,14 +3026,10 @@ public static Matrix4x4 DoubleArrayToMatrix4x4(double[] array)
}
public static bool GetCameraParametersNew(int width, int height, ref RGBCameraParamsNew paramsNew)
{
if (UPxr_GetToken())
// if (UPxr_GetToken())
{
return getCameraParametersNew(width,height,ref paramsNew);
}
else
{
return false;
}
}

public static int UPxr_SetDeviceOwner(string pkg, string cls)
Expand Down
Binary file not shown.
Binary file added Enterprise/android/CameraRenderingPlugin.aar
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions README.md

This file was deleted.

7 changes: 0 additions & 7 deletions README.md.meta

This file was deleted.

Binary file modified Runtime/Android/PxrPlatform.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion Runtime/Debugger/Scripts/Core/PXR_PicoDebuggerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private static void OnBeforeSceneLoadRuntimeMethod()

private static void AddPrefab()
{
GameObject prefab = Resources.Load<GameObject>("PICODebugger");
GameObject prefab = Resources.Load<GameObject>("PXR_PICODebugger");
if (prefab != null)
{
Instantiate(prefab, Vector3.zero, Quaternion.identity);
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Debugger/Scripts/UI/Default/PXR_UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PXR_UIManager : MonoBehaviour
private void Start()
{
config = Resources.Load<PXR_PicoDebuggerSO>("PXR_PicoDebuggerSO");
uiController = Resources.Load<GameObject>("DebuggerPanel").GetComponent<PXR_UIController>();
uiController = Resources.Load<GameObject>("PXR_DebuggerPanel").GetComponent<PXR_UIController>();
if(config.isOpen)
{
switch (config.debuggerLauncherButton)
Expand Down
23 changes: 1 addition & 22 deletions Runtime/Debugger/UI/RoundedRectMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ material is strictly forbidden unless prior written permission is obtained from
using UnityEngine;
using UnityEditor;
using System.IO;
#if UNITY_EDITOR
#if UNITY_EDITOR || DEVELOPMENT_BUILD
namespace Unity.XR.PXR.Debugger
{
[RequireComponent(typeof(MeshFilter))]
Expand Down Expand Up @@ -43,22 +43,6 @@ private void Init(){
isInit = true;
}
}
// 在Inspector中通过按钮触发保存
[ContextMenu("Save Mesh And Remove Component")]
public void SaveMesh()
{
MeshFilter mf = GetComponent<MeshFilter>();
if (mf == null || mf.mesh == null) return;

string path = $"Assets/{saveName}.asset";
if(File.Exists(path)){
Debug.Log($"Remove Exist File");
AssetDatabase.DeleteAsset(path);
}
AssetDatabase.CreateAsset(mf.mesh, path);
AssetDatabase.SaveAssets();
Debug.Log($"Mesh saved to: {path}");
}
public static List<Vector3> CreateRoundedRectPath(Vector3 center, float width, float height, float radius, bool[] corners, int cornerSegments)
{
List<Vector3> path = new();
Expand Down Expand Up @@ -151,11 +135,6 @@ private void GenerateRoundedRectMesh()

mesh.RecalculateBounds();
mesh.RecalculateNormals();
// mesh.RecalculateTangents();
// for (var i = 0; i < mesh.normals.Length; i++)
// {
// Debug.Log($"normals {i}:{mesh.normals[i]}");
// }
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions Runtime/InputSystem/DeviceLayouts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected override void FinishSetup()
public class PXR_Controller : XRControllerWithRumble
{
[Preserve]
[InputControl(aliases = new[] { "Primary2DAxis", "Touchpad" })]
[InputControl(aliases = new[] { "Primary2DAxis", "Thumbstick" })]
public Vector2Control thumbstick { get; private set; }

[Preserve]
Expand All @@ -171,7 +171,7 @@ public class PXR_Controller : XRControllerWithRumble
[InputControl(aliases = new[] { "GripButton", "GripPress" })]
public ButtonControl gripPressed { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "Primary2DAxisClick", "TouchpadPress" })]
[InputControl(aliases = new[] { "Primary2DAxisClick", "ThumbstickPress" })]
public ButtonControl thumbstickClicked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "ATouch", "XTouch" })]
Expand All @@ -189,11 +189,11 @@ public class PXR_Controller : XRControllerWithRumble
[InputControl(aliases = new[] { "Menu" })]
public ButtonControl menu { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "TouchpadTouch" })]
public ButtonControl touchpadTouched { get; private set; }
[InputControl(aliases = new[] { "ThumbstickTouch" })]
public ButtonControl thumbstickTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "ThumbRestTouch" })]
public ButtonControl thumbstickTouched { get; private set; }
public ButtonControl thumbRestTouched { get; private set; }

[Preserve]
[InputControl(aliases = new[] { "controllerTrackingState" })]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ protected override void RegisterActionMapsWithRuntime()

AddActionMap(actionMap);
}
protected override string GetDeviceLayoutName()
{
return nameof(PICO4TouchController);
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,10 @@ protected override void RegisterActionMapsWithRuntime()

AddActionMap(actionMap);
}
protected override string GetDeviceLayoutName()
{
return nameof(PICO4UltraController);
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ protected override void RegisterActionMapsWithRuntime()

AddActionMap(actionMap);
}
protected override string GetDeviceLayoutName()
{
return nameof(PICOG3TouchController);
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,10 @@ protected override void RegisterActionMapsWithRuntime()

AddActionMap(actionMap);
}
protected override string GetDeviceLayoutName()
{
return nameof(PICONeo3Controller);
}
}
}
#endif
2 changes: 1 addition & 1 deletion Runtime/Scripts/OpenXRFeatures/PICOFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class PICOFeature : OpenXRFeature
/// The feature id string. This is used to give the feature a well known id for reference.
/// </summary>
public const string featureId = "com.unity.openxr.feature.pico";
public const string OpenXrExtensionList = "XR_PICO_controller_interaction";
public const string OpenXrExtensionList = "XR_PICO_controller_interaction "+"XR_PICO_view_state";
public bool isPicoSupport = false;
public static Action<bool> onAppFocusedAction;

Expand Down
3 changes: 2 additions & 1 deletion Runtime/Scripts/PXR_Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ public override bool Initialize()
colorSpace = (ushort)((QualitySettings.activeColorSpace == ColorSpace.Linear) ? 1 : 0),
useContentProtect = Convert.ToUInt16(PXR_ProjectSetting.GetProjectConfig().useContentProtect),
systemDisplayFrequency = settings.GetSystemDisplayFrequency(),
optimizeBufferDiscards = settings.GetOptimizeBufferDiscards(),
// Workaround: Disable optimizeBufferDiscards for Vulkan to prevent rendering artifacts (left eye whiteout)
optimizeBufferDiscards = (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Vulkan) ? (ushort)0 : settings.GetOptimizeBufferDiscards(),
enableAppSpaceWarp = Convert.ToUInt16(settings.enableAppSpaceWarp),
enableSubsampled = Convert.ToUInt16(PXR_ProjectSetting.GetProjectConfig().enableSubsampled),
lateLatchingDebug = Convert.ToUInt16(PXR_ProjectSetting.GetProjectConfig().latelatchingDebug),
Expand Down
6 changes: 6 additions & 0 deletions Runtime/Scripts/PXR_Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ public enum SecureMROperatorType
UpdateGltf = 31,
RenderText = 32,
LoadTexture = 33,
Svd = 34,
Norm = 35,
SwapHwcChw = 36,
}

#endregion
Expand Down Expand Up @@ -6864,6 +6867,9 @@ public static class SecureMR
{ typeof(UpdateGltfOperator), SecureMROperatorType.UpdateGltf },
{ typeof(RenderTextOperator), SecureMROperatorType.RenderText },
{ typeof(LoadTextureOperator), SecureMROperatorType.LoadTexture },
{ typeof(SvdOperator), SecureMROperatorType.Svd },
{ typeof(NormOperator), SecureMROperatorType.Norm },
{ typeof(SwapHwcChwOperator), SecureMROperatorType.SwapHwcChw },
};

public static PxrResult UPxr_CreateSecureMRProvider(int width, int height, out ulong providerHandle)
Expand Down
Loading