Esempio n. 1
0
        private bool PluginVersionMatchesRuntime()
        {
            VarjoVersion p = Varjo.GetPluginVersion();
            VarjoVersion r = Varjo.GetVarjoRuntimeVersion();

            return(p.major == r.major && p.minor == r.minor && p.patch == r.patch);
        }
Esempio n. 2
0
        internal void StartMeshSubsystem()
        {
            if (!PluginVersionMatchesRuntime())
            {
                VarjoVersion p = Varjo.GetPluginVersion();
                VarjoVersion r = Varjo.GetVarjoRuntimeVersion();
                Debug.LogFormat(LogType.Error, LogOption.None, this,
                                "Failed to start experimental Varjo XR Meshing Subsystem. 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);
                return;
            }

            m_MeshSubsystemRefCount += 1;
            if (m_MeshSubsystemRefCount == 1)
            {
                StartSubsystem <XRMeshSubsystem>();
            }
        }
Esempio n. 3
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);
        }