version 2.0.0
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7668e041703aef84793af8e9ed989023
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
# 12.70. XR_HTC_vive_wrist_tracker_interaction
|
||||
## Name String
|
||||
XR_HTC_vive_wrist_tracker_interaction
|
||||
## Revision
|
||||
1
|
||||
## VIVE Wrist Tracker input
|
||||
### Interaction profile path:
|
||||
- /interaction_profiles/htc/vive_wrist_tracker
|
||||
|
||||
### Valid for user paths:
|
||||
- /user/wrist_htc/left
|
||||
- /user/wrist_htc/right
|
||||
|
||||
### Supported input source
|
||||
- On /user/wrist_htc/left only:
|
||||
- <20>K/input/menu/click
|
||||
- <20>K/input/x/click
|
||||
- On /user/wrist_htc/right only:
|
||||
- <20>K/input/system/click (may not be available for application use)
|
||||
- <20>K/input/a/click
|
||||
- <20>K/input/entity_htc/pose
|
||||
|
||||
The entity_htc pose allows the applications to recognize the origin of a tracked input device, especially for the wearable devices which are not held in the user<65><72>s hand. The entity_htc pose is defined as follows:
|
||||
|
||||
- The entity position: The center position of the tracked device.
|
||||
- The entity orientation: Oriented with +Y up, +X to the right, and -Z forward.
|
||||
|
||||
## VIVE Plugin
|
||||
|
||||
After adding the "VIVE Focus3 Wrist Tracker" to "Project Settings > XR Plugin-in Management > OpenXR > Android Tab > Interaction Profiles", you can use the following Input Action Pathes.
|
||||
|
||||
### Left Hand
|
||||
- <ViveWristTracker>{LeftHand}/primaryButton: Left tracker primary button pressed state.
|
||||
- <ViveWristTracker>{LeftHand}/menu: Left tracker menu button pressed state.
|
||||
- <ViveWristTracker>{LeftHand}/devicePose: Left tracker pose.
|
||||
- <ViveWristTracker>{LeftHand}/devicePose/isTracked: Left tracker tracking state.
|
||||
|
||||
### Right Hand
|
||||
- <ViveWristTracker>{RightHand}/primaryButton: Right tracker primary button pressed state.
|
||||
- <ViveWristTracker>{RightHand}/menu: Right tracker menu button pressed state.
|
||||
- <ViveWristTracker>{RightHand}/devicePose: Right tracker pose.
|
||||
- <ViveWristTracker>{RightHand}/devicePose/isTracked: Right tracker tracking state.
|
||||
|
||||
Refer to the <VIVE OpenXR sample path>/Plugin/Input/ActionMap/InputActions.inputActions about the "Input Action Path" usage and the sample <VIVE OpenXR sample path>/Plugin/Input/OpenXRInput.unity.
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c68233f6b41d7145b07de86f5d16638
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 771c0636a727c9742971602d5da26011
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright HTC Corporation All Rights Reserved.
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
using UnityEngine.XR.OpenXR.Features;
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.XR.OpenXR.Features;
|
||||
#endif
|
||||
|
||||
namespace VIVE.OpenXR
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[OpenXRFeature(UiName = "VIVE XR Foveation",
|
||||
Desc = "Support the HTC foveation extension.",
|
||||
Company = "HTC",
|
||||
DocumentationLink = "..\\Documentation",
|
||||
OpenxrExtensionStrings = "XR_HTC_foveation",
|
||||
Version = "1.0.0",
|
||||
BuildTargetGroups = new[] { BuildTargetGroup.Android },
|
||||
FeatureId = featureId
|
||||
)]
|
||||
#endif
|
||||
public class ViveFoveation : OpenXRFeature
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag bits for XrFoveationDynamicFlagsHTC
|
||||
/// </summary>
|
||||
public const UInt64 XR_FOVEATION_DYNAMIC_LEVEL_ENABLED_BIT_HTC = 0x00000001;
|
||||
public const UInt64 XR_FOVEATION_DYNAMIC_CLEAR_FOV_ENABLED_BIT_HTC = 0x00000002;
|
||||
public const UInt64 XR_FOVEATION_DYNAMIC_FOCAL_CENTER_OFFSET_ENABLED_BIT_HTC = 0x00000004;
|
||||
|
||||
/// <summary>
|
||||
/// The feature id string. This is used to give the feature a well known id for reference.
|
||||
/// </summary>
|
||||
public const string featureId = "vive.openxr.feature.foveation";
|
||||
|
||||
protected override IntPtr HookGetInstanceProcAddr(IntPtr func)
|
||||
{
|
||||
Debug.Log("EXT: registering our own xrGetInstanceProcAddr");
|
||||
if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Vulkan)
|
||||
{
|
||||
Debug.Log("Vulkan no hook foveation");
|
||||
return func;
|
||||
}
|
||||
return intercept_xrGetInstanceProcAddr(func);
|
||||
}
|
||||
|
||||
private const string ExtLib = "viveopenxr";
|
||||
[DllImport(ExtLib, EntryPoint = "intercept_xrGetInstanceProcAddr")]
|
||||
private static extern IntPtr intercept_xrGetInstanceProcAddr(IntPtr func);
|
||||
|
||||
[DllImport(ExtLib, EntryPoint = "applyFoveationHTC")]
|
||||
private static extern XrResult applyFoveationHTC(XrFoveationModeHTC mode, UInt32 configCount, XrFoveationConfigurationHTC[] configs, UInt64 flags);
|
||||
|
||||
/// <summary>
|
||||
/// function to apply HTC Foveation
|
||||
/// </summary>
|
||||
public static XrResult ApplyFoveationHTC(XrFoveationModeHTC mode, UInt32 configCount, XrFoveationConfigurationHTC[] configs, UInt64 flags = 0)
|
||||
{
|
||||
//Debug.Log("Unity HTCFoveat:configCount " + configCount);
|
||||
//if (configCount >=2) {
|
||||
//Debug.Log("Unity HTCFoveat:configs[0].clearFovDegree " + configs[0].clearFovDegree);
|
||||
//Debug.Log("Unity HTCFoveat:configs[0].level " + configs[0].level);
|
||||
//Debug.Log("Unity HTCFoveat:configs[1].clearFovDegree " + configs[1].clearFovDegree);
|
||||
//Debug.Log("Unity HTCFoveat:configs[1].level " + configs[1].level);
|
||||
//}
|
||||
return applyFoveationHTC(mode, configCount, configs, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17b6a897c202288439905d3efb0e006f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user