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

◆ ProcessHighDetail()

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

Definition at line 140 of file EyeballShader.cs.

141 {
142 Vector2 vector = new Vector2(1.5f, 0.5f);
143 Vector2 vector2 = vector + _pupilOffset;
144 for (int i = 0; i < fragment.Count; i++)
145 {
146 Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
147 Vector2 vector3 = canvasPositionOfIndex - vector;
148 Vector4 vector4 = Vector4.One;
149 float num = (vector2 - canvasPositionOfIndex).Length();
150 for (int j = 1; j < Rings.Length; j++)
151 {
152 Ring ring = Rings[j];
153 Ring ring2 = Rings[j - 1];
154 if (num < ring.Distance)
155 {
156 vector4 = Vector4.Lerp(ring2.Color, ring.Color, (num - ring2.Distance) / (ring.Distance - ring2.Distance));
157 break;
158 }
159 }
160 float num2 = (float)Math.Sqrt(1f - 0.4f * vector3.Y * vector3.Y) * 5f;
161 float num3 = Math.Abs(vector3.X) - num2 * (1.1f * _eyelidProgress - 0.1f);
162 if (num3 > 0f)
163 {
164 vector4 = Vector4.Lerp(vector4, _eyelidColor, Math.Min(1f, num3 * 10f));
165 }
166 fragment.SetColor(i, vector4);
167 }
168 }
void SetColor(int index, Vector4 color)
Definition Fragment.cs:97
Vector2 GetCanvasPositionOfIndex(int index)
Definition Fragment.cs:75
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Sqrt(double d)
static double Abs(double value)
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277

References Terraria.GameContent.RGB.EyeballShader._eyelidColor, Terraria.GameContent.RGB.EyeballShader._eyelidProgress, Terraria.GameContent.RGB.EyeballShader._pupilOffset, System.Math.Abs(), Terraria.GameContent.RGB.EyeballShader.Ring.Color, ReLogic.Peripherals.RGB.Fragment.Count, Terraria.GameContent.RGB.EyeballShader.Ring.Distance, ReLogic.Peripherals.RGB.Fragment.GetCanvasPositionOfIndex(), Microsoft.Xna.Framework.Vector4.Lerp(), System.Math.Min(), Microsoft.Xna.Framework.Vector4.One, Terraria.GameContent.RGB.EyeballShader.Rings, ReLogic.Peripherals.RGB.Fragment.SetColor(), System.Math.Sqrt(), Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.