diff --git a/BluntDx.dll b/BluntDx.dll index 0644a43f5d..89dd1b3e4b 100644 Binary files a/BluntDx.dll and b/BluntDx.dll differ diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index 7327432798..8f30052602 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -27,6 +27,8 @@ namespace OpenRa.Game FvfVertexBuffer vertexBuffer; + Dictionary drawBatches = new Dictionary(); + void LoadTextures() { List tempSheets = new List(); @@ -63,7 +65,6 @@ namespace OpenRa.Game void LoadVertexBuffer() { Dictionary> indexMap = new Dictionary>(); - Vertex[] vertices = new Vertex[4 * 128 * 128];//map.Width * map.Height]; for( int i = 0; i < 128; i++ ) @@ -94,8 +95,12 @@ namespace OpenRa.Game vertexBuffer = new FvfVertexBuffer(device, vertices.Length, Vertex.Format); vertexBuffer.SetData(vertices); - Dictionary indexBuffers = new Dictionary(); - + foreach (KeyValuePair> p in indexMap) + { + IndexBuffer indexBuffer = new IndexBuffer(device, p.Value.Count); + indexBuffer.SetData(p.Value.ToArray()); + drawBatches.Add(p.Key, indexBuffer); + } } public MainWindow() @@ -133,10 +138,16 @@ namespace OpenRa.Game // render something :) - //vertexBuffer.Bind(0); - //indexBuffer.Bind(); + vertexBuffer.Bind(0); - //device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 2 * map.Width * map.Height); + foreach (KeyValuePair batch in drawBatches) + { + //todo: bind texture! + + batch.Value.Bind(); + device.DrawIndexedPrimitives(PrimitiveType.TriangleList, + vertexBuffer.Size, batch.Value.Size / 3); + } device.End(); device.Present();