internal CellData GetCell(MyLodTypeEnum lod, ref Vector3I cellCoord) { Int64 key = MySession.Static.VoxelMaps.GetCellHashCode(m_voxelMap.VoxelMapId, ref cellCoord, lod); CellData cachedCell; if (!m_cellsByCoordinate.TryGetValue(key, out cachedCell)) { if (CellAffectsTriangles(m_voxelMap.Storage, lod, ref cellCoord)) { cachedCell = CellPool.AllocateOrCreate(); m_cellsByCoordinate.Add(key, cachedCell); Profiler.Begin("Cell precalc"); MyVoxelPrecalc.PrecalcImmediatelly( new MyVoxelPrecalcTaskItem( lod, m_voxelMap, cachedCell, new Vector3I( cellCoord.X * MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS, cellCoord.Y * MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS, cellCoord.Z * MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS))); Profiler.End(); } } return(cachedCell); }
internal CellData GetCellLater(MyLodTypeEnum lod, ref Vector3I cellCoord) { Int64 key = MySession.Static.VoxelMaps.GetCellHashCode(m_voxelMap.VoxelMapId, ref cellCoord, lod); CellData cachedCell; if (!m_cellsByCoordinate.TryGetValue(key, out cachedCell)) { if (CellAffectsTriangles(m_voxelMap.Storage, lod, ref cellCoord)) { cachedCell = CellPool.AllocateOrCreate(); m_cellsByCoordinate.Add(key, cachedCell); MyVoxelPrecalc.AddToQueue(MyLodTypeEnum.LOD0, m_voxelMap, cachedCell, cellCoord.X * MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS, cellCoord.Y * MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS, cellCoord.Z * MyVoxelConstants.GEOMETRY_CELL_SIZE_IN_VOXELS); } } return(cachedCell); }