예제 #1
0
        static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner)
        {
            bool oldShadowEnabled  = serialized.settings.shadowsType.enumValueIndex != 0;
            bool newShadowsEnabled = EditorGUILayout.Toggle(s_Styles.enableShadowMap, oldShadowEnabled);

            if (oldShadowEnabled ^ newShadowsEnabled)
            {
                serialized.settings.shadowsType.enumValueIndex = newShadowsEnabled ? (int)LightShadows.Hard : (int)LightShadows.None;
            }

            using (new EditorGUI.DisabledScope(!newShadowsEnabled))
            {
                EditorGUILayout.PropertyField(serialized.serializedShadowData.resolution, s_Styles.shadowResolution);
                EditorGUILayout.Slider(serialized.serializedLightData.shadowNearPlane, HDShadowUtils.k_MinShadowNearPlane, 10f, s_Styles.shadowNearPlane);

                if (serialized.settings.isMixed)
                {
                    using (new EditorGUI.DisabledScope(!(GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset).renderPipelineSettings.supportShadowMask))
                    {
                        EditorGUI.BeginChangeCheck();
                        ShadowmaskMode shadowmask = serialized.serializedLightData.nonLightmappedOnly.boolValue ? ShadowmaskMode.ShadowMask : ShadowmaskMode.DistanceShadowmask;
                        shadowmask = (ShadowmaskMode)EditorGUILayout.EnumPopup(s_Styles.nonLightmappedOnly, shadowmask);
                        if (EditorGUI.EndChangeCheck())
                        {
                            serialized.serializedLightData.nonLightmappedOnly.boolValue = shadowmask == ShadowmaskMode.ShadowMask;
                            ((Light)owner.target).lightShadowCasterMode = shadowmask == ShadowmaskMode.ShadowMask ? LightShadowCasterMode.NonLightmappedOnly : LightShadowCasterMode.Everything;
                        }
                    }
                }

                EditorGUILayout.Slider(serialized.serializedShadowData.viewBiasScale, 0.0f, 15.0f, s_Styles.viewBiasScale);
            }
        }
        /// <summary>
        /// Load values found inside PlayerPrefs.
        /// </summary>
        private void LoadValues()
        {
            ResolutionIndex = PlayerPrefs.GetInt("SETTINGSMANAGER_RESOLUTIONINDEX", ResolutionIndex);

            if (ResolutionIndex <= -1)
            {
                Vector2Int currentResolution = new Vector2Int(Screen.currentResolution.width, Screen.currentResolution.height);

                bool exit = false;
                foreach (KeyValuePair <AspectRatioTypes, Vector2Int[]> aspectRatio in m_ResolutionList)
                {
                    for (int i = 0; i < aspectRatio.Value.Length; i++)
                    {
                        if (currentResolution == aspectRatio.Value[i])
                        {
                            ResolutionIndex = i;
                            AspectRatio     = aspectRatio.Key;
                            exit            = true;
                            break;
                        }
                    }

                    if (exit)
                    {
                        break;
                    }
                }

                if (ResolutionIndex == -1)
                {
                    // Standard 1080p
                    ResolutionIndex = 2;
                    AspectRatio     = AspectRatioTypes.Ratio16by9;
                }
            }
            else
            {
                AspectRatio = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_ASPECTRATIO", AspectRatio);
            }

            Fullscreen  = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_FULLSCREEN", Fullscreen);
            RefreshRate = PlayerPrefs.GetInt("SETTINGSMANAGER_REFRESHRATE", RefreshRate);

            PixelLightCount         = PlayerPrefs.GetInt("SETTINGSMANAGER_PIXELLIGHTCOUNT", PixelLightCount);
            TextureQuality          = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_TEXTUREQUALITYTYPE", TextureQuality);
            AnisotropicFiltering    = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_ANISOTROPICFILTERING", AnisotropicFiltering);
            AntiAliasing            = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_ANTIALIASING", AntiAliasing);
            SoftParticles           = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_SOFTPARTICLES", SoftParticles);
            RealtimeReflectionProbe = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_REALTIMEREFLECTIONPROBE", RealtimeReflectionProbe);
            VSyncCount = PlayerPrefs.GetInt("SETTINGSMANAGER_VSYNCCOUNT", VSyncCount);

            ShadowQualityType     = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWQUALITYTYPE", ShadowQualityType);
            ShadowResolutionType  = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWRESOLUTIONTYPE", ShadowResolutionType);
            ShadowProjectionType  = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWPROJECTIONTYPE", ShadowProjectionType);
            ShadowDistance        = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWDISTANCETYPE", ShadowDistance);
            ShadowmaskModeType    = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWMASKMODE", ShadowmaskModeType);
            ShadowNearPlaneOffset = PlayerPrefs.GetInt("SETTINGSMANAGER_SHADOWNEARPLANEOFFSET", ShadowNearPlaneOffset);
            ShadowCascadeType     = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_SHADOWCASCADETYPE", ShadowCascadeType);
        }
