diff --git a/Geometry/MeshSprite.cs b/Geometry/MeshSprite.cs index 0d9e29f..87dac1c 100644 --- a/Geometry/MeshSprite.cs +++ b/Geometry/MeshSprite.cs @@ -6,6 +6,15 @@ namespace Kav public class MeshSprite { private static readonly int PixelScale = 40; + private static readonly short[] Indices = new short[] + { + 0, + 1, + 2, + 1, + 3, + 2 + }; public IndexBuffer IndexBuffer { get; } public VertexBuffer VertexBuffer { get; } @@ -29,7 +38,7 @@ namespace Kav 6, BufferUsage.WriteOnly ); - IndexBuffer.SetData(GenerateIndexArray()); + IndexBuffer.SetData(Indices); VertexBuffer = new VertexBuffer( graphicsDevice, @@ -56,7 +65,7 @@ namespace Kav 6, BufferUsage.WriteOnly ); - IndexBuffer.SetData(GenerateIndexArray()); + IndexBuffer.SetData(Indices); VertexBuffer = new VertexBuffer( graphicsDevice, @@ -67,18 +76,6 @@ namespace Kav VertexBuffer.SetData(GenerateVertexArray(Texture)); } - private static short[] GenerateIndexArray() - { - short[] result = new short[6]; - result[0] = 0; - result[1] = 1; - result[2] = 2; - result[3] = 1; - result[4] = 3; - result[5] = 2; - return result; - } - private static VertexPositionNormalTexture[] GenerateVertexArray(Texture2D texture) { VertexPositionNormalTexture[] result = new VertexPositionNormalTexture[4];