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

◆ Apply() [2/2]

virtual void Terraria.Graphics.Shaders.ArmorShaderData.Apply ( Entity entity,
DrawData? drawData = null )
inlinevirtual

Reimplemented in Terraria.GameContent.Dyes.ReflectiveArmorShaderData, Terraria.GameContent.Dyes.TeamArmorShaderData, and Terraria.GameContent.Dyes.TwilightDyeShaderData.

Definition at line 34 of file ArmorShaderData.cs.

35 {
36 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
37 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
38 //IL_00b5: Unknown result type (might be due to invalid IL or missing references)
39 //IL_02d3: Unknown result type (might be due to invalid IL or missing references)
40 //IL_02ee: Unknown result type (might be due to invalid IL or missing references)
41 //IL_0152: Unknown result type (might be due to invalid IL or missing references)
42 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
43 //IL_00fa: Unknown result type (might be due to invalid IL or missing references)
44 //IL_010c: Unknown result type (might be due to invalid IL or missing references)
45 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
46 //IL_0129: Unknown result type (might be due to invalid IL or missing references)
47 //IL_0368: Unknown result type (might be due to invalid IL or missing references)
48 //IL_0157: Unknown result type (might be due to invalid IL or missing references)
49 //IL_016d: Unknown result type (might be due to invalid IL or missing references)
50 //IL_0188: Unknown result type (might be due to invalid IL or missing references)
51 //IL_01a3: Unknown result type (might be due to invalid IL or missing references)
52 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
53 //IL_01ae: Unknown result type (might be due to invalid IL or missing references)
54 //IL_01e5: Unknown result type (might be due to invalid IL or missing references)
55 //IL_021c: Unknown result type (might be due to invalid IL or missing references)
56 //IL_0242: Unknown result type (might be due to invalid IL or missing references)
57 //IL_03a1: Unknown result type (might be due to invalid IL or missing references)
58 //IL_03a6: Unknown result type (might be due to invalid IL or missing references)
59 //IL_03bd: Unknown result type (might be due to invalid IL or missing references)
60 //IL_03c5: Unknown result type (might be due to invalid IL or missing references)
61 //IL_03cd: Unknown result type (might be due to invalid IL or missing references)
62 //IL_03d5: Unknown result type (might be due to invalid IL or missing references)
63 //IL_03dd: Unknown result type (might be due to invalid IL or missing references)
64 //IL_0406: Unknown result type (might be due to invalid IL or missing references)
65 //IL_0281: Unknown result type (might be due to invalid IL or missing references)
66 base.Shader.Parameters["uColor"].SetValue(_uColor);
67 base.Shader.Parameters["uSaturation"].SetValue(_uSaturation);
68 base.Shader.Parameters["uSecondaryColor"].SetValue(_uSecondaryColor);
69 base.Shader.Parameters["uTime"].SetValue(Main.GlobalTimeWrappedHourly);
70 base.Shader.Parameters["uOpacity"].SetValue(_uOpacity);
71 base.Shader.Parameters["uTargetPosition"].SetValue(_uTargetPosition);
72 if (drawData.HasValue)
73 {
74 DrawData value = drawData.Value;
75 Vector4 value2 = ((!value.sourceRect.HasValue) ? new Vector4(0f, 0f, (float)value.texture.Width, (float)value.texture.Height) : new Vector4((float)value.sourceRect.Value.X, (float)value.sourceRect.Value.Y, (float)value.sourceRect.Value.Width, (float)value.sourceRect.Value.Height));
76 base.Shader.Parameters["uSourceRect"].SetValue(value2);
77 base.Shader.Parameters["uLegacyArmorSourceRect"].SetValue(value2);
78 base.Shader.Parameters["uWorldPosition"].SetValue(Main.screenPosition + value.position);
79 base.Shader.Parameters["uImageSize0"].SetValue(new Vector2((float)value.texture.Width, (float)value.texture.Height));
80 base.Shader.Parameters["uLegacyArmorSheetSize"].SetValue(new Vector2((float)value.texture.Width, (float)value.texture.Height));
81 base.Shader.Parameters["uRotation"].SetValue(value.rotation * (((Enum)value.effect).HasFlag((Enum)(object)(SpriteEffects)1) ? (-1f) : 1f));
82 base.Shader.Parameters["uDirection"].SetValue((!((Enum)value.effect).HasFlag((Enum)(object)(SpriteEffects)1)) ? 1 : (-1));
83 }
84 else
85 {
86 Vector4 value3 = default(Vector4);
87 ((Vector4)(ref value3))._002Ector(0f, 0f, 4f, 4f);
88 base.Shader.Parameters["uSourceRect"].SetValue(value3);
89 base.Shader.Parameters["uLegacyArmorSourceRect"].SetValue(value3);
90 base.Shader.Parameters["uRotation"].SetValue(0f);
91 }
92 if (_uImage != null)
93 {
94 Main.graphics.GraphicsDevice.Textures[1] = (Texture)(object)_uImage.Value;
95 base.Shader.Parameters["uImageSize1"].SetValue(new Vector2((float)_uImage.Width(), (float)_uImage.Height()));
96 }
97 if (entity != null)
98 {
99 base.Shader.Parameters["uDirection"].SetValue((float)entity.direction);
100 }
101 if (entity is Player { bodyFrame: var bodyFrame })
102 {
103 base.Shader.Parameters["uLegacyArmorSourceRect"].SetValue(new Vector4((float)bodyFrame.X, (float)bodyFrame.Y, (float)bodyFrame.Width, (float)bodyFrame.Height));
104 base.Shader.Parameters["uLegacyArmorSheetSize"].SetValue(new Vector2(40f, 1120f));
105 }
106 Apply();
107 }

References Terraria.Graphics.Shaders.ArmorShaderData._uColor, Terraria.Graphics.Shaders.ArmorShaderData._uImage, Terraria.Graphics.Shaders.ArmorShaderData._uOpacity, Terraria.Graphics.Shaders.ArmorShaderData._uSaturation, Terraria.Graphics.Shaders.ArmorShaderData._uSecondaryColor, Terraria.Graphics.Shaders.ArmorShaderData._uTargetPosition, Terraria.Graphics.Shaders.ShaderData.Apply(), Terraria.Entity.direction, Terraria.DataStructures.DrawData.effect, Terraria.Main.GlobalTimeWrappedHourly, Terraria.Main.graphics, Terraria.DataStructures.DrawData.position, Terraria.DataStructures.DrawData.rotation, Terraria.Main.screenPosition, Terraria.DataStructures.DrawData.sourceRect, and Terraria.DataStructures.DrawData.texture.

+ Here is the call graph for this function: