Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
JungleShader.cs
Go to the documentation of this file.
1using System;
4
6
8{
9 private readonly Vector4 _backgroundColor = new Color(40, 80, 0).ToVector4();
10
11 private readonly Vector4 _sporeColor = new Color(255, 255, 0).ToVector4();
12
13 private readonly Vector4[] _flowerColors = new Vector4[5]
14 {
15 Color.Yellow.ToVector4(),
16 Color.Pink.ToVector4(),
17 Color.Purple.ToVector4(),
18 Color.Red.ToVector4(),
19 Color.Blue.ToVector4()
20 };
21
22 [RgbProcessor(/*Could not decode attribute arguments.*/)]
23 private void ProcessLowDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
24 {
25 for (int i = 0; i < fragment.Count; i++)
26 {
27 float dynamicNoise = NoiseHelper.GetDynamicNoise(fragment.GetCanvasPositionOfIndex(i) * 0.3f, time / 5f);
28 Vector4 vector = Vector4.Lerp(_backgroundColor, _sporeColor, dynamicNoise);
29 fragment.SetColor(i, vector);
30 }
31 }
32
33 [RgbProcessor(/*Could not decode attribute arguments.*/)]
34 private void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
35 {
36 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
37 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
38 //IL_000f: Invalid comparison between Unknown and I4
39 bool flag = (int)device.Type == 0 || (int)device.Type == 6;
40 for (int i = 0; i < fragment.Count; i++)
41 {
42 Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
43 Point gridPositionOfIndex = fragment.GetGridPositionOfIndex(i);
44 float dynamicNoise = NoiseHelper.GetDynamicNoise(canvasPositionOfIndex * 0.3f, time / 5f);
45 dynamicNoise = Math.Max(0f, 1f - dynamicNoise * 2.5f);
46 Vector4 vector = Vector4.Lerp(_backgroundColor, _sporeColor, dynamicNoise);
47 if (flag)
48 {
49 float dynamicNoise2 = NoiseHelper.GetDynamicNoise(gridPositionOfIndex.X, gridPositionOfIndex.Y, time / 100f);
50 dynamicNoise2 = Math.Max(0f, 1f - dynamicNoise2 * 20f);
51 vector = Vector4.Lerp(vector, _flowerColors[((gridPositionOfIndex.Y * 47 + gridPositionOfIndex.X) % 5 + 5) % 5], dynamicNoise2);
52 }
53 fragment.SetColor(i, vector);
54 }
55 }
56}
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
readonly RgbDeviceType Type
Definition RgbDevice.cs:8
static byte Max(byte val1, byte val2)
Definition Math.cs:738
void ProcessLowDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
static float GetDynamicNoise(int index, float currentTime)
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277