예제 #1
0
            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();
            }
예제 #2
0
            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();
            }
예제 #3
0
            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();
            }
예제 #4
0
            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();
            }