Example #1
0
        public void Append(VertexPositionTexture[] wallVertices, VertexPositionTexture[] wallEdgeVertices, Color color)
        {
            WallBuffer.Dispose();
            WallBuffer = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, this.wallVertices.Length + wallVertices.Length, BufferUsage.WriteOnly);
            int originalWallVertexCount = this.wallVertices.Length;

            Array.Resize(ref this.wallVertices, originalWallVertexCount + wallVertices.Length);
            Array.Copy(LevelRenderer.GetColoredVertices(wallVertices, color), 0, this.wallVertices, originalWallVertexCount, wallVertices.Length);
            WallBuffer.SetData(this.wallVertices);

            WallEdgeBuffer.Dispose();
            WallEdgeBuffer = new VertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, this.wallEdgeVertices.Length + wallEdgeVertices.Length, BufferUsage.WriteOnly);
            int originalWallEdgeVertexCount = this.wallEdgeVertices.Length;

            Array.Resize(ref this.wallEdgeVertices, originalWallEdgeVertexCount + wallEdgeVertices.Length);
            Array.Copy(LevelRenderer.GetColoredVertices(wallEdgeVertices, color), 0, this.wallEdgeVertices, originalWallEdgeVertexCount, wallEdgeVertices.Length);
            WallEdgeBuffer.SetData(this.wallEdgeVertices);
        }
Example #2
0
 protected virtual void Dispose(bool disposing)
 {
     IsDisposed = true;
     WallEdgeBuffer?.Dispose();
     WallBuffer?.Dispose();
 }