@needle-tools/gltf-build-pipeline 1.1.6 → 1.2.0
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,12 @@ 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.2.0] - 2023-07-21
|
|
8
|
+
- add: resolving of material json pointers
|
|
9
|
+
|
|
10
|
+
## [1.1.6] - 2023-07-10
|
|
11
|
+
- change: bump gltf-transform dependency to latest 3.4.6
|
|
12
|
+
|
|
7
13
|
## [1.1.5] - 2023-06-26
|
|
8
14
|
- change: bump gltf-transform dependency to latest 3.4.3
|
|
9
15
|
|
|
@@ -556,16 +556,27 @@ class JsonPointerHandler {
|
|
|
556
556
|
console.warn("WARN: failed registering pointer", fullPath, value);
|
|
557
557
|
}
|
|
558
558
|
if (value.startsWith("/materials/")) {
|
|
559
|
-
// set a reference to the material to avoid dedup
|
|
560
|
-
// see https://github.com/donmccurdy/glTF-Transform/issues/980#issuecomment-1585748202
|
|
561
559
|
if (this.debug)
|
|
562
560
|
console.log("Read pointer", value);
|
|
563
561
|
const index = parseInt(value.substring("/materials/".length));
|
|
564
562
|
const mat = context.materials[index];
|
|
565
563
|
if (mat) {
|
|
566
|
-
|
|
567
|
-
|
|
564
|
+
// UPDATE: I think the code below is not necessary anymore when we resolve the deduplicated material index
|
|
565
|
+
// set a reference to the material to avoid dedup
|
|
566
|
+
// see https://github.com/donmccurdy/glTF-Transform/issues/980#issuecomment-1585748202
|
|
567
|
+
// if (ext) {
|
|
568
|
+
// ext.setReference(value, mat);
|
|
569
|
+
// }
|
|
570
|
+
let pointer = this.map.get(value);
|
|
571
|
+
if (!pointer) {
|
|
572
|
+
const definition = context.jsonDoc.json.materials[index];
|
|
573
|
+
const res = new MaterialPointerResolver(this.document, mat, definition);
|
|
574
|
+
res.init(context); // < init here otherwise the fields defined in the TexturePointer will be undefined (this caused e.g. finding the previous texture filter to fail)
|
|
575
|
+
pointer = new JsonPointer("/materials/", res);
|
|
576
|
+
pointer.debug = this.debug;
|
|
577
|
+
this.map.set(value, pointer);
|
|
568
578
|
}
|
|
579
|
+
pointer?.register(obj, key);
|
|
569
580
|
}
|
|
570
581
|
}
|
|
571
582
|
}
|
|
@@ -715,3 +726,10 @@ function findSource(texDef) {
|
|
|
715
726
|
}
|
|
716
727
|
return undefined;
|
|
717
728
|
}
|
|
729
|
+
class MaterialPointerResolver extends PointerResolver {
|
|
730
|
+
init(context) {
|
|
731
|
+
}
|
|
732
|
+
resolve(context) {
|
|
733
|
+
return context.materialIndexMap.get(this.inputObject);
|
|
734
|
+
}
|
|
735
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|