public override bool Initialize()
        {
            // Send the settings over to the native plugin
            VarjoSettings settings = GetSettings();

            settings.UpdateSettings();

            CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "VarjoDisplay");
            CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "VarjoInput");

            return(true);
        }
Пример #2
0
        public VarjoSettings GetSettings()
        {
            VarjoSettings settings = null;

#if UNITY_EDITOR
            UnityEditor.EditorBuildSettings.TryGetConfigObject <VarjoSettings>("Varjo.XR.Settings", out settings);
#else
            settings = VarjoSettings.s_Settings;
#endif
            if (settings == null)
            {
                settings = CreateInstance <VarjoSettings>();
            }
            return(settings);
        }
        /// <summary>Override of <see cref="IPreprocessBuildWithReport"></summary>
        /// <param name="report">Build report.</param>
        public void OnPreprocessBuild(BuildReport report)
        {
            // Always remember to cleanup preloaded assets after build to make sure we don't
            // dirty later builds with assets that may not be needed or are out of date.
            CleanOldSettings();

            VarjoSettings settings = null;

            EditorBuildSettings.TryGetConfigObject("Varjo.XR.Settings", out settings);
            if (settings == null)
            {
                return;
            }

            UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();

            if (!preloadedAssets.Contains(settings))
            {
                var assets = preloadedAssets.ToList();
                assets.Add(settings);
                PlayerSettings.SetPreloadedAssets(assets.ToArray());
            }
        }
Пример #4
0
 public void Awake()
 {
     s_Settings = this;
 }
Пример #5
0
        public override bool Initialize()
        {
            // Send the settings over to the native plugin
            VarjoSettings settings = GetSettings();

            if (settings != null)
            {
                UserDefinedSettings uds;
                uds.stereoRenderingMode  = (ushort)settings.StereoRenderingMode;
                uds.separateCullPass     = (ushort)(settings.SeparateCullPass ? 1 : 0);
                uds.foveatedRendering    = (ushort)(settings.FoveatedRendering ? 1 : 0);
                uds.contextScalingFactor = settings.ContextScalingFactor;
                uds.focusScalingFactor   = settings.FocusScalingFactor;
                uds.opaque          = (ushort)(settings.Opaque ? 1 : 0);
                uds.faceLocked      = (ushort)(settings.FaceLocked ? 1 : 0);
                uds.flipY           = (ushort)(settings.FlipY ? 1 : 0);
                uds.occlusionMesh   = (ushort)(settings.OcclusionMesh ? 1 : 0);
                uds.sessionPriority = settings.SessionPriority;
                uds.submitDepth     = (ushort)(settings.SubmitDepth ? 1 : 0);
                uds.depthSorting    = (ushort)(settings.DepthSorting ? 1 : 0);
                uds.depthTestRange  = (ushort)(settings.DepthTestRange ? 1 : 0);
                uds.depthTestNearZ  = settings.DepthTestNearZ;
                uds.depthTestFarZ   = settings.DepthTestFarZ;

#if !HDRP || HDRP_8_OR_NEWER
                uds.checkSinglePassValue = 1;
#else
                uds.checkSinglePassValue = 0;
#endif

                switch (settings.StereoRenderingMode)
                {
                default:
                case VarjoStereoRenderingMode.MultiPass:
                    uds.useTextureArrays = 0;
                    break;

                case VarjoStereoRenderingMode.TwoPass:
                    uds.useTextureArrays = 1;
                    break;
                }
                SetUserDefinedSettings(uds);
            }

            CreateSubsystem <XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "VarjoDisplay");
            CreateSubsystem <XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "VarjoInput");
#if VARJO_EXPERIMENTAL_FEATURES
            if (!PluginVersionMatchesRuntime())
            {
                VarjoVersion p = Varjo.GetPluginVersion();
                VarjoVersion r = Varjo.GetVarjoRuntimeVersion();
                Debug.LogFormat(LogType.Warning, LogOption.None, this,
                                "Experimental Varjo XR Meshing Subsystem can't be initialized. Experimental features in this version of the plugin can only be used with Varjo Base version {0}.{1}.{2}.\n" +
                                "Varjo Base {3}.{4}.{5} is currently installed. Install Varjo Base {0}.{1}.{2} to use experimental XR Meshing Subsystem.",
                                p.major, p.minor, p.patch, r.major, r.minor, r.patch);
            }
            else
            {
                CreateSubsystem <XRMeshSubsystemDescriptor, XRMeshSubsystem>(s_MeshSubsystemDescriptors, "VarjoMeshing");
            }
#endif
            return(true);
        }
Пример #6
0
 public void Awake()
 {
     s_Settings = this;
     s_Settings.UpdateSettings();
 }