Skip to content

Commit

Permalink
ensures the final mesh is loaded before attempting to download
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnnnii committed Nov 1, 2024
1 parent 84e2479 commit 8c3f681
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/hooks/queries/download/create-mesh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ async function mergeSliceMeshes(
.concat(meshUtils.convertVertexSpace(elevation, vertexSpace, { signal }));

if (includeOriginMarker) {
const originMesh = await createOriginMarker(projectedOrigin);
const zmax = features.reduce((max, next) => next.extent.zmax > max ? next.extent.zmax : max, elevation.extent.zmax);
const zmin = features.reduce((min, next) => min > next.extent.zmin ? next.extent.zmin : min, elevation.extent.zmin);
const height = zmax - zmin;

console.log({ height })
const originMesh = await createOriginMarker(projectedOrigin, height);
meshPromises.push(meshUtils.convertVertexSpace(originMesh, vertexSpace, { signal }))
}

Expand Down Expand Up @@ -93,5 +98,7 @@ export async function createMesh({
signal,
});

await slice.load();

return slice;
}

0 comments on commit 8c3f681

Please sign in to comment.