void UpdateLightingData() { if (Scmap.map == null) { return; } Scmap.Sun.transform.rotation = Quaternion.Euler(new Vector3(DA.value, -360 + RA.value, 0)); Vector3 SunDir = Scmap.Sun.transform.rotation * Vector3.back; SunDir.z *= -1; Scmap.map.SunDirection = SunDir; Scmap.map.LightingMultiplier = LightMultipiler.value; Scmap.map.SunColor = LightColor.GetVectorValue(); Scmap.map.SunAmbience = AmbienceColor.GetVectorValue(); Scmap.map.ShadowFillColor = ShadowColor.GetVectorValue(); Scmap.map.SpecularColor = Specular.GetVector4Value(); Scmap.map.FogColor = FogColor.GetVectorValue(); Scmap.map.FogStart = FogStart.value; Scmap.map.FogEnd = FogEnd.value; Scmap.UpdateLighting(); Scmap.Skybox.LoadSkybox(); }
void UpdateLightingData() { if (Scmap.map == null) { return; } Scmap.Sun.transform.rotation = Quaternion.Euler(new Vector3(DA.value, -360 + RA.value, 0)); Vector3 SunDir = Scmap.Sun.transform.rotation * Vector3.back; SunDir.z *= -1; Scmap.map.SunDirection = SunDir; Scmap.map.LightingMultiplier = LightMultipiler.value; Scmap.map.SunColor = LightColor.GetVectorValue(); Scmap.map.SunAmbience = AmbienceColor.GetVectorValue(); Scmap.map.ShadowFillColor = ShadowColor.GetVectorValue(); Scmap.map.SpecularColor = Specular.GetVector4Value(); Scmap.map.FogColor = FogColor.GetVectorValue(); Scmap.map.FogStart = FogStart.value; Scmap.map.FogEnd = FogEnd.value; Scmap.UpdateLighting(); Scmap.Skybox.LoadSkybox(); /* * // Set light * Scmap.Sun.transform.rotation = Quaternion.Euler(new Vector3(DA.value, -360 + RA.value, 0)); * * Scmap.map.SunDirection = Scmap.Sun.transform.rotation * Vector3.back; * * Vector3 SunDIr = new Vector3(-Scmap.map.SunDirection.x, -Scmap.map.SunDirection.y, -Scmap.map.SunDirection.z); * Scmap.Sun.transform.rotation = Quaternion.LookRotation(SunDIr); * Scmap.Sun.color = new Color(Scmap.map.SunColor.x, Scmap.map.SunColor.y, Scmap.map.SunColor.z, 1); * Scmap.Sun.intensity = Scmap.map.LightingMultiplier * SunMultipiler; * * Shader.SetGlobalFloat("_LightingMultiplier", Scmap.map.LightingMultiplier); * Shader.SetGlobalColor("_SunColor", new Color(Scmap.map.SunColor.x * 0.5f, Scmap.map.SunColor.y * 0.5f, Scmap.map.SunColor.z * 0.5f, 1)); * Shader.SetGlobalColor("_SunAmbience", new Color(Scmap.map.SunAmbience.x * 0.5f, Scmap.map.SunAmbience.y * 0.5f, Scmap.map.SunAmbience.z * 0.5f, 1)); * Shader.SetGlobalColor("_ShadowColor", new Color(Scmap.map.ShadowFillColor.x * 0.5f, Scmap.map.ShadowFillColor.y * 0.5f, Scmap.map.ShadowFillColor.z * 0.5f, 1)); */ }
public void WaterSettingsChanged(bool Slider) { if (Loading) { return; } bool AnyChanged = ScmapEditor.Current.map.Water.ColorLerp.x != ColorLerpXElevation.value || ScmapEditor.Current.map.Water.ColorLerp.y != ColorLerpYElevation.value || ScmapEditor.Current.map.Water.SurfaceColor != WaterColor.GetVectorValue() || ScmapEditor.Current.map.Water.SunColor != SunColor.GetVectorValue() || ScmapEditor.Current.map.Water.SunStrength != SunStrength.value || ScmapEditor.Current.map.Water.SunShininess != SunShininess.value || ScmapEditor.Current.map.Water.SunReflection != SunReflection.value || ScmapEditor.Current.map.Water.FresnelPower != FresnelPower.value || ScmapEditor.Current.map.Water.FresnelBias != FresnelBias.value || ScmapEditor.Current.map.Water.UnitReflection != UnitReflection.value || ScmapEditor.Current.map.Water.SkyReflection != SkyReflection.value || ScmapEditor.Current.map.Water.RefractionScale != RefractionScale.value ; if (!AnyChanged) { return; } if (!UndoRegistered) { Undo.Current.RegisterWaterSettingsChange(); UndoRegistered = true; WaterSettingsChangedBegin(); } if (!Slider) { UndoRegistered = false; } ScmapEditor.Current.map.Water.ColorLerp.x = ColorLerpXElevation.value; ScmapEditor.Current.map.Water.ColorLerp.y = ColorLerpYElevation.value; ScmapEditor.Current.map.Water.SurfaceColor = WaterColor.GetVectorValue(); ScmapEditor.Current.map.Water.SunColor = SunColor.GetVectorValue(); ScmapEditor.Current.map.Water.SunStrength = SunStrength.value; ScmapEditor.Current.map.Water.SunShininess = SunShininess.value; ScmapEditor.Current.map.Water.SunReflection = SunReflection.value; ScmapEditor.Current.map.Water.FresnelPower = FresnelPower.value; ScmapEditor.Current.map.Water.FresnelBias = FresnelBias.value; ScmapEditor.Current.map.Water.UnitReflection = UnitReflection.value; ScmapEditor.Current.map.Water.SkyReflection = SkyReflection.value; ScmapEditor.Current.map.Water.RefractionScale = RefractionScale.value; UpdateScmap(false); }