//protected int NumberOfSavedChunksAt(Vector3Int pos, int sizePow) //{ // Vector3Int coord = PositionToStorageGroupCoord(pos); // StorageTreeRoot r; // if (storageGroups.TryGetValue(coord, out r)) // { // IStorageGroupOrganizer<StoredChunkEdits> node; // if (r.TryGetNodeWithSizePower(new int[] { pos.x, pos.y, pos.z }, sizePow, out node)) // { // return node.ChildrenWithMipMapReady; // } // } // return 0; //} public void DecreaseChunkLod(CompressedMarchingCubeChunk chunk, int toLodPower) { if (toLodPower == DESTROY_CHUNK_LOD) { chunk.DestroyChunk(); } else if (toLodPower == DEACTIVATE_CHUNK_LOD) { chunk.ResetChunk(); } else { chunk.FreeSimpleChunkCollider(); toLodPower = GetFeasibleReducedLodForChunk(chunk, toLodPower); int toLod = RoundToPowerOf2(toLodPower); if (toLod <= chunk.LOD || chunk.ChunkSize % toLod != 0) { Debug.LogWarning($"invalid new chunk lod {toLodPower} from lod {chunk.LODPower}"); } if (chunk.Leaf.AllSiblingsAreLeafsWithSameTargetLod()) { MergeAndReduceChunkBranch(chunk, toLodPower); } else { ///Decrease single chunk lod ExchangeSingleChunkAsyncParallel(chunk, chunk.CenterPos, toLodPower, chunk.ChunkSizePower, true); } } }