上传YomovSDK
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine.Profiling;
|
||||
|
||||
//using VIVE.OpenXR.Utils;
|
||||
using VIVE.OpenXR.Hand;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_EXT_hand_tracking_defs
|
||||
{
|
||||
public virtual XrResult xrCreateHandTrackerEXT(ref XrHandTrackerCreateInfoEXT createInfo, out ulong handTracker)
|
||||
{
|
||||
handTracker = 0;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
public virtual XrResult xrDestroyHandTrackerEXT(ulong handTracker)
|
||||
{
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
protected XrHandJointLocationsEXT m_JointLocations = new XrHandJointLocationsEXT(XrStructureType.XR_TYPE_HAND_JOINT_LOCATIONS_EXT, IntPtr.Zero, 0, 0, IntPtr.Zero);
|
||||
protected void InitializeHandJointLocations()
|
||||
{
|
||||
if (m_JointLocations.jointCount != 0) { return; }
|
||||
|
||||
m_JointLocations.type = XrStructureType.XR_TYPE_HAND_JOINT_LOCATIONS_EXT;
|
||||
m_JointLocations.next = IntPtr.Zero;
|
||||
m_JointLocations.isActive = 0;
|
||||
m_JointLocations.jointCount = (uint)XrHandJointEXT.XR_HAND_JOINT_MAX_ENUM_EXT;
|
||||
|
||||
XrHandJointLocationEXT joint_location_ext_type = default(XrHandJointLocationEXT);
|
||||
m_JointLocations.jointLocations = Marshal.AllocHGlobal(Marshal.SizeOf(joint_location_ext_type) * (int)m_JointLocations.jointCount);
|
||||
}
|
||||
public virtual XrResult xrLocateHandJointsEXT(ulong handTracker, XrHandJointsLocateInfoEXT locateInfo, out XrHandJointLocationsEXT locations)
|
||||
{
|
||||
locations = m_JointLocations;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
|
||||
protected Dictionary<bool, XrHandJointLocationEXT[]> s_JointLocation = new Dictionary<bool, XrHandJointLocationEXT[]>()
|
||||
{
|
||||
{ true, new XrHandJointLocationEXT[(int)XrHandJointEXT.XR_HAND_JOINT_MAX_ENUM_EXT] },
|
||||
{ false, new XrHandJointLocationEXT[(int)XrHandJointEXT.XR_HAND_JOINT_MAX_ENUM_EXT] }
|
||||
};
|
||||
protected List<XrHandJointLocationEXT> l_HandJointLocation = new List<XrHandJointLocationEXT>();
|
||||
/// <summary>
|
||||
/// A convenient function to retrieve the left/right hand joint <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XrHandJointLocationEXT">location data</see>.
|
||||
/// </summary>
|
||||
/// <param name="isLeft">True for left hand.</param>
|
||||
/// <param name="handJointLocation">Joint location data in <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XrHandJointLocationEXT">XrHandJointLocationEXT</see>.</param>
|
||||
/// <param name="timestamp">The hand tracking data timestamp.</param>
|
||||
/// <returns>True for valid data.</returns>
|
||||
public virtual bool GetJointLocations(bool isLeft, out XrHandJointLocationEXT[] handJointLocation, out XrTime timestamp)
|
||||
{
|
||||
handJointLocation = s_JointLocation[isLeft];
|
||||
timestamp = 0;
|
||||
|
||||
if (m_JointLocations.isActive == 1)
|
||||
{
|
||||
MemoryTools.CopyFromRawMemory(handJointLocation, m_JointLocations.jointLocations, (int)m_JointLocations.jointCount);
|
||||
|
||||
handJointLocation = s_JointLocation[isLeft];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// A convenient function to retrieve the left/right hand joint <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XrHandJointLocationEXT">location data</see>.
|
||||
/// </summary>
|
||||
/// <param name="isLeft">True for left hand.</param>
|
||||
/// <param name="handJointLocation">Joint location data in <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XrHandJointLocationEXT">XrHandJointLocationEXT</see>.</param>
|
||||
/// <returns>True for valid data.</returns>
|
||||
public virtual bool GetJointLocations(bool isLeft, out XrHandJointLocationEXT[] handJointLocation)
|
||||
{
|
||||
return GetJointLocations(isLeft, out handJointLocation, out XrTime timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
public static class XR_EXT_hand_tracking
|
||||
{
|
||||
static XR_EXT_hand_tracking_defs m_Instance = null;
|
||||
public static XR_EXT_hand_tracking_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_EXT_hand_tracking_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refer to OpenXR <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrCreateHandTrackerEXT">xrCreateHandTrackerEXT</see>.
|
||||
/// </summary>
|
||||
/// <param name="createInfo"></param>
|
||||
/// <param name="handTracker"></param>
|
||||
/// <returns></returns>
|
||||
public static XrResult xrCreateHandTrackerEXT(ref XrHandTrackerCreateInfoEXT createInfo, out ulong handTracker)
|
||||
{
|
||||
return Interop.xrCreateHandTrackerEXT(ref createInfo, out handTracker);
|
||||
}
|
||||
/// <summary>
|
||||
/// Refer to OpenXR <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrDestroyHandTrackerEXT">xrDestroyHandTrackerEXT</see>.
|
||||
/// </summary>
|
||||
/// <param name="handTracker"></param>
|
||||
/// <returns></returns>
|
||||
public static XrResult xrDestroyHandTrackerEXT(ulong handTracker)
|
||||
{
|
||||
return Interop.xrDestroyHandTrackerEXT(handTracker);
|
||||
}
|
||||
/// <summary>
|
||||
/// Refer to OpenXR <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrLocateHandJointsEXT">xrLocateHandJointsEXT</see>.
|
||||
/// </summary>
|
||||
/// <param name="handTracker"></param>
|
||||
/// <param name="locateInfo"></param>
|
||||
/// <param name="locations"></param>
|
||||
/// <returns></returns>
|
||||
public static XrResult xrLocateHandJointsEXT(ulong handTracker, XrHandJointsLocateInfoEXT locateInfo, out XrHandJointLocationsEXT locations)
|
||||
{
|
||||
return Interop.xrLocateHandJointsEXT(handTracker, locateInfo, out locations);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e2bf12a4229e504096c59632e5d2a68
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,104 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
|
||||
using VIVE.OpenXR.Hand;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_EXT_hand_tracking_impls : XR_EXT_hand_tracking_defs
|
||||
{
|
||||
#region Log
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_EXT_hand_tracking_impls";
|
||||
StringBuilder m_sb = null;
|
||||
StringBuilder sb
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_sb == null) { m_sb = new StringBuilder(); }
|
||||
return m_sb;
|
||||
}
|
||||
}
|
||||
void DEBUG(StringBuilder msg) { Debug.LogFormat("{0} {1}", LOG_TAG, msg); }
|
||||
#endregion
|
||||
|
||||
public XR_EXT_hand_tracking_impls() { sb.Clear().Append("XR_EXT_hand_tracking_impls()"); DEBUG(sb); }
|
||||
|
||||
private ViveHandTracking feature = null;
|
||||
private bool ASSERT_FEATURE(bool init = false)
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<ViveHandTracking>(); }
|
||||
bool enabled = (feature != null);
|
||||
if (init)
|
||||
{
|
||||
sb.Clear().Append("ViveHandTracking is ").Append((enabled ? "enabled." : "disabled."));
|
||||
DEBUG(sb);
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public override XrResult xrCreateHandTrackerEXT(ref XrHandTrackerCreateInfoEXT createInfo, out ulong handTracker)
|
||||
{
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
handTracker = 0;
|
||||
|
||||
if (ASSERT_FEATURE(true))
|
||||
{
|
||||
sb.Clear().Append("xrCreateHandTrackerEXT"); DEBUG(sb);
|
||||
XrHandTrackerCreateInfoEXT info = createInfo;
|
||||
result = (XrResult)feature.CreateHandTrackerEXT(ref info, out XrHandTrackerEXT tracker);
|
||||
if (result == XrResult.XR_SUCCESS) { handTracker = tracker; }
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
public override XrResult xrDestroyHandTrackerEXT(ulong handTracker)
|
||||
{
|
||||
if (ASSERT_FEATURE(true))
|
||||
{
|
||||
sb.Clear().Append("xrDestroyHandTrackerEXT"); DEBUG(sb);
|
||||
return (XrResult)feature.DestroyHandTrackerEXT(handTracker);
|
||||
}
|
||||
|
||||
return XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
}
|
||||
public override XrResult xrLocateHandJointsEXT(ulong handTracker, XrHandJointsLocateInfoEXT locateInfo, out XrHandJointLocationsEXT locations)
|
||||
{
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
InitializeHandJointLocations();
|
||||
locations = m_JointLocations;
|
||||
|
||||
if (ASSERT_FEATURE())
|
||||
{
|
||||
XrHandJointLocationsEXT joints = m_JointLocations;
|
||||
result = (XrResult)feature.LocateHandJointsEXT(handTracker, locateInfo, ref joints);
|
||||
if (result == XrResult.XR_SUCCESS) { locations = joints; }
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool GetJointLocations(bool isLeft, out XrHandJointLocationEXT[] handJointLocation, out XrTime timestamp)
|
||||
{
|
||||
if (ASSERT_FEATURE())
|
||||
{
|
||||
if (feature.GetJointLocations(isLeft, out handJointLocation, out timestamp))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
handJointLocation = s_JointLocation[isLeft];
|
||||
timestamp = 0;
|
||||
return false;
|
||||
}
|
||||
public override bool GetJointLocations(bool isLeft, out XrHandJointLocationEXT[] handJointLocation)
|
||||
{
|
||||
return GetJointLocations(isLeft, out handJointLocation, out XrTime timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7d6929ec60d5a2469d083059c5ba39a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_EXT_user_presence_defs
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if an user is present. Default is true.
|
||||
/// </summary>
|
||||
/// <returns>True for present.</returns>
|
||||
public virtual bool IsUserPresent() { return true; }
|
||||
}
|
||||
|
||||
public static class XR_EXT_user_presence
|
||||
{
|
||||
static XR_EXT_user_presence_defs m_Instance = null;
|
||||
public static XR_EXT_user_presence_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_EXT_user_presence_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afabb243c07ef464c838493b18d0a72b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
|
||||
using VIVE.OpenXR.UserPresence;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_EXT_user_presence_impls : XR_EXT_user_presence_defs
|
||||
{
|
||||
#region Log
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_EXT_user_presence_impls";
|
||||
StringBuilder m_sb = null;
|
||||
StringBuilder sb {
|
||||
get {
|
||||
if (m_sb == null) { m_sb = new StringBuilder(); }
|
||||
return m_sb;
|
||||
}
|
||||
}
|
||||
void DEBUG(StringBuilder msg) { Debug.LogFormat("{0} {1}", LOG_TAG, msg); }
|
||||
#endregion
|
||||
|
||||
public XR_EXT_user_presence_impls() { sb.Clear().Append("XR_EXT_user_presence_impls()"); DEBUG(sb); }
|
||||
|
||||
private ViveUserPresence feature = null;
|
||||
private bool ASSERT_FEATURE(bool init = false)
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<ViveUserPresence>(); }
|
||||
bool enabled = (feature != null);
|
||||
if (init)
|
||||
{
|
||||
sb.Clear().Append("ViveUserPresence is ").Append((enabled ? "enabled." : "disabled."));
|
||||
DEBUG(sb);
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public override bool IsUserPresent()
|
||||
{
|
||||
if (ASSERT_FEATURE()) { return feature.IsUserPresent(); }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f553917d855c8347a13c7630afb07f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using VIVE.OpenXR.CompositionLayer;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_composition_layer_extra_settings_defs
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable the sharpening setting to the projection layer.
|
||||
/// </summary>
|
||||
/// <param name="sharpeningMode">The sharpening mode in <see cref="XrSharpeningModeHTC"/>.</param>
|
||||
/// <param name="sharpeningLevel">The sharpening level in float [0, 1].</param>
|
||||
/// <returns>True for success.</returns>
|
||||
public virtual bool EnableSharpening(XrSharpeningModeHTC sharpeningMode, float sharpeningLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable the sharpening setting on the projection layer.
|
||||
/// </summary>
|
||||
/// <returns>True for success</returns>
|
||||
public virtual bool DisableSharpening()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class XR_HTC_composition_layer_extra_settings
|
||||
{
|
||||
static XR_HTC_composition_layer_extra_settings_defs m_Instance = null;
|
||||
public static XR_HTC_composition_layer_extra_settings_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_HTC_composition_layer_extra_settings_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f9a9405f2a3f6c44b131cd38cec8ae3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
|
||||
using VIVE.OpenXR.CompositionLayer;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_composition_layer_extra_settings_impls : XR_HTC_composition_layer_extra_settings_defs
|
||||
{
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_HTC_composition_layer_extra_settings_impls";
|
||||
void DEBUG(string msg) { Debug.Log(LOG_TAG + " " + msg); }
|
||||
public XR_HTC_composition_layer_extra_settings_impls() { DEBUG("XR_HTC_composition_layer_extra_settings_impls()"); }
|
||||
private ViveCompositionLayerExtraSettings feature = null;
|
||||
|
||||
private void ASSERT_FEATURE()
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<ViveCompositionLayerExtraSettings>(); }
|
||||
}
|
||||
|
||||
public override bool EnableSharpening(XrSharpeningModeHTC sharpeningMode, float sharpeningLevel)
|
||||
{
|
||||
DEBUG("xrViveCompositionLayer_EnableSharpening");
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
return feature.EnableSharpening(sharpeningMode, sharpeningLevel);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool DisableSharpening()
|
||||
{
|
||||
DEBUG("xrViveCompositionLayer_EnableSharpening");
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
return feature.DisableSharpening();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd47d8d4716ae4c41a5d2e88f849d99b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,143 @@
|
||||
// ===================== 2022 HTC Corporation. All Rights Reserved. ===================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using VIVE.OpenXR.EyeTracker;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_eye_tracker_defs
|
||||
{
|
||||
public virtual XrResult xrCreateEyeTrackerHTC(XrEyeTrackerCreateInfoHTC createInfo, out XrEyeTrackerHTC eyeTracker)
|
||||
{
|
||||
eyeTracker = 0;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
public virtual XrResult xrDestroyEyeTrackerHTC(XrEyeTrackerHTC eyeTracker)
|
||||
{
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
protected XrEyeGazeDataHTC m_eyeGazes = new XrEyeGazeDataHTC(); //= new XrEyeGazeDataHTC(XrStructureType.XR_TYPE_EYE_GAZE_DATA_HTC, IntPtr.Zero, 0);
|
||||
public virtual XrResult xrGetEyeGazeDataHTC(XrEyeTrackerHTC eyeTracker, XrEyeGazeDataInfoHTC gazeInfo, out XrEyeGazeDataHTC eyeGazes)
|
||||
{
|
||||
m_eyeGazes.type = XrStructureType.XR_TYPE_EYE_GAZE_DATA_HTC;
|
||||
m_eyeGazes.next = IntPtr.Zero;
|
||||
m_eyeGazes.time = 0;
|
||||
eyeGazes = m_eyeGazes;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
public virtual bool GetEyeGazeData(out XrSingleEyeGazeDataHTC[] out_gazes)
|
||||
{
|
||||
m_eyeGazes.type = XrStructureType.XR_TYPE_EYE_GAZE_DATA_HTC;
|
||||
m_eyeGazes.next = IntPtr.Zero;
|
||||
m_eyeGazes.time = 0;
|
||||
out_gazes = m_eyeGazes.gaze;
|
||||
return false;
|
||||
}
|
||||
protected XrEyePupilDataHTC m_pupilData = new XrEyePupilDataHTC();
|
||||
public virtual XrResult xrGetEyePupilDataHTC(XrEyeTrackerHTC eyeTracker, XrEyePupilDataInfoHTC pupilDataInfo, out XrEyePupilDataHTC pupilData)
|
||||
{
|
||||
m_pupilData.type = XrStructureType.XR_TYPE_EYE_PUPIL_DATA_HTC;
|
||||
m_pupilData.next = IntPtr.Zero;
|
||||
m_pupilData.time = 0;
|
||||
pupilData = m_pupilData;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
public virtual bool GetEyePupilData(out XrSingleEyePupilDataHTC[] pupilData)
|
||||
{
|
||||
m_pupilData.type = XrStructureType.XR_TYPE_EYE_PUPIL_DATA_HTC;
|
||||
m_pupilData.next = IntPtr.Zero;
|
||||
m_pupilData.time = 0;
|
||||
pupilData = m_pupilData.pupilData;
|
||||
return false;
|
||||
}
|
||||
protected XrEyeGeometricDataHTC m_eyeGeometricData = new XrEyeGeometricDataHTC();
|
||||
public virtual XrResult xrGetEyeGeometricDataHTC(XrEyeTrackerHTC eyeTracker,
|
||||
XrEyeGeometricDataInfoHTC info,
|
||||
out XrEyeGeometricDataHTC eyeGeometricData)
|
||||
{
|
||||
m_eyeGeometricData.type = XrStructureType.XR_TYPE_EYE_GEOMETRIC_DATA_HTC;
|
||||
m_eyeGeometricData.next = IntPtr.Zero;
|
||||
m_eyeGeometricData.time = 0;
|
||||
eyeGeometricData = m_eyeGeometricData;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
public virtual bool GetEyeGeometricData(out XrSingleEyeGeometricDataHTC[] geometricData)
|
||||
{
|
||||
m_eyeGeometricData.type = XrStructureType.XR_TYPE_EYE_GEOMETRIC_DATA_HTC;
|
||||
m_eyeGeometricData.next = IntPtr.Zero;
|
||||
m_eyeGeometricData.time = 0;
|
||||
geometricData = m_eyeGeometricData.eyeGeometricData;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public class XR_HTC_eye_tracker
|
||||
{
|
||||
static XR_HTC_eye_tracker_defs m_Instance = null;
|
||||
public static XR_HTC_eye_tracker_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_HTC_eye_tracker_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An application can create an <see cref="XrEyeTrackerHTC">XrEyeTrackerHTC</see> handle using CreateEyeTracker.
|
||||
/// </summary>
|
||||
/// <param name="createInfo">The <see cref="XrEyeTrackerCreateInfoHTC">XrEyeTrackerCreateInfoHTC</see> used to specify the eye tracker.</param>
|
||||
/// <param name="eyeTracker">The returned XrEyeTrackerHTC handle.</param>
|
||||
/// <returns>XR_SUCCESS for success.</returns>
|
||||
public static XrResult xrCreateEyeTrackerHTC(XrEyeTrackerCreateInfoHTC createInfo, out XrEyeTrackerHTC eyeTracker)
|
||||
{
|
||||
return Interop.xrCreateEyeTrackerHTC(createInfo,out eyeTracker);
|
||||
}
|
||||
/// <summary>
|
||||
/// Releases the eye tracker and the underlying resources when the eye tracking experience is over.
|
||||
/// </summary>
|
||||
/// <param name="eyeTracker">An XrEyeTrackerHTC previously created by xrCreateEyeTrackerHTC.</param>
|
||||
/// <returns>XR_SUCCESS for success.</returns>
|
||||
public static XrResult xrDestroyEyeTrackerHTC(XrEyeTrackerHTC eyeTracker)
|
||||
{
|
||||
return Interop.xrDestroyEyeTrackerHTC(eyeTracker);
|
||||
}
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="XrEyeGazeDataHTC">XrEyeGazeDataHTC</see> data of a <see cref="XrEyeTrackerHTC">XrEyeTrackerHTC</see>.
|
||||
/// </summary>
|
||||
/// <param name="eyeTracker">An <see cref="XrEyeTrackerHTC">XrEyeTrackerHTC</see> previously created by <see cref="ViveEyeTrackerHelper.xrCreateEyeTrackerHTCDelegate">xrCreateEyeTrackerHTC</see>.</param>
|
||||
/// <param name="gazeInfo">The information to get eye gaze.</param>
|
||||
/// <param name="eyeGazes">Output parameter to retrieve a pointer to <see cref="XrEyeGazeDataHTC">XrEyeGazeDataHTC</see> receiving the returned eye poses.</param>
|
||||
/// <returns>XR_SUCCESS for success.</returns>
|
||||
public static XrResult xrGetEyeGazeDataHTC(XrEyeTrackerHTC eyeTracker, XrEyeGazeDataInfoHTC gazeInfo, out XrEyeGazeDataHTC eyeGazes)
|
||||
{
|
||||
return Interop.xrGetEyeGazeDataHTC(eyeTracker, gazeInfo, out eyeGazes);
|
||||
}
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="XrEyePupilDataHTC">XrEyePupilDataHTC</see> data of a <see cref="XrEyeTrackerHTC">XrEyeTrackerHTC</see>.
|
||||
/// </summary>
|
||||
/// <param name="eyeTracker">An <see cref="XrEyeTrackerHTC">XrEyeTrackerHTC</see> previously created by <see cref="ViveEyeTrackerHelper.xrCreateEyeTrackerHTCDelegate">xrCreateEyeTrackerHTC</see>.</param>
|
||||
/// <param name="pupilDataInfo">The information to get pupil data.</param>
|
||||
/// <param name="pupilData">A pointer to <see cref="XrEyePupilDataHTC">XrEyePupilDataHTC</see> returned by the runtime.</param>
|
||||
/// <returns>XR_SUCCESS for success.</returns>
|
||||
public static XrResult xrGetEyePupilDataHTC(XrEyeTrackerHTC eyeTracker, XrEyePupilDataInfoHTC pupilDataInfo, out XrEyePupilDataHTC pupilData)
|
||||
{
|
||||
return Interop.xrGetEyePupilDataHTC(eyeTracker, pupilDataInfo, out pupilData);
|
||||
}
|
||||
/// <param name="eyeTracker">An <see cref="XrEyeTrackerHTC">XrEyeTrackerHTC</see> previously created by <see cref="ViveEyeTrackerHelper.xrCreateEyeTrackerHTCDelegate">xrCreateEyeTrackerHTC</see>.</param>
|
||||
/// <param name="info">A pointer to <see cref="XrEyeGeometricDataInfoHTC">XrEyeGeometricDataInfoHTC</see> structure.</param>
|
||||
/// <param name="eyeGeometricData">A pointer to <see cref="XrEyeGeometricDataHTC">XrEyeGeometricDataHTC</see> returned by the runtime.</param>
|
||||
/// <returns>XR_SUCCESS for success.</returns>
|
||||
public static XrResult xrGetEyeGeometricDataHTC(XrEyeTrackerHTC eyeTracker,
|
||||
XrEyeGeometricDataInfoHTC info,
|
||||
out XrEyeGeometricDataHTC eyeGeometricData)
|
||||
{
|
||||
return Interop.xrGetEyeGeometricDataHTC(eyeTracker,info, out eyeGeometricData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fb607ec9f5f9a349841a128ef8b2725
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,132 @@
|
||||
// ===================== 2022 HTC Corporation. All Rights Reserved. ===================
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.XR.OpenXR;
|
||||
|
||||
using VIVE.OpenXR.EyeTracker;
|
||||
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_eye_tracker_impls : XR_HTC_eye_tracker_defs
|
||||
{
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_HTC_eye_tracker_impls";
|
||||
void DEBUG(string msg) { Debug.Log(LOG_TAG + " " + msg); }
|
||||
|
||||
private ViveEyeTracker feature = null;
|
||||
private void ASSERT_FEATURE()
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<ViveEyeTracker>(); }
|
||||
}
|
||||
|
||||
public override XrResult xrCreateEyeTrackerHTC(XrEyeTrackerCreateInfoHTC createInfo, out XrEyeTrackerHTC eyeTracker)
|
||||
{
|
||||
DEBUG("xrCreateEyeTrackerHTC");
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
eyeTracker = 0;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = (XrResult)feature.CreateEyeTracker(createInfo, out XrEyeTrackerHTC value);
|
||||
if (result == XrResult.XR_SUCCESS) { eyeTracker = value; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public override XrResult xrDestroyEyeTrackerHTC(XrEyeTrackerHTC eyeTracker)
|
||||
{
|
||||
DEBUG("xrDestroyEyeTrackerHTC");
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature) { return (XrResult)feature.DestroyEyeTracker(eyeTracker); }
|
||||
|
||||
return XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
}
|
||||
public override XrResult xrGetEyeGazeDataHTC(XrEyeTrackerHTC eyeTracker, XrEyeGazeDataInfoHTC gazeInfo, out XrEyeGazeDataHTC eyeGazes)
|
||||
{
|
||||
eyeGazes = m_eyeGazes;
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = (XrResult)feature.GetEyeGazeData(eyeTracker, gazeInfo, out XrEyeGazeDataHTC gazes);
|
||||
if (result == XrResult.XR_SUCCESS) { eyeGazes = gazes; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool GetEyeGazeData(out XrSingleEyeGazeDataHTC[] out_gazes)
|
||||
{
|
||||
out_gazes = m_eyeGazes.gaze;
|
||||
bool result = false;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = feature.GetEyeGazeData(out XrSingleEyeGazeDataHTC[] data);
|
||||
if (result) out_gazes = data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override XrResult xrGetEyePupilDataHTC(XrEyeTrackerHTC eyeTracker, XrEyePupilDataInfoHTC pupilDataInfo, out XrEyePupilDataHTC pupilData)
|
||||
{
|
||||
pupilData = m_pupilData;
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = (XrResult)feature.GetEyePupilData(eyeTracker, pupilDataInfo, out XrEyePupilDataHTC data);
|
||||
if (result == XrResult.XR_SUCCESS) { pupilData = data; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool GetEyePupilData(out XrSingleEyePupilDataHTC[] pupilData)
|
||||
{
|
||||
pupilData = m_pupilData.pupilData;
|
||||
bool result = false;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = feature.GetEyePupilData(out XrSingleEyePupilDataHTC[] data);
|
||||
if (result) pupilData = data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public override XrResult xrGetEyeGeometricDataHTC(XrEyeTrackerHTC eyeTracker,
|
||||
XrEyeGeometricDataInfoHTC info,
|
||||
out XrEyeGeometricDataHTC eyeGeometricData)
|
||||
{
|
||||
eyeGeometricData = m_eyeGeometricData;
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = (XrResult)feature.GetEyeGeometricData(eyeTracker, info, out XrEyeGeometricDataHTC geometricData);
|
||||
if (result == XrResult.XR_SUCCESS) { eyeGeometricData = geometricData; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public override bool GetEyeGeometricData(out XrSingleEyeGeometricDataHTC[] geometricData)
|
||||
{
|
||||
geometricData = m_eyeGeometricData.eyeGeometricData;
|
||||
bool result = false;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = feature.GetEyeGeometricData(out XrSingleEyeGeometricDataHTC[] data);
|
||||
if (result) geometricData = data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 166bae55cad9f9146a8c2ada64d74832
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
// ===================== 2022 HTC Corporation. All Rights Reserved. ===================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using VIVE.OpenXR.FacialTracking;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_facial_tracking_defs
|
||||
{
|
||||
public virtual XrResult xrCreateFacialTrackerHTC(XrFacialTrackerCreateInfoHTC createInfo, out ulong facialTracker)
|
||||
{
|
||||
facialTracker = 0;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
public virtual XrResult xrDestroyFacialTrackerHTC(ulong facialTracker)
|
||||
{
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
const int kMaxExpressionCount = 64;
|
||||
protected XrFacialExpressionsHTC m_FacialExpressions = new XrFacialExpressionsHTC(XrStructureType.XR_TYPE_FACIAL_EXPRESSIONS_HTC, IntPtr.Zero, 0, 0, 0, IntPtr.Zero);
|
||||
protected void InitializeFacialExpressions()
|
||||
{
|
||||
if (m_FacialExpressions.expressionCount != 0) { return; }
|
||||
|
||||
m_FacialExpressions.type = XrStructureType.XR_TYPE_FACIAL_EXPRESSIONS_HTC;
|
||||
m_FacialExpressions.next = IntPtr.Zero;
|
||||
m_FacialExpressions.isActive = 0;
|
||||
m_FacialExpressions.sampleTime = 0;
|
||||
m_FacialExpressions.expressionCount = kMaxExpressionCount;
|
||||
m_FacialExpressions.expressionWeightings = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * kMaxExpressionCount);
|
||||
}
|
||||
public virtual XrResult xrGetFacialExpressionsHTC(ulong facialTracker, out XrFacialExpressionsHTC facialExpressions)
|
||||
{
|
||||
facialExpressions = m_FacialExpressions;
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
|
||||
protected Dictionary<XrFacialTrackingTypeHTC, float[]> s_ExpressionWeightings = new Dictionary<XrFacialTrackingTypeHTC, float[]>()
|
||||
{
|
||||
{ XrFacialTrackingTypeHTC.XR_FACIAL_TRACKING_TYPE_EYE_DEFAULT_HTC, new float[kMaxExpressionCount] },
|
||||
{ XrFacialTrackingTypeHTC.XR_FACIAL_TRACKING_TYPE_LIP_DEFAULT_HTC, new float[kMaxExpressionCount] }
|
||||
};
|
||||
/// <summary>
|
||||
/// Retrieves an array of values of blend shapes for a facial expression on a given time.
|
||||
/// </summary>
|
||||
/// <param name="facialTrackingType">The <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XrFacialTrackingTypeHTC">XrFacialTrackingTypeHTC</see> describes which type of tracking the <see cref="XrFacialTrackerHTC">XrFacialTrackerHTC</see> is using.</param>
|
||||
/// <param name="expressionWeightings">A float array filled in by the runtime, specifying the weightings for each blend shape. The array size is <see cref="XrEyeExpressionHTC.XR_EYE_EXPRESSION_MAX_ENUM_HTC">XR_EYE_EXPRESSION_MAX_ENUM_HTC</see> for eye expression and <see cref="XrLipExpressionHTC.XR_LIP_EXPRESSION_MAX_ENUM_HTC">XR_LIP_EXPRESSION_MAX_ENUM_HTC</see> for lip expression.</param>
|
||||
/// <returns>True for success.</returns>
|
||||
public virtual bool GetExpressionWeightings(XrFacialTrackingTypeHTC facialTrackingType, out float[] expressionWeightings)
|
||||
{
|
||||
expressionWeightings = s_ExpressionWeightings[facialTrackingType];
|
||||
int expressionCount = s_ExpressionWeightings[facialTrackingType].Length;
|
||||
|
||||
if (m_FacialExpressions.isActive == 1 && expressionCount <= kMaxExpressionCount)
|
||||
{
|
||||
Marshal.Copy(m_FacialExpressions.expressionWeightings, s_ExpressionWeightings[facialTrackingType], 0, s_ExpressionWeightings[facialTrackingType].Length);
|
||||
expressionWeightings = s_ExpressionWeightings[facialTrackingType];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class XR_HTC_facial_tracking
|
||||
{
|
||||
static XR_HTC_facial_tracking_defs m_Instance = null;
|
||||
public static XR_HTC_facial_tracking_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_HTC_facial_tracking_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refer to OpenXR <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrCreateFacialTrackerHTC">xrCreateFacialTrackerHTC</see>.
|
||||
/// </summary>
|
||||
/// <param name="createInfo"></param>
|
||||
/// <param name="facialTracker"></param>
|
||||
/// <returns></returns>
|
||||
public static XrResult xrCreateFacialTrackerHTC(XrFacialTrackerCreateInfoHTC createInfo, out ulong facialTracker)
|
||||
{
|
||||
return Interop.xrCreateFacialTrackerHTC(createInfo, out facialTracker);
|
||||
}
|
||||
/// <summary>
|
||||
/// Refer to OpenXR <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrDestroyFacialTrackerHTC">xrDestroyFacialTrackerHTC</see>.
|
||||
/// </summary>
|
||||
/// <param name="facialTracker"></param>
|
||||
/// <returns></returns>
|
||||
public static XrResult xrDestroyFacialTrackerHTC(ulong facialTracker)
|
||||
{
|
||||
return Interop.xrDestroyFacialTrackerHTC(facialTracker);
|
||||
}
|
||||
/// <summary>
|
||||
/// Refer to OpenXR <see href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#xrGetFacialExpressionsHTC">xrGetFacialExpressionsHTC</see>
|
||||
/// </summary>
|
||||
/// <param name="facialTracker"></param>
|
||||
/// <param name="facialExpressions"></param>
|
||||
/// <returns></returns>
|
||||
public static XrResult xrGetFacialExpressionsHTC(ulong facialTracker, out XrFacialExpressionsHTC facialExpressions)
|
||||
{
|
||||
return Interop.xrGetFacialExpressionsHTC(facialTracker, out facialExpressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a291ffd0f5a17ca44b07fa43f29a8e48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
// ===================== 2022 HTC Corporation. All Rights Reserved. ===================
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.XR.OpenXR;
|
||||
|
||||
using VIVE.OpenXR.FacialTracking;
|
||||
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_facial_tracking_impls : XR_HTC_facial_tracking_defs
|
||||
{
|
||||
const string LOG_TAG = "VIVE.OpenXR.Android.XR_HTC_facial_tracking_impls";
|
||||
void DEBUG(string msg) { Debug.Log(LOG_TAG + " " + msg); }
|
||||
|
||||
private ViveFacialTracking feature = null;
|
||||
private void ASSERT_FEATURE() {
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<ViveFacialTracking>(); }
|
||||
}
|
||||
|
||||
public override XrResult xrCreateFacialTrackerHTC(XrFacialTrackerCreateInfoHTC createInfo, out ulong facialTracker)
|
||||
{
|
||||
DEBUG("xrCreateFacialTrackerHTC");
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
facialTracker = 0;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = (XrResult)feature.CreateFacialTracker(createInfo, out XrFacialTrackerHTC value);
|
||||
if (result == XrResult.XR_SUCCESS) { facialTracker = value; }
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
public override XrResult xrDestroyFacialTrackerHTC(ulong facialTracker)
|
||||
{
|
||||
DEBUG("xrDestroyFacialTrackerHTC");
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature) { return (XrResult)feature.DestroyFacialTracker(facialTracker); }
|
||||
|
||||
return XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
}
|
||||
public override XrResult xrGetFacialExpressionsHTC(ulong facialTracker, out XrFacialExpressionsHTC facialExpressions)
|
||||
{
|
||||
InitializeFacialExpressions();
|
||||
facialExpressions = m_FacialExpressions;
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = (XrResult)feature.GetFacialExpressions(facialTracker, out XrFacialExpressionsHTC exps);
|
||||
if (result == XrResult.XR_SUCCESS) { facialExpressions = exps; }
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool GetExpressionWeightings(XrFacialTrackingTypeHTC facialTrackingType, out float[] expressionWeightings)
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
if (feature) { return feature.GetFacialExpressions((XrFacialTrackingTypeHTC)facialTrackingType, out expressionWeightings); }
|
||||
|
||||
expressionWeightings = s_ExpressionWeightings[facialTrackingType];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef22a055fe672f04990446ce0bd458d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VIVE.OpenXR.Passthrough;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_passthrough_defs
|
||||
{
|
||||
public virtual XrResult xrCreatePassthroughHTC(XrPassthroughCreateInfoHTC createInfo, out XrPassthroughHTC passthrough)
|
||||
{
|
||||
passthrough = 0;
|
||||
return XrResult.XR_ERROR_RUNTIME_FAILURE;
|
||||
}
|
||||
public virtual XrResult xrDestroyPassthroughHTC(XrPassthroughHTC passthrough)
|
||||
{
|
||||
return XrResult.XR_ERROR_RUNTIME_FAILURE;
|
||||
}
|
||||
|
||||
public virtual void GetOriginEndFrameLayerList(out List<IntPtr> layers)
|
||||
{
|
||||
layers = new List<IntPtr>();
|
||||
}
|
||||
|
||||
public virtual void SubmitLayers(List<IntPtr> layers)
|
||||
{
|
||||
}
|
||||
public virtual XrSpace GetTrackingSpace()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual XrFrameState GetFrameState()
|
||||
{
|
||||
return new XrFrameState();
|
||||
}
|
||||
}
|
||||
|
||||
public static class XR_HTC_passthrough
|
||||
{
|
||||
static XR_HTC_passthrough_defs m_Instance = null;
|
||||
public static XR_HTC_passthrough_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_HTC_passthrough_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static XrResult xrCreatePassthroughHTC(XrPassthroughCreateInfoHTC createInfo, out XrPassthroughHTC passthrough)
|
||||
{
|
||||
return Interop.xrCreatePassthroughHTC(createInfo,out passthrough);
|
||||
}
|
||||
public static XrResult xrDestroyPassthroughHTC(XrPassthroughHTC passthrough)
|
||||
{
|
||||
return Interop.xrDestroyPassthroughHTC(passthrough);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 099596ee936f4724f866de5335ef9cf6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,59 @@
|
||||
// ===================== 2022 HTC Corporation. All Rights Reserved. ===================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using VIVE.OpenXR.Passthrough;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_passthrough_configuration_defs
|
||||
{
|
||||
public virtual XrResult SetPassthroughConfigurationHTC(IntPtr config)
|
||||
{
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
|
||||
public virtual XrResult GetPassthroughConfigurationHTC(IntPtr config)
|
||||
{
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
|
||||
public virtual XrResult EnumeratePassthroughImageRatesHTC([In] UInt32 imageRateCapacityInput, ref UInt32 imageRateCountOutput, [In, Out] XrPassthroughConfigurationImageRateHTC[] imageRates)
|
||||
{
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
public class XR_HTC_passthrough_configuration
|
||||
{
|
||||
static XR_HTC_passthrough_configuration_defs m_Instance = null;
|
||||
public static XR_HTC_passthrough_configuration_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_HTC_passthrough_configuration_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static XrResult SetPassthroughConfigurationHTC(IntPtr config)
|
||||
{
|
||||
return Interop.SetPassthroughConfigurationHTC(config);
|
||||
}
|
||||
|
||||
public static XrResult GetPassthroughConfigurationHTC(IntPtr config)
|
||||
{
|
||||
return Interop.GetPassthroughConfigurationHTC(config);
|
||||
}
|
||||
|
||||
public static XrResult EnumeratePassthroughImageRatesHTC([In] UInt32 imageRateCapacityInput, ref UInt32 imageRateCountOutput, [In, Out] XrPassthroughConfigurationImageRateHTC[] imageRates)
|
||||
{
|
||||
return Interop.EnumeratePassthroughImageRatesHTC(imageRateCapacityInput, ref imageRateCountOutput, imageRates);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa07bedac75da4b4dbe13a60f146d130
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,75 @@
|
||||
// ===================== 2022 HTC Corporation. All Rights Reserved. ===================
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.XR.OpenXR;
|
||||
|
||||
using VIVE.OpenXR.Passthrough;
|
||||
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_passthrough_configuration_impls : XR_HTC_passthrough_configuration_defs
|
||||
{
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_HTC_passthrough_configuration_impls";
|
||||
void DEBUG(string msg) { Debug.Log(LOG_TAG + " " + msg); }
|
||||
|
||||
private VivePassthrough feature = null;
|
||||
private void ASSERT_FEATURE()
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<VivePassthrough>(); }
|
||||
}
|
||||
|
||||
public override XrResult SetPassthroughConfigurationHTC(IntPtr config)
|
||||
{
|
||||
DEBUG("SetPassthroughConfigurationHTC");
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
if (!feature.SupportsImageQuality() || !feature.SupportsImageRate())
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
|
||||
result = (XrResult)feature.SetPassthroughConfigurationHTC(config);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override XrResult GetPassthroughConfigurationHTC(IntPtr config)
|
||||
{
|
||||
DEBUG("GetPassthroughConfigurationHTC");
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
if (!feature.SupportsImageQuality() || !feature.SupportsImageRate())
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
result = (XrResult)feature.GetPassthroughConfigurationHTC(config);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override XrResult EnumeratePassthroughImageRatesHTC([In] UInt32 imageRateCapacityInput, ref UInt32 imageRateCountOutput, [In, Out] XrPassthroughConfigurationImageRateHTC[] imageRates)
|
||||
{
|
||||
DEBUG("EnumeratePassthroughImageRatesHTC");
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
if (!feature.SupportsImageQuality() || !feature.SupportsImageRate())
|
||||
return XrResult.XR_ERROR_FEATURE_UNSUPPORTED;
|
||||
result = (XrResult)feature.EnumeratePassthroughImageRatesHTC(imageRateCapacityInput, ref imageRateCountOutput, imageRates);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e70585d207c033c4999abe9294405298
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
using VIVE.OpenXR.Passthrough;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_passthrough_impls : XR_HTC_passthrough_defs
|
||||
{
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_HTC_passthrough_impls";
|
||||
void DEBUG(string msg) { Debug.Log(LOG_TAG + " " + msg); }
|
||||
public XR_HTC_passthrough_impls() { DEBUG("XR_HTC_passthrough_impls()"); }
|
||||
private VivePassthrough feature = null;
|
||||
|
||||
private void ASSERT_FEATURE()
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<VivePassthrough>(); }
|
||||
}
|
||||
|
||||
public override XrResult xrCreatePassthroughHTC(XrPassthroughCreateInfoHTC createInfo, out XrPassthroughHTC passthrough)
|
||||
{
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
passthrough = 0;
|
||||
ASSERT_FEATURE();
|
||||
|
||||
if(feature)
|
||||
result = feature.CreatePassthroughHTC(createInfo,out passthrough);
|
||||
|
||||
return result;
|
||||
}
|
||||
public override XrResult xrDestroyPassthroughHTC(XrPassthroughHTC passthrough)
|
||||
{
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
ASSERT_FEATURE();
|
||||
|
||||
if(feature)
|
||||
result = feature.DestroyPassthroughHTC(passthrough);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override XrSpace GetTrackingSpace()
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
|
||||
if (feature)
|
||||
return feature.GetTrackingSpace();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override XrFrameState GetFrameState()
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
return feature.GetFrameState();
|
||||
return new XrFrameState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97968beb8cc921d4cbebb8e3a2bc3d6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_path_enumeration_defs
|
||||
{
|
||||
public virtual XrResult xrEnumeratePathsForInteractionProfileHTC(
|
||||
ref XrPathsForInteractionProfileEnumerateInfoHTC createInfo,
|
||||
UInt32 pathCapacityInput,
|
||||
ref UInt32 pathCountOutput,
|
||||
[In, Out] XrPath[] paths)
|
||||
{
|
||||
paths = null;
|
||||
return XrResult.XR_ERROR_RUNTIME_FAILURE;
|
||||
}
|
||||
|
||||
public virtual bool GetUserPaths(string interactionProfileString, out XrPath[] userPaths)
|
||||
{
|
||||
userPaths = null;
|
||||
return false;
|
||||
}
|
||||
public virtual bool GetInputPathsWithUserPath(string interactionProfileString, XrPath userPath, out XrPath[] inputPaths)
|
||||
{
|
||||
inputPaths = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual string PathToString(ulong path) { return null; }
|
||||
public virtual ulong StringToPath(string str) {
|
||||
return 0; }
|
||||
}
|
||||
|
||||
public static class XR_HTC_path_enumeration
|
||||
{
|
||||
static XR_HTC_path_enumeration_defs m_Instance = null;
|
||||
public static XR_HTC_path_enumeration_defs Interop
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
m_Instance = new XR_HTC_path_enumeration_impls();
|
||||
}
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static XrResult xrEnumeratePathsForInteractionProfileHTC(
|
||||
ref XrPathsForInteractionProfileEnumerateInfoHTC createInfo,
|
||||
UInt32 pathCapacityInput,
|
||||
ref UInt32 pathCountOutput,
|
||||
[In, Out] XrPath[] paths)
|
||||
{
|
||||
return Interop.xrEnumeratePathsForInteractionProfileHTC(ref createInfo,
|
||||
pathCapacityInput,
|
||||
ref pathCountOutput,
|
||||
paths);
|
||||
}
|
||||
|
||||
public static string PathToString(ulong path) { return Interop.PathToString(path); }
|
||||
public static ulong StringToPath(string str)
|
||||
{
|
||||
return Interop.StringToPath(str); }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be103afd6857e52418eed1936213db83
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,104 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
public class XR_HTC_path_enumeration_impls : XR_HTC_path_enumeration_defs
|
||||
{
|
||||
const string LOG_TAG = "VIVE.OpenXR.XR_HTC_path_enumeration_impls";
|
||||
void DEBUG(string msg) { Debug.Log(LOG_TAG + " " + msg); }
|
||||
public XR_HTC_path_enumeration_impls() { DEBUG("XR_HTC_path_enumeration_impls()"); }
|
||||
private VivePathEnumeration feature = null;
|
||||
|
||||
private void ASSERT_FEATURE()
|
||||
{
|
||||
if (feature == null) { feature = OpenXRSettings.Instance.GetFeature<VivePathEnumeration>(); }
|
||||
}
|
||||
|
||||
public override XrResult xrEnumeratePathsForInteractionProfileHTC(
|
||||
ref XrPathsForInteractionProfileEnumerateInfoHTC createInfo,
|
||||
UInt32 pathCapacityInput,
|
||||
ref UInt32 pathCountOutput,
|
||||
[In, Out] XrPath[] paths)
|
||||
{
|
||||
DEBUG("xrEnumeratePathsForInteractionProfileHTC");
|
||||
XrResult result = XrResult.XR_ERROR_VALIDATION_FAILURE;
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
result = feature.EnumeratePathsForInteractionProfileHTC(ref createInfo, pathCapacityInput,
|
||||
ref pathCountOutput, paths);
|
||||
if (result != XrResult.XR_SUCCESS) { paths = null; }
|
||||
}
|
||||
paths = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool GetUserPaths(string interactionProfileString, out XrPath[] userPaths)
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
if (feature.GetUserPaths(interactionProfileString, out userPaths))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
userPaths = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
userPaths = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool GetInputPathsWithUserPath(string interactionProfileString, XrPath userPath, out XrPath[] inputPaths)
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
{
|
||||
if (feature.GetInputPathsWithUserPath(interactionProfileString, userPath,out inputPaths))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
inputPaths = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inputPaths = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override string PathToString(ulong path)
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
return feature.xrPathToString(path);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public override ulong StringToPath(string str)
|
||||
{
|
||||
ASSERT_FEATURE();
|
||||
if (feature)
|
||||
return feature.xrStringToPath(str);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0778892173385d4291570f9f47ec08d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user