streaming-gltf 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tools/bake-progressive.mjs +14 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "streaming-gltf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Streaming progressive glTF LOD renderer (BatchedMesh/InstancedMesh tiers, network-lazy GPU-eager LOD streaming, on-GPU position lerping) plus the local bake/convert + streaming-download pipeline (tools/bake-*.mjs).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -423,9 +423,20 @@ export async function bakeProgressive(INPUT, OUT_DIR) {
|
|
|
423
423
|
let target = Math.min(FAR_TRI_CAP * 3, u32.length);
|
|
424
424
|
target -= target % 3;
|
|
425
425
|
target = Math.max(96, target); // >=32 tris
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
// simplifySloppy asserts on some inputs (degenerate / tiny / non-
|
|
427
|
+
// manifold index buffers). The unskinned LOD is an optimization,
|
|
428
|
+
// not a correctness requirement: on failure keep the meshopt-
|
|
429
|
+
// decoded indices as-is (a heavier-but-correct far dot) rather
|
|
430
|
+
// than aborting the whole bake.
|
|
431
|
+
try {
|
|
432
|
+
const res = MeshoptSimplifier.simplifySloppy(u32, f32, 3, null, target, 1e9);
|
|
433
|
+
const out = Array.isArray(res) ? res[0] : res;
|
|
434
|
+
if (out && out.length >= 3) {
|
|
435
|
+
idxAcc.setArray(out instanceof Uint32Array ? out : new Uint32Array(out));
|
|
436
|
+
}
|
|
437
|
+
} catch (e) {
|
|
438
|
+
console.warn(`[bake] simplifySloppy skipped for unskinned LOD (${u32.length / 3} tris): ${e.message}`);
|
|
439
|
+
}
|
|
429
440
|
}
|
|
430
441
|
} else {
|
|
431
442
|
await cloneDoc.transform(
|