diff --git a/worldwind/src/commonMain/kotlin/earth/worldwind/render/PathBatchRenderer.kt b/worldwind/src/commonMain/kotlin/earth/worldwind/render/PathBatchRenderer.kt index fd7d7158..a51260d4 100644 --- a/worldwind/src/commonMain/kotlin/earth/worldwind/render/PathBatchRenderer.kt +++ b/worldwind/src/commonMain/kotlin/earth/worldwind/render/PathBatchRenderer.kt @@ -60,8 +60,9 @@ class PathBatchRenderer : BatchRenderer { } override fun render(rc : RenderContext) { - // remove shapes that wasn't requested to be drawn this frame - for(path in pathToBatchedPaths.keys) { + // Remove shapes that wasn't requested to be drawn this frame + val pathsToRemove = pathToBatchedPaths.keys.filter { it.lastRequestedFrameIndex != rc.frameIndex } + for(path in pathsToRemove) { if(path.lastRequestedFrameIndex != rc.frameIndex) { removePathFromBatch(path) }