Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ProcessHighDetail()

void Terraria.GameContent.RGB.CultistShader.ProcessHighDetail ( RgbDevice device,
Fragment fragment,
EffectDetailLevel quality,
float time )
inlineprivate

Definition at line 24 of file CultistShader.cs.

25 {
26 time *= 2f;
27 for (int i = 0; i < fragment.Count; i++)
28 {
29 Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
30 Vector4 backgroundColor = _backgroundColor;
31 float num = time * 0.5f + canvasPositionOfIndex.X + canvasPositionOfIndex.Y;
32 float value = (float)Math.Cos(num) * 2f + 2f;
33 value = MathHelper.Clamp(value, 0f, 1f);
34 num = (num + (float)Math.PI) % ((float)Math.PI * 6f);
35 Vector4 value2;
36 if (num < (float)Math.PI * 2f)
37 {
38 float staticNoise = NoiseHelper.GetStaticNoise(canvasPositionOfIndex * 0.3f + new Vector2(12.5f, time * 0.2f));
39 staticNoise = Math.Max(0f, 1f - staticNoise * staticNoise * 4f * staticNoise);
40 staticNoise = MathHelper.Clamp(staticNoise, 0f, 1f);
41 value2 = Vector4.Lerp(_fireDarkColor, _fireBrightColor, staticNoise);
42 }
43 else if (num < (float)Math.PI * 4f)
44 {
45 float dynamicNoise = NoiseHelper.GetDynamicNoise(new Vector2((canvasPositionOfIndex.X + canvasPositionOfIndex.Y) * 0.2f, 0f), time / 5f);
46 dynamicNoise = Math.Max(0f, 1f - dynamicNoise * 1.5f);
47 value2 = Vector4.Lerp(_iceDarkColor, _iceBrightColor, dynamicNoise);
48 }
49 else
50 {
51 float dynamicNoise2 = NoiseHelper.GetDynamicNoise(canvasPositionOfIndex * 0.15f, time * 0.05f);
52 dynamicNoise2 = (float)Math.Sin(dynamicNoise2 * 15f) * 0.5f + 0.5f;
53 dynamicNoise2 = Math.Max(0f, 1f - 5f * dynamicNoise2);
54 value2 = Vector4.Lerp(_lightningDarkColor, _lightningBrightColor, dynamicNoise2);
55 }
56 backgroundColor = Vector4.Lerp(backgroundColor, value2, value);
57 fragment.SetColor(i, backgroundColor);
58 }
59 }
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
void SetColor(int index, Vector4 color)
Definition Fragment.cs:97
Vector2 GetCanvasPositionOfIndex(int index)
Definition Fragment.cs:75
static double Cos(double d)
static double Sin(double a)
const double PI
Definition Math.cs:16
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277

References Terraria.GameContent.RGB.CultistShader._backgroundColor, Terraria.GameContent.RGB.CultistShader._fireBrightColor, Terraria.GameContent.RGB.CultistShader._fireDarkColor, Terraria.GameContent.RGB.CultistShader._iceBrightColor, Terraria.GameContent.RGB.CultistShader._iceDarkColor, Terraria.GameContent.RGB.CultistShader._lightningBrightColor, Terraria.GameContent.RGB.CultistShader._lightningDarkColor, Microsoft.Xna.Framework.MathHelper.Clamp(), System.Math.Cos(), ReLogic.Peripherals.RGB.Fragment.Count, ReLogic.Peripherals.RGB.Fragment.GetCanvasPositionOfIndex(), Terraria.GameContent.RGB.NoiseHelper.GetDynamicNoise(), Terraria.GameContent.RGB.NoiseHelper.GetStaticNoise(), Microsoft.Xna.Framework.Vector4.Lerp(), System.Math.Max(), System.Math.PI, ReLogic.Peripherals.RGB.Fragment.SetColor(), System.Math.Sin(), System.value, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.