Example #1
0
        public static void OnEndBuildLayers(this ClipmapLevel clipmapLevel, ClipmapCell clipmapCell, ClipmapChunk nullableClipmapChunk)
        {
            nullableClipmapChunks[clipmapLevel.id][clipmapCell.id] = nullableClipmapChunk;

            remainingCellCount[clipmapLevel.id]--;
            Logger.Debug($"Decrementing remainingCellCount to {remainingCellCount[clipmapLevel.id]}");

            if (remainingCellCount[clipmapLevel.id] <= 0)
            {
                clipmapLevel.SwapChunks(nullableClipmapChunks[clipmapLevel.id]);
                nullableClipmapChunks[clipmapLevel.id].Clear();

                if (remainingCellCount.All((levelCountPair) => levelCountPair.Value <= 0))
                {
                    isMeshesRebuilding = false;
                    Logger.Debug($"{clipmapLevel}: Mesh building finished with 'remainingCellCount' of {remainingCellCount[clipmapLevel.id]}");

                    if (rebuildingMessage != null)
                    {
                        ErrorMessageExtensions.SetMessageTimeEnd(rebuildingMessage, Time.time);
                        ErrorMessageExtensions.pendingMessageToRemove = rebuildingMessage;
                        rebuildingMessage = null;
                    }
                }
            }
            else if (rebuildingMessage != null)
            {
                var oldTimeEnd  = ErrorMessageExtensions.GetMessageTimeEnd(rebuildingMessage);
                var timeFadeOut = ErrorMessageExtensions.GetTimeFadeOut();
                if (oldTimeEnd - timeFadeOut < Time.time)
                {
                    rebuildingMessage = ErrorMessageExtensions.AddReturnMessage(rebuildingTerrainMsg);
                }
            }
        }
Example #2
0
        public static void OnBatchOctreesEdited(this ClipmapLevel clipmapLevel, List <Int3.Bounds> blockRanges)
        {
            var processingCells = clipmapLevel.GetProcessingCells(blockRanges);

            if (!remainingCellCount.ContainsKey(clipmapLevel.id))
            {
                remainingCellCount[clipmapLevel.id] = 0;
            }

            if (remainingCellCount.All((levelCountPair) => levelCountPair.Value <= 0))
            {
                isMeshesRebuilding = true;
                if (Config.Instance.rebuildMessages)
                {
                    rebuildingMessage = ErrorMessageExtensions.AddReturnMessage(rebuildingTerrainMsg);
                }
            }

            remainingCellCount[clipmapLevel.id] += processingCells.Count;
            if (!nullableClipmapChunks.ContainsKey(clipmapLevel.id))
            {
                nullableClipmapChunks[clipmapLevel.id] = new Dictionary <Int3, ClipmapChunk>();
            }

            Logger.Debug($"{clipmapLevel}: Setting remainingCellCount to {remainingCellCount[clipmapLevel.id]}");

            foreach (var cell in processingCells)
            {
                cell.OnBatchOctreesEdited();
            }
        }