// Use this for initialization void Start () { //QualitySettings.vSyncCount = 0; time = new SilverLiningTime (); sky = new SilverLiningSky (); location = new SilverLiningLocation (); lastFogColor = new Color (0, 0, 0, 0); lastFogDensity = -1; todSliderValue = (float)hour + (float)minutes / (60.0f); sky.moonWidthDegrees = moonInitialWidthDegrees; sky.sunWidthDegrees = sunInitialWidthDegrees; sky.Start (); CreateClouds (); //Camera.main.clearFlags = CameraClearFlags.Depth; float farClip = (float)Math.Max (100000.0 * unitScale, Camera.main.farClipPlane); Camera.main.farClipPlane = farClip; cumulusCloudTransform = GameObject.Find ("CumulusClouds"); cirrusCloudTransform = GameObject.Find ("CirrusClouds"); stratusCloudTransform = GameObject.Find ("StratusClouds"); }
// Use this for initialization void Start() { //QualitySettings.vSyncCount = 0; time = new SilverLiningTime(); sky = new SilverLiningSky(); location = new SilverLiningLocation(); lastFogColor = new Color(0, 0, 0, 0); lastFogDensity = -1; todSliderValue = (float)hour + (float)minutes / (60.0f); sky.moonWidthDegrees = moonInitialWidthDegrees; sky.sunWidthDegrees = sunInitialWidthDegrees; sky.Start(); CreateClouds(); //Camera.main.clearFlags = CameraClearFlags.Depth; float farClip = (float)Math.Max(100000.0 * unitScale, Camera.main.farClipPlane); Camera.main.farClipPlane = farClip; cumulusCloudTransform = GameObject.Find("CumulusClouds"); cirrusCloudTransform = GameObject.Find("CirrusClouds"); stratusCloudTransform = GameObject.Find("StratusClouds"); }
public void Update(SilverLiningSky sky, float pDensity, Vector3 center, bool doFog) { topRenderer.material.SetFloat("_Density", pDensity); bottomRenderer.material.SetFloat("_Density", pDensity); topRenderer.material.SetFloat("_CloudSize", cloudSize); bottomRenderer.material.SetFloat("_CloudSize", cloudSize); if (doFog) { if (fogShader) { topRenderer.material.shader = fogShader; bottomRenderer.material.shader = fogShader; } } else { if (noFogShader) { topRenderer.material.shader = noFogShader; bottomRenderer.material.shader = noFogShader; } } float segmentSize = cloudSize / 20.0f; Vector3 camPos = Camera.main.transform.position; Vector3 offset = new Vector3(); offset.x = (float)(-(camPos.x % segmentSize) + (center.x % segmentSize)); offset.y = center.y - camPos.y; offset.z = (float)(-(camPos.z % segmentSize) + (center.z % segmentSize)); cloudTop.transform.position = camPos + offset + new Vector3(0, cloudThickness, 0); cloudBottom.transform.position = camPos + offset; ApplyFog(center); }
public void Update(SilverLiningSky sky, float pDensity, Vector3 center, bool doFog) { topRenderer.material.SetFloat("_Density", pDensity); bottomRenderer.material.SetFloat("_Density", pDensity); topRenderer.material.SetFloat("_CloudSize", cloudSize); bottomRenderer.material.SetFloat("_CloudSize", cloudSize); if (doFog) { if (fogShader) { topRenderer.material.shader = fogShader; bottomRenderer.material.shader = fogShader; } } else { if (noFogShader) { topRenderer.material.shader = noFogShader; bottomRenderer.material.shader = noFogShader; } } float segmentSize = cloudSize / 20.0f; Vector3 camPos; if (Camera.main == null) { camPos = new Vector3(); } else { camPos = Camera.main.transform.position; } Vector3 offset = new Vector3(); offset.x = (float)(-(camPos.x % segmentSize) + (center.x % segmentSize)); offset.y = center.y - camPos.y; offset.z = (float)(-(camPos.z % segmentSize) + (center.z % segmentSize)); cloudTop.transform.position = camPos + offset + new Vector3(0, cloudThickness, 0); cloudBottom.transform.position = camPos + offset; ApplyFog(center); }