This commit is contained in:
2025-11-13 17:40:28 +08:00
parent 962ab49609
commit 10156da245
5503 changed files with 805282 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRByteTensorData : PXR_SecureMRTensorData
{
public byte[] data;
public override byte[] ToByteArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b4efb5baf0eb4852ba302b21419172a2
timeCreated: 1742250481

View File

@@ -0,0 +1,25 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRFileTensorData : PXR_SecureMRTensorData
{
public TextAsset fileAsset;
public override byte[] ToByteArray()
{
if (fileAsset != null)
{
return fileAsset.bytes;
}
else
{
return null;
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 57d3aabc698e3d14193ef3b3b3514a0d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRFloatTensorData : PXR_SecureMRTensorData
{
public float[] data;
public override float[] ToFloatArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 833a9c77186f6d44f910747e2046c202
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRIntTensorData : PXR_SecureMRTensorData
{
public int[] data;
public override int[] ToIntArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 63fcdcd56ea9c1342879c35bcdcc5125
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.PXR.SecureMR
{
public abstract class PXR_SecureMRTensorData : MonoBehaviour
{
public virtual byte[] ToByteArray()
{
return null;
}
public virtual float[] ToFloatArray()
{
return null;
}
public virtual int[] ToIntArray()
{
return null;
}
public virtual ushort[] ToUShortArray()
{
return null;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44bf4283f84ec944499e0dab7994ddf9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
#if !PICO_OPENXR_SDK
using System.Collections;
using System.Collections.Generic;
using Unity.XR.PXR.SecureMR;
using UnityEngine;
public class PXR_SecureMRTextureTensorData : PXR_SecureMRTensorData
{
//The texture that will be converted to color and float array
//Note: you have to mark the texture as Read/Write in the Inspector
[SerializeField]
private Texture2D texture;
private Color32[] _colorData;
private float[] _rgbaFloatData;
private int[] _rgbaIntData;
private byte[] _rgbaByteData;
public Texture2D Texture
{
get { return texture; }
set
{
texture = value;
UpdateArrayData();
}
}
public override float[] ToFloatArray()
{
return _rgbaFloatData;
}
public override byte[] ToByteArray()
{
return _rgbaByteData;
}
public override int[] ToIntArray()
{
return _rgbaIntData;
}
private void UpdateArrayData()
{
if (texture == null)
{
_colorData = null;
_rgbaFloatData = null;
_rgbaByteData = null;
_rgbaIntData = null;
return;
}
// Get raw color data from texture
_colorData = texture.GetPixels32();
_rgbaIntData = texture.GetPixelData<int>(0).ToArray();
// Convert to RGBA float array
_rgbaFloatData = new float[_colorData.Length * 4];
_rgbaByteData = new byte[_colorData.Length * 4];
for (int i = 0; i < _colorData.Length; i++)
{
_rgbaFloatData[i * 4] = _colorData[i].r / 255f; // R
_rgbaFloatData[i * 4 + 1] = _colorData[i].g / 255f; // G
_rgbaFloatData[i * 4 + 2] = _colorData[i].b / 255f; // B
_rgbaFloatData[i * 4 + 3] = _colorData[i].a / 255f; // A
_rgbaByteData[i * 4] = _colorData[i].r; // R
_rgbaByteData[i * 4 + 1] = _colorData[i].g; // G
_rgbaByteData[i * 4 + 2] = _colorData[i].b; // B
_rgbaByteData[i * 4 + 3] = _colorData[i].a; // A
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36f03292700cd294c9f91534a11624a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#if !PICO_OPENXR_SDK
namespace Unity.XR.PXR.SecureMR
{
public class PXR_SecureMRUShortTensorData : PXR_SecureMRTensorData
{
public ushort[] data;
public override ushort[] ToUShortArray()
{
return data;
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a0d99d67fc7b4174854334e5094f0824
timeCreated: 1742251258