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)); */ }