refactor: removed parameters on triangle batch calls on TriangleBatcher for multi window support

This commit is contained in:
2026-01-28 22:19:04 +03:00
parent c68de39c83
commit b9f3227f73
2 changed files with 6 additions and 7 deletions

View File

@@ -19,8 +19,11 @@ public class MonoGameTriangleBatch : Behaviour, ITriangleBatch, IFirstFrameUpdat
private BasicEffect basicEffect = null!;
private readonly RasterizerState rasterizerState = new() { CullMode = CullMode.None };
private ICamera camera = null!;
public void FirstActiveFrame()
{
camera = Universe.FindRequiredBehaviour<ICamera>();
GraphicsDevice graphicsDevice = Universe.FindRequiredBehaviour<MonoGameWindowContainer>().Window.GraphicsDevice;
this.graphicsDevice = graphicsDevice;
basicEffect = new(graphicsDevice);
@@ -47,8 +50,8 @@ public class MonoGameTriangleBatch : Behaviour, ITriangleBatch, IFirstFrameUpdat
{
Viewport viewport = graphicsDevice.Viewport;
this.view = (view ?? Matrix4x4.Identity).Transposed.ToXnaMatrix();
this.projection = (projection ?? Matrix4x4.CreateOrthographicViewCentered(viewport.Width, viewport.Height)).Transposed.ToXnaMatrix();
this.view = (view ?? camera.ViewMatrix).Transposed.ToXnaMatrix();
this.projection = (projection ?? camera.ProjectionMatrix).Transposed.ToXnaMatrix();
}
public void End() => Flush();