Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RainShader.cs
Go to the documentation of this file.
1using System;
4
6
7public class RainShader : ChromaShader
8{
9 private bool _inBloodMoon;
10
11 public override void Update(float elapsedTime)
12 {
14 }
15
16 [RgbProcessor(/*Could not decode attribute arguments.*/)]
17 private void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
18 {
19 Vector4 value = ((!_inBloodMoon) ? new Vector4(0f, 0f, 1f, 1f) : new Vector4(1f, 0f, 0f, 1f));
20 Vector4 vector = new Vector4(0f, 0f, 0f, 0.75f);
21 for (int i = 0; i < fragment.Count; i++)
22 {
23 Point gridPositionOfIndex = fragment.GetGridPositionOfIndex(i);
24 Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
25 float num = (NoiseHelper.GetStaticNoise(gridPositionOfIndex.X) * 10f + time) % 10f - canvasPositionOfIndex.Y;
26 Vector4 vector2 = vector;
27 if (num > 0f)
28 {
29 float amount = Math.Max(0f, 1.2f - num);
30 if (num < 0.2f)
31 {
32 amount = num * 5f;
33 }
34 vector2 = Vector4.Lerp(vector2, value, amount);
35 }
36 fragment.SetColor(i, vector2);
37 }
38 }
39}
Point GetGridPositionOfIndex(int index)
Definition Fragment.cs:81
void SetColor(int index, Vector4 color)
Definition Fragment.cs:97
Vector2 GetCanvasPositionOfIndex(int index)
Definition Fragment.cs:75
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static float GetStaticNoise(int index)
void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
Definition RainShader.cs:17
override void Update(float elapsedTime)
Definition RainShader.cs:11
static bool bloodMoon
Definition Main.cs:1296
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277