Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
CameraFilterPack_Atmosphere_Rain.cs
Go to the documentation of this file.
1using UnityEngine;
2
3[ExecuteInEditMode]
4[AddComponentMenu("Camera Filter Pack/Weather/Rain")]
5public class CameraFilterPack_Atmosphere_Rain : MonoBehaviour
6{
7 public Shader SCShader;
8
9 private float TimeX = 1f;
10
12
13 [Range(0f, 1f)]
14 public float Fade = 1f;
15
16 [Range(0f, 2f)]
17 public float Intensity = 0.5f;
18
19 [Range(-0.25f, 0.25f)]
20 public float DirectionX = 0.12f;
21
22 [Range(0.4f, 2f)]
23 public float Size = 1.5f;
24
25 [Range(0f, 0.5f)]
26 public float Speed = 0.275f;
27
28 [Range(0f, 0.5f)]
29 public float Distortion = 0.05f;
30
31 [Range(0f, 1f)]
32 public float StormFlashOnOff = 1f;
33
34 private Texture2D Texture2;
35
37 {
38 get
39 {
40 if (SCMaterial == null)
41 {
43 SCMaterial.hideFlags = HideFlags.HideAndDontSave;
44 }
45 return SCMaterial;
46 }
47 }
48
49 private void Start()
50 {
51 Texture2 = Resources.Load("CameraFilterPack_Atmosphere_Rain_FX") as Texture2D;
52 SCShader = Shader.Find("CameraFilterPack/Atmosphere_Rain");
53 if (!SystemInfo.supportsImageEffects)
54 {
55 base.enabled = false;
56 }
57 }
58
59 private void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
60 {
61 if (SCShader != null)
62 {
63 TimeX += Time.deltaTime;
64 if (TimeX > 100f)
65 {
66 TimeX = 0f;
67 }
68 material.SetFloat("_TimeX", TimeX);
69 material.SetFloat("_Value", Fade);
70 material.SetFloat("_Value2", Intensity);
71 material.SetFloat("_Value3", DirectionX);
72 material.SetFloat("_Value4", Speed);
73 material.SetFloat("_Value5", Size);
74 material.SetFloat("_Value6", Distortion);
75 material.SetFloat("_Value7", StormFlashOnOff);
76 material.SetVector("_ScreenResolution", new Vector4(sourceTexture.width, sourceTexture.height, 0f, 0f));
77 material.SetTexture("Texture2", Texture2);
78 Graphics.Blit(sourceTexture, destTexture, material);
79 }
80 else
81 {
82 Graphics.Blit(sourceTexture, destTexture);
83 }
84 }
85
86 private void Update()
87 {
88 }
89
90 private void OnDisable()
91 {
92 if ((bool)SCMaterial)
93 {
94 Object.DestroyImmediate(SCMaterial);
95 }
96 }
97}
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)