示例#1
0
        public void UpdatePieceMeshes(RectangleF region)
        {
            currentHeightMapVersion++;
            int npiecesw = Pieces.GetLength(1);
            int npiecesh = Pieces.GetLength(0);

            region.X      -= PieceSize.Width / 4 / Size.Width;
            region.Y      -= PieceSize.Height / 4 / Size.Height;
            region.Width  += PieceSize.Width / 2 / Size.Width;
            region.Height += PieceSize.Height / 2 / Size.Height;
            for (int y = (int)(region.Top * npiecesh); y <= (int)(region.Bottom * npiecesh) && y < Pieces.GetLength(0); y++)
            {
                for (int x = (int)(region.Left * npiecesw); x <= (int)(region.Right * npiecesw) && x < Pieces.GetLength(1); x++)
                {
                    Pieces[y, x].UpdateMesh();
                }
            }
        }