Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UnderworldShader.cs
Go to the documentation of this file.
1using System;
4
6
8{
9 private readonly Vector4 _backColor;
10
11 private readonly Vector4 _frontColor;
12
13 private readonly float _speed;
14
15 public UnderworldShader(Color backColor, Color frontColor, float speed)
16 {
17 _backColor = backColor.ToVector4();
18 _frontColor = frontColor.ToVector4();
19 _speed = speed;
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 Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
28 Vector4 vector = Vector4.Lerp(_backColor, _frontColor, (float)Math.Sin(time * _speed + canvasPositionOfIndex.X) * 0.5f + 0.5f);
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 for (int i = 0; i < fragment.Count; i++)
37 {
38 float dynamicNoise = NoiseHelper.GetDynamicNoise(fragment.GetCanvasPositionOfIndex(i) * 0.5f, time * _speed / 3f);
39 Vector4 vector = Vector4.Lerp(_backColor, _frontColor, dynamicNoise);
40 fragment.SetColor(i, vector);
41 }
42 }
43}
void SetColor(int index, Vector4 color)
Definition Fragment.cs:97
Vector2 GetCanvasPositionOfIndex(int index)
Definition Fragment.cs:75
static double Sin(double a)
static float GetDynamicNoise(int index, float currentTime)
UnderworldShader(Color backColor, Color frontColor, float speed)
void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
void ProcessLowDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277