예제 #3
0
        static void DrawShadowMapContent(SerializedHDLight serialized, Editor owner)
        {
            bool oldShadowEnabled  = serialized.settings.shadowsType.enumValueIndex != 0;
            bool newShadowsEnabled = EditorGUILayout.Toggle(s_Styles.enableShadowMap, oldShadowEnabled);

            if (oldShadowEnabled ^ newShadowsEnabled)
            {
                serialized.settings.shadowsType.enumValueIndex = newShadowsEnabled ? (int)LightShadows.Hard : (int)LightShadows.None;
            }

            using (new EditorGUI.DisabledScope(!newShadowsEnabled))
            {
#if ENABLE_RAYTRACING
                if (LightShape.Rectangle == serialized.editorLightShape)
                {
                    EditorGUILayout.PropertyField(serialized.serializedLightData.useRayTracedShadows, s_Styles.useRayTracedShadows);
                }
                if (!serialized.serializedLightData.useRayTracedShadows.boolValue || LightShape.Rectangle != serialized.editorLightShape)
#endif
                {
                    EditorGUILayout.DelayedIntField(serialized.serializedShadowData.resolution, s_Styles.shadowResolution);
                    EditorGUILayout.Slider(serialized.serializedLightData.shadowNearPlane, HDShadowUtils.k_MinShadowNearPlane, 10f, s_Styles.shadowNearPlane);

                    if (serialized.settings.isMixed)
                    {
                        using (new EditorGUI.DisabledScope(!(GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset).currentPlatformRenderPipelineSettings.supportShadowMask))
                        {
                            EditorGUI.showMixedValue = serialized.serializedLightData.nonLightmappedOnly.hasMultipleDifferentValues;
                            EditorGUI.BeginChangeCheck();
                            ShadowmaskMode shadowmask = serialized.serializedLightData.nonLightmappedOnly.boolValue ? ShadowmaskMode.ShadowMask : ShadowmaskMode.DistanceShadowmask;
                            shadowmask = (ShadowmaskMode)EditorGUILayout.EnumPopup(s_Styles.nonLightmappedOnly, shadowmask);
                            if (EditorGUI.EndChangeCheck())
                            {
                                serialized.serializedLightData.nonLightmappedOnly.boolValue = shadowmask == ShadowmaskMode.ShadowMask;
                                foreach (Light target in owner.targets)
                                {
                                    target.lightShadowCasterMode = shadowmask == ShadowmaskMode.ShadowMask ? LightShadowCasterMode.NonLightmappedOnly : LightShadowCasterMode.Everything;
                                }
                            }
                            EditorGUI.showMixedValue = false;
                        }
                    }
                    if (serialized.editorLightShape == LightShape.Rectangle)
                    {
                        EditorGUILayout.Slider(serialized.serializedLightData.areaLightShadowCone, 10.0f, 179.0f, s_Styles.areaLightShadowCone);
                    }
                    else
                    {
                        EditorGUILayout.Slider(serialized.serializedShadowData.viewBiasScale, 0.0f, 15.0f, s_Styles.viewBiasScale);
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isSet"></param>
        public QualitySettingsKun(bool isSet) : base()
        {
            isDirty = false;
            if (isSet)
            {
                activeColorSpace             = QualitySettings.activeColorSpace;
                anisotropicFiltering         = QualitySettings.anisotropicFiltering;
                antiAliasing                 = QualitySettings.antiAliasing;
                asyncUploadBufferSize        = QualitySettings.asyncUploadBufferSize;
                asyncUploadPersistentBuffer  = QualitySettings.asyncUploadPersistentBuffer;
                asyncUploadTimeSlice         = QualitySettings.asyncUploadTimeSlice;
                billboardsFaceCameraPosition = QualitySettings.billboardsFaceCameraPosition;
                desiredColorSpace            = QualitySettings.desiredColorSpace;
                lodBias            = QualitySettings.lodBias;
                masterTextureLimit = QualitySettings.masterTextureLimit;
                maximumLODLevel    = QualitySettings.maximumLODLevel;
                maxQueuedFrames    = QualitySettings.maxQueuedFrames;
                names = QualitySettings.names;
                particleRaycastBudget           = QualitySettings.particleRaycastBudget;
                pixelLightCount                 = QualitySettings.pixelLightCount;
                realtimeReflectionProbes        = QualitySettings.realtimeReflectionProbes;
                resolutionScalingFixedDPIFactor = QualitySettings.resolutionScalingFixedDPIFactor;
                shadowCascade2Split             = QualitySettings.shadowCascade2Split;
                mShadowCascade4Split            = new Vector3Kun(QualitySettings.shadowCascade4Split);
                shadowCascades        = QualitySettings.shadowCascades;
                shadowDistance        = QualitySettings.shadowDistance;
                shadowmaskMode        = QualitySettings.shadowmaskMode;
                shadowNearPlaneOffset = QualitySettings.shadowNearPlaneOffset;
                shadowProjection      = QualitySettings.shadowProjection;
                shadowResolution      = QualitySettings.shadowResolution;
                shadows = QualitySettings.shadows;
#if UNITY_2019_1_OR_NEWER
                skinWeights = QualitySettings.skinWeights;
#endif
                softParticles                     = QualitySettings.softParticles;
                softVegetation                    = QualitySettings.softVegetation;
                streamingMipmapsActive            = QualitySettings.streamingMipmapsActive;
                streamingMipmapsAddAllCameras     = QualitySettings.streamingMipmapsAddAllCameras;
                streamingMipmapsMaxFileIORequests = QualitySettings.streamingMipmapsMaxFileIORequests;
                streamingMipmapsMaxLevelReduction = QualitySettings.streamingMipmapsMaxLevelReduction;
                streamingMipmapsMemoryBudget      = QualitySettings.streamingMipmapsMemoryBudget;
                streamingMipmapsRenderersPerFrame = QualitySettings.streamingMipmapsRenderersPerFrame;
                vSyncCount = QualitySettings.vSyncCount;
            }
        }
        /// <summary>
        /// Load values from a SettingPreset object minus resolution.
        /// </summary>
        public void LoadValues(SettingsPreset preset)
        {
            PixelLightCount         = preset.PixelLightCount;
            TextureQuality          = preset.TextureQuality;
            AnisotropicFiltering    = preset.AnisotropicFiltering;
            AntiAliasing            = preset.AntiAliasing;
            SoftParticles           = preset.SoftParticles;
            RealtimeReflectionProbe = preset.RealtimeReflectionProbe;
            VSyncCount = preset.VSyncCount;

            ShadowQualityType     = preset.ShadowQualityType;
            ShadowResolutionType  = preset.ShadowResolutionType;
            ShadowProjectionType  = preset.ShadowProjectionType;
            ShadowDistance        = preset.ShadowDistance;
            ShadowmaskModeType    = preset.ShadowmaskModeType;
            ShadowNearPlaneOffset = preset.ShadowNearPlaneOffset;
            ShadowCascadeType     = preset.ShadowCascadeType;
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="binaryReader"></param>
        public virtual void Deserialize(BinaryReader binaryReader)
        {
            activeColorSpace             = (ColorSpace)binaryReader.ReadInt32();
            anisotropicFiltering         = (AnisotropicFiltering)binaryReader.ReadInt32();
            antiAliasing                 = binaryReader.ReadInt32();
            asyncUploadBufferSize        = binaryReader.ReadInt32();
            asyncUploadPersistentBuffer  = binaryReader.ReadBoolean();
            asyncUploadTimeSlice         = binaryReader.ReadInt32();
            billboardsFaceCameraPosition = binaryReader.ReadBoolean();
            desiredColorSpace            = (ColorSpace)binaryReader.ReadInt32();
            lodBias            = binaryReader.ReadSingle();
            masterTextureLimit = binaryReader.ReadInt32();
            maximumLODLevel    = binaryReader.ReadInt32();
            maxQueuedFrames    = binaryReader.ReadInt32();
            names = SerializerKun.DesirializeStrings(binaryReader);
            particleRaycastBudget           = binaryReader.ReadInt32();
            pixelLightCount                 = binaryReader.ReadInt32();
            realtimeReflectionProbes        = binaryReader.ReadBoolean();
            resolutionScalingFixedDPIFactor = binaryReader.ReadSingle();
            shadowCascade2Split             = binaryReader.ReadSingle();
            mShadowCascade4Split            = SerializerKun.DesirializeObject <Vector3Kun>(binaryReader);
            shadowCascades        = binaryReader.ReadInt32();
            shadowDistance        = binaryReader.ReadSingle();
            shadowmaskMode        = (ShadowmaskMode)binaryReader.ReadInt32();
            shadowNearPlaneOffset = binaryReader.ReadSingle();
            shadowProjection      = (ShadowProjection)binaryReader.ReadInt32();
            shadowResolution      = (ShadowResolution)binaryReader.ReadInt32();
            shadows = (ShadowQuality)binaryReader.ReadInt32();
#if UNITY_2019_1_OR_NEWER
            skinWeights = (SkinWeights)binaryReader.ReadInt32();
#endif
            softParticles                     = binaryReader.ReadBoolean();
            softVegetation                    = binaryReader.ReadBoolean();
            streamingMipmapsActive            = binaryReader.ReadBoolean();
            streamingMipmapsAddAllCameras     = binaryReader.ReadBoolean();
            streamingMipmapsMaxFileIORequests = binaryReader.ReadInt32();
            streamingMipmapsMaxLevelReduction = binaryReader.ReadInt32();
            streamingMipmapsMemoryBudget      = binaryReader.ReadSingle();
            streamingMipmapsRenderersPerFrame = binaryReader.ReadInt32();
            vSyncCount = binaryReader.ReadInt32();
            isDirty    = binaryReader.ReadBoolean();
        }
        /// <summary>
        /// Load values from a SettingPreset object including resolution.
        /// </summary>
        public void LoadValues(SettingsPreset preset, bool loadResolution)
        {
            if (loadResolution)
            {
                ResolutionIndex = PlayerPrefs.GetInt("SETTINGSMANAGER_RESOLUTIONINDEX", ResolutionIndex);

                if (ResolutionIndex <= -1)
                {
                    Vector2Int currentResolution = new Vector2Int(Screen.currentResolution.width, Screen.currentResolution.height);

                    bool exit = false;
                    foreach (KeyValuePair <AspectRatioTypes, Vector2Int[]> aspectRatio in m_ResolutionList)
                    {
                        for (int i = 0; i < aspectRatio.Value.Length; i++)
                        {
                            if (currentResolution == aspectRatio.Value[i])
                            {
                                ResolutionIndex = i;
                                AspectRatio     = aspectRatio.Key;
                                exit            = true;
                                break;
                            }
                        }

                        if (exit)
                        {
                            break;
                        }
                    }

                    if (ResolutionIndex == -1)
                    {
                        // Standard 1080p
                        ResolutionIndex = 2;
                        AspectRatio     = AspectRatioTypes.Ratio16by9;
                    }
                }
                else
                {
                    AspectRatio = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_ASPECTRATIO", AspectRatio);
                }

                Fullscreen  = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_FULLSCREEN", Fullscreen);
                RefreshRate = PlayerPrefs.GetInt("SETTINGSMANAGER_REFRESHRATE", RefreshRate);
            }

            PixelLightCount         = preset.PixelLightCount;
            TextureQuality          = preset.TextureQuality;
            AnisotropicFiltering    = preset.AnisotropicFiltering;
            AntiAliasing            = preset.AntiAliasing;
            SoftParticles           = preset.SoftParticles;
            RealtimeReflectionProbe = preset.RealtimeReflectionProbe;
            VSyncCount = preset.VSyncCount;

            ShadowQualityType     = preset.ShadowQualityType;
            ShadowResolutionType  = preset.ShadowResolutionType;
            ShadowProjectionType  = preset.ShadowProjectionType;
            ShadowDistance        = preset.ShadowDistance;
            ShadowmaskModeType    = preset.ShadowmaskModeType;
            ShadowNearPlaneOffset = preset.ShadowNearPlaneOffset;
            ShadowCascadeType     = preset.ShadowCascadeType;
        }
        /// <summary>
        /// Apply changes done to the manager towards the actual game. If overwrite, it will force save all settings, not just the changed ones.
        /// </summary>
        public void ApplyChanges(bool overwrite = false)
        {
            // Screen
            if (overwrite || (m_CurrentResolutionIndex != ResolutionIndex || m_CurrentAspectRatio != AspectRatio || m_CurrentlyFullscreen != Fullscreen || m_CurrentRefreshRate != RefreshRate))
            {
                m_CurrentAspectRatio     = AspectRatio;
                m_CurrentResolutionIndex = ResolutionIndex;
                m_CurrentlyFullscreen    = Fullscreen;
                m_CurrentRefreshRate     = RefreshRate;
                Vector2Int resolution = m_ResolutionList[m_CurrentAspectRatio][m_CurrentResolutionIndex];
                Screen.SetResolution(resolution.x, resolution.y, m_CurrentlyFullscreen, m_CurrentRefreshRate);

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_ASPECTRATIO", m_CurrentAspectRatio);
                PlayerPrefs.SetInt("SETTINGSMANAGER_RESOLUTIONINDEX", m_CurrentResolutionIndex);
                PlayerPrefsUtil.SetBool("SETTINGSMANAGER_FULLSCREEN", m_CurrentlyFullscreen);
                PlayerPrefs.GetInt("SETTINGSMANAGER_REFRESHRATE", m_CurrentRefreshRate);
            }

            // Graphics
            if (overwrite || (m_CurrentPixelLightCount != PixelLightCount))
            {
                m_CurrentPixelLightCount        = PixelLightCount;
                QualitySettings.pixelLightCount = m_CurrentPixelLightCount;

                PlayerPrefs.SetInt("SETTINGSMANAGER_PIXELLIGHTCOUNT", m_CurrentPixelLightCount);
            }

            if (overwrite || (m_CurrentTextureQualityType != TextureQuality))
            {
                m_CurrentTextureQualityType        = TextureQuality;
                QualitySettings.masterTextureLimit = (int)m_CurrentTextureQualityType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_TEXTUREQUALITYTYPE", m_CurrentTextureQualityType);
            }

            if (overwrite || (m_CurrentAnisotropicFiltering != AnisotropicFiltering))
            {
                m_CurrentAnisotropicFiltering        = AnisotropicFiltering;
                QualitySettings.anisotropicFiltering = m_CurrentAnisotropicFiltering ? UnityEngine.AnisotropicFiltering.Enable : UnityEngine.AnisotropicFiltering.Disable;

                PlayerPrefsUtil.SetBool("SETTINGSMANAGER_ANISOTROPICFILTERING", m_CurrentAnisotropicFiltering);
            }

            if (overwrite || (m_CurrentAntiAliasingType != AntiAliasing))
            {
                m_CurrentAntiAliasingType    = AntiAliasing;
                QualitySettings.antiAliasing = (int)m_CurrentAntiAliasingType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_ANTIALIASINGTYPE", m_CurrentAntiAliasingType);
            }

            if (overwrite || (m_CurrentSoftParticles != SoftParticles))
            {
                m_CurrentSoftParticles        = SoftParticles;
                QualitySettings.softParticles = m_CurrentSoftParticles;

                PlayerPrefsUtil.SetBool("SETTINGSMANAGER_SOFTPARTICLES", m_CurrentSoftParticles);
            }

            if (overwrite || (m_CurrentRealtimeReflectionProbe != RealtimeReflectionProbe))
            {
                m_CurrentRealtimeReflectionProbe         = RealtimeReflectionProbe;
                QualitySettings.realtimeReflectionProbes = m_CurrentRealtimeReflectionProbe;

                PlayerPrefsUtil.SetBool("SETTINGSMANAGER_REALTIMEREFLECTIONPROBE", m_CurrentRealtimeReflectionProbe);
            }

            if (overwrite || (m_CurrentVSyncCount != VSyncCount))
            {
                m_CurrentVSyncCount        = VSyncCount;
                QualitySettings.vSyncCount = VSyncCount;

                PlayerPrefs.SetInt("SETTINGSMANAGER_VSYNCCOUNT", m_CurrentVSyncCount);
            }

            // Shadows
            if (overwrite || (m_CurrentShadowQualityType != ShadowQualityType))
            {
                m_CurrentShadowQualityType = ShadowQualityType;
                QualitySettings.shadows    = m_CurrentShadowQualityType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_SHADOWQUALITYTYPE", m_CurrentShadowQualityType);
            }

            if (overwrite || (m_CurrentShadowResolutionType != ShadowResolutionType))
            {
                m_CurrentShadowResolutionType    = ShadowResolutionType;
                QualitySettings.shadowResolution = m_CurrentShadowResolutionType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_SHADOWRESOLUTIONTYPE", m_CurrentShadowQualityType);
            }

            if (overwrite || (m_CurrentShadowProjectionType != ShadowProjectionType))
            {
                m_CurrentShadowProjectionType    = ShadowProjectionType;
                QualitySettings.shadowProjection = m_CurrentShadowProjectionType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_SHADOWPROJECTIONTYPE", m_CurrentShadowProjectionType);
            }

            if (overwrite || (m_CurrentShadowDistanceType != ShadowDistance))
            {
                m_CurrentShadowDistanceType    = ShadowDistance;
                QualitySettings.shadowDistance = (int)m_CurrentShadowDistanceType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_SHADOWDISTANCETYPE", m_CurrentShadowProjectionType);
            }

            if (overwrite || (m_CurrentShadowmaskModeType != ShadowmaskModeType))
            {
                m_CurrentShadowmaskModeType    = ShadowmaskModeType;
                QualitySettings.shadowmaskMode = m_CurrentShadowmaskModeType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_SHADOWMASKMODE", m_CurrentShadowmaskModeType);
            }

            if (overwrite || (m_CurrentShadowNearPlaneOffset != ShadowNearPlaneOffset))
            {
                m_CurrentShadowNearPlaneOffset        = ShadowNearPlaneOffset;
                QualitySettings.shadowNearPlaneOffset = m_CurrentShadowNearPlaneOffset;

                PlayerPrefs.SetInt("SETTINGSMANAGER_SHADOWNEARPLANEOFFSET", m_CurrentShadowNearPlaneOffset);
            }

            if (overwrite || (m_CurrentShadowCascadeType != ShadowCascadeType))
            {
                m_CurrentShadowCascadeType     = ShadowCascadeType;
                QualitySettings.shadowCascades = (int)m_CurrentShadowCascadeType;

                PlayerPrefsUtil.SetEnum("SETTINGSMANAGER_SHADOWCASCADETYPE", m_CurrentShadowCascadeType);
            }
        }
예제 #9
0
        /// <summary>
        /// Save current settings to default settings
        /// </summary>
        public void SaveCurrentToDefault()
        {
            defaultProceduralSunIntensity           = proceduralSunIntensity;
            defaultProceduralLWRPSunIntensity       = proceduralLWRPSunIntensity;
            defaultProceduralHDRPSunIntensity       = proceduralHDRPSunIntensity;
            defaultProceduralSunColor               = proceduralSunColor;
            defaultProceduralSunSize                = proceduralSunSize;
            defaultHDRPProceduralSunSize            = hdrpProceduralSunSize;
            defaultProceduralSunSizeConvergence     = proceduralSunSizeConvergence;
            defaultHDRPProceduralSunSizeConvergence = hdrpProceduralSunSizeConvergence;
            defaultProceduralAtmosphereThickness    = proceduralAtmosphereThickness;
            defaultProceduralGroundColor            = proceduralGroundColor;
            defaultProceduralSkyTint                = proceduralSkyTint;
            defaultProceduralSkyExposure            = proceduralSkyExposure;
            defaultProceduralSkyboxRotation         = proceduralSkyboxRotation;
            defaultProceduralSkyboxPitch            = proceduralSkyboxPitch;
            defaultIncludeSunInBaking               = includeSunInBaking;
            defaultUseSkies = useSkies;
            defaultSkyboxGroundIntensity   = skyboxGroundIntensity;
            defaultSkyboxRotation          = skyboxRotation;
            defaultSkyboxPitch             = skyboxPitch;
            defaultShadowDistance          = shadowDistance;
            defaultShadowType              = shadowType;
            defaultShadowStrength          = shadowStrength;
            defaultIndirectLightMultiplier = indirectLightMultiplier;

            defaultProceduralFogColor        = proceduralFogColor;
            defaultProceduralFogDistance     = proceduralFogDistance;
            defaultProceduralNearFogDistance = proceduralNearFogDistance;
            defaultProceduralFogDensity      = proceduralFogDensity;

            defaultScaleHorizonObjectWithFog = scaleHorizonObjectWithFog;
            defaultHorizonSkyEnabled         = horizonSkyEnabled;
            defaultHorizonBlend            = horizonBlend;
            defaultHorizonFalloff          = horizonFalloff;
            defaultHorizonFogDensity       = horizonFogDensity;
            defaultHorizonScattering       = horizonScattering;
            defaultHorizonSize             = horizonSize;
            defaultFollowPlayer            = followPlayer;
            defaultHorizonPosition         = horizonPosition;
            defaultHorizonUpdateTime       = horizonUpdateTime;
            defaultAmbientMode             = ambientMode;
            defaultSkyColor                = skyColor;
            defaultEquatorColor            = equatorColor;
            defaultGroundColor             = groundColor;
            defaultLWRPSkyColor            = lwrpSkyColor;
            defaultLWRPEquatorColor        = lwrpEquatorColor;
            defaultLWRPGroundColor         = lwrpGroundColor;
            defaultShadowQuality           = shadowQuality;
            defaultShadowmaskMode          = shadowmaskMode;
            defaultShadowQuality           = shadowQuality;
            defaultShadowResolution        = shadowResolution;
            defaultShadowProjection        = shadowProjection;
            defaultCascadeCount            = cascadeCount;
            defaultEnableSunDisk           = enableSunDisk;
            defaultProceduralSkyMultiplier = proceduralSkyMultiplier;

            defaultIsGlobal      = isGlobal;
            defaultBlendDistance = blendDistance;
            defaultWeight        = weight;
            defaultPriority      = priority;

            defaultHDRIExposure         = hDRIExposure;
            defaultHDRIMultiplier       = hDRIMultiplier;
            defaultHDRIUpdateMode       = hDRIUpdateMode;
            defaultHDRIRotation         = hDRIRotation;
            defaultMaxShadowDistance    = maxShadowDistance;
            defaultCascadeSplit1        = cascadeSplit1;
            defaultCascadeSplit2        = cascadeSplit2;
            defaultCascadeSplit3        = cascadeSplit3;
            defaultUseContactShadows    = useContactShadows;
            defaultContactShadowsLength = contactShadowsLength;
            defaultContactShadowsDistanceScaleFactor = contactShadowsDistanceScaleFactor;
            defaultContactShadowsMaxDistance         = contactShadowsMaxDistance;
            defaultContactShadowsFadeDistance        = contactShadowsFadeDistance;
            defaultContactShadowsSampleCount         = contactShadowsSampleCount;
            defaultContactShadowsOpacity             = contactShadowsOpacity;
            defaultUseMicroShadowing  = useMicroShadowing;
            defaultMicroShadowOpacity = microShadowOpacity;
            defaultVolumetricSingleScatteringAlbedo = volumetricSingleScatteringAlbedo;
            defaultVolumetricBaseFogDistance        = volumetricBaseFogDistance;
            defaultVolumetricBaseFogHeight          = volumetricBaseFogHeight;
            defaultVolumetricMeanHeight             = volumetricMeanHeight;
            defaultVolumetricGlobalAnisotropy       = volumetricGlobalAnisotropy;
            defaultVolumetricGlobalLightProbeDimmer = volumetricGlobalLightProbeDimmer;
            defaultVolumetricMaxFogDistance         = volumetricMaxFogDistance;
            defaultVolumetricEnableDistanceFog      = volumetricEnableDistanceFog;

            defaultVolumetricConstFogColor      = volumetricConstFogColor;
            defaultVolumetricMipFogNear         = volumetricMipFogNear;
            defaultVolumetricMipFogFar          = volumetricMipFogFar;
            defaultVolumetricMipFogMaxMip       = volumetricMipFogMaxMip;
            defaultExponentialFogDensity        = exponentialFogDensity;
            defaultExponentialBaseHeight        = exponentialBaseHeight;
            defaultExponentialHeightAttenuation = exponentialHeightAttenuation;
            defaultExponentialMaxFogDistance    = exponentialMaxFogDistance;
            defaultExponentialMipFogNear        = exponentialMipFogNear;
            defaultExponentialMipFogFar         = exponentialMipFogFar;
            defaultExponentialMipFogMaxMip      = exponentialMipFogMaxMip;
            defaultLinearFogDensity             = linearFogDensity;
            defaultLinearHeightStart            = linearHeightStart;
            defaultLinearHeightEnd         = linearHeightEnd;
            defaultLinearMaxFogDistance    = linearMaxFogDistance;
            defaultLinearMipFogNear        = linearMipFogNear;
            defaultLinearMipFogFar         = linearMipFogFar;
            defaultLinearMipFogMaxMip      = linearMipFogMaxMip;
            defaultVolumetricDistanceRange = volumetricDistanceRange;
            defaultVolumetricSliceDistributionUniformity = volumetricSliceDistributionUniformity;
            defaultIndirectDiffuseIntensity     = indirectDiffuseIntensity;
            defaultIndirectSpecularIntensity    = indirectSpecularIntensity;
            defaultEnableScreenSpaceReflections = enableScreenSpaceReflections;
            defaultScreenEdgeFadeDistance       = screenEdgeFadeDistance;
            defaultMaxNumberOfRaySteps          = maxNumberOfRaySteps;
            defaultObjectThickness              = objectThickness;
            defaultMinSmoothness                = minSmoothness;
            defaultSmoothnessFadeStart          = smoothnessFadeStart;
            defaultReflectSky                   = reflectSky;
            defaultEnableScreenSpaceRefractions = enableScreenSpaceRefractions;
            defaultScreenWeightDistance         = screenWeightDistance;
            defaultUseBakingSky                 = useBakingSky;
            defaultUseFogDensityVolume          = useFogDensityVolume;
            defaultSingleScatteringAlbedo       = singleScatteringAlbedo;
            defaultDensityVolumeFogDistance     = densityVolumeFogDistance;
            defaultFogDensityMaskTexture        = fogDensityMaskTexture;
            defaultDensityMaskTiling            = densityMaskTiling;
            defaultDensityScale                 = densityScale;
            defaultHDRPFogDistance              = hDRPFogDistance;

#if HDPipeline
#if UNITY_2018_3_OR_NEWER
            defaultVolumeProfile          = volumeProfile;
            defaultVolumetricFogColorMode = volumetricFogColorMode;
            defaultFogColorMode           = fogColorMode;
            defaultHDRISkyIntensityMode   = hDRISkyIntensityMode;
#endif
#endif
        }
예제 #10
0
        /// <summary>
        /// Revert current settings back to default settings
        /// </summary>
        public void RevertToDefault()
        {
            proceduralSunSize                = defaultProceduralSunSize;
            hdrpProceduralSunSize            = defaultHDRPProceduralSunSize;
            proceduralSunSizeConvergence     = defaultProceduralSunSizeConvergence;
            hdrpProceduralSunSizeConvergence = defaultHDRPProceduralSunSizeConvergence;
            proceduralAtmosphereThickness    = defaultProceduralAtmosphereThickness;
            proceduralGroundColor            = defaultProceduralGroundColor;
            proceduralSkyTint                = defaultProceduralSkyTint;
            proceduralSkyExposure            = defaultProceduralSkyExposure;
            proceduralSunColor               = defaultProceduralSunColor;
            proceduralSunIntensity           = defaultProceduralSunIntensity;
            proceduralLWRPSunIntensity       = defaultProceduralLWRPSunIntensity;
            proceduralHDRPSunIntensity       = defaultProceduralHDRPSunIntensity;
            proceduralFogColor               = defaultProceduralFogColor;
            proceduralFogDistance            = defaultProceduralFogDistance;
            proceduralNearFogDistance        = defaultProceduralNearFogDistance;
            proceduralFogDensity             = defaultProceduralFogDensity;
            proceduralSkyboxRotation         = defaultProceduralSkyboxRotation;
            proceduralSkyboxPitch            = defaultProceduralSkyboxPitch;
            includeSunInBaking               = defaultIncludeSunInBaking;
            useSkies = defaultUseSkies;
            skyboxGroundIntensity   = defaultSkyboxGroundIntensity;
            skyboxRotation          = defaultSkyboxRotation;
            skyboxPitch             = defaultSkyboxPitch;
            shadowStrength          = defaultShadowStrength;
            indirectLightMultiplier = defaultIndirectLightMultiplier;
            shadowDistance          = defaultShadowDistance;
            shadowType = defaultShadowType;

            scaleHorizonObjectWithFog = defaultScaleHorizonObjectWithFog;
            horizonSkyEnabled         = defaultHorizonSkyEnabled;
            horizonBlend            = defaultHorizonBlend;
            horizonFalloff          = defaultHorizonFalloff;
            horizonFogDensity       = defaultHorizonFogDensity;
            horizonScattering       = defaultHorizonScattering;
            horizonSize             = defaultHorizonSize;
            followPlayer            = defaultFollowPlayer;
            horizonPosition         = defaultHorizonPosition;
            horizonUpdateTime       = defaultHorizonUpdateTime;
            ambientMode             = defaultAmbientMode;
            skyColor                = defaultSkyColor;
            equatorColor            = defaultEquatorColor;
            groundColor             = defaultGroundColor;
            lwrpSkyColor            = defaultLWRPSkyColor;
            lwrpEquatorColor        = defaultLWRPEquatorColor;
            lwrpGroundColor         = defaultLWRPGroundColor;
            shadowQuality           = defaultShadowQuality;
            shadowmaskMode          = defaultShadowmaskMode;
            shadowResolution        = defaultShadowResolution;
            shadowProjection        = defaultShadowProjection;
            cascadeCount            = defaultCascadeCount;
            enableSunDisk           = defaultEnableSunDisk;
            proceduralSkyMultiplier = defaultProceduralSkyMultiplier;

            isGlobal      = defaultIsGlobal;
            blendDistance = defaultBlendDistance;
            weight        = defaultWeight;
            priority      = defaultPriority;

            maxShadowDistance    = defaultMaxShadowDistance;
            cascadeSplit1        = defaultCascadeSplit1;
            cascadeSplit2        = defaultCascadeSplit2;
            cascadeSplit3        = defaultCascadeSplit3;
            useContactShadows    = defaultUseContactShadows;
            contactShadowsLength = defaultContactShadowsLength;
            contactShadowsDistanceScaleFactor = defaultContactShadowsDistanceScaleFactor;
            contactShadowsMaxDistance         = defaultContactShadowsMaxDistance;
            contactShadowsFadeDistance        = defaultContactShadowsFadeDistance;
            contactShadowsSampleCount         = defaultContactShadowsSampleCount;
            contactShadowsOpacity             = defaultContactShadowsOpacity;
            useMicroShadowing  = defaultUseMicroShadowing;
            microShadowOpacity = defaultMicroShadowOpacity;

            hDRIExposure   = defaultHDRIExposure;
            hDRIMultiplier = defaultHDRIMultiplier;
            hDRIUpdateMode = defaultHDRIUpdateMode;
            hDRIRotation   = defaultHDRIRotation;

            volumetricSingleScatteringAlbedo = defaultVolumetricSingleScatteringAlbedo;
            volumetricBaseFogDistance        = defaultVolumetricBaseFogDistance;
            volumetricBaseFogHeight          = defaultVolumetricBaseFogHeight;
            volumetricMeanHeight             = defaultVolumetricMeanHeight;
            volumetricGlobalAnisotropy       = defaultVolumetricGlobalAnisotropy;
            volumetricGlobalLightProbeDimmer = defaultVolumetricGlobalLightProbeDimmer;
            volumetricMaxFogDistance         = defaultVolumetricMaxFogDistance;
            volumetricEnableDistanceFog      = defaultVolumetricEnableDistanceFog;
            volumetricConstFogColor          = defaultVolumetricConstFogColor;
            volumetricMipFogNear             = defaultVolumetricMipFogNear;
            volumetricMipFogFar     = defaultVolumetricMipFogFar;
            volumetricMipFogMaxMip  = defaultVolumetricMipFogMaxMip;
            volumetricDistanceRange = defaultVolumetricDistanceRange;
            volumetricSliceDistributionUniformity = defaultVolumetricSliceDistributionUniformity;
            exponentialBaseHeight        = defaultExponentialBaseHeight;
            exponentialHeightAttenuation = defaultExponentialHeightAttenuation;
            exponentialMaxFogDistance    = defaultExponentialMaxFogDistance;
            exponentialMipFogNear        = defaultExponentialMipFogNear;
            exponentialMipFogFar         = defaultExponentialMipFogFar;
            exponentialMipFogMaxMip      = defaultExponentialMipFogMaxMip;
            linearHeightStart            = defaultLinearHeightStart;
            linearHeightEnd              = defaultLinearHeightEnd;
            linearMaxFogDistance         = defaultLinearMaxFogDistance;
            linearMipFogNear             = defaultLinearMipFogNear;
            linearMipFogFar              = defaultLinearMipFogFar;
            linearMipFogMaxMip           = defaultLinearMipFogMaxMip;
            indirectDiffuseIntensity     = defaultIndirectDiffuseIntensity;
            indirectSpecularIntensity    = defaultIndirectSpecularIntensity;
            enableScreenSpaceReflections = defaultEnableScreenSpaceReflections;
            screenEdgeFadeDistance       = defaultScreenEdgeFadeDistance;
            maxNumberOfRaySteps          = defaultMaxNumberOfRaySteps;
            objectThickness              = defaultObjectThickness;
            minSmoothness                = defaultMinSmoothness;
            smoothnessFadeStart          = defaultSmoothnessFadeStart;
            reflectSky                   = defaultReflectSky;
            enableScreenSpaceRefractions = defaultEnableScreenSpaceRefractions;
            screenWeightDistance         = defaultScreenWeightDistance;
            useBakingSky                 = defaultUseBakingSky;
            useFogDensityVolume          = defaultUseFogDensityVolume;
            singleScatteringAlbedo       = defaultSingleScatteringAlbedo;
            densityVolumeFogDistance     = defaultDensityVolumeFogDistance;
            fogDensityMaskTexture        = defaultFogDensityMaskTexture;
            densityMaskTiling            = defaultDensityMaskTiling;
            densityScale                 = defaultDensityScale;
            linearFogDensity             = defaultLinearFogDensity;
            exponentialFogDensity        = defaultExponentialFogDensity;
            hDRPFogDistance              = defaultHDRPFogDistance;

#if HDPipeline
#if UNITY_2018_3_OR_NEWER
            volumeProfile          = defaultVolumeProfile;
            volumetricFogColorMode = defaultVolumetricFogColorMode;
            hDRISkyIntensityMode   = defaultHDRISkyIntensityMode;
            fogColorMode           = defaultFogColorMode;
#endif
#endif
        }
예제 #11
0
 private void Start()
 {
     oldShadowmaskMode = QualitySettings.shadowmaskMode;
     QualitySettings.shadowmaskMode = shadowmaskMode;
 }