Cleanup overlay shaders when done (#10432)

This commit is contained in:
metalgearsloth
2022-08-13 10:58:53 +10:00
committed by GitHub
parent 2faf84e943
commit 87c05f2949
14 changed files with 22 additions and 3 deletions

View File

@@ -510,6 +510,8 @@ namespace Content.Client.AI
{ {
DrawRegions(screenHandle, viewport); DrawRegions(screenHandle, viewport);
} }
screenHandle.UseShader(null);
} }
} }

View File

@@ -148,6 +148,7 @@ public sealed class ExplosionDebugOverlay : Overlay
handle.SetTransform(SpaceMatrix); handle.SetTransform(SpaceMatrix);
DrawTiles(handle, gridBounds, SpaceTiles, SpaceTileSize); DrawTiles(handle, gridBounds, SpaceTiles, SpaceTileSize);
handle.SetTransform(Matrix3.Identity);
} }
private void DrawTiles( private void DrawTiles(

View File

@@ -25,6 +25,7 @@ namespace Content.Client.CombatMode
worldHandle.UseShader(_shader); worldHandle.UseShader(_shader);
var viewport = args.WorldAABB; var viewport = args.WorldAABB;
worldHandle.DrawRect(viewport, Color.White); worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
} }
} }
} }

View File

@@ -48,6 +48,7 @@ namespace Content.Client.Cooldown
_shader.SetParameter("progress", Progress); _shader.SetParameter("progress", Progress);
handle.UseShader(_shader); handle.UseShader(_shader);
handle.DrawRect(PixelSizeBox, color); handle.DrawRect(PixelSizeBox, color);
handle.UseShader(null);
} }
} }

View File

@@ -69,6 +69,8 @@ namespace Content.Client.Decals
} }
} }
} }
handle.SetTransform(Matrix3.Identity);
} }
public SpriteSpecifier GetDecalSprite(string id) public SpriteSpecifier GetDecalSprite(string id)

View File

@@ -118,6 +118,7 @@ namespace Content.Client.DoAfter.UI
leftOffset + (int) (XPixelDiff * Ratio * UIScale), leftOffset + (int) (XPixelDiff * Ratio * UIScale),
-2); -2);
handle.DrawRect(box, color); handle.DrawRect(box, color);
handle.UseShader(null);
} }
} }

View File

@@ -66,5 +66,6 @@ public sealed class RainbowOverlay : Overlay
_rainbowShader.SetParameter("effectScale", EffectScale); _rainbowShader.SetParameter("effectScale", EffectScale);
handle.UseShader(_rainbowShader); handle.UseShader(_rainbowShader);
handle.DrawRect(args.WorldBounds, Color.White); handle.DrawRect(args.WorldBounds, Color.White);
handle.UseShader(null);
} }
} }

View File

@@ -67,6 +67,7 @@ public sealed class DrunkOverlay : Overlay
_drunkShader.SetParameter("boozePower", _visualScale); _drunkShader.SetParameter("boozePower", _visualScale);
handle.UseShader(_drunkShader); handle.UseShader(_drunkShader);
handle.DrawRect(args.WorldBounds, Color.White); handle.DrawRect(args.WorldBounds, Color.White);
handle.UseShader(null);
} }
/// <summary> /// <summary>

View File

@@ -60,6 +60,7 @@ public sealed class ExplosionOverlay : Overlay
} }
drawHandle.SetTransform(Matrix3.Identity); drawHandle.SetTransform(Matrix3.Identity);
drawHandle.UseShader(null);
} }
private void DrawExplosion(DrawingHandleWorld drawHandle, Box2Rotated worldBounds, Explosion exp, int index, EntityQuery<TransformComponent> xforms) private void DrawExplosion(DrawingHandleWorld drawHandle, Box2Rotated worldBounds, Explosion exp, int index, EntityQuery<TransformComponent> xforms)
@@ -84,7 +85,7 @@ public sealed class ExplosionOverlay : Overlay
gridBounds = Matrix3.Invert(exp.SpaceMatrix).TransformBox(worldBounds); gridBounds = Matrix3.Invert(exp.SpaceMatrix).TransformBox(worldBounds);
drawHandle.SetTransform(exp.SpaceMatrix); drawHandle.SetTransform(exp.SpaceMatrix);
DrawTiles(drawHandle, gridBounds, index, exp.SpaceTiles, exp, exp.SpaceTileSize); DrawTiles(drawHandle, gridBounds, index, exp.SpaceTiles, exp, exp.SpaceTileSize);
} }

