Parallelize model loading
This commit is contained in:
parent
5a5656109e
commit
ec68fccaa3
1 changed files with 5 additions and 3 deletions
|
@ -22,14 +22,16 @@ export async function buildMeshes(
|
||||||
mappedFeatures: MappedFeature[],
|
mappedFeatures: MappedFeature[],
|
||||||
model: Group
|
model: Group
|
||||||
) {
|
) {
|
||||||
for (let i = 0; i < mappedFeatures.length; i++) {
|
const meshPromises = mappedFeatures.map(async (layerData) => {
|
||||||
const layerData = mappedFeatures[i];
|
|
||||||
const mesh = await buildMesh(layerData);
|
const mesh = await buildMesh(layerData);
|
||||||
if (layerData.name === "Topography") {
|
if (layerData.name === "Topography") {
|
||||||
mesh.visible = false;
|
mesh.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
model.add(mesh);
|
model.add(mesh);
|
||||||
}
|
});
|
||||||
|
|
||||||
|
await Promise.all(meshPromises);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function buildMesh(layerData: MappedFeature) {
|
async function buildMesh(layerData: MappedFeature) {
|
||||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue