using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using UnityEngine; using UnityEngine.Bindings; using UnityEngine.Rendering; using UnityEngine.Scripting; [assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")] [assembly: InternalsVisibleTo("UnityEngine.Cloud")] [assembly: InternalsVisibleTo("UnityEngine.Networking")] [assembly: UnityEngineModuleAssembly] [assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")] [assembly: InternalsVisibleTo("UnityEngine.PS5Module")] [assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")] [assembly: InternalsVisibleTo("UnityEngine.PS4Module")] [assembly: InternalsVisibleTo("UnityEngine.SwitchModule")] [assembly: InternalsVisibleTo("UnityEngine.WindModule")] [assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")] [assembly: InternalsVisibleTo("UnityEngine.VideoModule")] [assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")] [assembly: InternalsVisibleTo("UnityEngine.XRModule")] [assembly: InternalsVisibleTo("UnityEngine.VFXModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")] [assembly: InternalsVisibleTo("UnityEngine.UmbraModule")] [assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")] [assembly: InternalsVisibleTo("UnityEngine.UIModule")] [assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")] [assembly: InternalsVisibleTo("UnityEngine.VRModule")] [assembly: InternalsVisibleTo("UnityEngine.TerrainModule")] [assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")] [assembly: InternalsVisibleTo("UnityEngine.Analytics")] [assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")] [assembly: InternalsVisibleTo("Unity.RenderPipelines.Universal.2D.Runtime")] [assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")] [assembly: InternalsVisibleTo("GoogleAR.UnityNative")] [assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")] [assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")] [assembly: InternalsVisibleTo("Assembly-CSharp-testable")] [assembly: InternalsVisibleTo("Unity.Timeline")] [assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")] [assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")] [assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")] [assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")] [assembly: InternalsVisibleTo("Unity.Analytics")] [assembly: InternalsVisibleTo("Unity.RuntimeTests")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.ExternalVersionControl")] [assembly: InternalsVisibleTo("Unity.IntegrationTests")] [assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")] [assembly: InternalsVisibleTo("Unity.Burst.Editor")] [assembly: InternalsVisibleTo("Unity.Burst")] [assembly: InternalsVisibleTo("Unity.Automation")] [assembly: InternalsVisibleTo("UnityEngine.TestRunner")] [assembly: InternalsVisibleTo("UnityEngine.Purchasing")] [assembly: InternalsVisibleTo("UnityEngine.Advertisements")] [assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")] [assembly: InternalsVisibleTo("UnityEngine.StreamingModule")] [assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")] [assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")] [assembly: InternalsVisibleTo("UnityEngine.TLSModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")] [assembly: InternalsVisibleTo("UnityEngine.ContentLoadModule")] [assembly: InternalsVisibleTo("UnityEngine.CommandStateObserverModule")] [assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")] [assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")] [assembly: InternalsVisibleTo("UnityEngine.ClothModule")] [assembly: InternalsVisibleTo("UnityEngine.AudioModule")] [assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")] [assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")] [assembly: InternalsVisibleTo("UnityEngine.AnimationModule")] [assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")] [assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")] [assembly: InternalsVisibleTo("UnityEngine.ARModule")] [assembly: InternalsVisibleTo("UnityEngine.InputModule")] [assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")] [assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")] [assembly: InternalsVisibleTo("UnityEngine.AIModule")] [assembly: InternalsVisibleTo("UnityEngine.CoreModule")] [assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")] [assembly: InternalsVisibleTo("UnityEngine")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")] [assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")] [assembly: InternalsVisibleTo("UnityEngine.DirectorModule")] [assembly: InternalsVisibleTo("UnityEngine.GIModule")] [assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")] [assembly: InternalsVisibleTo("UnityEngine.TilemapModule")] [assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")] [assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")] [assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: InternalsVisibleTo("UnityEngine.PropertiesModule")] [assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")] [assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")] [assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")] [assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")] [assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")] [assembly: InternalsVisibleTo("UnityEngine.MultiplayerModule")] [assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")] [assembly: InternalsVisibleTo("UnityEngine.MarshallingModule")] [assembly: InternalsVisibleTo("UnityEngine.InputForUIModule")] [assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")] [assembly: InternalsVisibleTo("Unity.Subsystem.Registration")] [assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")] [assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")] [assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")] [assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")] [assembly: InternalsVisibleTo("UnityEngine.HierarchyCoreModule")] [assembly: InternalsVisibleTo("UnityEngine.GridModule")] [assembly: InternalsVisibleTo("UnityEngine.GraphToolsFoundationModule")] [assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")] [assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")] [assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")] [assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")] [assembly: CompilationRelaxations(8)] [assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")] [assembly: InternalsVisibleTo("Unity.Runtime")] [assembly: InternalsVisibleTo("Unity.Core")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")] [assembly: InternalsVisibleTo("UnityEngine.Core.Runtime.Tests")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")] [assembly: InternalsVisibleTo("Unity.Collections")] [assembly: InternalsVisibleTo("Unity.UIElements")] [assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")] [assembly: InternalsVisibleTo("Unity.UIElements.Editor")] [assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")] [assembly: InternalsVisibleTo("UnityEngine.UIElements.Tests")] [assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")] [assembly: InternalsVisibleTo("Unity.UIElements.RuntimeTests")] [assembly: InternalsVisibleTo("UnityEngine.UI")] [assembly: InternalsVisibleTo("Unity.Networking.Transport")] [assembly: InternalsVisibleTo("Unity.ucg.QoS")] [assembly: InternalsVisibleTo("Unity.Services.QoS")] [assembly: InternalsVisibleTo("Unity.Logging")] [assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")] [assembly: InternalsVisibleTo("Unity.Entities")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")] [assembly: InternalsVisibleTo("Unity.Entities.Tests")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace UnityEngine.XR { [RequiredByNativeCode] [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputTrackingFacade.h")] [NativeConditional("ENABLE_VR")] [StaticAccessor(/*Could not decode attribute arguments.*/)] public static class InputTracking { private enum TrackingStateEventType { NodeAdded, NodeRemoved, TrackingAcquired, TrackingLost } [Obsolete("This API is obsolete, and should no longer be used. Please use the TrackedPoseDriver in the Legacy Input Helpers package for controlling a camera in XR.")] [NativeConditional("ENABLE_VR")] public static extern bool disablePositionalTracking { [MethodImpl(MethodImplOptions.InternalCall)] [NativeName("GetPositionalTrackingDisabled")] get; [MethodImpl(MethodImplOptions.InternalCall)] [NativeName("SetPositionalTrackingDisabled")] set; } public static event Action trackingAcquired; public static event Action trackingLost; public static event Action nodeAdded; public static event Action nodeRemoved; [RequiredByNativeCode] private static void InvokeTrackingEvent(TrackingStateEventType eventType, XRNode nodeType, long uniqueID, bool tracked) { Action action = null; XRNodeState obj = new XRNodeState { uniqueID = (ulong)uniqueID, nodeType = nodeType, tracked = tracked }; ((Action)(eventType switch { TrackingStateEventType.TrackingAcquired => InputTracking.trackingAcquired, TrackingStateEventType.TrackingLost => InputTracking.trackingLost, TrackingStateEventType.NodeAdded => InputTracking.nodeAdded, TrackingStateEventType.NodeRemoved => InputTracking.nodeRemoved, _ => throw new ArgumentException("TrackingEventHandler - Invalid EventType: " + eventType), }))?.Invoke(obj); } [Obsolete("This API is obsolete, and should no longer be used. Please use InputDevice.TryGetFeatureValue with the CommonUsages.devicePosition usage instead.")] [NativeConditional("ENABLE_VR", "Vector3f::zero")] public static Vector3 GetLocalPosition(XRNode node) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) GetLocalPosition_Injected(node, out var ret); return ret; } [Obsolete("This API is obsolete, and should no longer be used. Please use InputDevice.TryGetFeatureValue with the CommonUsages.deviceRotation usage instead.")] [NativeConditional("ENABLE_VR", "Quaternionf::identity()")] public static Quaternion GetLocalRotation(XRNode node) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) GetLocalRotation_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [NativeConditional("ENABLE_VR")] [Obsolete("This API is obsolete, and should no longer be used. Please use XRInputSubsystem.TryRecenter() instead.")] public static extern void Recenter(); [NativeConditional("ENABLE_VR")] [Obsolete("This API is obsolete, and should no longer be used. Please use InputDevice.name with the device associated with that tracking data instead.")] public static string GetNodeName(ulong uniqueId) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ManagedSpanWrapper ret = default(ManagedSpanWrapper); string stringAndDispose; try { GetNodeName_Injected(uniqueId, out ret); } finally { stringAndDispose = OutStringMarshaller.GetStringAndDispose(ret); } return stringAndDispose; } public static void GetNodeStates(List nodeStates) { if (nodeStates == null) { throw new ArgumentNullException("nodeStates"); } nodeStates.Clear(); GetNodeStates_Internal(nodeStates); } [NativeConditional("ENABLE_VR")] private unsafe static void GetNodeStates_Internal([NotNull] List nodeStates) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (nodeStates == null) { ThrowHelper.ThrowArgumentNullException((object)nodeStates, "nodeStates"); } List list = default(List); BlittableListWrapper nodeStates2 = default(BlittableListWrapper); try { list = nodeStates; fixed (XRNodeState[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref nodeStates2))..ctor(val, list.Count); GetNodeStates_Internal_Injected(ref nodeStates2); } } finally { ((BlittableListWrapper)(ref nodeStates2)).Unmarshal(list); } } [MethodImpl(MethodImplOptions.InternalCall)] [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputTracking.h")] [StaticAccessor(/*Could not decode attribute arguments.*/)] internal static extern ulong GetDeviceIdAtXRNode(XRNode node); [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputTracking.h")] [StaticAccessor(/*Could not decode attribute arguments.*/)] internal unsafe static void GetDeviceIdsAtXRNode_Internal(XRNode node, [NotNull] List deviceIds) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (deviceIds == null) { ThrowHelper.ThrowArgumentNullException((object)deviceIds, "deviceIds"); } List list = default(List); BlittableListWrapper deviceIds2 = default(BlittableListWrapper); try { list = deviceIds; fixed (ulong[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref deviceIds2))..ctor(val, list.Count); GetDeviceIdsAtXRNode_Internal_Injected(node, ref deviceIds2); } } finally { ((BlittableListWrapper)(ref deviceIds2)).Unmarshal(list); } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetLocalPosition_Injected(XRNode node, out Vector3 ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetLocalRotation_Injected(XRNode node, out Quaternion ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetNodeName_Injected(ulong uniqueId, out ManagedSpanWrapper ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetNodeStates_Internal_Injected(ref BlittableListWrapper nodeStates); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetDeviceIdsAtXRNode_Internal_Injected(XRNode node, ref BlittableListWrapper deviceIds); } public enum XRNode { LeftEye, RightEye, CenterEye, Head, LeftHand, RightHand, GameController, TrackingReference, HardwareTracker } [Flags] internal enum AvailableTrackingData { None = 0, PositionAvailable = 1, RotationAvailable = 2, VelocityAvailable = 4, AngularVelocityAvailable = 8, AccelerationAvailable = 0x10, AngularAccelerationAvailable = 0x20 } [UsedByNativeCode] public struct XRNodeState { private XRNode m_Type; private AvailableTrackingData m_AvailableFields; private Vector3 m_Position; private Quaternion m_Rotation; private Vector3 m_Velocity; private Vector3 m_AngularVelocity; private Vector3 m_Acceleration; private Vector3 m_AngularAcceleration; private int m_Tracked; private ulong m_UniqueID; public ulong uniqueID { get { return m_UniqueID; } set { m_UniqueID = value; } } public XRNode nodeType { get { return m_Type; } set { m_Type = value; } } public bool tracked { get { return m_Tracked == 1; } set { m_Tracked = (value ? 1 : 0); } } public Vector3 position { set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) m_Position = value; m_AvailableFields |= AvailableTrackingData.PositionAvailable; } } public Quaternion rotation { set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) m_Rotation = value; m_AvailableFields |= AvailableTrackingData.RotationAvailable; } } public Vector3 velocity { set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) m_Velocity = value; m_AvailableFields |= AvailableTrackingData.VelocityAvailable; } } public Vector3 angularVelocity { set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) m_AngularVelocity = value; m_AvailableFields |= AvailableTrackingData.AngularVelocityAvailable; } } public Vector3 acceleration { set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) m_Acceleration = value; m_AvailableFields |= AvailableTrackingData.AccelerationAvailable; } } public Vector3 angularAcceleration { set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) m_AngularAcceleration = value; m_AvailableFields |= AvailableTrackingData.AngularAccelerationAvailable; } } public bool TryGetPosition(out Vector3 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGet(m_Position, AvailableTrackingData.PositionAvailable, out position); } public bool TryGetRotation(out Quaternion rotation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGet(m_Rotation, AvailableTrackingData.RotationAvailable, out rotation); } public bool TryGetVelocity(out Vector3 velocity) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGet(m_Velocity, AvailableTrackingData.VelocityAvailable, out velocity); } public bool TryGetAngularVelocity(out Vector3 angularVelocity) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGet(m_AngularVelocity, AvailableTrackingData.AngularVelocityAvailable, out angularVelocity); } public bool TryGetAcceleration(out Vector3 acceleration) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGet(m_Acceleration, AvailableTrackingData.AccelerationAvailable, out acceleration); } public bool TryGetAngularAcceleration(out Vector3 angularAcceleration) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return TryGet(m_AngularAcceleration, AvailableTrackingData.AngularAccelerationAvailable, out angularAcceleration); } private bool TryGet(Vector3 inValue, AvailableTrackingData availabilityFlag, out Vector3 outValue) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((m_AvailableFields & availabilityFlag) > AvailableTrackingData.None) { outValue = inValue; return true; } outValue = Vector3.zero; return false; } private bool TryGet(Quaternion inValue, AvailableTrackingData availabilityFlag, out Quaternion outValue) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((m_AvailableFields & availabilityFlag) > AvailableTrackingData.None) { outValue = inValue; return true; } outValue = Quaternion.identity; return false; } } [NativeConditional("ENABLE_VR")] public struct HapticCapabilities : IEquatable { private uint m_NumChannels; private bool m_SupportsImpulse; private bool m_SupportsBuffer; private uint m_BufferFrequencyHz; private uint m_BufferMaxSize; private uint m_BufferOptimalSize; public uint numChannels { get { return m_NumChannels; } internal set { m_NumChannels = value; } } public bool supportsImpulse { get { return m_SupportsImpulse; } internal set { m_SupportsImpulse = value; } } public bool supportsBuffer { get { return m_SupportsBuffer; } internal set { m_SupportsBuffer = value; } } public uint bufferFrequencyHz { get { return m_BufferFrequencyHz; } internal set { m_BufferFrequencyHz = value; } } public uint bufferMaxSize { get { return m_BufferMaxSize; } internal set { m_BufferMaxSize = value; } } public uint bufferOptimalSize { get { return m_BufferOptimalSize; } internal set { m_BufferOptimalSize = value; } } public override bool Equals(object obj) { if (!(obj is HapticCapabilities)) { return false; } return Equals((HapticCapabilities)obj); } public bool Equals(HapticCapabilities other) { return numChannels == other.numChannels && supportsImpulse == other.supportsImpulse && supportsBuffer == other.supportsBuffer && bufferFrequencyHz == other.bufferFrequencyHz && bufferMaxSize == other.bufferMaxSize && bufferOptimalSize == other.bufferOptimalSize; } public override int GetHashCode() { return numChannels.GetHashCode() ^ (supportsImpulse.GetHashCode() << 1) ^ (supportsBuffer.GetHashCode() >> 1) ^ (bufferFrequencyHz.GetHashCode() << 2) ^ (bufferMaxSize.GetHashCode() >> 2) ^ (bufferOptimalSize.GetHashCode() << 3); } public static bool operator ==(HapticCapabilities a, HapticCapabilities b) { return a.Equals(b); } public static bool operator !=(HapticCapabilities a, HapticCapabilities b) { return !(a == b); } } internal enum InputFeatureType : uint { Custom = 0u, Binary = 1u, DiscreteStates = 2u, Axis1D = 3u, Axis2D = 4u, Axis3D = 5u, Rotation = 6u, Hand = 7u, Bone = 8u, Eyes = 9u, kUnityXRInputFeatureTypeInvalid = uint.MaxValue } internal enum ConnectionChangeType : uint { Connected, Disconnected, ConfigChange } public enum InputDeviceRole : uint { Unknown, Generic, LeftHanded, RightHanded, GameController, TrackingReference, HardwareTracker, LegacyController } [Flags] public enum InputDeviceCharacteristics : uint { None = 0u, HeadMounted = 1u, Camera = 2u, HeldInHand = 4u, HandTracking = 8u, EyeTracking = 0x10u, TrackedDevice = 0x20u, Controller = 0x40u, TrackingReference = 0x80u, Left = 0x100u, Right = 0x200u, Simulated6DOF = 0x400u } [Flags] public enum InputTrackingState : uint { None = 0u, Position = 1u, Rotation = 2u, Velocity = 4u, AngularVelocity = 8u, Acceleration = 0x10u, AngularAcceleration = 0x20u, All = 0x3Fu } [RequiredByNativeCode] [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")] [NativeConditional("ENABLE_VR")] public struct InputFeatureUsage : IEquatable { internal string m_Name; [NativeName("m_FeatureType")] internal InputFeatureType m_InternalType; public string name { get { return m_Name; } internal set { m_Name = value; } } internal InputFeatureType internalType { get { return m_InternalType; } set { m_InternalType = value; } } public Type type => m_InternalType switch { InputFeatureType.Custom => typeof(byte[]), InputFeatureType.Binary => typeof(bool), InputFeatureType.DiscreteStates => typeof(uint), InputFeatureType.Axis1D => typeof(float), InputFeatureType.Axis2D => typeof(Vector2), InputFeatureType.Axis3D => typeof(Vector3), InputFeatureType.Rotation => typeof(Quaternion), InputFeatureType.Hand => typeof(Hand), InputFeatureType.Bone => typeof(Bone), InputFeatureType.Eyes => typeof(Eyes), _ => throw new InvalidCastException("No valid managed type for unknown native type."), }; internal InputFeatureUsage(string name, InputFeatureType type) { m_Name = name; m_InternalType = type; } public override bool Equals(object obj) { if (!(obj is InputFeatureUsage)) { return false; } return Equals((InputFeatureUsage)obj); } public bool Equals(InputFeatureUsage other) { return name == other.name && internalType == other.internalType; } public override int GetHashCode() { return name.GetHashCode() ^ (internalType.GetHashCode() << 1); } public static bool operator ==(InputFeatureUsage a, InputFeatureUsage b) { return a.Equals(b); } public static bool operator !=(InputFeatureUsage a, InputFeatureUsage b) { return !(a == b); } public InputFeatureUsage As() { if (type != typeof(T)) { throw new ArgumentException("InputFeatureUsage type does not match out variable type."); } return new InputFeatureUsage(name); } } public struct InputFeatureUsage : IEquatable> { public string name { get; set; } private Type usageType => typeof(T); public InputFeatureUsage(string usageName) { name = usageName; } public override bool Equals(object obj) { if (!(obj is InputFeatureUsage)) { return false; } return Equals((InputFeatureUsage)obj); } public bool Equals(InputFeatureUsage other) { return name == other.name; } public override int GetHashCode() { return name.GetHashCode(); } public static bool operator ==(InputFeatureUsage a, InputFeatureUsage b) { return a.Equals(b); } public static bool operator !=(InputFeatureUsage a, InputFeatureUsage b) { return !(a == b); } public static explicit operator InputFeatureUsage(InputFeatureUsage self) { InputFeatureType inputFeatureType = InputFeatureType.kUnityXRInputFeatureTypeInvalid; Type type = self.usageType; if (type == typeof(bool)) { inputFeatureType = InputFeatureType.Binary; } else if (type == typeof(uint)) { inputFeatureType = InputFeatureType.DiscreteStates; } else if (type == typeof(float)) { inputFeatureType = InputFeatureType.Axis1D; } else if (type == typeof(Vector2)) { inputFeatureType = InputFeatureType.Axis2D; } else if (type == typeof(Vector3)) { inputFeatureType = InputFeatureType.Axis3D; } else if (type == typeof(Quaternion)) { inputFeatureType = InputFeatureType.Rotation; } else if (type == typeof(Hand)) { inputFeatureType = InputFeatureType.Hand; } else if (type == typeof(Bone)) { inputFeatureType = InputFeatureType.Bone; } else if (type == typeof(Eyes)) { inputFeatureType = InputFeatureType.Eyes; } else if (type == typeof(byte[])) { inputFeatureType = InputFeatureType.Custom; } else if (type.IsEnum) { inputFeatureType = InputFeatureType.DiscreteStates; } if (inputFeatureType != InputFeatureType.kUnityXRInputFeatureTypeInvalid) { return new InputFeatureUsage(self.name, inputFeatureType); } throw new InvalidCastException("No valid InputFeatureType for " + self.name + "."); } } public static class CommonUsages { public static InputFeatureUsage isTracked = new InputFeatureUsage("IsTracked"); public static InputFeatureUsage primaryButton = new InputFeatureUsage("PrimaryButton"); public static InputFeatureUsage primaryTouch = new InputFeatureUsage("PrimaryTouch"); public static InputFeatureUsage secondaryButton = new InputFeatureUsage("SecondaryButton"); public static InputFeatureUsage secondaryTouch = new InputFeatureUsage("SecondaryTouch"); public static InputFeatureUsage gripButton = new InputFeatureUsage("GripButton"); public static InputFeatureUsage triggerButton = new InputFeatureUsage("TriggerButton"); public static InputFeatureUsage menuButton = new InputFeatureUsage("MenuButton"); public static InputFeatureUsage primary2DAxisClick = new InputFeatureUsage("Primary2DAxisClick"); public static InputFeatureUsage primary2DAxisTouch = new InputFeatureUsage("Primary2DAxisTouch"); public static InputFeatureUsage secondary2DAxisClick = new InputFeatureUsage("Secondary2DAxisClick"); public static InputFeatureUsage secondary2DAxisTouch = new InputFeatureUsage("Secondary2DAxisTouch"); public static InputFeatureUsage userPresence = new InputFeatureUsage("UserPresence"); public static InputFeatureUsage trackingState = new InputFeatureUsage("TrackingState"); public static InputFeatureUsage batteryLevel = new InputFeatureUsage("BatteryLevel"); public static InputFeatureUsage trigger = new InputFeatureUsage("Trigger"); public static InputFeatureUsage grip = new InputFeatureUsage("Grip"); public static InputFeatureUsage primary2DAxis = new InputFeatureUsage("Primary2DAxis"); public static InputFeatureUsage secondary2DAxis = new InputFeatureUsage("Secondary2DAxis"); public static InputFeatureUsage devicePosition = new InputFeatureUsage("DevicePosition"); public static InputFeatureUsage leftEyePosition = new InputFeatureUsage("LeftEyePosition"); public static InputFeatureUsage rightEyePosition = new InputFeatureUsage("RightEyePosition"); public static InputFeatureUsage centerEyePosition = new InputFeatureUsage("CenterEyePosition"); public static InputFeatureUsage colorCameraPosition = new InputFeatureUsage("CameraPosition"); public static InputFeatureUsage deviceVelocity = new InputFeatureUsage("DeviceVelocity"); public static InputFeatureUsage deviceAngularVelocity = new InputFeatureUsage("DeviceAngularVelocity"); public static InputFeatureUsage leftEyeVelocity = new InputFeatureUsage("LeftEyeVelocity"); public static InputFeatureUsage leftEyeAngularVelocity = new InputFeatureUsage("LeftEyeAngularVelocity"); public static InputFeatureUsage rightEyeVelocity = new InputFeatureUsage("RightEyeVelocity"); public static InputFeatureUsage rightEyeAngularVelocity = new InputFeatureUsage("RightEyeAngularVelocity"); public static InputFeatureUsage centerEyeVelocity = new InputFeatureUsage("CenterEyeVelocity"); public static InputFeatureUsage centerEyeAngularVelocity = new InputFeatureUsage("CenterEyeAngularVelocity"); public static InputFeatureUsage colorCameraVelocity = new InputFeatureUsage("CameraVelocity"); public static InputFeatureUsage colorCameraAngularVelocity = new InputFeatureUsage("CameraAngularVelocity"); public static InputFeatureUsage deviceAcceleration = new InputFeatureUsage("DeviceAcceleration"); public static InputFeatureUsage deviceAngularAcceleration = new InputFeatureUsage("DeviceAngularAcceleration"); public static InputFeatureUsage leftEyeAcceleration = new InputFeatureUsage("LeftEyeAcceleration"); public static InputFeatureUsage leftEyeAngularAcceleration = new InputFeatureUsage("LeftEyeAngularAcceleration"); public static InputFeatureUsage rightEyeAcceleration = new InputFeatureUsage("RightEyeAcceleration"); public static InputFeatureUsage rightEyeAngularAcceleration = new InputFeatureUsage("RightEyeAngularAcceleration"); public static InputFeatureUsage centerEyeAcceleration = new InputFeatureUsage("CenterEyeAcceleration"); public static InputFeatureUsage centerEyeAngularAcceleration = new InputFeatureUsage("CenterEyeAngularAcceleration"); public static InputFeatureUsage colorCameraAcceleration = new InputFeatureUsage("CameraAcceleration"); public static InputFeatureUsage colorCameraAngularAcceleration = new InputFeatureUsage("CameraAngularAcceleration"); public static InputFeatureUsage deviceRotation = new InputFeatureUsage("DeviceRotation"); public static InputFeatureUsage leftEyeRotation = new InputFeatureUsage("LeftEyeRotation"); public static InputFeatureUsage rightEyeRotation = new InputFeatureUsage("RightEyeRotation"); public static InputFeatureUsage centerEyeRotation = new InputFeatureUsage("CenterEyeRotation"); public static InputFeatureUsage colorCameraRotation = new InputFeatureUsage("CameraRotation"); public static InputFeatureUsage handData = new InputFeatureUsage("HandData"); public static InputFeatureUsage eyesData = new InputFeatureUsage("EyesData"); [Obsolete("CommonUsages.dPad is not used by any XR platform and will be removed.")] public static InputFeatureUsage dPad = new InputFeatureUsage("DPad"); [Obsolete("CommonUsages.indexFinger is not used by any XR platform and will be removed.")] public static InputFeatureUsage indexFinger = new InputFeatureUsage("IndexFinger"); [Obsolete("CommonUsages.MiddleFinger is not used by any XR platform and will be removed.")] public static InputFeatureUsage middleFinger = new InputFeatureUsage("MiddleFinger"); [Obsolete("CommonUsages.RingFinger is not used by any XR platform and will be removed.")] public static InputFeatureUsage ringFinger = new InputFeatureUsage("RingFinger"); [Obsolete("CommonUsages.PinkyFinger is not used by any XR platform and will be removed.")] public static InputFeatureUsage pinkyFinger = new InputFeatureUsage("PinkyFinger"); [Obsolete("CommonUsages.thumbrest is Oculus only, and is being moved to their package. Please use OculusUsages.thumbrest. These will still function until removed.")] public static InputFeatureUsage thumbrest = new InputFeatureUsage("Thumbrest"); [Obsolete("CommonUsages.indexTouch is Oculus only, and is being moved to their package. Please use OculusUsages.indexTouch. These will still function until removed.")] public static InputFeatureUsage indexTouch = new InputFeatureUsage("IndexTouch"); [Obsolete("CommonUsages.thumbTouch is Oculus only, and is being moved to their package. Please use OculusUsages.thumbTouch. These will still function until removed.")] public static InputFeatureUsage thumbTouch = new InputFeatureUsage("ThumbTouch"); } [NativeConditional("ENABLE_VR")] [UsedByNativeCode] public struct InputDevice : IEquatable { private static List s_InputSubsystemCache; private ulong m_DeviceId; private bool m_Initialized; private ulong deviceId => m_Initialized ? m_DeviceId : ulong.MaxValue; public XRInputSubsystem subsystem { get { if (s_InputSubsystemCache == null) { s_InputSubsystemCache = new List(); } if (m_Initialized) { uint num = (uint)(m_DeviceId >> 32); SubsystemManager.GetSubsystems(s_InputSubsystemCache); for (int i = 0; i < s_InputSubsystemCache.Count; i++) { if (num == s_InputSubsystemCache[i].GetIndex()) { return s_InputSubsystemCache[i]; } } } return null; } } public bool isValid => IsValidId() && InputDevices.IsDeviceValid(m_DeviceId); public string name => IsValidId() ? InputDevices.GetDeviceName(m_DeviceId) : null; [Obsolete("This API has been marked as deprecated and will be removed in future versions. Please use InputDevice.characteristics instead.")] public InputDeviceRole role => IsValidId() ? InputDevices.GetDeviceRole(m_DeviceId) : InputDeviceRole.Unknown; public string manufacturer => IsValidId() ? InputDevices.GetDeviceManufacturer(m_DeviceId) : null; public string serialNumber => IsValidId() ? InputDevices.GetDeviceSerialNumber(m_DeviceId) : null; public InputDeviceCharacteristics characteristics => IsValidId() ? InputDevices.GetDeviceCharacteristics(m_DeviceId) : InputDeviceCharacteristics.None; internal InputDevice(ulong deviceId) { m_DeviceId = deviceId; m_Initialized = true; } private bool IsValidId() { return deviceId != ulong.MaxValue; } public bool SendHapticImpulse(uint channel, float amplitude, float duration = 1f) { if (!IsValidId()) { return false; } if (amplitude < 0f) { throw new ArgumentException("Amplitude of SendHapticImpulse cannot be negative."); } if (duration < 0f) { throw new ArgumentException("Duration of SendHapticImpulse cannot be negative."); } return InputDevices.SendHapticImpulse(m_DeviceId, channel, amplitude, duration); } public bool SendHapticBuffer(uint channel, byte[] buffer) { if (!IsValidId()) { return false; } return InputDevices.SendHapticBuffer(m_DeviceId, channel, buffer); } public bool TryGetHapticCapabilities(out HapticCapabilities capabilities) { if (CheckValidAndSetDefault(out capabilities)) { return InputDevices.TryGetHapticCapabilities(m_DeviceId, out capabilities); } return false; } public void StopHaptics() { if (IsValidId()) { InputDevices.StopHaptics(m_DeviceId); } } public bool TryGetFeatureUsages(List featureUsages) { if (IsValidId()) { return InputDevices.TryGetFeatureUsages(m_DeviceId, featureUsages); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out bool value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_bool(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out uint value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_UInt32(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out float value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_float(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out Vector2 value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_Vector2f(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out Vector3 value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_Vector3f(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out Quaternion value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_Quaternionf(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out Hand value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_XRHand(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out Bone value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_XRBone(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out Eyes value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValue_XREyes(m_DeviceId, usage.name, out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, byte[] value) { if (IsValidId()) { return InputDevices.TryGetFeatureValue_Custom(m_DeviceId, usage.name, value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, out InputTrackingState value) { if (IsValidId()) { uint value2 = 0u; if (InputDevices.TryGetFeatureValue_UInt32(m_DeviceId, usage.name, out value2)) { value = (InputTrackingState)value2; return true; } } value = InputTrackingState.None; return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out bool value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValueAtTime_bool(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out uint value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValueAtTime_UInt32(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out float value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValueAtTime_float(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out Vector2 value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValueAtTime_Vector2f(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out Vector3 value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValueAtTime_Vector3f(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out Quaternion value) { if (CheckValidAndSetDefault(out value)) { return InputDevices.TryGetFeatureValueAtTime_Quaternionf(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value); } return false; } public bool TryGetFeatureValue(InputFeatureUsage usage, DateTime time, out InputTrackingState value) { if (IsValidId()) { uint value2 = 0u; if (InputDevices.TryGetFeatureValueAtTime_UInt32(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value2)) { value = (InputTrackingState)value2; return true; } } value = InputTrackingState.None; return false; } private bool CheckValidAndSetDefault(out T value) { value = default(T); return IsValidId(); } public override bool Equals(object obj) { if (!(obj is InputDevice)) { return false; } return Equals((InputDevice)obj); } public bool Equals(InputDevice other) { return deviceId == other.deviceId; } public override int GetHashCode() { return deviceId.GetHashCode(); } public static bool operator ==(InputDevice a, InputDevice b) { return a.Equals(b); } public static bool operator !=(InputDevice a, InputDevice b) { return !(a == b); } } internal static class TimeConverter { private static readonly DateTime s_Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public static DateTime now => DateTime.Now; public static long LocalDateTimeToUnixTimeMilliseconds(DateTime date) { return Convert.ToInt64((date.ToUniversalTime() - s_Epoch).TotalMilliseconds); } public static DateTime UnixTimeMillisecondsToLocalDateTime(long unixTimeInMilliseconds) { DateTime dateTime = s_Epoch; return dateTime.AddMilliseconds(unixTimeInMilliseconds).ToLocalTime(); } } public enum HandFinger { Thumb, Index, Middle, Ring, Pinky } [NativeConditional("ENABLE_VR")] [NativeHeader("XRScriptingClasses.h")] [NativeHeader("Modules/XR/XRPrefix.h")] [RequiredByNativeCode] [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")] [StaticAccessor(/*Could not decode attribute arguments.*/)] public struct Hand : IEquatable { private ulong m_DeviceId; private uint m_FeatureIndex; internal ulong deviceId => m_DeviceId; internal uint featureIndex => m_FeatureIndex; public bool TryGetRootBone(out Bone boneOut) { return Hand_TryGetRootBone(this, out boneOut); } private static bool Hand_TryGetRootBone(Hand hand, out Bone boneOut) { return Hand_TryGetRootBone_Injected(ref hand, out boneOut); } public bool TryGetFingerBones(HandFinger finger, List bonesOut) { if (bonesOut == null) { throw new ArgumentNullException("bonesOut"); } return Hand_TryGetFingerBonesAsList(this, finger, bonesOut); } private unsafe static bool Hand_TryGetFingerBonesAsList(Hand hand, HandFinger finger, [NotNull] List bonesOut) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (bonesOut == null) { ThrowHelper.ThrowArgumentNullException((object)bonesOut, "bonesOut"); } List list = default(List); BlittableListWrapper bonesOut2 = default(BlittableListWrapper); try { list = bonesOut; fixed (Bone[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref bonesOut2))..ctor(val, list.Count); return Hand_TryGetFingerBonesAsList_Injected(ref hand, finger, ref bonesOut2); } } finally { ((BlittableListWrapper)(ref bonesOut2)).Unmarshal(list); } } public override bool Equals(object obj) { if (!(obj is Hand)) { return false; } return Equals((Hand)obj); } public bool Equals(Hand other) { return deviceId == other.deviceId && featureIndex == other.featureIndex; } public override int GetHashCode() { return deviceId.GetHashCode() ^ (featureIndex.GetHashCode() << 1); } public static bool operator ==(Hand a, Hand b) { return a.Equals(b); } public static bool operator !=(Hand a, Hand b) { return !(a == b); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Hand_TryGetRootBone_Injected([In] ref Hand hand, out Bone boneOut); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Hand_TryGetFingerBonesAsList_Injected([In] ref Hand hand, HandFinger finger, ref BlittableListWrapper bonesOut); } internal enum EyeSide { Left, Right } [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")] [StaticAccessor(/*Could not decode attribute arguments.*/)] [NativeHeader("XRScriptingClasses.h")] [NativeHeader("Modules/XR/XRPrefix.h")] [NativeConditional("ENABLE_VR")] [RequiredByNativeCode] public struct Eyes : IEquatable { private ulong m_DeviceId; private uint m_FeatureIndex; internal ulong deviceId => m_DeviceId; internal uint featureIndex => m_FeatureIndex; public bool TryGetLeftEyePosition(out Vector3 position) { return Eyes_TryGetEyePosition(this, EyeSide.Left, out position); } public bool TryGetRightEyePosition(out Vector3 position) { return Eyes_TryGetEyePosition(this, EyeSide.Right, out position); } public bool TryGetLeftEyeRotation(out Quaternion rotation) { return Eyes_TryGetEyeRotation(this, EyeSide.Left, out rotation); } public bool TryGetRightEyeRotation(out Quaternion rotation) { return Eyes_TryGetEyeRotation(this, EyeSide.Right, out rotation); } private static bool Eyes_TryGetEyePosition(Eyes eyes, EyeSide chirality, out Vector3 position) { return Eyes_TryGetEyePosition_Injected(ref eyes, chirality, out position); } private static bool Eyes_TryGetEyeRotation(Eyes eyes, EyeSide chirality, out Quaternion rotation) { return Eyes_TryGetEyeRotation_Injected(ref eyes, chirality, out rotation); } public bool TryGetFixationPoint(out Vector3 fixationPoint) { return Eyes_TryGetFixationPoint(this, out fixationPoint); } private static bool Eyes_TryGetFixationPoint(Eyes eyes, out Vector3 fixationPoint) { return Eyes_TryGetFixationPoint_Injected(ref eyes, out fixationPoint); } public bool TryGetLeftEyeOpenAmount(out float openAmount) { return Eyes_TryGetEyeOpenAmount(this, EyeSide.Left, out openAmount); } public bool TryGetRightEyeOpenAmount(out float openAmount) { return Eyes_TryGetEyeOpenAmount(this, EyeSide.Right, out openAmount); } private static bool Eyes_TryGetEyeOpenAmount(Eyes eyes, EyeSide chirality, out float openAmount) { return Eyes_TryGetEyeOpenAmount_Injected(ref eyes, chirality, out openAmount); } public override bool Equals(object obj) { if (!(obj is Eyes)) { return false; } return Equals((Eyes)obj); } public bool Equals(Eyes other) { return deviceId == other.deviceId && featureIndex == other.featureIndex; } public override int GetHashCode() { return deviceId.GetHashCode() ^ (featureIndex.GetHashCode() << 1); } public static bool operator ==(Eyes a, Eyes b) { return a.Equals(b); } public static bool operator !=(Eyes a, Eyes b) { return !(a == b); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Eyes_TryGetEyePosition_Injected([In] ref Eyes eyes, EyeSide chirality, out Vector3 position); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Eyes_TryGetEyeRotation_Injected([In] ref Eyes eyes, EyeSide chirality, out Quaternion rotation); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Eyes_TryGetFixationPoint_Injected([In] ref Eyes eyes, out Vector3 fixationPoint); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Eyes_TryGetEyeOpenAmount_Injected([In] ref Eyes eyes, EyeSide chirality, out float openAmount); } [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")] [NativeHeader("Modules/XR/XRPrefix.h")] [NativeConditional("ENABLE_VR")] [RequiredByNativeCode] [StaticAccessor(/*Could not decode attribute arguments.*/)] [NativeHeader("XRScriptingClasses.h")] public struct Bone : IEquatable { private ulong m_DeviceId; private uint m_FeatureIndex; internal ulong deviceId => m_DeviceId; internal uint featureIndex => m_FeatureIndex; public bool TryGetPosition(out Vector3 position) { return Bone_TryGetPosition(this, out position); } private static bool Bone_TryGetPosition(Bone bone, out Vector3 position) { return Bone_TryGetPosition_Injected(ref bone, out position); } public bool TryGetRotation(out Quaternion rotation) { return Bone_TryGetRotation(this, out rotation); } private static bool Bone_TryGetRotation(Bone bone, out Quaternion rotation) { return Bone_TryGetRotation_Injected(ref bone, out rotation); } public bool TryGetParentBone(out Bone parentBone) { return Bone_TryGetParentBone(this, out parentBone); } private static bool Bone_TryGetParentBone(Bone bone, out Bone parentBone) { return Bone_TryGetParentBone_Injected(ref bone, out parentBone); } public bool TryGetChildBones(List childBones) { return Bone_TryGetChildBones(this, childBones); } private unsafe static bool Bone_TryGetChildBones(Bone bone, [NotNull] List childBones) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (childBones == null) { ThrowHelper.ThrowArgumentNullException((object)childBones, "childBones"); } List list = default(List); BlittableListWrapper childBones2 = default(BlittableListWrapper); try { list = childBones; fixed (Bone[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref childBones2))..ctor(val, list.Count); return Bone_TryGetChildBones_Injected(ref bone, ref childBones2); } } finally { ((BlittableListWrapper)(ref childBones2)).Unmarshal(list); } } public override bool Equals(object obj) { if (!(obj is Bone)) { return false; } return Equals((Bone)obj); } public bool Equals(Bone other) { return deviceId == other.deviceId && featureIndex == other.featureIndex; } public override int GetHashCode() { return deviceId.GetHashCode() ^ (featureIndex.GetHashCode() << 1); } public static bool operator ==(Bone a, Bone b) { return a.Equals(b); } public static bool operator !=(Bone a, Bone b) { return !(a == b); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Bone_TryGetPosition_Injected([In] ref Bone bone, out Vector3 position); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Bone_TryGetRotation_Injected([In] ref Bone bone, out Quaternion rotation); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Bone_TryGetParentBone_Injected([In] ref Bone bone, out Bone parentBone); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Bone_TryGetChildBones_Injected([In] ref Bone bone, ref BlittableListWrapper childBones); } [StructLayout(LayoutKind.Sequential)] [NativeConditional("ENABLE_VR")] [NativeHeader("Modules/XR/Subsystems/Input/Public/XRInputDevices.h")] [UsedByNativeCode] [StaticAccessor(/*Could not decode attribute arguments.*/)] public class InputDevices { private static List s_InputDeviceList; public static event Action deviceConnected; public static event Action deviceDisconnected; public static event Action deviceConfigChanged; public static InputDevice GetDeviceAtXRNode(XRNode node) { ulong deviceIdAtXRNode = InputTracking.GetDeviceIdAtXRNode(node); return new InputDevice(deviceIdAtXRNode); } public static void GetDevicesAtXRNode(XRNode node, List inputDevices) { if (inputDevices == null) { throw new ArgumentNullException("inputDevices"); } List list = new List(); InputTracking.GetDeviceIdsAtXRNode_Internal(node, list); inputDevices.Clear(); foreach (ulong item2 in list) { InputDevice item = new InputDevice(item2); if (item.isValid) { inputDevices.Add(item); } } } public static void GetDevices(List inputDevices) { if (inputDevices == null) { throw new ArgumentNullException("inputDevices"); } inputDevices.Clear(); GetDevices_Internal(inputDevices); } [Obsolete("This API has been marked as deprecated and will be removed in future versions. Please use InputDevices.GetDevicesWithCharacteristics instead.")] public static void GetDevicesWithRole(InputDeviceRole role, List inputDevices) { if (inputDevices == null) { throw new ArgumentNullException("inputDevices"); } if (s_InputDeviceList == null) { s_InputDeviceList = new List(); } GetDevices_Internal(s_InputDeviceList); inputDevices.Clear(); foreach (InputDevice s_InputDevice in s_InputDeviceList) { if (s_InputDevice.role == role) { inputDevices.Add(s_InputDevice); } } } public static void GetDevicesWithCharacteristics(InputDeviceCharacteristics desiredCharacteristics, List inputDevices) { if (inputDevices == null) { throw new ArgumentNullException("inputDevices"); } if (s_InputDeviceList == null) { s_InputDeviceList = new List(); } GetDevices_Internal(s_InputDeviceList); inputDevices.Clear(); foreach (InputDevice s_InputDevice in s_InputDeviceList) { if ((s_InputDevice.characteristics & desiredCharacteristics) == desiredCharacteristics) { inputDevices.Add(s_InputDevice); } } } [RequiredByNativeCode] private static void InvokeConnectionEvent(ulong deviceId, ConnectionChangeType change) { switch (change) { case ConnectionChangeType.Connected: if (InputDevices.deviceConnected != null) { InputDevices.deviceConnected(new InputDevice(deviceId)); } break; case ConnectionChangeType.Disconnected: if (InputDevices.deviceDisconnected != null) { InputDevices.deviceDisconnected(new InputDevice(deviceId)); } break; case ConnectionChangeType.ConfigChange: if (InputDevices.deviceConfigChanged != null) { InputDevices.deviceConfigChanged(new InputDevice(deviceId)); } break; } } private unsafe static void GetDevices_Internal([NotNull] List inputDevices) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (inputDevices == null) { ThrowHelper.ThrowArgumentNullException((object)inputDevices, "inputDevices"); } List list = default(List); BlittableListWrapper inputDevices2 = default(BlittableListWrapper); try { list = inputDevices; fixed (InputDevice[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref inputDevices2))..ctor(val, list.Count); GetDevices_Internal_Injected(ref inputDevices2); } } finally { ((BlittableListWrapper)(ref inputDevices2)).Unmarshal(list); } } [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool SendHapticImpulse(ulong deviceId, uint channel, float amplitude, float duration); internal unsafe static bool SendHapticBuffer(ulong deviceId, uint channel, [NotNull] byte[] buffer) { if (buffer == null) { ThrowHelper.ThrowArgumentNullException((object)buffer, "buffer"); } Span span = new Span(buffer); bool result; fixed (byte* ptr = span) { ManagedSpanWrapper buffer2 = default(ManagedSpanWrapper); ((ManagedSpanWrapper)(ref buffer2))..ctor((void*)ptr, span.Length); result = SendHapticBuffer_Injected(deviceId, channel, ref buffer2); } return result; } [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool TryGetHapticCapabilities(ulong deviceId, out HapticCapabilities capabilities); [MethodImpl(MethodImplOptions.InternalCall)] internal static extern void StopHaptics(ulong deviceId); internal static bool TryGetFeatureUsages(ulong deviceId, [NotNull] List featureUsages) { if (featureUsages == null) { ThrowHelper.ThrowArgumentNullException((object)featureUsages, "featureUsages"); } return TryGetFeatureUsages_Injected(deviceId, featureUsages); } internal unsafe static bool TryGetFeatureValue_bool(ulong deviceId, string usage, out bool value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_bool_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_bool_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_UInt32(ulong deviceId, string usage, out uint value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_UInt32_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_UInt32_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_float(ulong deviceId, string usage, out float value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_float_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_float_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_Vector2f(ulong deviceId, string usage, out Vector2 value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_Vector2f_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_Vector2f_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_Vector3f(ulong deviceId, string usage, out Vector3 value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_Vector3f_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_Vector3f_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_Quaternionf(ulong deviceId, string usage, out Quaternion value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_Quaternionf_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_Quaternionf_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_Custom(ulong deviceId, string usage, [Out] byte[] value) { //The blocks IL_002a, IL_0030, IL_0036, IL_0038, IL_004c are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. //The blocks IL_004c are reachable both inside and outside the pinned region starting at IL_0031. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. BlittableArrayWrapper value2 = default(BlittableArrayWrapper); try { ManagedSpanWrapper val = default(ManagedSpanWrapper); ref ManagedSpanWrapper usage2; if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref val)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref val))..ctor((void*)ptr, readOnlySpan.Length); usage2 = ref val; if (value != null) { fixed (byte[] array = value) { if (array.Length != 0) { ((BlittableArrayWrapper)(ref value2))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } return TryGetFeatureValue_Custom_Injected(deviceId, ref usage2, out value2); } } return TryGetFeatureValue_Custom_Injected(deviceId, ref usage2, out value2); } } usage2 = ref val; if (value != null) { array = value; if (array.Length != 0) { ((BlittableArrayWrapper)(ref value2))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } } return TryGetFeatureValue_Custom_Injected(deviceId, ref usage2, out value2); } finally { ((BlittableArrayWrapper)(ref value2)).Unmarshal(ref array); } } internal unsafe static bool TryGetFeatureValueAtTime_bool(ulong deviceId, string usage, long time, out bool value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValueAtTime_bool_Injected(deviceId, ref usage2, time, out value); } } return TryGetFeatureValueAtTime_bool_Injected(deviceId, ref usage2, time, out value); } finally { } } internal unsafe static bool TryGetFeatureValueAtTime_UInt32(ulong deviceId, string usage, long time, out uint value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValueAtTime_UInt32_Injected(deviceId, ref usage2, time, out value); } } return TryGetFeatureValueAtTime_UInt32_Injected(deviceId, ref usage2, time, out value); } finally { } } internal unsafe static bool TryGetFeatureValueAtTime_float(ulong deviceId, string usage, long time, out float value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValueAtTime_float_Injected(deviceId, ref usage2, time, out value); } } return TryGetFeatureValueAtTime_float_Injected(deviceId, ref usage2, time, out value); } finally { } } internal unsafe static bool TryGetFeatureValueAtTime_Vector2f(ulong deviceId, string usage, long time, out Vector2 value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValueAtTime_Vector2f_Injected(deviceId, ref usage2, time, out value); } } return TryGetFeatureValueAtTime_Vector2f_Injected(deviceId, ref usage2, time, out value); } finally { } } internal unsafe static bool TryGetFeatureValueAtTime_Vector3f(ulong deviceId, string usage, long time, out Vector3 value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValueAtTime_Vector3f_Injected(deviceId, ref usage2, time, out value); } } return TryGetFeatureValueAtTime_Vector3f_Injected(deviceId, ref usage2, time, out value); } finally { } } internal unsafe static bool TryGetFeatureValueAtTime_Quaternionf(ulong deviceId, string usage, long time, out Quaternion value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValueAtTime_Quaternionf_Injected(deviceId, ref usage2, time, out value); } } return TryGetFeatureValueAtTime_Quaternionf_Injected(deviceId, ref usage2, time, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_XRHand(ulong deviceId, string usage, out Hand value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_XRHand_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_XRHand_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_XRBone(ulong deviceId, string usage, out Bone value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_XRBone_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_XRBone_Injected(deviceId, ref usage2, out value); } finally { } } internal unsafe static bool TryGetFeatureValue_XREyes(ulong deviceId, string usage, out Eyes value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper usage2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(usage, ref usage2)) { ReadOnlySpan readOnlySpan = usage.AsSpan(); fixed (char* ptr = readOnlySpan) { ((ManagedSpanWrapper)(ref usage2))..ctor((void*)ptr, readOnlySpan.Length); return TryGetFeatureValue_XREyes_Injected(deviceId, ref usage2, out value); } } return TryGetFeatureValue_XREyes_Injected(deviceId, ref usage2, out value); } finally { } } [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool IsDeviceValid(ulong deviceId); internal static string GetDeviceName(ulong deviceId) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ManagedSpanWrapper ret = default(ManagedSpanWrapper); string stringAndDispose; try { GetDeviceName_Injected(deviceId, out ret); } finally { stringAndDispose = OutStringMarshaller.GetStringAndDispose(ret); } return stringAndDispose; } internal static string GetDeviceManufacturer(ulong deviceId) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ManagedSpanWrapper ret = default(ManagedSpanWrapper); string stringAndDispose; try { GetDeviceManufacturer_Injected(deviceId, out ret); } finally { stringAndDispose = OutStringMarshaller.GetStringAndDispose(ret); } return stringAndDispose; } internal static string GetDeviceSerialNumber(ulong deviceId) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ManagedSpanWrapper ret = default(ManagedSpanWrapper); string stringAndDispose; try { GetDeviceSerialNumber_Injected(deviceId, out ret); } finally { stringAndDispose = OutStringMarshaller.GetStringAndDispose(ret); } return stringAndDispose; } [MethodImpl(MethodImplOptions.InternalCall)] internal static extern InputDeviceCharacteristics GetDeviceCharacteristics(ulong deviceId); internal static InputDeviceRole GetDeviceRole(ulong deviceId) { InputDeviceCharacteristics deviceCharacteristics = GetDeviceCharacteristics(deviceId); if ((deviceCharacteristics & (InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.TrackedDevice)) == (InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.TrackedDevice)) { return InputDeviceRole.Generic; } if ((deviceCharacteristics & (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Left)) == (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Left)) { return InputDeviceRole.LeftHanded; } if ((deviceCharacteristics & (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Right)) == (InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Right)) { return InputDeviceRole.RightHanded; } if ((deviceCharacteristics & InputDeviceCharacteristics.Controller) == InputDeviceCharacteristics.Controller) { return InputDeviceRole.GameController; } if ((deviceCharacteristics & (InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.TrackingReference)) == (InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.TrackingReference)) { return InputDeviceRole.TrackingReference; } if ((deviceCharacteristics & InputDeviceCharacteristics.TrackedDevice) == InputDeviceCharacteristics.TrackedDevice) { return InputDeviceRole.HardwareTracker; } return InputDeviceRole.Unknown; } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetDevices_Internal_Injected(ref BlittableListWrapper inputDevices); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool SendHapticBuffer_Injected(ulong deviceId, uint channel, ref ManagedSpanWrapper buffer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureUsages_Injected(ulong deviceId, List featureUsages); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_bool_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out bool value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_UInt32_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out uint value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_float_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_Vector2f_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out Vector2 value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_Vector3f_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out Vector3 value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_Quaternionf_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out Quaternion value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_Custom_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out BlittableArrayWrapper value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValueAtTime_bool_Injected(ulong deviceId, ref ManagedSpanWrapper usage, long time, out bool value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValueAtTime_UInt32_Injected(ulong deviceId, ref ManagedSpanWrapper usage, long time, out uint value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValueAtTime_float_Injected(ulong deviceId, ref ManagedSpanWrapper usage, long time, out float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValueAtTime_Vector2f_Injected(ulong deviceId, ref ManagedSpanWrapper usage, long time, out Vector2 value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValueAtTime_Vector3f_Injected(ulong deviceId, ref ManagedSpanWrapper usage, long time, out Vector3 value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValueAtTime_Quaternionf_Injected(ulong deviceId, ref ManagedSpanWrapper usage, long time, out Quaternion value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_XRHand_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out Hand value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_XRBone_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out Bone value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFeatureValue_XREyes_Injected(ulong deviceId, ref ManagedSpanWrapper usage, out Eyes value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetDeviceName_Injected(ulong deviceId, out ManagedSpanWrapper ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetDeviceManufacturer_Injected(ulong deviceId, out ManagedSpanWrapper ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetDeviceSerialNumber_Injected(ulong deviceId, out ManagedSpanWrapper ret); } [NativeType(Header = "Modules/XR/Subsystems/Display/XRDisplaySubsystem.h")] [UsedByNativeCode] [NativeConditional("ENABLE_XR")] [NativeHeader("Modules/XR/XRPrefix.h")] public class XRDisplaySubsystem : IntegratedSubsystem { [Flags] public enum FoveatedRenderingFlags { None = 0, GazeAllowed = 1 } public enum LateLatchNode { Head, LeftHand, RightHand } [Flags] public enum TextureLayout { Texture2DArray = 1, SingleTexture2D = 2, SeparateTexture2Ds = 4 } public enum ReprojectionMode { Unspecified, PositionAndOrientation, OrientationOnly, None } [NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")] public struct XRRenderParameter { public Matrix4x4 view; public Matrix4x4 projection; public Rect viewport; public Mesh occlusionMesh; public int textureArraySlice; public Matrix4x4 previousView; public bool isPreviousViewValid; } [NativeHeader("Runtime/Graphics/CommandBuffer/RenderingCommandBuffer.h")] [NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")] [NativeHeader("Runtime/Graphics/RenderTextureDesc.h")] public struct XRRenderPass { private IntPtr displaySubsystemInstance; public int renderPassIndex; public RenderTargetIdentifier renderTarget; public RenderTextureDescriptor renderTargetDesc; public bool hasMotionVectorPass; public RenderTargetIdentifier motionVectorRenderTarget; public RenderTextureDescriptor motionVectorRenderTargetDesc; public bool shouldFillOutDepth; public int cullingPassIndex; public IntPtr foveatedRenderingInfo; [NativeMethod(Name = "XRRenderPassScriptApi::GetRenderParameter", IsFreeFunction = true, HasExplicitThis = true, ThrowsException = true)] [NativeConditional("ENABLE_XR")] public void GetRenderParameter(Camera camera, int renderParameterIndex, out XRRenderParameter renderParameter) { GetRenderParameter_Injected(ref this, MarshalledUnityObject.Marshal(camera), renderParameterIndex, out renderParameter); } [MethodImpl(MethodImplOptions.InternalCall)] [NativeMethod(Name = "XRRenderPassScriptApi::GetRenderParameterCount", IsFreeFunction = true, HasExplicitThis = true)] [NativeConditional("ENABLE_XR")] public extern int GetRenderParameterCount(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetRenderParameter_Injected(ref XRRenderPass _unity_self, IntPtr camera, int renderParameterIndex, out XRRenderParameter renderParameter); } [NativeHeader("Runtime/Graphics/RenderTexture.h")] [NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")] public struct XRBlitParams { public RenderTexture srcTex; public int srcTexArraySlice; public Rect srcRect; public Rect destRect; public IntPtr foveatedRenderingInfo; public bool srcHdrEncoded; public ColorGamut srcHdrColorGamut; public int srcHdrMaxLuminance; } [NativeHeader("Modules/XR/Subsystems/Display/XRDisplaySubsystem.bindings.h")] public struct XRMirrorViewBlitDesc { private IntPtr displaySubsystemInstance; public bool nativeBlitAvailable; public bool nativeBlitInvalidStates; public int blitParamsCount; [MethodImpl(MethodImplOptions.InternalCall)] [NativeMethod(Name = "XRMirrorViewBlitDescScriptApi::GetBlitParameter", IsFreeFunction = true, HasExplicitThis = true)] [NativeConditional("ENABLE_XR")] public extern void GetBlitParameter(int blitParameterIndex, out XRBlitParams blitParameter); } internal static class BindingsMarshaller { public static IntPtr ConvertToNative(XRDisplaySubsystem xrDisplaySubsystem) { return ((IntegratedSubsystem)xrDisplaySubsystem).m_Ptr; } } private HDROutputSettings m_HDROutputSettings; [Obsolete("singlePassRenderingDisabled{get;set;} is deprecated. Use textureLayout and supportedTextureLayouts instead.", false)] public bool singlePassRenderingDisabled { get { return (textureLayout & TextureLayout.Texture2DArray) == 0; } set { if (value) { textureLayout = TextureLayout.SeparateTexture2Ds; } else if ((supportedTextureLayouts & TextureLayout.Texture2DArray) > (TextureLayout)0) { textureLayout = TextureLayout.Texture2DArray; } } } public bool displayOpaque { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_displayOpaque_Injected(intPtr); } } public bool contentProtectionEnabled { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_contentProtectionEnabled_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_contentProtectionEnabled_Injected(intPtr, value); } } public float scaleOfAllViewports { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_scaleOfAllViewports_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_scaleOfAllViewports_Injected(intPtr, value); } } public float scaleOfAllRenderTargets { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_scaleOfAllRenderTargets_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_scaleOfAllRenderTargets_Injected(intPtr, value); } } public float zNear { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_zNear_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_zNear_Injected(intPtr, value); } } public float zFar { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_zFar_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_zFar_Injected(intPtr, value); } } public bool sRGB { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_sRGB_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_sRGB_Injected(intPtr, value); } } public float occlusionMaskScale { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_occlusionMaskScale_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_occlusionMaskScale_Injected(intPtr, value); } } public float foveatedRenderingLevel { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_foveatedRenderingLevel_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_foveatedRenderingLevel_Injected(intPtr, value); } } public FoveatedRenderingFlags foveatedRenderingFlags { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_foveatedRenderingFlags_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_foveatedRenderingFlags_Injected(intPtr, value); } } public TextureLayout textureLayout { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_textureLayout_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_textureLayout_Injected(intPtr, value); } } public TextureLayout supportedTextureLayouts { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_supportedTextureLayouts_Injected(intPtr); } } public ReprojectionMode reprojectionMode { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_reprojectionMode_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_reprojectionMode_Injected(intPtr, value); } } public bool disableLegacyRenderer { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_disableLegacyRenderer_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_disableLegacyRenderer_Injected(intPtr, value); } } public HDROutputSettings hdrOutputSettings { get { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (m_HDROutputSettings == null) { m_HDROutputSettings = new HDROutputSettings(-1); } return m_HDROutputSettings; } } public event Action displayFocusChanged; [RequiredByNativeCode] private void InvokeDisplayFocusChanged(bool focus) { if (this.displayFocusChanged != null) { this.displayFocusChanged(focus); } } public void MarkTransformLateLatched(Transform transform, LateLatchNode nodeType) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } MarkTransformLateLatched_Injected(intPtr, MarshalledUnityObject.Marshal(transform), nodeType); } public void SetFocusPlane(Vector3 point, Vector3 normal, Vector3 velocity) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } SetFocusPlane_Injected(intPtr, ref point, ref normal, ref velocity); } public void SetMSAALevel(int level) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } SetMSAALevel_Injected(intPtr, level); } public int GetRenderPassCount() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetRenderPassCount_Injected(intPtr); } public void GetRenderPass(int renderPassIndex, out XRRenderPass renderPass) { if (!Internal_TryGetRenderPass(renderPassIndex, out renderPass)) { throw new IndexOutOfRangeException("renderPassIndex"); } } [NativeMethod("TryGetRenderPass")] private bool Internal_TryGetRenderPass(int renderPassIndex, out XRRenderPass renderPass) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Internal_TryGetRenderPass_Injected(intPtr, renderPassIndex, out renderPass); } public void EndRecordingIfLateLatched(Camera camera) { if (!Internal_TryEndRecordingIfLateLatched(camera) && (Object)(object)camera == (Object)null) { throw new ArgumentNullException("camera"); } } [NativeMethod("TryEndRecordingIfLateLatched")] private bool Internal_TryEndRecordingIfLateLatched(Camera camera) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Internal_TryEndRecordingIfLateLatched_Injected(intPtr, MarshalledUnityObject.Marshal(camera)); } public void BeginRecordingIfLateLatched(Camera camera) { if (!Internal_TryBeginRecordingIfLateLatched(camera) && (Object)(object)camera == (Object)null) { throw new ArgumentNullException("camera"); } } [NativeMethod("TryBeginRecordingIfLateLatched")] private bool Internal_TryBeginRecordingIfLateLatched(Camera camera) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Internal_TryBeginRecordingIfLateLatched_Injected(intPtr, MarshalledUnityObject.Marshal(camera)); } public void GetCullingParameters(Camera camera, int cullingPassIndex, out ScriptableCullingParameters scriptableCullingParameters) { if (!Internal_TryGetCullingParams(camera, cullingPassIndex, out scriptableCullingParameters)) { if ((Object)(object)camera == (Object)null) { throw new ArgumentNullException("camera"); } throw new IndexOutOfRangeException("cullingPassIndex"); } } [NativeHeader("Runtime/Graphics/ScriptableRenderLoop/ScriptableCulling.h")] [NativeMethod("TryGetCullingParams")] private bool Internal_TryGetCullingParams(Camera camera, int cullingPassIndex, out ScriptableCullingParameters scriptableCullingParameters) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Internal_TryGetCullingParams_Injected(intPtr, MarshalledUnityObject.Marshal(camera), cullingPassIndex, out scriptableCullingParameters); } [NativeMethod("TryGetAppGPUTimeLastFrame")] public bool TryGetAppGPUTimeLastFrame(out float gpuTimeLastFrame) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryGetAppGPUTimeLastFrame_Injected(intPtr, out gpuTimeLastFrame); } [NativeMethod("TryGetCompositorGPUTimeLastFrame")] public bool TryGetCompositorGPUTimeLastFrame(out float gpuTimeLastFrameCompositor) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryGetCompositorGPUTimeLastFrame_Injected(intPtr, out gpuTimeLastFrameCompositor); } [NativeMethod("TryGetDroppedFrameCount")] public bool TryGetDroppedFrameCount(out int droppedFrameCount) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryGetDroppedFrameCount_Injected(intPtr, out droppedFrameCount); } [NativeMethod("TryGetFramePresentCount")] public bool TryGetFramePresentCount(out int framePresentCount) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryGetFramePresentCount_Injected(intPtr, out framePresentCount); } [NativeMethod("TryGetDisplayRefreshRate")] public bool TryGetDisplayRefreshRate(out float displayRefreshRate) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryGetDisplayRefreshRate_Injected(intPtr, out displayRefreshRate); } [NativeMethod("TryGetMotionToPhoton")] public bool TryGetMotionToPhoton(out float motionToPhoton) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryGetMotionToPhoton_Injected(intPtr, out motionToPhoton); } [NativeConditional("ENABLE_XR")] [NativeMethod(Name = "UnityXRRenderTextureIdToRenderTexture", IsThreadSafe = false)] public RenderTexture GetRenderTexture(uint unityXrRenderTextureId) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Unmarshal.UnmarshalUnityObject(GetRenderTexture_Injected(intPtr, unityXrRenderTextureId)); } [NativeMethod(Name = "GetTextureForRenderPass", IsThreadSafe = false)] [NativeConditional("ENABLE_XR")] public RenderTexture GetRenderTextureForRenderPass(int renderPass) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Unmarshal.UnmarshalUnityObject(GetRenderTextureForRenderPass_Injected(intPtr, renderPass)); } [NativeMethod(Name = "GetSharedDepthTextureForRenderPass", IsThreadSafe = false)] [NativeConditional("ENABLE_XR")] public RenderTexture GetSharedDepthTextureForRenderPass(int renderPass) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return Unmarshal.UnmarshalUnityObject(GetSharedDepthTextureForRenderPass_Injected(intPtr, renderPass)); } [NativeMethod(Name = "GetPreferredMirrorViewBlitMode", IsThreadSafe = false)] [NativeConditional("ENABLE_XR")] public int GetPreferredMirrorBlitMode() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetPreferredMirrorBlitMode_Injected(intPtr); } [NativeConditional("ENABLE_XR")] [NativeMethod(Name = "SetPreferredMirrorViewBlitMode", IsThreadSafe = false)] public void SetPreferredMirrorBlitMode(int blitMode) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } SetPreferredMirrorBlitMode_Injected(intPtr, blitMode); } [Obsolete("GetMirrorViewBlitDesc(RenderTexture, out XRMirrorViewBlitDesc) is deprecated. Use GetMirrorViewBlitDesc(RenderTexture, out XRMirrorViewBlitDesc, int) instead.", false)] public bool GetMirrorViewBlitDesc(RenderTexture mirrorRt, out XRMirrorViewBlitDesc outDesc) { return GetMirrorViewBlitDesc(mirrorRt, out outDesc, -1); } [NativeConditional("ENABLE_XR")] [NativeMethod(Name = "QueryMirrorViewBlitDesc", IsThreadSafe = false)] public bool GetMirrorViewBlitDesc(RenderTexture mirrorRt, out XRMirrorViewBlitDesc outDesc, int mode) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetMirrorViewBlitDesc_Injected(intPtr, MarshalledUnityObject.Marshal(mirrorRt), out outDesc, mode); } [Obsolete("AddGraphicsThreadMirrorViewBlit(CommandBuffer, bool) is deprecated. Use AddGraphicsThreadMirrorViewBlit(CommandBuffer, bool, int) instead.", false)] public bool AddGraphicsThreadMirrorViewBlit(CommandBuffer cmd, bool allowGraphicsStateInvalidate) { return AddGraphicsThreadMirrorViewBlit(cmd, allowGraphicsStateInvalidate, -1); } [NativeHeader("Runtime/Graphics/CommandBuffer/RenderingCommandBuffer.h")] [NativeMethod(Name = "AddGraphicsThreadMirrorViewBlit", IsThreadSafe = false)] [NativeConditional("ENABLE_XR")] public bool AddGraphicsThreadMirrorViewBlit(CommandBuffer cmd, bool allowGraphicsStateInvalidate, int mode) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return AddGraphicsThreadMirrorViewBlit_Injected(intPtr, (cmd == null) ? ((IntPtr)0) : BindingsMarshaller.ConvertToNative(cmd), allowGraphicsStateInvalidate, mode); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_displayOpaque_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_contentProtectionEnabled_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_contentProtectionEnabled_Injected(IntPtr _unity_self, bool value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_scaleOfAllViewports_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_scaleOfAllViewports_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_scaleOfAllRenderTargets_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_scaleOfAllRenderTargets_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_zNear_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_zNear_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_zFar_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_zFar_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_sRGB_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_sRGB_Injected(IntPtr _unity_self, bool value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_occlusionMaskScale_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_occlusionMaskScale_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_foveatedRenderingLevel_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_foveatedRenderingLevel_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern FoveatedRenderingFlags get_foveatedRenderingFlags_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_foveatedRenderingFlags_Injected(IntPtr _unity_self, FoveatedRenderingFlags value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void MarkTransformLateLatched_Injected(IntPtr _unity_self, IntPtr transform, LateLatchNode nodeType); [MethodImpl(MethodImplOptions.InternalCall)] private static extern TextureLayout get_textureLayout_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_textureLayout_Injected(IntPtr _unity_self, TextureLayout value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern TextureLayout get_supportedTextureLayouts_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ReprojectionMode get_reprojectionMode_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_reprojectionMode_Injected(IntPtr _unity_self, ReprojectionMode value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void SetFocusPlane_Injected(IntPtr _unity_self, [In] ref Vector3 point, [In] ref Vector3 normal, [In] ref Vector3 velocity); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void SetMSAALevel_Injected(IntPtr _unity_self, int level); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_disableLegacyRenderer_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_disableLegacyRenderer_Injected(IntPtr _unity_self, bool value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern int GetRenderPassCount_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_TryGetRenderPass_Injected(IntPtr _unity_self, int renderPassIndex, out XRRenderPass renderPass); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_TryEndRecordingIfLateLatched_Injected(IntPtr _unity_self, IntPtr camera); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_TryBeginRecordingIfLateLatched_Injected(IntPtr _unity_self, IntPtr camera); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_TryGetCullingParams_Injected(IntPtr _unity_self, IntPtr camera, int cullingPassIndex, out ScriptableCullingParameters scriptableCullingParameters); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetAppGPUTimeLastFrame_Injected(IntPtr _unity_self, out float gpuTimeLastFrame); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetCompositorGPUTimeLastFrame_Injected(IntPtr _unity_self, out float gpuTimeLastFrameCompositor); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetDroppedFrameCount_Injected(IntPtr _unity_self, out int droppedFrameCount); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetFramePresentCount_Injected(IntPtr _unity_self, out int framePresentCount); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetDisplayRefreshRate_Injected(IntPtr _unity_self, out float displayRefreshRate); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetMotionToPhoton_Injected(IntPtr _unity_self, out float motionToPhoton); [MethodImpl(MethodImplOptions.InternalCall)] private static extern IntPtr GetRenderTexture_Injected(IntPtr _unity_self, uint unityXrRenderTextureId); [MethodImpl(MethodImplOptions.InternalCall)] private static extern IntPtr GetRenderTextureForRenderPass_Injected(IntPtr _unity_self, int renderPass); [MethodImpl(MethodImplOptions.InternalCall)] private static extern IntPtr GetSharedDepthTextureForRenderPass_Injected(IntPtr _unity_self, int renderPass); [MethodImpl(MethodImplOptions.InternalCall)] private static extern int GetPreferredMirrorBlitMode_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void SetPreferredMirrorBlitMode_Injected(IntPtr _unity_self, int blitMode); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool GetMirrorViewBlitDesc_Injected(IntPtr _unity_self, IntPtr mirrorRt, out XRMirrorViewBlitDesc outDesc, int mode); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool AddGraphicsThreadMirrorViewBlit_Injected(IntPtr _unity_self, IntPtr cmd, bool allowGraphicsStateInvalidate, int mode); } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct XRMirrorViewBlitMode { public const int Default = 0; public const int LeftEye = -1; public const int RightEye = -2; public const int SideBySide = -3; public const int SideBySideOcclusionMesh = -4; public const int Distort = -5; public const int None = -6; } [NativeHeader("Modules/XR/XRPrefix.h")] [NativeType(Header = "Modules/XR/Subsystems/Display/XRDisplaySubsystemDescriptor.h")] public struct XRMirrorViewBlitModeDesc { public int blitMode; public string blitModeDesc; } [NativeType(Header = "Modules/XR/Subsystems/Display/XRDisplaySubsystemDescriptor.h")] [UsedByNativeCode] public class XRDisplaySubsystemDescriptor : IntegratedSubsystemDescriptor { internal static class BindingsMarshaller { public static IntPtr ConvertToNative(XRDisplaySubsystemDescriptor descriptor) { return ((IntegratedSubsystemDescriptor)descriptor).m_Ptr; } } [NativeConditional("ENABLE_XR")] public bool disablesLegacyVr { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_disablesLegacyVr_Injected(intPtr); } } [NativeConditional("ENABLE_XR")] public bool enableBackBufferMSAA { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_enableBackBufferMSAA_Injected(intPtr); } } [NativeConditional("ENABLE_XR")] [NativeMethod("TryGetAvailableMirrorModeCount")] public int GetAvailableMirrorBlitModeCount() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetAvailableMirrorBlitModeCount_Injected(intPtr); } [NativeMethod("TryGetMirrorModeByIndex")] [NativeConditional("ENABLE_XR")] public void GetMirrorBlitModeByIndex(int index, out XRMirrorViewBlitModeDesc mode) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } GetMirrorBlitModeByIndex_Injected(intPtr, index, out mode); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_disablesLegacyVr_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_enableBackBufferMSAA_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern int GetAvailableMirrorBlitModeCount_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetMirrorBlitModeByIndex_Injected(IntPtr _unity_self, int index, out XRMirrorViewBlitModeDesc mode); } public enum TrackingOriginModeFlags { Unknown = 0, Device = 1, Floor = 2, TrackingReference = 4, Unbounded = 8 } [NativeConditional("ENABLE_XR")] [NativeType(Header = "Modules/XR/Subsystems/Input/XRInputSubsystem.h")] [UsedByNativeCode] public class XRInputSubsystem : IntegratedSubsystem { internal static class BindingsMarshaller { public static IntPtr ConvertToNative(XRInputSubsystem xrInputSubsystem) { return ((IntegratedSubsystem)xrInputSubsystem).m_Ptr; } } private List m_DeviceIdsCache; public event Action trackingOriginUpdated; public event Action boundaryChanged; internal uint GetIndex() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetIndex_Injected(intPtr); } public bool TryRecenter() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TryRecenter_Injected(intPtr); } public bool TryGetInputDevices(List devices) { if (devices == null) { throw new ArgumentNullException("devices"); } devices.Clear(); if (m_DeviceIdsCache == null) { m_DeviceIdsCache = new List(); } m_DeviceIdsCache.Clear(); TryGetDeviceIds_AsList(m_DeviceIdsCache); for (int i = 0; i < m_DeviceIdsCache.Count; i++) { devices.Add(new InputDevice(m_DeviceIdsCache[i])); } return true; } public bool TrySetTrackingOriginMode(TrackingOriginModeFlags origin) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return TrySetTrackingOriginMode_Injected(intPtr, origin); } public TrackingOriginModeFlags GetTrackingOriginMode() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetTrackingOriginMode_Injected(intPtr); } public TrackingOriginModeFlags GetSupportedTrackingOriginModes() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetSupportedTrackingOriginModes_Injected(intPtr); } public bool TryGetBoundaryPoints(List boundaryPoints) { if (boundaryPoints == null) { throw new ArgumentNullException("boundaryPoints"); } return TryGetBoundaryPoints_AsList(boundaryPoints); } private unsafe bool TryGetBoundaryPoints_AsList(List boundaryPoints) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //The blocks IL_0041 are reachable both inside and outside the pinned region starting at IL_001d. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. List list = default(List); BlittableListWrapper boundaryPoints2 = default(BlittableListWrapper); try { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } list = boundaryPoints; if (list != null) { fixed (Vector3[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref boundaryPoints2))..ctor(val, list.Count); return TryGetBoundaryPoints_AsList_Injected(intPtr, ref boundaryPoints2); } } return TryGetBoundaryPoints_AsList_Injected(intPtr, ref boundaryPoints2); } finally { ((BlittableListWrapper)(ref boundaryPoints2)).Unmarshal(list); } } [RequiredByNativeCode(GenerateProxy = true)] private static void InvokeTrackingOriginUpdatedEvent(IntPtr internalPtr) { IntegratedSubsystem integratedSubsystemByPtr = SubsystemManager.GetIntegratedSubsystemByPtr(internalPtr); if (integratedSubsystemByPtr is XRInputSubsystem { trackingOriginUpdated: not null } xRInputSubsystem) { xRInputSubsystem.trackingOriginUpdated(xRInputSubsystem); } } [RequiredByNativeCode(GenerateProxy = true)] private static void InvokeBoundaryChangedEvent(IntPtr internalPtr) { IntegratedSubsystem integratedSubsystemByPtr = SubsystemManager.GetIntegratedSubsystemByPtr(internalPtr); if (integratedSubsystemByPtr is XRInputSubsystem { boundaryChanged: not null } xRInputSubsystem) { xRInputSubsystem.boundaryChanged(xRInputSubsystem); } } internal unsafe void TryGetDeviceIds_AsList(List deviceIds) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //The blocks IL_0041 are reachable both inside and outside the pinned region starting at IL_001d. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. List list = default(List); BlittableListWrapper deviceIds2 = default(BlittableListWrapper); try { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } list = deviceIds; if (list != null) { fixed (ulong[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref deviceIds2))..ctor(val, list.Count); TryGetDeviceIds_AsList_Injected(intPtr, ref deviceIds2); return; } } TryGetDeviceIds_AsList_Injected(intPtr, ref deviceIds2); } finally { ((BlittableListWrapper)(ref deviceIds2)).Unmarshal(list); } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern uint GetIndex_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryRecenter_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TrySetTrackingOriginMode_Injected(IntPtr _unity_self, TrackingOriginModeFlags origin); [MethodImpl(MethodImplOptions.InternalCall)] private static extern TrackingOriginModeFlags GetTrackingOriginMode_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern TrackingOriginModeFlags GetSupportedTrackingOriginModes_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetBoundaryPoints_AsList_Injected(IntPtr _unity_self, ref BlittableListWrapper boundaryPoints); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void TryGetDeviceIds_AsList_Injected(IntPtr _unity_self, ref BlittableListWrapper deviceIds); } [NativeHeader("Modules/XR/XRPrefix.h")] [NativeType(Header = "Modules/XR/Subsystems/Input/XRInputSubsystemDescriptor.h")] [UsedByNativeCode] [NativeConditional("ENABLE_XR")] public class XRInputSubsystemDescriptor : IntegratedSubsystemDescriptor { internal static class BindingsMarshaller { public static IntPtr ConvertToNative(XRInputSubsystemDescriptor descriptor) { return ((IntegratedSubsystemDescriptor)descriptor).m_Ptr; } } [NativeConditional("ENABLE_XR")] public bool disablesLegacyInput { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_disablesLegacyInput_Injected(intPtr); } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool get_disablesLegacyInput_Injected(IntPtr _unity_self); } [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] [UsedByNativeCode] public struct MeshId : IEquatable { private static MeshId s_InvalidId = default(MeshId); private ulong m_SubId1; private ulong m_SubId2; public static MeshId InvalidId => s_InvalidId; public override string ToString() { return string.Format("{0}-{1}", m_SubId1.ToString("X16"), m_SubId2.ToString("X16")); } public override int GetHashCode() { return m_SubId1.GetHashCode() ^ m_SubId2.GetHashCode(); } public override bool Equals(object obj) { return obj is MeshId && Equals((MeshId)obj); } public bool Equals(MeshId other) { return m_SubId1 == other.m_SubId1 && m_SubId2 == other.m_SubId2; } public static bool operator ==(MeshId id1, MeshId id2) { return id1.m_SubId1 == id2.m_SubId1 && id1.m_SubId2 == id2.m_SubId2; } public static bool operator !=(MeshId id1, MeshId id2) { return id1.m_SubId1 != id2.m_SubId1 || id1.m_SubId2 != id2.m_SubId2; } } [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] [RequiredByNativeCode] public enum MeshGenerationStatus { Success, InvalidMeshId, GenerationAlreadyInProgress, Canceled, UnknownError } internal static class HashCodeHelper { private const int k_HashCodeMultiplier = 486187739; public static int Combine(int hash1, int hash2) { return hash1 * 486187739 + hash2; } public static int Combine(int hash1, int hash2, int hash3) { return Combine(Combine(hash1, hash2), hash3); } public static int Combine(int hash1, int hash2, int hash3, int hash4) { return Combine(Combine(hash1, hash2, hash3), hash4); } public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5) { return Combine(Combine(hash1, hash2, hash3, hash4), hash5); } public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6) { return Combine(Combine(hash1, hash2, hash3, hash4, hash5), hash6); } public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6, int hash7) { return Combine(Combine(hash1, hash2, hash3, hash4, hash5, hash6), hash7); } public static int Combine(int hash1, int hash2, int hash3, int hash4, int hash5, int hash6, int hash7, int hash8) { return Combine(Combine(hash1, hash2, hash3, hash4, hash5, hash6, hash7), hash8); } } [RequiredByNativeCode] [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] public struct MeshGenerationResult : IEquatable { public MeshId MeshId { get; } public Mesh Mesh { get; } public MeshCollider MeshCollider { get; } public MeshGenerationStatus Status { get; } public MeshVertexAttributes Attributes { get; } public ulong Timestamp { get; } public Vector3 Position { get; } public Quaternion Rotation { get; } public Vector3 Scale { get; } public override bool Equals(object obj) { if (!(obj is MeshGenerationResult)) { return false; } return Equals((MeshGenerationResult)obj); } public bool Equals(MeshGenerationResult other) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) int result; if (MeshId.Equals(other.MeshId) && ((object)Mesh).Equals((object?)other.Mesh) && ((object)MeshCollider).Equals((object?)other.MeshCollider) && Status == other.Status && Attributes == other.Attributes) { Vector3 val = Position; if (((Vector3)(ref val)).Equals(other.Position)) { Quaternion rotation = Rotation; if (((Quaternion)(ref rotation)).Equals(other.Rotation)) { val = Scale; result = (((Vector3)(ref val)).Equals(other.Scale) ? 1 : 0); goto IL_00a7; } } } result = 0; goto IL_00a7; IL_00a7: return (byte)result != 0; } public static bool operator ==(MeshGenerationResult lhs, MeshGenerationResult rhs) { return lhs.Equals(rhs); } public static bool operator !=(MeshGenerationResult lhs, MeshGenerationResult rhs) { return !lhs.Equals(rhs); } public override int GetHashCode() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) return HashCodeHelper.Combine(MeshId.GetHashCode(), ((object)Mesh).GetHashCode(), ((object)MeshCollider).GetHashCode(), ((int)Status).GetHashCode(), ((int)Attributes).GetHashCode(), ((object)Position/*cast due to .constrained prefix*/).GetHashCode(), ((object)Rotation/*cast due to .constrained prefix*/).GetHashCode(), ((object)Scale/*cast due to .constrained prefix*/).GetHashCode()); } } [Flags] [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] [UsedByNativeCode] public enum MeshVertexAttributes { None = 0, Normals = 1, Tangents = 2, UVs = 4, Colors = 8 } [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] [UsedByNativeCode] [Flags] public enum MeshGenerationOptions { None = 0, ConsumeTransform = 1 } [UsedByNativeCode] [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] public enum MeshChangeState { Added, Updated, Removed, Unchanged } [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] [UsedByNativeCode] public struct MeshInfo : IEquatable { public MeshId MeshId { get; set; } public MeshChangeState ChangeState { get; set; } public int PriorityHint { get; set; } public override bool Equals(object obj) { if (!(obj is MeshInfo)) { return false; } return Equals((MeshInfo)obj); } public bool Equals(MeshInfo other) { return MeshId.Equals(other.MeshId) && ChangeState.Equals(other.ChangeState) && PriorityHint.Equals(other.PriorityHint); } public static bool operator ==(MeshInfo lhs, MeshInfo rhs) { return lhs.Equals(rhs); } public static bool operator !=(MeshInfo lhs, MeshInfo rhs) { return !lhs.Equals(rhs); } public override int GetHashCode() { return HashCodeHelper.Combine(MeshId.GetHashCode(), ((int)ChangeState).GetHashCode(), PriorityHint.GetHashCode()); } } [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshBindings.h")] [UsedByNativeCode] public readonly struct MeshTransform : IEquatable { public MeshId MeshId { get; } public ulong Timestamp { get; } public Vector3 Position { get; } public Quaternion Rotation { get; } public Vector3 Scale { get; } public MeshTransform(in MeshId meshId, ulong timestamp, in Vector3 position, in Quaternion rotation, in Vector3 scale) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) MeshId = meshId; Timestamp = timestamp; Position = position; Rotation = rotation; Scale = scale; } public override bool Equals(object obj) { return obj is MeshTransform other && Equals(other); } public bool Equals(MeshTransform other) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) int result; if (MeshId.Equals(other.MeshId) && Timestamp == other.Timestamp) { Vector3 val = Position; if (((Vector3)(ref val)).Equals(other.Position)) { Quaternion rotation = Rotation; if (((Quaternion)(ref rotation)).Equals(other.Rotation)) { val = Scale; result = (((Vector3)(ref val)).Equals(other.Scale) ? 1 : 0); goto IL_006c; } } } result = 0; goto IL_006c; IL_006c: return (byte)result != 0; } public static bool operator ==(MeshTransform lhs, MeshTransform rhs) { return lhs.Equals(rhs); } public static bool operator !=(MeshTransform lhs, MeshTransform rhs) { return !lhs.Equals(rhs); } public override int GetHashCode() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) return HashCodeHelper.Combine(MeshId.GetHashCode(), Timestamp.GetHashCode(), ((object)Position/*cast due to .constrained prefix*/).GetHashCode(), ((object)Rotation/*cast due to .constrained prefix*/).GetHashCode(), ((object)Scale/*cast due to .constrained prefix*/).GetHashCode()); } } [NativeHeader("Modules/XR/XRPrefix.h")] [NativeHeader("Modules/XR/Subsystems/Meshing/XRMeshingSubsystem.h")] [NativeConditional("ENABLE_XR")] [UsedByNativeCode] public class XRMeshSubsystem : IntegratedSubsystem { [NativeConditional("ENABLE_XR")] private readonly struct MeshTransformList : IDisposable { private readonly IntPtr m_Self; public int Count => GetLength(m_Self); public IntPtr Data => GetData(m_Self); public MeshTransformList(IntPtr self) { m_Self = self; } public void Dispose() { Dispose(m_Self); } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction("UnityXRMeshTransformList_get_Length")] private static extern int GetLength(IntPtr self); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction("UnityXRMeshTransformList_get_Data")] private static extern IntPtr GetData(IntPtr self); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction("UnityXRMeshTransformList_Dispose")] private static extern void Dispose(IntPtr self); } internal static class BindingsMarshaller { public static IntPtr ConvertToNative(XRMeshSubsystem subsystem) { return ((IntegratedSubsystem)subsystem).m_Ptr; } } public float meshDensity { get { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return get_meshDensity_Injected(intPtr); } set { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } set_meshDensity_Injected(intPtr, value); } } public bool TryGetMeshInfos(List meshInfosOut) { if (meshInfosOut == null) { throw new ArgumentNullException("meshInfosOut"); } return GetMeshInfosAsList(meshInfosOut); } private unsafe bool GetMeshInfosAsList(List meshInfos) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //The blocks IL_0041 are reachable both inside and outside the pinned region starting at IL_001d. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. List list = default(List); BlittableListWrapper meshInfos2 = default(BlittableListWrapper); try { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } list = meshInfos; if (list != null) { fixed (MeshInfo[] array = NoAllocHelpers.ExtractArrayFromList(list)) { BlittableArrayWrapper val = default(BlittableArrayWrapper); if (array.Length != 0) { ((BlittableArrayWrapper)(ref val))..ctor(Unsafe.AsPointer(ref array[0]), array.Length); } ((BlittableListWrapper)(ref meshInfos2))..ctor(val, list.Count); return GetMeshInfosAsList_Injected(intPtr, ref meshInfos2); } } return GetMeshInfosAsList_Injected(intPtr, ref meshInfos2); } finally { ((BlittableListWrapper)(ref meshInfos2)).Unmarshal(list); } } private MeshInfo[] GetMeshInfosAsFixedArray() { BlittableArrayWrapper ret = default(BlittableArrayWrapper); MeshInfo[] result; try { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } GetMeshInfosAsFixedArray_Injected(intPtr, out ret); } finally { MeshInfo[] array = default(MeshInfo[]); ((BlittableArrayWrapper)(ref ret)).Unmarshal(ref array); result = array; } return result; } public void GenerateMeshAsync(MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action onMeshGenerationComplete) { GenerateMeshAsync(meshId, mesh, meshCollider, attributes, onMeshGenerationComplete, MeshGenerationOptions.None); } public void GenerateMeshAsync(MeshId meshId, Mesh mesh, MeshCollider meshCollider, MeshVertexAttributes attributes, Action onMeshGenerationComplete, MeshGenerationOptions options) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } GenerateMeshAsync_Injected(intPtr, ref meshId, MarshalledUnityObject.Marshal(mesh), MarshalledUnityObject.Marshal(meshCollider), attributes, onMeshGenerationComplete, options); } [RequiredByNativeCode] private void InvokeMeshReadyDelegate(MeshGenerationResult result, Action onMeshGenerationComplete) { onMeshGenerationComplete?.Invoke(result); } public bool SetBoundingVolume(Vector3 origin, Vector3 extents) { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return SetBoundingVolume_Injected(intPtr, ref origin, ref extents); } public unsafe NativeArray GetUpdatedMeshTransforms(Allocator allocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) using MeshTransformList meshTransformList = new MeshTransformList(GetUpdatedMeshTransforms()); NativeArray val = new NativeArray(meshTransformList.Count, allocator, (NativeArrayOptions)0); UnsafeUtility.MemCpy(NativeArrayUnsafeUtility.GetUnsafePtr(val), meshTransformList.Data.ToPointer(), (long)(meshTransformList.Count * Unsafe.SizeOf())); return val; } private IntPtr GetUpdatedMeshTransforms() { IntPtr intPtr = BindingsMarshaller.ConvertToNative(this); if (intPtr == (IntPtr)0) { ThrowHelper.ThrowNullReferenceException((object)this); } return GetUpdatedMeshTransforms_Injected(intPtr); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool GetMeshInfosAsList_Injected(IntPtr _unity_self, ref BlittableListWrapper meshInfos); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetMeshInfosAsFixedArray_Injected(IntPtr _unity_self, out BlittableArrayWrapper ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GenerateMeshAsync_Injected(IntPtr _unity_self, [In] ref MeshId meshId, IntPtr mesh, IntPtr meshCollider, MeshVertexAttributes attributes, Action onMeshGenerationComplete, MeshGenerationOptions options); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float get_meshDensity_Injected(IntPtr _unity_self); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void set_meshDensity_Injected(IntPtr _unity_self, float value); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool SetBoundingVolume_Injected(IntPtr _unity_self, [In] ref Vector3 origin, [In] ref Vector3 extents); [MethodImpl(MethodImplOptions.InternalCall)] private static extern IntPtr GetUpdatedMeshTransforms_Injected(IntPtr _unity_self); } [NativeHeader("Modules/XR/XRPrefix.h")] [NativeType(Header = "Modules/XR/Subsystems/Planes/XRMeshSubsystemDescriptor.h")] [UsedByNativeCode] public class XRMeshSubsystemDescriptor : IntegratedSubsystemDescriptor { internal static class BindingsMarshaller { public static IntPtr ConvertToNative(XRMeshSubsystemDescriptor descriptor) { return ((IntegratedSubsystemDescriptor)descriptor).m_Ptr; } } } } namespace UnityEngine.XR.Provider { public static class XRStats { public static bool TryGetStat(IntegratedSubsystem xrSubsystem, string tag, out float value) { return TryGetStat_Internal(xrSubsystem.m_Ptr, tag, out value); } [NativeMethod("TryGetStatByName_Internal")] [StaticAccessor(/*Could not decode attribute arguments.*/)] [NativeConditional("ENABLE_XR")] [NativeHeader("Modules/XR/Stats/XRStats.h")] private unsafe static bool TryGetStat_Internal(IntPtr ptr, string tag, out float value) { //The blocks IL_002a are reachable both inside and outside the pinned region starting at IL_0019. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement. try { ManagedSpanWrapper tag2 = default(ManagedSpanWrapper); if (!StringMarshaller.TryMarshalEmptyOrNullString(tag, ref tag2)) { ReadOnlySpan readOnlySpan = tag.AsSpan(); fixed (char* ptr2 = readOnlySpan) { ((ManagedSpanWrapper)(ref tag2))..ctor((void*)ptr2, readOnlySpan.Length); return TryGetStat_Internal_Injected(ptr, ref tag2, out value); } } return TryGetStat_Internal_Injected(ptr, ref tag2, out value); } finally { } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool TryGetStat_Internal_Injected(IntPtr ptr, ref ManagedSpanWrapper tag, out float value); } }