Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     //Resolution
     fullScreen = Screen.fullScreen;
     //Rendering
     antiAliasing    = QualitySettings.antiAliasing;
     anisotropicFilt = QualitySettings.anisotropicFiltering;
     textureQuality  = QualitySettings.masterTextureLimit;
     pixelLightCount = QualitySettings.pixelLightCount;
     //Shadow
     shadowProjection = QualitySettings.shadowProjection;
     shadowDistance   = QualitySettings.shadowDistance;
     shadowCascade    = QualitySettings.shadowCascades;
     //Other
     vSync = QualitySettings.vSyncCount;
     particleRaycastBudget = QualitySettings.particleRaycastBudget;
     frameRate             = Application.targetFrameRate;
     //FPS
     frameUpdateTimer           = new System.Timers.Timer(refreshRateMS);
     frameUpdateTimer.Elapsed  += new ElapsedEventHandler(frameUpdateTimer_Elapsed);
     frameUpdateTimer.AutoReset = true;
     frameUpdateTimer.Start();
     //Volume
     masterVolume = AudioListener.volume * 100;
 }
Beispiel #2
0
 public ShadowSettings(LightShadows shadows, ShadowProjection shadowProjection, int shadowCascades, float shadowDistance)
 {
     this.shadows          = shadows;
     this.shadowProjection = shadowProjection;
     this.shadowCascades   = shadowCascades;
     this.shadowDistance   = shadowDistance;
 }
Beispiel #3
0
    float ShadowGroup(float xStart, float yStart)
    {
        float xPos = xStart + 25;
        float yPos = yStart + 25;

        GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Shadow", headingColor));
        yPos = yPos + sWidthHeight.y;
        GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Projection: " + QualitySettings.shadowProjection.ToString());
        yPos = yPos + sWidthHeight.y;
        if (GUI.Button(new Rect(xPos, yPos, bWidthHeight.x, bWidthHeight.y), ShadowProjection.CloseFit.ToString()))
        {
            shadowProjection = ShadowProjection.CloseFit;
        }
        if (GUI.Button(new Rect(xPos + bWidthHeight.x, yPos, bWidthHeight.x, bWidthHeight.y), ShadowProjection.StableFit.ToString()))
        {
            shadowProjection = ShadowProjection.StableFit;
        }
        QualitySettings.shadowProjection = shadowProjection;
        yPos = yPos + bWidthHeight.y;
        GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Distance: " + QualitySettings.shadowDistance);
        shadowDistance = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), shadowDistance, 0, maxShadowDistance);
        QualitySettings.shadowDistance = shadowDistance;
        yPos = yPos + sWidthHeight.y;
        GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Cascade: " + QualitySettings.shadowCascades);
        shadowCascade = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), shadowCascade, 0, maxShadowCascade);
        shadowCascade = (int)Mathf.ClosestPowerOfTwo((int)shadowCascade);
        if (shadowCascade == 1)
        {
            shadowCascade = 0;
        }
        QualitySettings.shadowCascades = (int)Mathf.ClosestPowerOfTwo((int)shadowCascade);

        return(yPos);
    }
        /// <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);
        }
Beispiel #5
0
 public ShadowQual()
 {
     shadowDist    = 20f;
     shadowCasc    = 2;
     shadowProj    = ShadowProjection.CloseFit;
     oldShadowCasc = 2;
     oldShadowProj = ShadowProjection.CloseFit;
 }
Beispiel #6
0
 public void DeincrementQuality()
 {
     int q = QualitySettings.GetQualityLevel ();
     ShadowProjection p = QualitySettings.shadowProjection;
     QualitySettings.SetQualityLevel (q - 1 < 0 ? qualitySettings.Length : q - 1);
     QualitySettings.shadowProjection = p;
     text.text = qualitySettings [QualitySettings.GetQualityLevel ()];
 }
    static int IntToEnum(IntPtr L)
    {
        int arg0           = (int)LuaDLL.lua_tonumber(L, 1);
        ShadowProjection o = (ShadowProjection)arg0;

        LuaScriptMgr.PushEnum(L, o);
        return(1);
    }
Beispiel #8
0
 public void IncrementQuality()
 {
     int q = QualitySettings.GetQualityLevel ();
     ShadowProjection p = QualitySettings.shadowProjection;
     QualitySettings.SetQualityLevel (q + 1 > qualitySettings.Length ? 0 : q + 1);
     QualitySettings.shadowProjection = p;
     text.text = qualitySettings [QualitySettings.GetQualityLevel ()];
 }
Beispiel #9
0
 public void Start()
 {
     oldShadowDistance = QualitySettings.shadowDistance;
     QualitySettings.shadowDistance = shadowDist;
     oldShadowCasc = QualitySettings.shadowCascades;
     QualitySettings.shadowCascades = shadowCasc;
     oldShadowProj = QualitySettings.shadowProjection;
     QualitySettings.shadowProjection = shadowProj;
 }
Beispiel #10
0
 void CloneGlobalShadowSettings()
 {
     shadows               = QualitySettings.shadows;
     ShadowResolution      = QualitySettings.shadowResolution;
     shadowNearPlaneOffset = QualitySettings.shadowNearPlaneOffset;
     shadowCascades        = QualitySettings.shadowCascades;
     ShadowProjection      = QualitySettings.shadowProjection;
     shadowDistance        = QualitySettings.shadowDistance;
     shadowCascade2Split   = QualitySettings.shadowCascade2Split;
     shadowCascade4Split   = QualitySettings.shadowCascade4Split;
 }
Beispiel #11
0
    private static int set_shadowProjection(IntPtr L)
    {
        int result;

        try
        {
            ShadowProjection shadowProjection = (ShadowProjection)((int)ToLua.CheckObject(L, 2, typeof(ShadowProjection)));
            QualitySettings.shadowProjection = shadowProjection;
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
        /// <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;
        }
Beispiel #14
0
        float ShadowGroup(float xStart, float yStart)
        {
            float xPos = xStart + 25;
            float yPos = yStart + 25;

            GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Shadow", headingColor));
            yPos = yPos + sWidthHeight.y;
            GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Projection: " + QualitySettings.shadowProjection.ToString());
            yPos = yPos + sWidthHeight.y;
            if (GUI.Button(new Rect(xPos, yPos, bWidthHeight.x, bWidthHeight.y), ShadowProjection.CloseFit.ToString()))
            {
                shadowProjection = ShadowProjection.CloseFit;
                Save(saveTag + GetName(new { shadowProjection }), 0);
            }
            if (GUI.Button(new Rect(xPos + bWidthHeight.x, yPos, bWidthHeight.x, bWidthHeight.y), ShadowProjection.StableFit.ToString()))
            {
                shadowProjection = ShadowProjection.StableFit;
                Save(saveTag + GetName(new { shadowProjection }), 1);
            }
            QualitySettings.shadowProjection = shadowProjection;
            yPos = yPos + bWidthHeight.y;

            var cameraController = GameObject.FindObjectsOfType <CameraController>().First();

            GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Max Shadow Distance: " + cameraController.m_maxShadowDistance);
            maxShadowDistance = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), maxShadowDistance, 0, shadowDistanceLimit);
            cameraController.m_maxShadowDistance = maxShadowDistance;
            Save(saveTag + GetName(new { shadowDistance = maxShadowDistance }), maxShadowDistance);
            yPos = yPos + sWidthHeight.y;

            GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Cascade: " + QualitySettings.shadowCascades);
            shadowCascade = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), shadowCascade, 0, maxShadowCascade);
            shadowCascade = (int)Mathf.ClosestPowerOfTwo((int)shadowCascade);
            Save(saveTag + GetName(new { shadowCascade }), shadowCascade);
            if (shadowCascade == 1)
            {
                shadowCascade = 0;
            }
            QualitySettings.shadowCascades = (int)Mathf.ClosestPowerOfTwo((int)shadowCascade);

            return(yPos);
        }
        /// <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>
        /// 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);
            }
        }
Beispiel #17
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
        }
Beispiel #18
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
        }
