private BoundingPatch[,] Combine2X2Patches(Patch[,] patchesInput)
        {
            var newRows       = (patchesInput.GetLength(0) + 1) / 2;
            var newCols       = (patchesInput.GetLength(1) + 1) / 2;
            var patchesOutput = new BoundingPatch[newRows, newCols];

            for (var y = 0; y < newRows; y++)
            {
                for (var x = 0; x < newCols; x++)
                {
                    var hierarchicalPatch = new BoundingPatch(Ctx);
                    for (var k = 0; k <= 1; k++)
                    {
                        for (var j = 0; j <= 1; j++)
                        {
                            var row = 2 * y + k;
                            var col = 2 * x + j;

                            if (row < patchesInput.GetLength(0) && col < patchesInput.GetLength(1))
                            {
                                hierarchicalPatch.AddChild(patchesInput[row, col]);
                            }
                            else
                            {
                                hierarchicalPatch.AddChild(null);
                            }
                        }
                    }
                    patchesOutput[y, x] = hierarchicalPatch;
                }
            }
            return(patchesOutput);
        }
        private void CreatePatchHierarchy()
        {
            var patchHierarchy = Combine2X2Patches(_grassPatches);

            while (patchHierarchy.Length > 1)
            {
                patchHierarchy = Combine2X2Patches(patchHierarchy);
            }
            _rootPatch = patchHierarchy[0, 0];
        }