-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow shaders to omit parameters they don't use. No longer throw exce…
…ption.
- Loading branch information
Showing
7 changed files
with
256 additions
and
4 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
patches/tModLoader/Terraria/GameContent/Dyes/ReflectiveArmorShaderData.cs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- src/TerrariaNetCore/Terraria/GameContent/Dyes/ReflectiveArmorShaderData.cs | ||
+++ src/tModLoader/Terraria/GameContent/Dyes/ReflectiveArmorShaderData.cs | ||
@@ -15,7 +_,7 @@ | ||
public override void Apply(Entity entity, DrawData? drawData) | ||
{ | ||
if (entity == null) { | ||
- base.Shader.Parameters["uLightSource"].SetValue(Vector3.Zero); | ||
+ base.Shader.Parameters["uLightSource"]?.SetValue(Vector3.Zero); | ||
} | ||
else { | ||
float num = 0f; | ||
@@ -53,7 +_,7 @@ | ||
value.Y *= 2f; | ||
value.Normalize(); | ||
value.Z *= 0.6f; | ||
- base.Shader.Parameters["uLightSource"].SetValue(value); | ||
+ base.Shader.Parameters["uLightSource"]?.SetValue(value); | ||
} | ||
|
||
base.Apply(entity, drawData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
patches/tModLoader/Terraria/GameContent/TreePaintingSettings.cs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- src/TerrariaNetCore/Terraria/GameContent/TreePaintingSettings.cs | ||
+++ src/tModLoader/Terraria/GameContent/TreePaintingSettings.cs | ||
@@ -15,12 +_,12 @@ | ||
|
||
public void ApplyShader(int paintColor, Effect shader) | ||
{ | ||
- shader.Parameters["leafHueTestOffset"].SetValue(HueTestOffset); | ||
+ shader.Parameters["leafHueTestOffset"]?.SetValue(HueTestOffset); | ||
- shader.Parameters["leafMinHue"].SetValue(SpecialGroupMinimalHueValue); | ||
+ shader.Parameters["leafMinHue"]?.SetValue(SpecialGroupMinimalHueValue); | ||
- shader.Parameters["leafMaxHue"].SetValue(SpecialGroupMaximumHueValue); | ||
+ shader.Parameters["leafMaxHue"]?.SetValue(SpecialGroupMaximumHueValue); | ||
- shader.Parameters["leafMinSat"].SetValue(SpecialGroupMinimumSaturationValue); | ||
+ shader.Parameters["leafMinSat"]?.SetValue(SpecialGroupMinimumSaturationValue); | ||
- shader.Parameters["leafMaxSat"].SetValue(SpecialGroupMaximumSaturationValue); | ||
+ shader.Parameters["leafMaxSat"]?.SetValue(SpecialGroupMaximumSaturationValue); | ||
- shader.Parameters["invertSpecialGroupResult"].SetValue(InvertSpecialGroupResult); | ||
+ shader.Parameters["invertSpecialGroupResult"]?.SetValue(InvertSpecialGroupResult); | ||
int index = Main.ConvertPaintIdToTileShaderIndex(paintColor, UseSpecialGroups, UseWallShaderHacks); | ||
shader.CurrentTechnique.Passes[index].Apply(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters