protected override bool SetFromProperties() { DayNightProperties properties = DayNightProperties.instance; switch (Name) { case ColorName.MoonInnerCorona: return(SetValue(properties.m_MoonInnerCorona)); case ColorName.MoonOuterCorona: return(SetValue(properties.m_MoonOuterCorona)); case ColorName.SkyTint: return(SetValue(properties.m_SkyTint)); case ColorName.NightHorizonColor: return(SetValue(properties.nightHorizonColor)); case ColorName.EarlyNightZenithColor: return(SetValue(properties.m_NightZenithColor.colorKeys[1].color)); case ColorName.LateNightZenithColor: return(SetValue(properties.m_NightZenithColor.colorKeys[0].color)); default: return(false); } }
public static void Reset() { _fogColorProperties = null; _dayNightProperties = null; var go = GameObject.FindObjectOfType <DaylightClassicProperties>(); if (go != null) { GameObject.Destroy(go); } _ingame = false; _europeanClassic = null; _tropicalClassic = null; _northClassic = null; _sunnyClassic = null; _winterClassic = null; _europeanAd = null; _tropicalAd = null; _northAd = null; _sunnyAd = null; _winterAd = null; _intensityAd = -1.0f; _lonAd = -1.0f; _latAd = -1.0f; _skyTintAd = Color.clear; _waveLengthsAd = Vector3.zero; //TODO(earalov): destroy textures? }
protected override void LoadValue() { DayNightProperties properties = DayNightProperties.instance; Texture oldTexture = properties.m_MoonTexture; Texture.wrapMode = TextureWrapMode.Clamp; properties.m_MoonTexture = Texture; if (oldTexture != null && !ReferenceEquals(oldTexture, Texture)) { Object.Destroy(oldTexture); } }
public static void Initialize() { Reset(); _fogColorProperties = new GameObject("DaylightClassicProperties"); _fogColorProperties.AddComponent <DaylightClassicProperties>(); _dayNightProperties = Object.FindObjectOfType <DayNightProperties>(); var renderProperties = Object.FindObjectOfType <RenderProperties>(); renderProperties.m_sun = _dayNightProperties.sunLightSource.transform; _ingame = true; }
protected override void LoadValue() { DayNightProperties properties = DayNightProperties.instance; switch (Name) { case FloatName.Longitude: properties.m_Longitude = (float)(CustomValue ?? Value); break; case FloatName.Latitude: properties.m_Latitude = (float)(CustomValue ?? Value); break; case FloatName.SunSize: properties.m_SunSize = (float)(CustomValue ?? Value); break; case FloatName.SunAnisotropy: properties.m_SunAnisotropyFactor = (float)(CustomValue ?? Value); break; case FloatName.MoonSize: properties.m_MoonSize = (float)(CustomValue ?? Value); break; case FloatName.Rayleigh: properties.m_RayleighScattering = (float)(CustomValue ?? Value); break; case FloatName.Mie: properties.m_MieScattering = (float)(CustomValue ?? Value); break; case FloatName.Exposure: properties.m_Exposure = (float)(CustomValue ?? Value); break; case FloatName.StarsIntensity: properties.m_StarsIntensity = (float)(CustomValue ?? Value); break; case FloatName.OuterSpaceIntensity: properties.m_OuterSpaceIntensity = (float)(CustomValue ?? Value); break; } }
protected override void LoadValue() { DayNightProperties properties = DayNightProperties.instance; switch (Name) { case ColorName.MoonInnerCorona: properties.m_MoonInnerCorona = (Color)(CustomValue ?? Value); break; case ColorName.MoonOuterCorona: properties.m_MoonOuterCorona = (Color)(CustomValue ?? Value); break; case ColorName.SkyTint: properties.m_SkyTint = (Color)(CustomValue ?? Value); break; case ColorName.NightHorizonColor: properties.m_NightHorizonColor = (Color)(CustomValue ?? Value); break; case ColorName.EarlyNightZenithColor: { GradientColorKey[] c = properties.m_NightZenithColor.colorKeys; GradientAlphaKey[] a = properties.m_NightZenithColor.alphaKeys; c[0].color = c[3].color = properties.m_NightZenithColor.colorKeys[0].color; c[1].color = c[2].color = (Color)(CustomValue ?? Value); properties.m_NightZenithColor.SetKeys(c, a); } break; case ColorName.LateNightZenithColor: { GradientColorKey[] c = properties.m_NightZenithColor.colorKeys; GradientAlphaKey[] a = properties.m_NightZenithColor.alphaKeys; c[0].color = c[3].color = (Color)(CustomValue ?? Value); c[1].color = c[2].color = properties.m_NightZenithColor.colorKeys[1].color; properties.m_NightZenithColor.SetKeys(c, a); } break; } }
protected override bool SetFromProperties() { DayNightProperties properties = DayNightProperties.instance; switch (Name) { case FloatName.Longitude: return(SetValue(properties.m_Longitude)); case FloatName.Latitude: return(SetValue(properties.m_Latitude)); case FloatName.SunSize: return(SetValue(properties.m_SunSize)); case FloatName.SunAnisotropy: return(SetValue(properties.m_SunAnisotropyFactor)); case FloatName.MoonSize: return(SetValue(properties.m_MoonSize)); case FloatName.Rayleigh: return(SetValue(properties.m_RayleighScattering)); case FloatName.Mie: return(SetValue(properties.m_MieScattering)); case FloatName.Exposure: return(SetValue(properties.m_Exposure)); case FloatName.StarsIntensity: return(SetValue(properties.m_StarsIntensity)); case FloatName.OuterSpaceIntensity: return(SetValue(properties.m_OuterSpaceIntensity)); default: return(false); } }
protected override bool SetFromProperties() { DayNightProperties properties = DayNightProperties.instance; return(SetTexture(properties.m_MoonTexture)); }
/* * 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(); } }