internal void KeepOrDiscardClippedCells(RequestCollector collector) { LodLevel parentLod, childLod; GetNearbyLodLevels(out parentLod, out childLod); MyCellCoord thisLodCell = new MyCellCoord(); foreach (var entry in m_clippedCells) { var data = entry.Value; bool needed = false; // too far, but less detailed data might be missing so we still check parent thisLodCell.SetUnpack(entry.Key); needed = !WasAncestorCellLoaded(parentLod, ref thisLodCell); if (needed) { if (data.State == CellState.Invalid) { if (!TryAddCellRequest(collector, parentLod, thisLodCell, entry.Key, data)) { continue; } } m_storedCellData.Add(entry.Key, data); } else { if (UseCache && data.State == CellState.Loaded) { var clipmapCellId = MyCellCoord.GetClipmapCellHash(m_clipmap.Id, entry.Key); CellsCache.Write(clipmapCellId, data); Delete(entry.Key, data, false); } else { if (data.State == CellState.Pending) { collector.CancelRequest(entry.Key); } if (data.Cell != null) { Delete(entry.Key, data); } } if (!UseCache) { CellsCache.Reset(); } } } m_clippedCells.Clear(); }
internal void KeepOrDiscardClippedCells(RequestCollector collector) { LodLevel parentLod, childLod; GetNearbyLodLevels(out parentLod, out childLod); MyCellCoord thisLodCell = new MyCellCoord(); foreach (var entry in m_clippedCells) { var data = entry.Value; bool needed = false; // too far, but less detailed data might be missing so we still check parent thisLodCell.SetUnpack(entry.Key); needed = !WasAncestorCellLoaded(parentLod, ref thisLodCell); if (needed) { if (data.State == CellState.Invalid) { collector.AddRequest(entry.Key, data.WasLoaded); data.State = CellState.Pending; } m_storedCellData.Add(entry.Key, data); } else { if (data.State == CellState.Pending) { collector.CancelRequest(entry.Key); } if (data.Cell != null) { Delete(entry.Key, data); } } } m_clippedCells.Clear(); }
internal void KeepOrDiscardClippedCells(RequestCollector collector) { LodLevel parentLod, childLod; GetNearbyLodLevels(out parentLod, out childLod); MyCellCoord thisLodCell = new MyCellCoord(); foreach (var entry in m_clippedCells) { var data = entry.Value; bool needed = false; // too far, but less detailed data might be missing so we still check parent thisLodCell.SetUnpack(entry.Key); needed = !WasAncestorCellLoaded(parentLod, ref thisLodCell); if (needed) { if (data.State == CellState.Invalid) { collector.AddRequest(entry.Key, data.WasLoaded); data.State = CellState.Pending; } m_storedCellData.Add(entry.Key, data); } else { if (data.State == CellState.Pending) collector.CancelRequest(entry.Key); if (data.Cell != null) Delete(entry.Key, data); } } m_clippedCells.Clear(); }
internal void KeepOrDiscardClippedCells(RequestCollector collector) { LodLevel parentLod, childLod; GetNearbyLodLevels(out parentLod, out childLod); MyCellCoord thisLodCell = new MyCellCoord(); foreach (var entry in m_clippedCells) { var data = entry.Value; bool needed = false; // too far, but less detailed data might be missing so we still check parent thisLodCell.SetUnpack(entry.Key); needed = !WasAncestorCellLoaded(parentLod, ref thisLodCell); if (needed) { if (data.State == CellState.Invalid) { if (!TryAddCellRequest(collector, parentLod, thisLodCell, entry.Key, data)) continue; } m_storedCellData.Add(entry.Key, data); } else { if (UseCache && data.State == CellState.Loaded) { var clipmapCellId = MyCellCoord.GetClipmapCellHash(m_clipmap.Id, entry.Key); CellsCache.Write(clipmapCellId, data); Delete(entry.Key, data, false); } else { if (data.State == CellState.Pending) collector.CancelRequest(entry.Key); if (data.Cell != null) Delete(entry.Key, data); } if (!UseCache) { CellsCache.Reset(); } } } m_clippedCells.Clear(); }