Beispiel #19
0
        private void ResetToDefault()
        {
            //Default
            antiAliasing    = QualitySettings.antiAliasing;
            anisotropicFilt = QualitySettings.anisotropicFiltering;
            textureQuality  = QualitySettings.masterTextureLimit;
            pixelLightCount = QualitySettings.pixelLightCount;
            //Shadow
            shadowProjection  = QualitySettings.shadowProjection;
            maxShadowDistance = QualitySettings.shadowDistance;
            shadowCascade     = QualitySettings.shadowCascades;
            //Other
            vSync = QualitySettings.vSyncCount;
            particleRaycastBudget = QualitySettings.particleRaycastBudget;
            frameRate             = Application.targetFrameRate;

            LoDLevel = QualitySettings.maximumLODLevel;
            LoDBias  = QualitySettings.lodBias;
            //fog
            Configuration.instance.fogClassic = Configuration.defaults.fogClassic;
            Configuration.Save();
            SetFogClassicOptions();

            qData.AddToValues("DONT_REMOVE_THIS", "ELSE_IT_RESETS!");


            //Save
            Save(saveTag + GetName(new { antiAliasing }), antiAliasing);

            float anisoFloat = -1;

            if (anisotropicFilt == AnisotropicFiltering.Disable)
            {
                anisoFloat = 0;
            }
            if (anisotropicFilt == AnisotropicFiltering.Enable)
            {
                anisoFloat = 1;
            }
            if (anisotropicFilt == AnisotropicFiltering.ForceEnable)
            {
                anisoFloat = 2;
            }
            Save(saveTag + GetName(new { anisotropicFilt }), anisoFloat);

            Save(saveTag + GetName(new { textureQuality }), textureQuality);
            Save(saveTag + GetName(new { pixelLightCount }), pixelLightCount);

            float shadowProjFloat = -1;

            if (shadowProjection == ShadowProjection.CloseFit)
            {
                shadowProjFloat = 0;
            }
            if (shadowProjection == ShadowProjection.StableFit)
            {
                shadowProjFloat = 1;
            }
            Save(saveTag + GetName(new { shadowProjection }), shadowProjFloat);

            Save(saveTag + GetName(new { shadowDistance = maxShadowDistance }), maxShadowDistance);
            Save(saveTag + GetName(new { shadowCascade }), shadowCascade);
            Save(saveTag + GetName(new { vSync }), vSync);
            Save(saveTag + GetName(new { particleRaycastBudget }), particleRaycastBudget);
            Save(saveTag + GetName(new { frameRate }), frameRate);
            Save(saveTag + GetName(new { LoDLevel }), LoDLevel);
            Save(saveTag + GetName(new { LoDBias }), LoDBias);
        }
Beispiel #20
0
 public void In([FriendlyName("Value", "The current value for this quality setting level.")] out ShadowProjection Value)
 {
     Value = QualitySettings.shadowProjection;
 }
