perf: forgotten memory allocation on triangle batch

This commit is contained in:
2025-10-16 08:43:40 +03:00
parent 25db60e436
commit 28bc022587

View File

@@ -21,6 +21,7 @@ public class TriangleBatch : ITriangleBatch
this.graphicsDevice = graphicsDevice;
basicEffect = new(graphicsDevice);
basicEffect.VertexColorEnabled = true;
vertexBuffer = new VertexBuffer(graphicsDevice, typeof(VertexPositionColor), 1024, BufferUsage.WriteOnly);
}
public void Draw(Triangle triangle, ColorRGBA colorRGBA)
@@ -64,7 +65,6 @@ public class TriangleBatch : ITriangleBatch
graphicsDevice.RasterizerState = rasterizerState;
basicEffect.Projection = _projection;
basicEffect.View = _view;
vertexBuffer = new VertexBuffer(graphicsDevice, typeof(VertexPositionColor), 1024, BufferUsage.WriteOnly);
vertexBuffer.SetData(vertices);
graphicsDevice.SetVertexBuffer(vertexBuffer);