This commit is contained in:
@@ -53,9 +53,11 @@ export async function convertStepFile(
|
|||||||
sourceFile: path.basename(inputPath),
|
sourceFile: path.basename(inputPath),
|
||||||
meshCount: result.meshes.length,
|
meshCount: result.meshes.length,
|
||||||
meshes: result.meshes.map(mesh => {
|
meshes: result.meshes.map(mesh => {
|
||||||
const pos = mesh.attributes.position.array
|
// Explicitly wrap in typed arrays — WASM may return array-like objects
|
||||||
const nor = mesh.attributes.normal?.array
|
// without a .buffer property, which would break Buffer.from().
|
||||||
const idx = mesh.index.array
|
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 {
|
return {
|
||||||
positions: Buffer.from(pos.buffer, pos.byteOffset, pos.byteLength).toString('base64'),
|
positions: Buffer.from(pos.buffer, pos.byteOffset, pos.byteLength).toString('base64'),
|
||||||
normals: nor ? Buffer.from(nor.buffer, nor.byteOffset, nor.byteLength).toString('base64') : null,
|
normals: nor ? Buffer.from(nor.buffer, nor.byteOffset, nor.byteLength).toString('base64') : null,
|
||||||
|
|||||||
Reference in New Issue
Block a user