View File

@@ -70,11 +70,11 @@ namespace Content.Client.Eye.Blinding
var worldHandle = args.WorldHandle; var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds; var viewport = args.WorldBounds;
worldHandle.SetTransform(Matrix3.Identity);
worldHandle.UseShader(_greyscaleShader); worldHandle.UseShader(_greyscaleShader);
worldHandle.DrawRect(viewport, Color.White); worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(_circleMaskShader); worldHandle.UseShader(_circleMaskShader);
worldHandle.DrawRect(viewport, Color.White); worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
} }
} }
} }

View File

@@ -60,6 +60,8 @@ namespace Content.Client.Flash
{ {
screenSpaceHandle.DrawTextureRect(_screenshotTexture, screenSize); screenSpaceHandle.DrawTextureRect(_screenshotTexture, screenSize);
} }
screenSpaceHandle.UseShader(null);
} }
protected override void DisposeBehavior() protected override void DisposeBehavior()

View File

@@ -214,6 +214,8 @@ public sealed class DamageOverlay : Overlay
handle.UseShader(_critShader); handle.UseShader(_critShader);
handle.DrawRect(viewport, Color.White); handle.DrawRect(viewport, Color.White);
} }
handle.UseShader(null);
} }
private float GetDiff(float value, float lastFrameTime) private float GetDiff(float value, float lastFrameTime)

View File

@@ -62,6 +62,8 @@ namespace Content.Client.Radiation
worldHandle.UseShader(shd); worldHandle.UseShader(shd);
worldHandle.DrawRect(Box2.CenteredAround(instance.CurrentMapCoords, new Vector2(instance.Range, instance.Range) * 2f), Color.White); worldHandle.DrawRect(Box2.CenteredAround(instance.CurrentMapCoords, new Vector2(instance.Range, instance.Range) * 2f), Color.White);
} }
worldHandle.UseShader(null);
} }
//Queries all pulses on the map and either adds or removes them from the list of rendered pulses based on whether they should be drawn (in range? on the same z-level/map? pulse entity still exists?) //Queries all pulses on the map and either adds or removes them from the list of rendered pulses based on whether they should be drawn (in range? on the same z-level/map? pulse entity still exists?)

View File

@@ -55,7 +55,7 @@ public sealed class DirectionIcon : TextureRect
} }
var rotation = direction.ToWorldAngle() - relativeAngle; var rotation = direction.ToWorldAngle() - relativeAngle;
Rotation = snap ? rotation.GetDir().ToAngle() : rotation; Rotation = snap ? rotation.GetDir().ToAngle() : rotation;
} }
protected override void Draw(DrawingHandleScreen handle) protected override void Draw(DrawingHandleScreen handle)
@@ -65,6 +65,8 @@ public sealed class DirectionIcon : TextureRect
var offset = (-_rotation.Value).RotateVec(Size * UIScale / 2) - Size * UIScale / 2; var offset = (-_rotation.Value).RotateVec(Size * UIScale / 2) - Size * UIScale / 2;
handle.SetTransform(Matrix3.CreateTransform(GlobalPixelPosition - offset, -_rotation.Value)); handle.SetTransform(Matrix3.CreateTransform(GlobalPixelPosition - offset, -_rotation.Value));
} }
handle.SetTransform(Matrix3.Identity);
base.Draw(handle); base.Draw(handle);
} }
} }