private void RebuildVertexBuffer(LandscapeBlock block)
        {
            CanAlterHeight = false;

            // Create the new VB
            block.VertexBuffer = new VertexBuffer(GraphicsDevice, block.Declaration, block.Verts.Length, BufferUsage.None);
            block.VertexBuffer.SetData(block.Verts);

            CanAlterHeight = true;
        }
        private void AdjustHeight(Direction direction, float weight)
        {
            bool rebuild = false;

            for (int bx = 0; bx < numBlocksX; bx++)
            {
                for (int by = 0; by < numBlocksZ; by++)
                {
                    LandscapeBlock block = Blocks[bx][by];

                    // If camera is in the bounding frustum check it for a hit
                    if (block.Visible)
                    {
                        switch (direction)
                        {
                        case Direction.Up:
                            for (int x = 0; x < block.Width; x++)
                            {
                                for (int y = 0; y < block.Height; y++)
                                {
                                    // Index of this vertice
                                    int index = block.GetIndex(x, y);

                                    // Get the distance from this veritce to the mouse position
                                    float distance = Vector3.Distance(block.Verts[index].Position, MouseCoords);

                                    if (distance <= BrushSize)
                                    {
                                        Vector3 height = new Vector3(0, weight, 0);
                                        height.Normalize();

                                        // Center
                                        block.Verts[index].Position += height;

                                        if (block.Left != null)
                                        {
                                            for (int x1 = 0; x1 < block.Left.Width; x1++)
                                            {
                                                for (int y1 = 0; y1 < block.Left.Height; y1++)
                                                {
                                                    float d2 = Vector3.Distance(block.Left.Verts[block.Left.GetIndex(x1, y1)].Position,
                                                                                block.Verts[index].Position);

                                                    if (d2 <= 5)
                                                    {
                                                        block.Left.Verts[block.Left.GetIndex(x1, y1)].Position.Y = block.Verts[index].Position.Y;
                                                    }
                                                }
                                            }
                                        }

                                        if (block.Right != null)
                                        {
                                            for (int x1 = 0; x1 < block.Right.Width; x1++)
                                            {
                                                for (int y1 = 0; y1 < block.Right.Height; y1++)
                                                {
                                                    float d2 = Vector3.Distance(block.Right.Verts[block.Right.GetIndex(x1, y1)].Position,
                                                                                block.Verts[index].Position);

                                                    if (d2 <= 5)
                                                    {
                                                        block.Right.Verts[block.Right.GetIndex(x1, y1)].Position.Y = block.Verts[index].Position.Y;
                                                    }
                                                }
                                            }
                                        }

                                        if (block.Top != null)
                                        {
                                            for (int x1 = 0; x1 < block.Top.Width; x1++)
                                            {
                                                for (int y1 = 0; y1 < block.Top.Height; y1++)
                                                {
                                                    float d2 = Vector3.Distance(block.Top.Verts[block.Top.GetIndex(x1, y1)].Position,
                                                                                block.Verts[index].Position);

                                                    if (d2 <= 5)
                                                    {
                                                        block.Top.Verts[block.Top.GetIndex(x1, y1)].Position.Y = block.Verts[index].Position.Y;
                                                    }
                                                }
                                            }
                                        }

                                        if (block.Bottom != null)
                                        {
                                            for (int x1 = 0; x1 < block.Bottom.Width; x1++)
                                            {
                                                for (int y1 = 0; y1 < block.Bottom.Height; y1++)
                                                {
                                                    float d2 = Vector3.Distance(block.Bottom.Verts[block.Bottom.GetIndex(x1, y1)].Position,
                                                                                block.Verts[index].Position);

                                                    if (d2 <= 5)
                                                    {
                                                        block.Bottom.Verts[block.Bottom.GetIndex(x1, y1)].Position.Y = block.Verts[index].Position.Y;
                                                    }
                                                }
                                            }
                                        }

                                        rebuild = true;
                                    }
                                }
                            }
                            break;

                        case Direction.Down:
                            break;
                        }

                        if (rebuild)
                        {
                            RebuildVertexBuffer(block);
                        }
                    }
                }
            }
        }