Beispiel #21
0
        /*
         * private ScreenSpaceAmbientOcclusion sSAOC;
         * private ScreenSpaceAmbientObscurance sSAOB;
         * private EdgeDetection edgeDetection;
         * private CreaseShading creaseShading;
         */
        /* Fog */

        /*
         * private float m_3DFogAmount = 0f;
         * private float m_3DFogAmountMax = 1f;
         *
         * private float m_3DFogStart  = 0f;
         * private float m_3DFogStartMax = 1f;
         *
         * private float m_3DFogDistance = 0;
         * private float m_3DFogDistanceMax = 100000f;
         *
         * private float m_3DNoiseStepSize = 0f;
         * private float m_3DNoiseStepSizeMax = 120f;
         *
         * private float m_3DNoiseScale = 0;
         * private float m_3DNoiseScaleMax = 1f;
         */
        //Game
        //private bool useButtons;
        //private bool useCollision;
        // Use this for initialization
        void Start()
        {
            //Resolution
            fullScreen = Screen.fullScreen;

            /*
             * //Rendering
             * antiAliasing = QualitySettings.antiAliasing;
             * anisotropicFilt = QualitySettings.anisotropicFiltering;
             * textureQuality = QualitySettings.masterTextureLimit;
             * pixelLightCount = QualitySettings.pixelLightCount;
             * //Shadow
             * shadowProjection = QualitySettings.shadowProjection;
             * shadowDistance = QualitySettings.shadowDistance;
             * shadowCascade = QualitySettings.shadowCascades;
             * //Other
             * vSync = QualitySettings.vSyncCount;
             * particleRaycastBudget = QualitySettings.particleRaycastBudget;
             * frameRate = Application.targetFrameRate;
             *
             * LoDLevel = QualitySettings.maximumLODLevel;
             * LoDBias = QualitySettings.lodBias;*/
            //FPS
            frameUpdateTimer           = new Timer(refreshRateMS);
            frameUpdateTimer.Elapsed  += new ElapsedEventHandler(frameUpdateTimer_Elapsed);
            frameUpdateTimer.AutoReset = true;
            frameUpdateTimer.Start();
            optionWindowRect = new Rect((Screen.width / 2) - (optionWindowRect.width / 2), (Screen.height / 2) - (optionWindowRect.height / 2), optionWindowRect.width, optionWindowRect.height);
            cameraBehaviours = Camera.main.GetComponents <MonoBehaviour>() as MonoBehaviour[];
            //Get MonoBehaviours here.
            foreach (var t in FindObjectsOfType <MonoBehaviour>())
            {
                var properties = t as RenderProperties;
                if (properties != null)
                {
                    this.renderProperties = properties;
                }
                var properties1 = t as DayNightProperties;
                if (properties1 != null)
                {
                    this.dayNightProperties = properties1;
                }
                var properties2 = t as DayNightCloudsProperties;
                if (properties2 != null)
                {
                    this.dayNightCloudsProperties = properties2;
                }
                var properties3 = t as FogProperties;
                if (properties3 != null)
                {
                    this.fogProperties = properties3;
                }
            }

            //m_fogHeight = (float)EUtils.GetFieldValue(renderProperties,"m_fogHeight");

            /*
             * m_fogHeight = (float)EUtils.GetFieldValue(renderProperties,"m_fogHeight");
             * EUtils.SetFieldValue(renderProperties,"m_fogHeight",m_fogHeight);
             *
             * m_edgeFogDistance = (float)EUtils.GetFieldValue(renderProperties,"m_edgeFogDistance");
             * EUtils.SetFieldValue(renderProperties,"m_edgeFogDistance",m_edgeFogDistance);
             *
             * m_useVolumeFog = (bool)EUtils.GetFieldValue(renderProperties,"m_useVolumeFog");
             * EUtils.SetFieldValue(renderProperties,"m_useVolumeFog",m_useVolumeFog);
             *
             * m_volumeFogDensity = (float)EUtils.GetFieldValue(renderProperties,"m_volumeFogDensity");
             * EUtils.SetFieldValue(renderProperties,"m_volumeFogDensity",m_volumeFogDensity);
             *
             * m_volumeFogStart = (float)EUtils.GetFieldValue(renderProperties,"m_volumeFogStart");
             * EUtils.SetFieldValue(renderProperties,"m_volumeFogStart",m_volumeFogStart);
             *
             * m_volumeFogDistance = (float)EUtils.GetFieldValue(renderProperties,"m_volumeFogDistance");
             * EUtils.SetFieldValue(renderProperties,"m_volumeFogDistance",m_volumeFogDistance);
             *
             * m_pollutionFogIntensity = (float)EUtils.GetFieldValue(renderProperties,"m_pollutionFogIntensity");
             * EUtils.SetFieldValue(renderProperties,"m_pollutionFogIntensity",m_pollutionFogIntensity);
             */
            /* Fog */

            /*
             * m_3DFogAmount =  (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DFogAmount");
             * m_3DFogStart  = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DFogStart");
             * m_3DFogDistance = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DFogDistance");
             * m_3DNoiseStepSize = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DNoiseStepSize");
             * m_3DNoiseScale = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DNoiseScale");
             */

            //Added Effects

            /*
             * sSAOC = Camera.main.gameObject.AddComponent<ScreenSpaceAmbientOcclusion>();
             * sSAOB = Camera.main.gameObject.AddComponent<ScreenSpaceAmbientObscurance>();
             * edgeDetection = Camera.main.gameObject.AddComponent<EdgeDetection>();
             * creaseShading = Camera.main.gameObject.AddComponent<CreaseShading>();
             *
             * sSAOC.enabled = false;
             * sSAOB.enabled = false;
             * edgeDetection.enabled = false;
             * creaseShading.enabled = false;*/


            //QugetFileLoader Alpha.
            filePath = Application.persistentDataPath + "\\qMoreOptionsConfig.qgt";
            QLoader qLoader = new QLoader(filePath);

            qData = qLoader.qData;
            if (qData == null)
            {
                qData = new QData();
            }

            if (qData.GetValueByKey("DONT_REMOVE_THIS") == null)
            {
                //OVERRIDE
                qData.AddToValues("DONT_REMOVE_THIS", "ELSE_IT_RESETS!");
                ResetToDefault();
            }
            else
            {
                //Default
                antiAliasing = Load(saveTag + GetName(new { antiAliasing }));
                //anisotropicFilt = Load(saveTag + GetName (new { anisotropicFilt }));
                float anisoFloat = Load(saveTag + GetName(new { anisotropicFilt }));
                if (anisoFloat == 0)
                {
                    anisotropicFilt = AnisotropicFiltering.Disable;
                }
                if (anisoFloat == 1)
                {
                    anisotropicFilt = AnisotropicFiltering.Enable;
                }
                if (anisoFloat == 2)
                {
                    anisotropicFilt = AnisotropicFiltering.ForceEnable;
                }

                textureQuality  = Load(saveTag + GetName(new { textureQuality }));
                pixelLightCount = Load(saveTag + GetName(new { pixelLightCount }));
                //Shadow
                float shadowProjFloat = Load(saveTag + GetName(new { shadowProjection }));
                if (shadowProjFloat == 0)
                {
                    shadowProjection = ShadowProjection.CloseFit;
                }
                if (shadowProjFloat == 1)
                {
                    shadowProjection = ShadowProjection.StableFit;
                }
                maxShadowDistance = Load(saveTag + GetName(new { shadowDistance = maxShadowDistance }));
                shadowCascade     = Load(saveTag + GetName(new { shadowCascade }));
                //Other
                vSync = Load(saveTag + GetName(new { vSync }));
                particleRaycastBudget = Load(saveTag + GetName(new { particleRaycastBudget }));
                frameRate             = Load(saveTag + GetName(new { frameRate }));

                LoDLevel = Load(saveTag + GetName(new { LoDLevel }));
                LoDBias  = Load(saveTag + GetName(new { LoDBias }));

                //Update
                QualitySettings.antiAliasing         = (int)antiAliasing;
                QualitySettings.anisotropicFiltering = anisotropicFilt;
                QualitySettings.masterTextureLimit   = (int)textureQuality;
                QualitySettings.pixelLightCount      = (int)pixelLightCount;
                //Shadow
                QualitySettings.shadowProjection = shadowProjection;

                QualitySettings.shadowDistance = maxShadowDistance;
                QualitySettings.shadowCascades = (int)shadowCascade;
                //Other
                QualitySettings.vSyncCount            = (int)vSync;
                QualitySettings.particleRaycastBudget = (int)particleRaycastBudget;
                Application.targetFrameRate           = (int)frameRate;

                QualitySettings.maximumLODLevel = (int)LoDLevel;
                QualitySettings.lodBias         = LoDBias;
                //Fog
                BackupFogClassicOptions();
                Configuration.instance.fogClassic = Configuration.defaults.fogClassic;
                SetFogClassicOptions();
            }
        }
 public ShadowSettings(LightShadows shadows, ShadowProjection shadowProjection, int shadowCascades, float shadowDistance)
 {
     this.shadows = shadows;
     this.shadowProjection = shadowProjection;
     this.shadowCascades = shadowCascades;
     this.shadowDistance = shadowDistance;
 }
        /// <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;
        }
