@needle-tools/gltf-build-pipeline 2.11.2 → 2.11.3-next.c7edcb3
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 +3 -0
- package/dist/cache/cache.d.ts +1 -1
- package/dist/cache/cache.js +1 -1
- package/dist/cli/index.js +6 -1
- package/dist/extensions/NEEDLE_progressive_texture_settings/index.js +1 -1
- package/dist/transforms/needle_progressive.js +8 -8
- package/dist/utils/version.gen.d.ts +1 -1
- package/dist/utils/version.gen.js +1 -1
- package/package.json +1 -1
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
|
+
## [2.11.3] - 2025-08-08
|
|
8
|
+
- Change: CLI `transform` with `--progressive` does now ignore LOD files
|
|
9
|
+
|
|
7
10
|
## [2.11.2] - 2025-08-07
|
|
8
11
|
- Change: `product` usecase should not flatten/join objects
|
|
9
12
|
|
package/dist/cache/cache.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Logger } from "@donmccurdy/caporal";
|
|
|
6
6
|
* This will remove all files in the cache directory.
|
|
7
7
|
*/
|
|
8
8
|
export declare function clearCache(logger?: Logger): void;
|
|
9
|
-
export declare const cacheSizeLimit
|
|
9
|
+
export declare const cacheSizeLimit: number;
|
|
10
10
|
/**
|
|
11
11
|
* Ensure that the cache size does not exceed the given maximum size in MB.
|
|
12
12
|
* @param maxSizeMB The maximum size in MB.
|
package/dist/cache/cache.js
CHANGED
|
@@ -32,7 +32,7 @@ export function clearCache(logger) {
|
|
|
32
32
|
else
|
|
33
33
|
logger.info(`Cleared cache at ${dir}`);
|
|
34
34
|
}
|
|
35
|
-
export const cacheSizeLimit = 1024;
|
|
35
|
+
export const cacheSizeLimit = 1024 * 5;
|
|
36
36
|
/**
|
|
37
37
|
* Ensure that the cache size does not exceed the given maximum size in MB.
|
|
38
38
|
* @param maxSizeMB The maximum size in MB.
|
package/dist/cli/index.js
CHANGED
|
@@ -127,7 +127,12 @@ Each version will be compressed and written to the output directory.
|
|
|
127
127
|
process.exit(ERROR_CODES.LOST_FILE);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
// If we run compression in a directory that has previously generated LOD files AND this command should also generate LOD files with this command we should ignore found LOD meshes or textures
|
|
131
|
+
else if (file != input && options.progressive === true && isLOD(file)) {
|
|
132
|
+
logger.debug(`→ Ignore existing LOD file at ${file}`);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
logger.info(`→ Transform ${file}`);
|
|
131
136
|
const progressive_results = new Array();
|
|
132
137
|
if (options.progressive === true) {
|
|
133
138
|
if (await make_progressive({
|
|
@@ -30,7 +30,7 @@ export class NEEDLE_progressive_texture_settings extends Extension {
|
|
|
30
30
|
// TODO: find a better way to handle texture definition count and texture count mismatch due to a texture being used in multiple slots (where gltf-transform optimizes the texture list and removes duplicates)
|
|
31
31
|
offset += 1;
|
|
32
32
|
// textureIndex = textureMap.get(key);
|
|
33
|
-
console.log(`INFO: Progressive texture extension was ${i}
|
|
33
|
+
console.log(`INFO: Progressive texture extension was already found at index ${i}...`);
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
@@ -22,7 +22,7 @@ export async function make_progressive(opts) {
|
|
|
22
22
|
}
|
|
23
23
|
// Don't re-process files that are already LODs
|
|
24
24
|
if (isMeshLOD(f) || isImageLOD(f)) {
|
|
25
|
-
opts.logger.info(`Progressive Transform: Ignore existing LOD file at ${f}`);
|
|
25
|
+
opts.logger.info(`[Progressive Transform]: Ignore existing LOD file at ${f}`);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const res = await onProcess(f, opts);
|
|
@@ -40,7 +40,7 @@ export async function make_progressive(opts) {
|
|
|
40
40
|
}
|
|
41
41
|
const resultsChanged = resultsCount !== opts.results.length;
|
|
42
42
|
if (opts.debug)
|
|
43
|
-
console.log(`Progressive Transform: ${opts.results.length} files processed. ${resultsChanged ? "Some results were removed" : ""}`);
|
|
43
|
+
console.log(`[Progressive Transform]: ${opts.results.length} files processed. ${resultsChanged ? "Some results were removed" : ""}`);
|
|
44
44
|
}
|
|
45
45
|
return success;
|
|
46
46
|
}
|
|
@@ -253,7 +253,7 @@ export function make_progressive_textures(filePath, _options = TEXTURE_RESIZE_DE
|
|
|
253
253
|
});
|
|
254
254
|
opts.results.push(outpath);
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const cacheKey = getKey(texture);
|
|
257
257
|
// TODO: this path should be added to the NEEDLE dependencies extension
|
|
258
258
|
const model = {
|
|
259
259
|
guid: textureGuid,
|
|
@@ -261,7 +261,7 @@ export function make_progressive_textures(filePath, _options = TEXTURE_RESIZE_DE
|
|
|
261
261
|
};
|
|
262
262
|
texture.setExtension(NEEDLE_PROGRESSIVE_EXTENSION_NAME, progressiveExt.createTexture(model));
|
|
263
263
|
if (opts.useCache) {
|
|
264
|
-
const cached = tryGetFromCache(
|
|
264
|
+
const cached = tryGetFromCache(cacheKey);
|
|
265
265
|
if (cached) {
|
|
266
266
|
logger.debug(`Progressive image ${index}: using cached preview version (size: ${options.size}))`);
|
|
267
267
|
texture.setImage(cached);
|
|
@@ -275,7 +275,7 @@ export function make_progressive_textures(filePath, _options = TEXTURE_RESIZE_DE
|
|
|
275
275
|
if (opts?.useCache === false) {
|
|
276
276
|
}
|
|
277
277
|
else
|
|
278
|
-
addToCache(
|
|
278
|
+
addToCache(cacheKey, texture.getImage());
|
|
279
279
|
}
|
|
280
280
|
logger.debug(`Progressive transform finished in ${((Date.now() - startTime) / 1000).toFixed(1)} sec.`);
|
|
281
281
|
});
|
|
@@ -492,7 +492,7 @@ async function resizeTexture(options, texture, logger, uri, slots) {
|
|
|
492
492
|
}
|
|
493
493
|
dstWidth = Math.floor(dstWidth);
|
|
494
494
|
dstHeight = Math.floor(dstHeight);
|
|
495
|
-
logger.
|
|
495
|
+
logger.info(`→ Resize texture (${uri || texture.getName() || slots.join(", ")}) from ${srcWidth}x${srcHeight} to ${dstWidth}x${dstHeight}px`);
|
|
496
496
|
// https://sharp.pixelplumbing.com/api-resize
|
|
497
497
|
const buffer = await sharp(texture.getImage())
|
|
498
498
|
.resize(dstWidth, dstHeight, {
|
|
@@ -657,11 +657,11 @@ export function make_progressive_meshes(filePath, _options, opts) {
|
|
|
657
657
|
const vertexDifference = lastMeshInfo.totalVertexCount - meshInfo.totalVertexCount;
|
|
658
658
|
const diff01 = vertexDifference / lastMeshInfo.totalVertexCount;
|
|
659
659
|
if (vertexDifference < 0) {
|
|
660
|
-
|
|
660
|
+
logger.info(`[${NAME}] Flag mesh LOD ${level}: vertex count did increase (${-vertexDifference.toFixed(0)} vertices, ${(-diff01 * 100).toFixed(4)}%) → LOD ${level} will be omitted. \"${mesh.getName()}\" at \"${lodInfo.path}\" ${JSON.stringify(lastMeshInfo)} → ${JSON.stringify(meshInfo)}`);
|
|
661
661
|
shouldOmitLevel = true;
|
|
662
662
|
}
|
|
663
663
|
else if (vertexDifference < 32 || diff01 < 0.05) {
|
|
664
|
-
logger.
|
|
664
|
+
logger.info(`[${NAME}] Flag mesh LOD ${level}: vertex count difference below threshold (removed ${vertexDifference.toFixed(0)} vertices, ${(-diff01 * 100).toFixed(4)}%) → LOD ${level} will be omitted. \"${mesh.getName()}\" at \"${lodInfo.path}\"`);
|
|
665
665
|
shouldOmitLevel = true;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.11.
|
|
1
|
+
export declare const version = "2.11.3-next.c7edcb3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.11.
|
|
1
|
+
export const version = "2.11.3-next.c7edcb3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.3-next.c7edcb3",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|