protected override void OnProcessChunk(Chunk chunk) { Profiler.BeginSample("ProcessChunk"); int xd = (m_viewerPos.x - chunk.Pos.x) / Env.ChunkSize; int yd = (m_viewerPos.y - chunk.Pos.y) / Env.ChunkSize; int zd = (m_viewerPos.z - chunk.Pos.z) / Env.ChunkSize; // Remove the chunk if it is too far away if ( !ChunkLoadOrder.CheckXZ(xd, zd, HorizontalChunkLoadRadius) || !ChunkLoadOrder.CheckY(yd, VerticalChunkLoadRadius) ) { chunk.RequestRemoval(); } else { // Dummy collider example - create a collider for chunks directly surrounding the viewer chunk.NeedsColliderGeometry = Helpers.Abs(xd) <= 1 && Helpers.Abs(yd) <= 1 && Helpers.Abs(zd) <= 1; if (!UseFrustumCulling) { // Update visibility information chunk.NeedsRenderGeometry = true; chunk.PossiblyVisible = true; } } Profiler.EndSample(); }
protected override void OnProcessChunk(Chunk chunk) { Profiler.BeginSample("ProcessChunk"); int tx = m_clipmap.TransformX(chunk.Pos.x / Env.ChunkSize); int ty = m_clipmap.TransformY(chunk.Pos.y / Env.ChunkSize); int tz = m_clipmap.TransformZ(chunk.Pos.z / Env.ChunkSize); // Chunk is too far away. Remove it if (!m_clipmap.IsInsideBounds_Transformed(tx, ty, tz)) { chunk.RequestRemoval(); } else { // Dummy collider example - create a collider for chunks directly surrounding the viewer int xd = Helpers.Abs((m_viewerPos.x - chunk.Pos.x) / Env.ChunkSize); int yd = Helpers.Abs((m_viewerPos.y - chunk.Pos.y) / Env.ChunkSize); int zd = Helpers.Abs((m_viewerPos.z - chunk.Pos.z) / Env.ChunkSize); chunk.NeedsColliderGeometry = xd <= 1 && yd <= 1 && zd <= 1; if (!UseFrustumCulling) { ClipmapItem item = m_clipmap.Get_Transformed(tx, ty, tz); // Chunk is in visibilty range. Full update with geometry generation is possible if (item.IsInVisibleRange) { //chunk.LOD = item.LOD; chunk.PossiblyVisible = true; chunk.NeedsRenderGeometry = true; } // Chunk is in cached range. Full update except for geometry generation else { //chunk.LOD = item.LOD; chunk.PossiblyVisible = true; chunk.NeedsRenderGeometry = false; } } } }