Beispiel #24
0
 public ShadowProjectionData(string displayText, ShadowProjection projectionType)
 {
     ButtonDisplayText = displayText;
     ProjectionType    = projectionType;
 }
        private void UpdateResources()
        {
            this.m_X = this.m_Camera.get_pixelWidth() / (int)this.m_DownsampleFactor;
            this.m_Y = this.m_Camera.get_pixelHeight() / (int)this.m_DownsampleFactor;
            if (this.m_Camera.get_actualRenderingPath() != this.m_PreviousRenderPath)
            {
                this.RenderPathChanged();
            }
            RenderTextureFormat renderTextureFormat = !this.m_Camera.get_allowHDR() ? (RenderTextureFormat)0 : (RenderTextureFormat)2;
            bool flag = this.m_ColourSpace != QualitySettings.get_activeColorSpace();

            this.m_ColourSpace = QualitySettings.get_activeColorSpace();
            if (this.WillRenderWithTemporalReprojection)
            {
                if (Object.op_Equality((Object)this.m_RadianceTarget_01, (Object)null))
                {
                    this.CreateRadianceTarget(DS_HazeView.kRadianceTarget01Name, out this.m_RadianceTarget_01);
                    this.m_CurrentRadianceTarget = this.m_RadianceTarget_01;
                }
                else if (flag || ((Texture)this.m_RadianceTarget_01).get_width() != this.m_Camera.get_pixelWidth() || (((Texture)this.m_RadianceTarget_01).get_height() != this.m_Camera.get_pixelHeight() || this.m_RadianceTarget_01.get_format() != renderTextureFormat))
                {
                    Object.DestroyImmediate((Object)this.m_RadianceTarget_01);
                    this.CreateRadianceTarget(DS_HazeView.kRadianceTarget01Name, out this.m_RadianceTarget_01);
                    this.m_CurrentRadianceTarget = this.m_RadianceTarget_01;
                }
                if (Object.op_Equality((Object)this.m_RadianceTarget_02, (Object)null))
                {
                    this.CreateRadianceTarget(DS_HazeView.kRadianceTarget02Name, out this.m_RadianceTarget_02);
                    this.m_PreviousRadianceTarget = this.m_RadianceTarget_02;
                }
                else if (flag || ((Texture)this.m_RadianceTarget_02).get_width() != this.m_Camera.get_pixelWidth() || (((Texture)this.m_RadianceTarget_02).get_height() != this.m_Camera.get_pixelHeight() || this.m_RadianceTarget_02.get_format() != renderTextureFormat))
                {
                    Object.DestroyImmediate((Object)this.m_RadianceTarget_02);
                    this.CreateRadianceTarget(DS_HazeView.kRadianceTarget02Name, out this.m_RadianceTarget_02);
                    this.m_PreviousRadianceTarget = this.m_RadianceTarget_02;
                }
                if (Object.op_Equality((Object)this.m_PreviousDepthTarget, (Object)null))
                {
                    this.CreateDepthTarget(DS_HazeView.kPreviousDepthTargetName, out this.m_PreviousDepthTarget, false);
                }
                else if (((Texture)this.m_PreviousDepthTarget).get_width() != this.m_Camera.get_pixelWidth() || ((Texture)this.m_PreviousDepthTarget).get_height() != this.m_Camera.get_pixelHeight())
                {
                    Object.DestroyImmediate((Object)this.m_PreviousDepthTarget);
                    this.CreateDepthTarget(DS_HazeView.kPreviousDepthTargetName, out this.m_PreviousDepthTarget, false);
                }
            }
            if (this.m_ClearRadianceCmdBuffer == null)
            {
                this.m_ClearRadianceCmdBuffer = new CommandBuffer();
                this.m_ClearRadianceCmdBuffer.set_name(DS_HazeView.kClearRadianceCmdBufferName);
            }
            CameraEvent   cameraEvent = this.m_Camera.get_actualRenderingPath() != 3 ? ((this.m_Camera.get_depthTextureMode() & 2) != 2 ? (CameraEvent)0 : (CameraEvent)2) : (CameraEvent)4;
            CommandBuffer foundCmd;

            if (!this.CameraHasClearRadianceCmdBuffer(out foundCmd))
            {
                this.m_Camera.AddCommandBuffer(cameraEvent, this.m_ClearRadianceCmdBuffer);
            }
            else if (foundCmd != this.m_ClearRadianceCmdBuffer)
            {
                this.m_Camera.RemoveCommandBuffer(cameraEvent, foundCmd);
                foundCmd.Dispose();
                this.m_Camera.AddCommandBuffer(cameraEvent, this.m_ClearRadianceCmdBuffer);
            }
            if (!Object.op_Implicit((Object)this.m_DirectLight))
            {
                return;
            }
            this.m_ShadowCascadesCmdBuffer = this.LightHasCascadesCopyCmdBuffer();
            if (this.m_ShadowCascadesCmdBuffer == null)
            {
                this.m_ShadowCascadesCmdBuffer = new CommandBuffer();
                this.m_ShadowCascadesCmdBuffer.set_name(DS_HazeView.kShadowCascadesCmdBufferName);
                this.m_ShadowCascadesCmdBuffer.SetGlobalTexture("_ShadowCascades", new RenderTargetIdentifier((BuiltinRenderTextureType)1));
                this.m_DirectLight.AddCommandBuffer((LightEvent)1, this.m_ShadowCascadesCmdBuffer);
            }
            this.m_DirectionalLightCmdBuffer = this.LightHasRenderCmdBuffer();
            if (this.m_DirectionalLightCmdBuffer == null)
            {
                this.m_DirectionalLightCmdBuffer = new CommandBuffer();
                this.m_DirectionalLightCmdBuffer.set_name(DS_HazeView.kDirectionalLightCmdBufferName);
                this.m_DirectLight.AddCommandBuffer((LightEvent)3, this.m_DirectionalLightCmdBuffer);
            }
            if (this.m_ShadowProjectionType == QualitySettings.get_shadowProjection())
            {
                return;
            }
            this.m_ShadowProjectionType = QualitySettings.get_shadowProjection();
        }
