Exemplo n.º 1
0
 public static void SetGlobalFogHeight()
 {
     UnityStandardAssets.ImageEffects.GlobalFog gf = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>();
     if (gf != null)
     {
         gf.height = VFDataRTGen.waterHeight;
     }
 }
Exemplo n.º 2
0
 public static void SetGlobalFogHeight(float height)
 {
     UnityStandardAssets.ImageEffects.GlobalFog gf = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>();
     if (gf != null)
     {
         gf.height = height;
     }
 }
Exemplo n.º 3
0
 protected override void InitValue()
 {
     slider.value = Convert.ToInt32(GameSettings.Instance.rendering.fog);
     valueLabel.text = GameSettings.Instance.rendering.fog.ToString();
     RenderSettings.fog = GameSettings.Instance.rendering.fog;
     fogComponent = cam.GetComponent<GlobalFog>();
     fogComponent.enabled = GameSettings.Instance.rendering.fog;
 }
Exemplo n.º 4
0
 void Awake()
 {
     if (instance == null)
     {
         instance  = this;
         density   = heightDensity;
         fogHeight = height;
         this.StartCoroutine(AffectFog());
         this.StartCoroutine(AffectFogHeight());
     }
 }
Exemplo n.º 5
0
 private void Start()
 {
     skybox = Toolbox.Instance.GetPlayer().GetComponent <SkyboxTransition>();
     normalFogMultiplier = skybox.fogMultiplier;
     normalAmbMultipliet = skybox.ambientMultiplier;
     fog           = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>();
     normalDensity = RenderSettings.fogDensity;
     player        = Toolbox.Instance.GetPlayer().transform;
     active        = false;
     skybox.AdMembrane(this);
 }
Exemplo n.º 6
0
 private void OnRenderImage(RenderTexture source, RenderTexture destination)
 {
     if (!this.CheckResources() || (!this.distanceFog && !this.heightFog))
     {
         Graphics.Blit(source, destination);
     }
     else
     {
         Camera    component     = base.GetComponent <Camera>();
         Transform transform     = component.transform;
         float     nearClipPlane = component.nearClipPlane;
         float     farClipPlane  = component.farClipPlane;
         float     fieldOfView   = component.fieldOfView;
         float     aspect        = component.aspect;
         Matrix4x4 identity      = Matrix4x4.identity;
         float     num           = fieldOfView * 0.5f;
         Vector3   b             = transform.right * nearClipPlane * Mathf.Tan(num * 0.0174532924f) * aspect;
         Vector3   b2            = transform.up * nearClipPlane * Mathf.Tan(num * 0.0174532924f);
         Vector3   vector        = transform.forward * nearClipPlane - b + b2;
         float     d             = vector.magnitude * farClipPlane / nearClipPlane;
         vector.Normalize();
         vector *= d;
         Vector3 vector2 = transform.forward * nearClipPlane + b + b2;
         vector2.Normalize();
         vector2 *= d;
         Vector3 vector3 = transform.forward * nearClipPlane + b - b2;
         vector3.Normalize();
         vector3 *= d;
         Vector3 vector4 = transform.forward * nearClipPlane - b - b2;
         vector4.Normalize();
         vector4 *= d;
         identity.SetRow(0, vector);
         identity.SetRow(1, vector2);
         identity.SetRow(2, vector3);
         identity.SetRow(3, vector4);
         Vector3 position = transform.position;
         float   num2     = position.y - this.height;
         float   z        = (num2 > 0f) ? 0f : 1f;
         float   y        = (!this.excludeFarPixels) ? 2f : 1f;
         this.fogMaterial.SetMatrix("_FrustumCornersWS", identity);
         this.fogMaterial.SetVector("_CameraWS", position);
         this.fogMaterial.SetVector("_HeightParams", new Vector4(this.height, num2, z, this.heightDensity * 0.5f));
         this.fogMaterial.SetVector("_DistanceParams", new Vector4(-Mathf.Max(this.startDistance, 0f), y, 0f, 0f));
         FogMode fogMode          = RenderSettings.fogMode;
         float   fogDensity       = RenderSettings.fogDensity;
         float   fogStartDistance = RenderSettings.fogStartDistance;
         float   fogEndDistance   = RenderSettings.fogEndDistance;
         bool    flag             = fogMode == FogMode.Linear;
         float   num3             = (!flag) ? 0f : (fogEndDistance - fogStartDistance);
         float   num4             = (Mathf.Abs(num3) <= 0.0001f) ? 0f : (1f / num3);
         Vector4 value;
         value.x = fogDensity * 1.2011224f;
         value.y = fogDensity * 1.442695f;
         value.z = ((!flag) ? 0f : (-num4));
         value.w = ((!flag) ? 0f : (fogEndDistance * num4));
         this.fogMaterial.SetVector("_SceneFogParams", value);
         this.fogMaterial.SetVector("_SceneFogMode", new Vector4((float)fogMode, (float)((!this.useRadialDistance) ? 0 : 1), 0f, 0f));
         int passNr;
         if (this.distanceFog && this.heightFog)
         {
             passNr = 0;
         }
         else if (this.distanceFog)
         {
             passNr = 1;
         }
         else
         {
             passNr = 2;
         }
         GlobalFog.CustomGraphicsBlit(source, destination, this.fogMaterial, passNr);
     }
 }
Exemplo n.º 7
0
 private void Start()
 {
     skybox = Toolbox.Instance.GetPlayer().GetComponent <SkyboxTransition>();
     fog    = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>();
 }