Implemented the changes of the new camera.

This commit is contained in:
2019-02-06 00:12:08 -06:00
parent e0858ad85d
commit 3c7e6cdefb
5 changed files with 13 additions and 11 deletions

View File

@@ -34,11 +34,11 @@ namespace RecrownedAthenaeum.Render
{
this.graphicsDevice = graphicsDevice ?? (Configuration.GraphicsDeviceManager.GraphicsDevice);
camera = camera ?? (Configuration.Camera2D);
basicEffect = new BasicEffect(this.graphicsDevice);
basicEffect.VertexColorEnabled = true;
basicEffect.View = camera.Matrix;
basicEffect.Projection = camera.projectionMatrix;
basicEffect.View = camera.ViewMatrix;
basicEffect.World = Matrix.Identity;
vertices = new List<VertexPositionColor>(verticesPerBatch);
}
@@ -69,9 +69,9 @@ namespace RecrownedAthenaeum.Render
public void End()
{
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
if (!began) throw new InvalidOperationException("Begin must be called before ending.");
Flush();
began = false;
}
/// <summary>
@@ -95,7 +95,7 @@ namespace RecrownedAthenaeum.Render
}
}
vertices.Add(new VertexPositionColor(new Vector3(vertex, 0), color));
bufferPosition = vertices.Count;
bufferPosition++;
}
/// <summary>
@@ -108,6 +108,7 @@ namespace RecrownedAthenaeum.Render
if (bufferPosition == 0) return;
graphicsDevice.DrawUserPrimitives(primitiveType, vertices.ToArray(), 0, bufferPosition / verticesPerPrimitive);
vertices.Clear();
bufferPosition = 0;
}