.../RunActivity/Viewer3D/DriverMachineInterface.cs | 35 +++++++++------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/Source/RunActivity/Viewer3D/DriverMachineInterface.cs b/Source/RunActivity/Viewer3D/DriverMachineInterface.cs index 9cfe6f1cc..a4bd18e1f 100644 --- a/Source/RunActivity/Viewer3D/DriverMachineInterface.cs +++ b/Source/RunActivity/Viewer3D/DriverMachineInterface.cs @@ -366,7 +366,12 @@ public void Draw(SpriteBatch spriteBatch, Point position) } if (!Active) return; - + + // Apply DriverMachineInterface Shader + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, Shader); + int x = 0, y = 0; foreach (var lines in DialLineCoords) @@ -377,30 +382,10 @@ public void Draw(SpriteBatch spriteBatch, Point position) spriteBatch.Draw(ColorTexture, new Rectangle(x, y, length, 1), null, Color.White, lines.W, new Vector2(0, 0), SpriteEffects.None, 0); } - // Monogame Spritebatch change Shaders procedure. - // Following spriteBatch.Begin statements must reflect those for CabSpriteBatchMaterial in materials.cs - - // Apply DriverMachineInterface Shader - - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, Shader); - // Draw gauge needle centre and speed limit markings spriteBatch.Draw(ColorTexture, new Vector2(position.X, position.Y), SourceRectangle, Color.Transparent, 0, new Vector2(0, 0), Scale, SpriteEffects.None, 0); - // Re-apply normal Cab lighting Shader - - spriteBatch.End(); - if (cabShader != null) - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, cabShader); - else - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, null); - - spriteBatch.Draw(ColorTexture, new Vector2(position.X, position.Y), SourceRectangle, Color.Transparent, 0, new Vector2(0, 0), Scale, SpriteEffects.None, 0); - - // End of spritebatch change Shaders - foreach (var text in DialSpeeds) { x = position.X + (int)(text.Position.X * Scale); @@ -427,6 +412,14 @@ public void Draw(SpriteBatch spriteBatch, Point position) y = position.Y + (int)(ReleaseSpeed.Position.Y * Scale); ReleaseSpeed.Draw(spriteBatch, new Point(x, y)); } + + // Re-apply normal Cab lighting Shader + + spriteBatch.End(); + if (cabShader != null) + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, cabShader); + else + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.Default, null, null); } private class TextPrimitive