private void UpdateVisibleChunks(Simulation.Simulation simulation) { //Clear visible chunks so we dont have to figure out which chunks are no longer being seen VisibleChunks.Clear(); Chunk rootChunk = simulation.World.ChunkIndex[ChunkKey]; //find the chunks that the player is currently simulating for (int y = rootChunk.ChunkY - simulation.SimulationDistance; y < rootChunk.ChunkY + simulation.SimulationDistance; y++) { for (int x = rootChunk.ChunkX - simulation.SimulationDistance; x < rootChunk.ChunkX + simulation.SimulationDistance; x++) { //Get a chunk if it exist at the location Chunk visibleChunk; if ((visibleChunk = simulation.World.ChunkFromChunkLocation(x, y)) == null) { continue; } //Add chunk to visible chunks VisibleChunks.Add(visibleChunk.ChunkKey); //update chunk history if new with a negative number so a full chunk update will be forced if (!ChunkVersions.ContainsKey(visibleChunk.ChunkKey)) { ChunkVersions[visibleChunk.ChunkKey] = -1; } } } }
public static void Render() { VisibleChunks.Clear(); foreach (var file in mActiveFiles) { file.RenderADT(SlimDX.Matrix.Identity); } }