diff --git a/CameraTest/CameraTest.cs b/CameraTest/CameraTest.cs
new file mode 100644
index 0000000..2ddd8a7
--- /dev/null
+++ b/CameraTest/CameraTest.cs
@@ -0,0 +1,149 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using RecrownedAthenaeum.Camera;
+using RecrownedAthenaeum.Render;
+using System;
+
+namespace CameraTest
+{
+ ///
+ /// This is the main type for your game.
+ ///
+ public class CameraTest : Game
+ {
+ GraphicsDeviceManager graphics;
+ SpriteBatch spriteBatch;
+ PrimitiveBatch pb;
+ Camera2D camera;
+ RectangleRenderer rr;
+ BasicEffect be;
+ public CameraTest()
+ {
+ graphics = new GraphicsDeviceManager(this);
+ Content.RootDirectory = "Content";
+ }
+
+ ///
+ /// Allows the game to perform any initialization it needs to before starting to run.
+ /// This is where it can query for any required services and load any non-graphic
+ /// related content. Calling base.Initialize will enumerate through any components
+ /// and initialize them as well.
+ ///
+ protected override void Initialize()
+ {
+ // TODO: Add your initialization logic here
+ base.Initialize();
+ }
+
+ ///
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ ///
+ protected override void LoadContent()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ camera = new Camera2D(graphics.GraphicsDevice);
+ spriteBatch = new SpriteBatch(GraphicsDevice);
+ rr = new RectangleRenderer(camera, GraphicsDevice);
+ pb = new PrimitiveBatch(camera, GraphicsDevice);
+ be = new BasicEffect(GraphicsDevice);
+ be.World = camera.worldMatrix;
+ be.View = camera.ViewMatrix;
+ be.Projection = camera.projectionMatrix;
+ // TODO: use this.Content to load your game content here
+ }
+
+ ///
+ /// UnloadContent will be called once per game and is the place to unload
+ /// game-specific content.
+ ///
+ protected override void UnloadContent()
+ {
+ // TODO: Unload any non ContentManager content here
+ rr.Dispose();
+ }
+
+ ///
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Update(GameTime gameTime)
+ {
+ if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
+ Exit();
+
+
+ if (Keyboard.GetState().IsKeyDown(Keys.Left))
+ {
+ Console.WriteLine("moving..");
+ camera.MoveCamera(new Vector2(-5, 0));
+ }
+ if (Keyboard.GetState().IsKeyDown(Keys.Right))
+ {
+ Console.WriteLine("moving..");
+ camera.MoveCamera(new Vector2(5, 0));
+ }
+ if (Keyboard.GetState().IsKeyDown(Keys.Up))
+ {
+ Console.WriteLine("moving..");
+ camera.MoveCamera(new Vector2(0, 5));
+ }
+ if (Keyboard.GetState().IsKeyDown(Keys.Down))
+ {
+ Console.WriteLine("moving..");
+ camera.MoveCamera(new Vector2(0, -5));
+ }
+ camera.Apply();
+
+ base.Update(gameTime);
+ }
+
+ ///
+ /// This is called when the game should draw itself.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Draw(GameTime gameTime)
+ {
+ GraphicsDevice.Clear(Color.Black);
+ rr.Draw(25, 25, 70, 70, Color.Purple);
+ /*
+ * float rotation = 0;
+ double width = 20;
+ double height = 20;
+ int x = 50;
+ int y = 50;
+ double topRightAngleFromOrig = Math.Atan(height / width);
+ pb.Begin(PrimitiveType.LineList);
+
+
+ Vector2 bottomLeft = new Vector2(x, y);
+ Vector2 bottomRight = new Vector2(x + (float)(Math.Cos(rotation) * width), y + (float)(Math.Sin(rotation) * width));
+ float origDiagonalHypotenuse = (float)Math.Sqrt(width * width + height * height);
+ Vector2 topRight = new Vector2(x + (float)Math.Cos(topRightAngleFromOrig + rotation) * origDiagonalHypotenuse, y + (float)Math.Sin(topRightAngleFromOrig + rotation) * origDiagonalHypotenuse);
+ Vector2 topLeft = new Vector2(x - (float)(Math.Cos((Math.PI / 2f) - rotation) * height), y + (float)(Math.Sin((Math.PI / 2f) - rotation) * height));
+
+ verts[0] = bottomLeft;
+ verts[1] = bottomRight;
+ verts[2] = topRight;
+ verts[3] = topLeft;
+
+ vertposcol[0] = new VertexPositionColor(new Vector3(verts[0], 0), Color.White);
+ vertposcol[1] = new VertexPositionColor(new Vector3(verts[1], 0), Color.White);
+ vertposcol[2] = new VertexPositionColor(new Vector3(verts[2], 0), Color.White);
+ vertposcol[3] = new VertexPositionColor(new Vector3(verts[3], 0), Color.White);
+
+ EffectTechnique effectTechnique = be.Techniques[0];
+ EffectPassCollection effectPassCollection = effectTechnique.Passes;
+ foreach (EffectPass pass in effectPassCollection)
+ {
+ pass.Apply();
+ GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertposcol, 0, 4);
+ }
+ pb.End();
+ */
+ base.Draw(gameTime);
+ }
+ }
+}
diff --git a/CameraTest/CameraTest.csproj b/CameraTest/CameraTest.csproj
new file mode 100644
index 0000000..586c16f
--- /dev/null
+++ b/CameraTest/CameraTest.csproj
@@ -0,0 +1,123 @@
+
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {4A9796EE-D10D-4ED8-AE6E-9CE96C3D4FE9}
+ WinExe
+ Properties
+ CameraTest
+ CameraTest
+ 512
+ DesktopGL
+ v4.5
+
+
+ true
+ bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\
+ DEBUG;TRACE;LINUX
+ full
+ AnyCPU
+ prompt
+ false
+ 4
+
+
+ bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\
+ TRACE;LINUX
+ true
+ pdbonly
+ AnyCPU
+ prompt
+ false
+ 4
+
+
+ Icon.ico
+
+
+ app.manifest
+
+
+
+
+
+
+
+
+ $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll
+
+
+
+
+
+
+
+
+
+
+
+ x86\SDL2.dll
+ PreserveNewest
+
+
+ x64\SDL2.dll
+ PreserveNewest
+
+
+ x86\soft_oal.dll
+ PreserveNewest
+
+
+ x64\soft_oal.dll
+ PreserveNewest
+
+
+ x86\libSDL2-2.0.so.0
+ PreserveNewest
+
+
+ x64\libSDL2-2.0.so.0
+ PreserveNewest
+
+
+ x86\libopenal.so.1
+ PreserveNewest
+
+
+ x64\libopenal.so.1
+ PreserveNewest
+
+
+ libSDL2-2.0.0.dylib
+ PreserveNewest
+
+
+ libopenal.1.dylib
+ PreserveNewest
+
+
+ MonoGame.Framework.dll.config
+ PreserveNewest
+
+
+
+
+
+ {95a926dc-1482-4368-91da-8d30ac04740a}
+ RecrownedAthenaeum
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CameraTest/Content/Content.mgcb b/CameraTest/Content/Content.mgcb
new file mode 100644
index 0000000..ddc4c36
--- /dev/null
+++ b/CameraTest/Content/Content.mgcb
@@ -0,0 +1,15 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:DesktopGL
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
diff --git a/CameraTest/Icon.bmp b/CameraTest/Icon.bmp
new file mode 100644
index 0000000..2b48165
Binary files /dev/null and b/CameraTest/Icon.bmp differ
diff --git a/CameraTest/Icon.ico b/CameraTest/Icon.ico
new file mode 100644
index 0000000..7d9dec1
Binary files /dev/null and b/CameraTest/Icon.ico differ
diff --git a/CameraTest/Program.cs b/CameraTest/Program.cs
new file mode 100644
index 0000000..5af3fb9
--- /dev/null
+++ b/CameraTest/Program.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace CameraTest
+{
+ ///
+ /// The main class.
+ ///
+ public static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ using (var game = new CameraTest())
+ game.Run();
+ }
+ }
+}
diff --git a/CameraTest/Properties/AssemblyInfo.cs b/CameraTest/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..c939579
--- /dev/null
+++ b/CameraTest/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("CameraTest")]
+[assembly: AssemblyProduct("CameraTest")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("185d293a-bbcb-409b-9f46-c3ede6883b16")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/CameraTest/app.manifest b/CameraTest/app.manifest
new file mode 100644
index 0000000..9b3972c
--- /dev/null
+++ b/CameraTest/app.manifest
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true/pm
+
+
+
+
diff --git a/Demo/Content/Content.mgcb b/Demo/Content/Content.mgcb
new file mode 100644
index 0000000..ddc4c36
--- /dev/null
+++ b/Demo/Content/Content.mgcb
@@ -0,0 +1,15 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:DesktopGL
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
diff --git a/Demo/Demo.cs b/Demo/Demo.cs
new file mode 100644
index 0000000..513f580
--- /dev/null
+++ b/Demo/Demo.cs
@@ -0,0 +1,101 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+
+namespace Demo
+{
+ ///
+ /// This is the main type for your game.
+ ///
+ public class Demo : Game
+ {
+ GraphicsDeviceManager graphics;
+ SpriteBatch spriteBatch;
+
+ BasicEffect basicEffect;
+ VertexPositionColor[] vertices;
+
+ public Demo()
+ {
+ graphics = new GraphicsDeviceManager(this);
+ Content.RootDirectory = "Content";
+ }
+
+ ///
+ /// Allows the game to perform any initialization it needs to before starting to run.
+ /// This is where it can query for any required services and load any non-graphic
+ /// related content. Calling base.Initialize will enumerate through any components
+ /// and initialize them as well.
+ ///
+ protected override void Initialize()
+ {
+ // TODO: Add your initialization logic here
+ basicEffect = new BasicEffect(GraphicsDevice);
+ basicEffect.View = Matrix.CreateLookAt(new Vector3(graphics.PreferredBackBufferWidth/2f, graphics.PreferredBackBufferHeight/2f, 1f), Vector3.Forward, Vector3.Up);
+ basicEffect.World = Matrix.Identity;
+ basicEffect.Projection = Matrix.CreateOrthographic(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1);
+ basicEffect.VertexColorEnabled = true;
+
+ vertices = new VertexPositionColor[5];
+ vertices[0] = new VertexPositionColor(new Vector3(5, 5, 0), Color.Red);
+ vertices[1] = new VertexPositionColor(new Vector3(10, 5, 0), Color.Red);
+ vertices[2] = new VertexPositionColor(new Vector3(10, 10, 0), Color.Red);
+ vertices[3] = new VertexPositionColor(new Vector3(5, 10, 0), Color.Red);
+ base.Initialize();
+ }
+
+ ///
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ ///
+ protected override void LoadContent()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ spriteBatch = new SpriteBatch(GraphicsDevice);
+
+ // TODO: use this.Content to load your game content here
+ }
+
+ ///
+ /// UnloadContent will be called once per game and is the place to unload
+ /// game-specific content.
+ ///
+ protected override void UnloadContent()
+ {
+ // TODO: Unload any non ContentManager content here
+ }
+
+ ///
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Update(GameTime gameTime)
+ {
+ if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
+ Exit();
+
+ // TODO: Add your update logic here
+
+ base.Update(gameTime);
+ }
+
+ ///
+ /// This is called when the game should draw itself.
+ ///
+ /// Provides a snapshot of timing values.
+ protected override void Draw(GameTime gameTime)
+ {
+ GraphicsDevice.Clear(Color.CornflowerBlue);
+
+ foreach (EffectPass effectPass in basicEffect.CurrentTechnique.Passes)
+ {
+ effectPass.Apply();
+ GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertices, 0, 4);
+ }
+ // TODO: Add your drawing code here
+
+ base.Draw(gameTime);
+ }
+ }
+}
diff --git a/Demo/Demo.csproj b/Demo/Demo.csproj
new file mode 100644
index 0000000..8335f21
--- /dev/null
+++ b/Demo/Demo.csproj
@@ -0,0 +1,117 @@
+
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {A56A7DFD-C5E7-4D9B-9A9F-25F94EC824BD}
+ WinExe
+ Properties
+ Demo
+ Demo
+ 512
+ DesktopGL
+ v4.5
+
+
+ true
+ bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\
+ DEBUG;TRACE;LINUX
+ full
+ AnyCPU
+ prompt
+ false
+ 4
+
+
+ bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\
+ TRACE;LINUX
+ true
+ pdbonly
+ AnyCPU
+ prompt
+ false
+ 4
+
+
+ Icon.ico
+
+
+ app.manifest
+
+
+
+
+
+
+
+
+ $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll
+
+
+
+
+
+
+
+
+
+
+
+ x86\SDL2.dll
+ PreserveNewest
+
+
+ x64\SDL2.dll
+ PreserveNewest
+
+
+ x86\soft_oal.dll
+ PreserveNewest
+
+
+ x64\soft_oal.dll
+ PreserveNewest
+
+
+ x86\libSDL2-2.0.so.0
+ PreserveNewest
+
+
+ x64\libSDL2-2.0.so.0
+ PreserveNewest
+
+
+ x86\libopenal.so.1
+ PreserveNewest
+
+
+ x64\libopenal.so.1
+ PreserveNewest
+
+
+ libSDL2-2.0.0.dylib
+ PreserveNewest
+
+
+ libopenal.1.dylib
+ PreserveNewest
+
+
+ MonoGame.Framework.dll.config
+ PreserveNewest
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Demo/Icon.bmp b/Demo/Icon.bmp
new file mode 100644
index 0000000..2b48165
Binary files /dev/null and b/Demo/Icon.bmp differ
diff --git a/Demo/Icon.ico b/Demo/Icon.ico
new file mode 100644
index 0000000..7d9dec1
Binary files /dev/null and b/Demo/Icon.ico differ
diff --git a/Demo/Program.cs b/Demo/Program.cs
new file mode 100644
index 0000000..5fe050b
--- /dev/null
+++ b/Demo/Program.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace Demo
+{
+ ///
+ /// The main class.
+ ///
+ public static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ using (var game = new Demo())
+ game.Run();
+ }
+ }
+}
diff --git a/Demo/Properties/AssemblyInfo.cs b/Demo/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..9fc03cb
--- /dev/null
+++ b/Demo/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Demo")]
+[assembly: AssemblyProduct("Demo")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7d7ad025-99d9-4c0b-9821-94d507213959")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Demo/app.manifest b/Demo/app.manifest
new file mode 100644
index 0000000..251b21a
--- /dev/null
+++ b/Demo/app.manifest
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true/pm
+
+
+
+
diff --git a/RecrownedAthenaeum.sln b/RecrownedAthenaeum.sln
index ae868d0..5777c91 100644
--- a/RecrownedAthenaeum.sln
+++ b/RecrownedAthenaeum.sln
@@ -9,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RecrownedAthenaeum.Pipeline
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RecrownedAthenaeum.Tools", "RecrownedAthenaeum.Tools\RecrownedAthenaeum.Tools.csproj", "{51E77E29-AD31-449E-9C98-980E5C978EF9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraTest", "CameraTest\CameraTest.csproj", "{4A9796EE-D10D-4ED8-AE6E-9CE96C3D4FE9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{A56A7DFD-C5E7-4D9B-9A9F-25F94EC824BD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +31,14 @@ Global
{51E77E29-AD31-449E-9C98-980E5C978EF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51E77E29-AD31-449E-9C98-980E5C978EF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51E77E29-AD31-449E-9C98-980E5C978EF9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4A9796EE-D10D-4ED8-AE6E-9CE96C3D4FE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4A9796EE-D10D-4ED8-AE6E-9CE96C3D4FE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4A9796EE-D10D-4ED8-AE6E-9CE96C3D4FE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4A9796EE-D10D-4ED8-AE6E-9CE96C3D4FE9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A56A7DFD-C5E7-4D9B-9A9F-25F94EC824BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A56A7DFD-C5E7-4D9B-9A9F-25F94EC824BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A56A7DFD-C5E7-4D9B-9A9F-25F94EC824BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A56A7DFD-C5E7-4D9B-9A9F-25F94EC824BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/RecrownedAthenaeum/Render/PrimitiveBatch.cs b/RecrownedAthenaeum/Render/PrimitiveBatch.cs
index 9cf2391..92a13f3 100644
--- a/RecrownedAthenaeum/Render/PrimitiveBatch.cs
+++ b/RecrownedAthenaeum/Render/PrimitiveBatch.cs
@@ -13,7 +13,6 @@ namespace RecrownedAthenaeum.Render
{
VertexPositionColor[] vertices;
int bufferPosition;
- VertexBuffer vertexBuffer;
BasicEffect basicEffect;
PrimitiveType primitiveType;
@@ -25,7 +24,6 @@ namespace RecrownedAthenaeum.Render
GraphicsDevice graphicsDevice;
bool began;
bool disposed;
- bool changed;
Camera3D camera;
///
@@ -40,8 +38,7 @@ namespace RecrownedAthenaeum.Render
this.camera = camera ?? (Configuration.Camera2D);
basicEffect = new BasicEffect(this.graphicsDevice);
basicEffect.VertexColorEnabled = true;
- vertices = new VertexPositionColor[verticesPerBatch];
- vertexBuffer = new VertexBuffer(this.graphicsDevice, typeof(VertexPositionColor), verticesPerBatch, BufferUsage.WriteOnly);
+ vertices = new VertexPositionColor[verticesPerBatch + 1];
}
///
@@ -84,7 +81,6 @@ namespace RecrownedAthenaeum.Render
/// The color of that vertex.
public void AddVertex(Vector2 vertex, Color color)
{
- changed = true;
if (!began) throw new InvalidOperationException("Begin needs to be called before adding vertex.");
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
if (primitiveType != PrimitiveType.LineStrip && primitiveType != PrimitiveType.TriangleStrip)
@@ -115,19 +111,13 @@ namespace RecrownedAthenaeum.Render
///
public void Flush()
{
- if (changed)
- {
- changed = false;
- vertexBuffer.SetData(vertices);
- }
- graphicsDevice.SetVertexBuffer(vertexBuffer);
if (!began) throw new InvalidOperationException("Begin needs to be called before flushing.");
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
if (bufferPosition == 0) return;
foreach (EffectPass effectPass in basicEffect.CurrentTechnique.Passes)
{
effectPass.Apply();
- graphicsDevice.DrawPrimitives(primitiveType, 0, bufferPosition/verticesPerPrimitive);
+ graphicsDevice.DrawUserPrimitives(primitiveType, vertices, 0, bufferPosition/verticesPerPrimitive);
}
bufferPosition = 0;
}