@needle-tools/gltf-build-pipeline 1.4.9 → 1.4.11
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,13 @@ 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.11] - 2023-04-29
|
|
8
|
+
- add: NEEDLE_progressive mesh now run sparse transform
|
|
9
|
+
- change: cli params for debug and caching are now `--debug` and `--no-caching`
|
|
10
|
+
|
|
11
|
+
## [1.4.10] - 2023-04-23
|
|
12
|
+
- add: NEEDLE_progressive can now load and process already draco compressed meshes
|
|
13
|
+
|
|
7
14
|
## [1.4.9] - 2023-04-23
|
|
8
15
|
- add: NEEDLE_progressive now have `hash` field for LODs which is generated using the content of the LOD and it's settings that produced it.
|
|
9
16
|
- fix: NEEDLE_progressive catches error when copying mesh with extensions where the copy operation fails
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BufferUtils, Document, NodeIO, PropertyType } from '@gltf-transform/core';
|
|
2
2
|
import { SIMPLIFY_DEFAULTS, WELD_DEFAULTS, listTextureSlots, sparse } from '@gltf-transform/functions';
|
|
3
|
+
import draco3d from 'draco3dgltf';
|
|
3
4
|
import { NEEDLE_PROGRESSIVE_EXTENSION_NAME, NEEDLE_progressive } from "../extensions/NEEDLE_progressive/index.js";
|
|
4
5
|
import { createOpaqueExtension, currentGenerator, NEEDLE_compression_texture, NEEDLE_mesh_compression, NEEDLE_progressive_mesh_settings, NEEDLE_progressive_texture_settings, registerExtensions as registerDefaultExtensions } from '../extensions/index.js';
|
|
5
6
|
import path, { basename } from 'path';
|
|
@@ -20,7 +21,7 @@ export async function make_progressive(opts) {
|
|
|
20
21
|
console.log(`Progressive Transform: Ignore existing LOD file at ${f}`);
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
await
|
|
24
|
+
await onProcess(f, opts);
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
function registerExtensions(io) {
|
|
@@ -36,7 +37,7 @@ function registerExtensions(io) {
|
|
|
36
37
|
// createOpaqueExtension(NEEDLE_mesh_compression.EXTENSION_NAME, [PropertyType.ROOT, PropertyType.MESH, PropertyType.PRIMITIVE]),
|
|
37
38
|
]);
|
|
38
39
|
}
|
|
39
|
-
async function
|
|
40
|
+
async function onProcess(file, opts) {
|
|
40
41
|
if (!file.endsWith(".glb") && !file.endsWith(".gltf")) {
|
|
41
42
|
console.log("ERR: file is not gltf/glb");
|
|
42
43
|
return;
|
|
@@ -49,6 +50,8 @@ async function process(file, opts) {
|
|
|
49
50
|
registerExtensions(io);
|
|
50
51
|
io.registerDependencies({
|
|
51
52
|
'meshopt.decoder': MeshoptDecoder,
|
|
53
|
+
'draco3d.decoder': await draco3d.createDecoderModule(),
|
|
54
|
+
'draco3d.encoder': await draco3d.createEncoderModule(),
|
|
52
55
|
});
|
|
53
56
|
const document = await io.read(file).catch((err) => {
|
|
54
57
|
// Log this message as a warning, it happens when trying to run on a already compressed gltf file (e.g. pre-processed. When logging an error we fail the build which is not desired)
|
|
@@ -719,6 +722,7 @@ async function createMeshLod(doc, basePath, level, mesh, meshInfo, guid, lodLeve
|
|
|
719
722
|
console.log(`[${NAME}] Pass compression format to mesh LOD ${level} → ${JSON.stringify(compressionExt.model)}`);
|
|
720
723
|
newDoc.getRoot().setExtension(NEEDLE_mesh_compression.EXTENSION_NAME, newProp);
|
|
721
724
|
}
|
|
725
|
+
await newDoc.transform(sparse());
|
|
722
726
|
const newIo = new NodeIO();
|
|
723
727
|
registerExtensions(newIo);
|
|
724
728
|
console.log(`[${NAME}] Write mesh LOD ${level} with to \"${fileName}\"`);
|
package/dist/utils/fileutils.js
CHANGED
|
@@ -48,6 +48,10 @@ export async function foreachGLTF(args, callback) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
async function testEntry(entry, callback, context) {
|
|
51
|
+
// ignore argument names (e.g. --debug)
|
|
52
|
+
if (entry.startsWith("--")) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
51
55
|
if (entry === "." || entry === "./") {
|
|
52
56
|
if (context.baseDirectory) {
|
|
53
57
|
entry = context.baseDirectory;
|
|
@@ -62,7 +66,7 @@ async function testEntry(entry, callback, context) {
|
|
|
62
66
|
// Try resolve potential relative path
|
|
63
67
|
const newPath = context.baseDirectory + "/" + entry;
|
|
64
68
|
if (existsSync(newPath) === false) {
|
|
65
|
-
console.log(`INFO: Resolved path failed: ${entry} -> ${newPath} (doesnt exist or is locked by another process)`);
|
|
69
|
+
console.log(`INFO: Resolved path failed: \"${entry}\" -> ${newPath} (doesnt exist or is locked by another process)`);
|
|
66
70
|
return;
|
|
67
71
|
}
|
|
68
72
|
else {
|
package/make-progressive.mjs
CHANGED
|
@@ -7,8 +7,8 @@ console.log(`[Needle Build Pipeline] transform to progressive — version ${getV
|
|
|
7
7
|
|
|
8
8
|
make_progressive({
|
|
9
9
|
path: args,
|
|
10
|
-
debug: args.includes("debug"),
|
|
11
|
-
useCache: args.includes("no-caching") === false,
|
|
10
|
+
debug: args.includes("--debug"),
|
|
11
|
+
useCache: args.includes("--no-caching") === false,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
|
package/pack-gltf.mjs
CHANGED
|
@@ -58,12 +58,12 @@ if (debug) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
let allowCaching = true;
|
|
61
|
-
if (args.includes("no-caching")) {
|
|
61
|
+
if (args.includes("--no-caching")) {
|
|
62
62
|
console.log("Caching is disabled")
|
|
63
63
|
allowCaching = false;
|
|
64
64
|
}
|
|
65
65
|
else if (showHelp)
|
|
66
|
-
console.log("Caching is enabled, use \"no-caching\" to disable it");
|
|
66
|
+
console.log("Caching is enabled, use \"--no-caching\" to disable it");
|
|
67
67
|
|
|
68
68
|
const noToktx = args.includes("no-toktx");
|
|
69
69
|
if (noToktx)
|
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.11",
|
|
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",
|