Beispiel #26
0
    private void LoadAllValues()
    {
        tog_fullScreen.isOn = Screen.fullScreen;
        tog_vSync.isOn      = (QualitySettings.vSyncCount > 0);

        plac_targetFPS.text = Application.targetFrameRate.ToString();

        slid_texQuality.value = slid_texQuality.maxValue - QualitySettings.masterTextureLimit;

        AnisotropicFiltering aniso = QualitySettings.anisotropicFiltering;

        if (aniso.Equals(AnisotropicFiltering.Disable))
        {
            slid_aniso.value = slid_aniso.minValue;
        }
        else if (aniso.Equals(AnisotropicFiltering.Enable))
        {
            slid_aniso.value = 1f;
        }
        else if (aniso.Equals(AnisotropicFiltering.ForceEnable))
        {
            slid_aniso.value = slid_aniso.maxValue;
        }

        int aaValue = QualitySettings.antiAliasing;

        if (aaValue == 0)
        {
            slid_antialias.value = slid_antialias.minValue;
        }
        else if (aaValue == 2)
        {
            slid_antialias.value = 1f;
        }
        else if (aaValue == 4)
        {
            slid_antialias.value = 2f;
        }
        else if (aaValue == 8)
        {
            slid_antialias.value = slid_antialias.maxValue;
        }

        ShadowQuality shadowQual = QualitySettings.shadows;

        if (shadowQual.Equals(ShadowQuality.Disable))
        {
            slid_shadows.value = slid_shadows.minValue;
        }
        else if (shadowQual.Equals(ShadowQuality.HardOnly))
        {
            slid_shadows.value = 1f;
        }
        else if (shadowQual.Equals(ShadowQuality.All))
        {
            slid_shadows.value = slid_shadows.maxValue;
        }

        ShadowResolution shadowRes = QualitySettings.shadowResolution;

        if (shadowRes.Equals(ShadowResolution.Low))
        {
            slid_shadowRes.value = slid_shadowRes.minValue;
        }
        else if (shadowRes.Equals(ShadowResolution.Medium))
        {
            slid_shadowRes.value = 1f;
        }
        else if (shadowRes.Equals(ShadowResolution.High))
        {
            slid_shadowRes.value = 2f;
        }
        else if (shadowRes.Equals(ShadowResolution.VeryHigh))
        {
            slid_shadowRes.value = slid_shadowRes.maxValue;
        }

        ShadowProjection shadowProj = QualitySettings.shadowProjection;

        if (shadowProj.Equals(ShadowProjection.CloseFit))
        {
            slid_shadowProj.value = slid_shadowProj.minValue;
        }
        else if (shadowProj.Equals(ShadowProjection.StableFit))
        {
            slid_shadowProj.value = slid_shadowProj.maxValue;
        }

        int shadowCasc = QualitySettings.shadowCascades;

        if (shadowCasc == 1)
        {
            slid_shadowCasc.value = slid_shadowCasc.minValue;
        }
        else if (shadowCasc == 2)
        {
            slid_shadowCasc.value = 1f;
        }
        else if (shadowCasc == 4)
        {
            slid_shadowCasc.value = slid_shadowCasc.maxValue;
        }

        plac_shadowDist.text  = ((int)QualitySettings.shadowDistance).ToString();
        plac_pixelLights.text = QualitySettings.pixelLightCount.ToString();
    }