new model viewer fix 2
Build and Push Docker Image / build (push) Successful in 12s

This commit is contained in:
jason
2026-04-23 09:20:16 -05:00
parent 023344aef0
commit bae1303e42
+5 -3
View File
@@ -53,9 +53,11 @@ export async function convertStepFile(
sourceFile: path.basename(inputPath),
meshCount: result.meshes.length,
meshes: result.meshes.map(mesh => {
const pos = mesh.attributes.position.array
const nor = mesh.attributes.normal?.array
const idx = mesh.index.array
// Explicitly wrap in typed arrays — WASM may return array-like objects
// without a .buffer property, which would break Buffer.from().
const pos = new Float32Array(mesh.attributes.position.array)
const nor = mesh.attributes.normal ? new Float32Array(mesh.attributes.normal.array) : null
const idx = new Uint32Array(mesh.index.array)
return {
positions: Buffer.from(pos.buffer, pos.byteOffset, pos.byteLength).toString('base64'),
normals: nor ? Buffer.from(nor.buffer, nor.byteOffset, nor.byteLength).toString('base64') : null,