Skip to content

Commit

Permalink
feat(terrain): improve terrain loading speed
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Jan 3, 2024
1 parent 3b8e912 commit a524995
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/terrain/TerrainManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ class TerrainManager {
group.matrixAutoUpdate = false;
group.matrixWorldAutoUpdate = false;

for (const chunk of area.chunks) {
if (chunk.layers.length === 0) {
continue;
}
const renderableChunks = area.chunks.filter((chunk) => chunk.layers.length > 0);
const meshes = await Promise.all(renderableChunks.map((chunk) => this.#createMesh(chunk)));

const mesh = await this.#createMesh(chunk);
for (const mesh of meshes) {
group.add(mesh);
}

Expand Down

0 comments on commit a524995

Please sign in to comment.