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

◆ ProcessHighDetail()

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

Definition at line 62 of file MoonShader.cs.

63 {
64 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
65 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
66 //IL_000f: Invalid comparison between Unknown and I4
67 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
68 if ((int)device.Type != 0 && (int)device.Type != 6)
69 {
70 ProcessLowDetail(device, fragment, quality, time);
71 return;
72 }
73 Vector2 vector = new Vector2(2f, 0.5f);
74 Vector2 vector2 = new Vector2(2.5f, 1f);
75 float num = _progress * (float)Math.PI + (float)Math.PI;
76 Vector2 vector3 = new Vector2((float)Math.Cos(num), (float)Math.Sin(num)) * vector2 + vector;
77 for (int i = 0; i < fragment.Count; i++)
78 {
79 Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
80 float dynamicNoise = NoiseHelper.GetDynamicNoise(canvasPositionOfIndex * new Vector2(0.1f, 0.5f) + new Vector2(time * 0.02f, 0f), time / 40f);
81 dynamicNoise = (float)Math.Sqrt(Math.Max(0f, 1f - 2f * dynamicNoise));
82 float num2 = (canvasPositionOfIndex - vector3).Length();
83 Vector4 vector4 = Vector4.Lerp(_skyColor, _cloudColor, dynamicNoise * 0.15f);
84 if (num2 < 0.8f)
85 {
86 vector4 = Vector4.Lerp(_moonRingColor, _moonCoreColor, Math.Min(0.1f, 0.8f - num2) / 0.1f);
87 }
88 else if (num2 < 1f)
89 {
90 vector4 = Vector4.Lerp(vector4, _moonRingColor, Math.Min(0.2f, 1f - num2) / 0.2f);
91 }
92 fragment.SetColor(i, vector4);
93 }
94 }
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 double Cos(double d)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Sqrt(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
void ProcessLowDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
Definition MoonShader.cs:50
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277

References Terraria.GameContent.RGB.MoonShader._cloudColor, Terraria.GameContent.RGB.MoonShader._moonCoreColor, Terraria.GameContent.RGB.MoonShader._moonRingColor, Terraria.GameContent.RGB.MoonShader._progress, Terraria.GameContent.RGB.MoonShader._skyColor, System.Math.Cos(), ReLogic.Peripherals.RGB.Fragment.Count, ReLogic.Peripherals.RGB.Fragment.GetCanvasPositionOfIndex(), Terraria.GameContent.RGB.NoiseHelper.GetDynamicNoise(), Microsoft.Xna.Framework.Vector4.Lerp(), System.Math.Max(), System.Math.Min(), System.Math.PI, Terraria.GameContent.RGB.MoonShader.ProcessLowDetail(), ReLogic.Peripherals.RGB.Fragment.SetColor(), System.Math.Sin(), System.Math.Sqrt(), and ReLogic.Peripherals.RGB.RgbDevice.Type.