@needle-tools/gltf-build-pipeline 1.4.5 → 1.4.6
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.4.6] - 2023-04-10
|
|
8
|
+
- fix: NEEDLE_progressive meshes do not revert primitive data for skinned meshes anymore. See NE-4596
|
|
9
|
+
|
|
7
10
|
## [1.4.5] - 2023-04-05
|
|
8
11
|
- fix: generating mesh and texture LOD for glbs without `NEEDLE_` extension
|
|
9
12
|
- fix: guid generation for progressive meshes when no `NEEDLE_` extension is present
|
|
@@ -474,11 +474,13 @@ export function make_progressive_meshes(filePath, _options, opts) {
|
|
|
474
474
|
let maxDensity = 0;
|
|
475
475
|
let primitiveIndex = 0;
|
|
476
476
|
const lodLevelInFile = generatedLODInfos.length;
|
|
477
|
-
const clonedData =
|
|
477
|
+
const clonedData = { primitives: [], weights: [...mesh.getWeights()] };
|
|
478
478
|
for (const prim of mesh.listPrimitives()) {
|
|
479
479
|
const data = clonePrimitiveData(prim);
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
if (data != null) {
|
|
481
|
+
clonedData.primitives.push(data);
|
|
482
|
+
}
|
|
483
|
+
console.log(`[${NAME}] Simplify mesh[${index}] primitive[${primitiveIndex}] (embedded)`);
|
|
482
484
|
const lastLod = LODS[lodLevelInFile];
|
|
483
485
|
// TODO: this should be run after simplification but then we need to change the runtime to use the LOD 0 density
|
|
484
486
|
const density = calculateMeshDensity(prim);
|
|
@@ -496,7 +498,7 @@ export function make_progressive_meshes(filePath, _options, opts) {
|
|
|
496
498
|
}
|
|
497
499
|
else if (difference < 32 || diff01 <= 0.05) {
|
|
498
500
|
// the lowest LOD has the same vertex count as the original mesh → we don't need to write the extension and can also delete previously generated LODs
|
|
499
|
-
console.log(`[${NAME}]: Flag mesh LOD ${generatedLODInfos.length}: vertex count difference below threshold (removed ${difference} vertices, ${(-diff01 * 100).toFixed(2)} %) → will remove
|
|
501
|
+
console.log(`[${NAME}]: Flag mesh LOD ${generatedLODInfos.length} (embedded): vertex count difference below threshold (removed ${difference} vertices, ${(-diff01 * 100).toFixed(2)} %) → will remove LOD. \"${mesh.getName()}\"`);
|
|
500
502
|
try {
|
|
501
503
|
for (const lodInfo of generatedLODInfos) {
|
|
502
504
|
rmSync(outputDirectory + "/" + lodInfo.path);
|
|
@@ -507,9 +509,12 @@ export function make_progressive_meshes(filePath, _options, opts) {
|
|
|
507
509
|
}
|
|
508
510
|
// reset data (simplify might have changed the mesh data that we cloned before)
|
|
509
511
|
const primitives = mesh.listPrimitives();
|
|
510
|
-
if (clonedData.length == primitives.length) {
|
|
512
|
+
if (clonedData.primitives.length == primitives.length) {
|
|
513
|
+
if (clonedData.weights?.length > 0) {
|
|
514
|
+
mesh.setWeights(clonedData.weights);
|
|
515
|
+
}
|
|
511
516
|
for (let i = 0; i < primitives.length; i++) {
|
|
512
|
-
setPrimitiveData(primitives[i], clonedData[i]);
|
|
517
|
+
setPrimitiveData(primitives[i], clonedData.primitives[i]);
|
|
513
518
|
}
|
|
514
519
|
}
|
|
515
520
|
return;
|
|
@@ -540,9 +545,14 @@ export function make_progressive_meshes(filePath, _options, opts) {
|
|
|
540
545
|
});
|
|
541
546
|
}
|
|
542
547
|
function clonePrimitiveData(prim) {
|
|
548
|
+
const semantics = prim.listSemantics();
|
|
549
|
+
if (semantics.some(s => s.includes("JOINTS"))) {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
543
552
|
const indices = new Uint32Array(prim.getIndices().getArray());
|
|
544
553
|
const attributes = {};
|
|
545
|
-
for (const attr of
|
|
554
|
+
for (const attr of semantics) {
|
|
555
|
+
console.log(`[${NAME}] Clone attribute ${attr}`);
|
|
546
556
|
const accessor = prim.getAttribute(attr);
|
|
547
557
|
if (accessor) {
|
|
548
558
|
attributes[attr] = new Float32Array(accessor.getArray());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|