Skip to content

Commit

Permalink
feat(terrain): support removal of loaded terrain
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Dec 29, 2023
1 parent 6f5f049 commit f9da66f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/terrain/TerrainManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ class TerrainManager {
return loading;
}

removeArea(areaId: number) {
const group = this.#loadedAreas.get(areaId);
if (!group) {
return;
}

for (const mesh of group.children) {
(mesh as TerrainMesh).dispose();
}

this.#loadedAreas.delete(areaId);
}

async #loadArea(areaId: number, area: MapArea) {
const group = new THREE.Group();
group.name = 'terrain';
Expand Down

0 comments on commit f9da66f

Please sign in to comment.