public override bool Initialize() { #if UNITY_INPUT_SYSTEM InputLayoutLoader.RegisterInputLayouts(); #endif PXR_Settings settings = GetSettings(); if (settings != null) { UserDefinedSettings userDefinedSettings = new UserDefinedSettings { stereoRenderingMode = (ushort)settings.GetStereoRenderingMode(), colorSpace = (ushort)((QualitySettings.activeColorSpace == ColorSpace.Linear) ? 1 : 0), useDefaultRenderTexture = settings.useDefaultRenderTexture, eyeRenderTextureResolution = settings.eyeRenderTextureResolution, }; try { PXR_Plugin.System.UPxr_GetHmdHardwareVersion(); } catch (DllNotFoundException d) { Debug.LogError(d.Message); } PXR_Plugin.System.UPxr_Construct(ConvertRotationWith2Vector); PXR_Plugin.System.UPxr_SetUserDefinedSettings(userDefinedSettings); } CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(displaySubsystemDescriptors, "PicoXR Display"); CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(inputSubsystemDescriptors, "PicoXR Input"); CreateSubsystem <PXR_PassThroughDescriptor, PXR_PassThroughSystem>(cameraSubsystemDescriptors, "PicoXR Camera"); if (displaySubsystem == null || inputSubsystem == null) { Debug.LogError("Unable to start Pico XR Plugin."); } if (displaySubsystem == null) { Debug.LogError("Failed to load display subsystem."); } if (inputSubsystem == null) { Debug.LogError("Failed to load input subsystem."); } if (passThroughSystem == null) { Debug.LogError("Failed to load passThrough system."); } return(displaySubsystem != null); }
public override bool Initialize() { #if UNITY_INPUT_SYSTEM InputLayoutLoader.RegisterInputLayouts(); #endif #if UNITY_ANDROID PXR_Settings settings = GetSettings(); float rate = -1.0f; switch (settings.systemDisplayFrequency) { case PXR_Settings.SystemDisplayFrequency.Default: { rate = 0.0f; break; } case PXR_Settings.SystemDisplayFrequency.RefreshRate72: { rate = 72.0f; break; } case PXR_Settings.SystemDisplayFrequency.RefreshRate90: { rate = 90.0f; break; } case PXR_Settings.SystemDisplayFrequency.RefreshRate120: { rate = 120.0f; break; } } if (settings != null) { UserDefinedSettings userDefinedSettings = new UserDefinedSettings { stereoRenderingMode = (ushort)settings.GetStereoRenderingMode(), colorSpace = (ushort)((QualitySettings.activeColorSpace == ColorSpace.Linear) ? 1 : 0), useContentProtect = PXR_ProjectSetting.GetProjectConfig().useContentProtect, systemDisplayFrequency = rate, }; PXR_Plugin.System.UPxr_Construct(ConvertRotationWith2Vector); PXR_Plugin.System.UPxr_SetUserDefinedSettings(userDefinedSettings); } #endif CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(displaySubsystemDescriptors, "PicoXR Display"); CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(inputSubsystemDescriptors, "PicoXR Input"); #if UNITY_ANDROID CreateSubsystem <PXR_PassThroughDescriptor, PXR_PassThroughSystem>(cameraSubsystemDescriptors, "PicoXR Camera"); #endif if (displaySubsystem == null && inputSubsystem == null) { Debug.LogError("PXRLog Unable to start Pico XR Plugin."); } else if (displaySubsystem == null) { Debug.LogError("PXRLog Failed to load display subsystem."); } else if (inputSubsystem == null) { Debug.LogError("PXRLog Failed to load input subsystem."); } else { PXR_Plugin.System.UPxr_InitializeFocusCallback(); } #if UNITY_ANDROID if (passThroughSystem == null) { Debug.LogError("PXRLog Failed to load passThrough system."); } #endif return(displaySubsystem != null); }