@needle-tools/gltf-build-pipeline 2.11.0 → 2.11.2-next.699e3f9
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 +6 -0
- package/dist/cli/index.js +1 -1
- package/dist/scripts/pack-gltf.js +1 -6
- package/dist/transforms/needle_progressive.js +3 -6
- package/dist/transforms/needle_texture_transform.js +2 -2
- 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,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
|
+
## [2.11.2] - 2025-08-07
|
|
8
|
+
- Change: `product` usecase should not flatten/join objects
|
|
9
|
+
|
|
10
|
+
## [2.11.1] - 2025-08-06
|
|
11
|
+
- Fix: issue where caching didn't store pre-calculated primitive densities. This caused incorrect LOD level calculation at runtime due to missing data when processing the same files a second time with caching enabled.
|
|
12
|
+
|
|
7
13
|
## [2.11.0] - 2025-08-01
|
|
8
14
|
- add: store densities per primitive
|
|
9
15
|
- fix: exception during cache key calculation
|
package/dist/cli/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { ERROR_CODES } from '../constants.js';
|
|
|
13
13
|
// For testing / dev you can run `npm link` in the package directory
|
|
14
14
|
// For removing the link run `npm rm --global @needle-tools/gltf-build-pipeline`
|
|
15
15
|
program
|
|
16
|
-
.command("version", "Print current
|
|
16
|
+
.command("version", "Print current version")
|
|
17
17
|
.action(async ({ logger }) => {
|
|
18
18
|
logger.info(getVersion());
|
|
19
19
|
})
|
|
@@ -4,7 +4,7 @@ import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
|
|
|
4
4
|
import draco3d from 'draco3dgltf';
|
|
5
5
|
import { existsSync, readFileSync, statSync, writeFileSync } from 'fs';
|
|
6
6
|
import { MeshoptDecoder, MeshoptEncoder } from 'meshoptimizer';
|
|
7
|
-
import { dedup,
|
|
7
|
+
import { dedup, prune, resample } from '@gltf-transform/functions';
|
|
8
8
|
import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS, NEEDLE_compression_texture, NEEDLE_mesh_compression, } from '../extensions/index.js';
|
|
9
9
|
import { isLOD, isMeshLOD, needle_animation_transform, needle_asset, needle_mesh_transform, needle_texture_transform, } from '../transforms/index.js';
|
|
10
10
|
import { getOutputPath, getVersion, ioTryReadWithMissingResources, writeNodeIO } from "../utils/index.js";
|
|
@@ -106,11 +106,6 @@ export async function packGLTF(inputFile, outputFile, options) {
|
|
|
106
106
|
keepSolidTextures: true,
|
|
107
107
|
}));
|
|
108
108
|
}
|
|
109
|
-
const isVRM = inputFile.toLowerCase().endsWith(".vrm");
|
|
110
|
-
if (!isVRM && !isProgressiveAsset && config?.usecase === "product") {
|
|
111
|
-
transforms.push(flatten());
|
|
112
|
-
transforms.push(join({ keepNamed: false }));
|
|
113
|
-
}
|
|
114
109
|
await document.transform(...transforms);
|
|
115
110
|
logger.info(`← Writing to ${outputFile}`);
|
|
116
111
|
await writeNodeIO(io, outputFile, document);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferUtils, Document, NodeIO, PropertyType, TextureChannel, Verbosity } from '@gltf-transform/core';
|
|
2
|
-
import { SIMPLIFY_DEFAULTS, WELD_DEFAULTS,
|
|
2
|
+
import { SIMPLIFY_DEFAULTS, WELD_DEFAULTS, listTextureChannels, listTextureSlots, sparse } from '@gltf-transform/functions';
|
|
3
3
|
import draco3d from 'draco3dgltf';
|
|
4
4
|
import { NEEDLE_PROGRESSIVE_EXTENSION_NAME, NEEDLE_progressive } from "../extensions/NEEDLE_progressive/index.js";
|
|
5
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';
|
|
@@ -99,9 +99,6 @@ async function onProcess(file, opts) {
|
|
|
99
99
|
logger.warn("WARN: Progressive meshes are not supported for VRM files yet");
|
|
100
100
|
transforms.push(sparse());
|
|
101
101
|
logger.info("→ Transforming: " + file);
|
|
102
|
-
if (!isVRM && opts.config?.usecase === "product") {
|
|
103
|
-
await document.transform(flatten(), join({ keepNamed: false }));
|
|
104
|
-
}
|
|
105
102
|
await document.transform(...transforms);
|
|
106
103
|
const filename = getOutputPath(file, opts.outpath);
|
|
107
104
|
;
|
|
@@ -476,7 +473,7 @@ async function resizeTexture(options, texture, logger, uri, slots) {
|
|
|
476
473
|
const [maxWidth, maxHeight] = options.size;
|
|
477
474
|
const [srcWidth, srcHeight] = texture.getSize();
|
|
478
475
|
if (srcWidth <= maxWidth && srcHeight <= maxHeight) {
|
|
479
|
-
logger.debug(`[${NAME}] Skipping,
|
|
476
|
+
logger.debug(`[${NAME}] Skipping, texture satisfies requested max size ${maxWidth}x${maxHeight}}`);
|
|
480
477
|
return;
|
|
481
478
|
}
|
|
482
479
|
if (maxWidth <= 0 || maxHeight <= 0) {
|
|
@@ -996,7 +993,7 @@ async function createMeshLod(inputFileName, doc, basePath, level, mesh, meshInfo
|
|
|
996
993
|
const sizeInMB = (bytes.byteLength / 1024 / 1024).toFixed(2);
|
|
997
994
|
logger.info(`[${NAME}] Add LOD ${level} to cache (${sizeInMB} MB) for \"${mesh.getName()}\" as ${cacheKey}`);
|
|
998
995
|
addToCache(cacheKey, bytes);
|
|
999
|
-
addMetaToCache(cacheKey, { meshInfo: newMeshInformation, density: density });
|
|
996
|
+
addMetaToCache(cacheKey, { meshInfo: newMeshInformation, density: density, densities: densities });
|
|
1000
997
|
}
|
|
1001
998
|
return {
|
|
1002
999
|
level,
|
|
@@ -230,7 +230,7 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
230
230
|
successfullyProcessed = await context.toktxContext.process(index, texture, options, context);
|
|
231
231
|
}
|
|
232
232
|
else {
|
|
233
|
-
|
|
233
|
+
logger.warn("Toktx not found: Skipping texture compression: " + originalMimeType);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
if (context.useCache && successfullyProcessed && key) {
|
|
@@ -249,7 +249,7 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
249
249
|
// we remove the original file (since it effectively gets replaced)
|
|
250
250
|
// otherwise we dont touch the original file
|
|
251
251
|
if (inDirectory == outDirectory && existsSync(originalPath)) {
|
|
252
|
-
|
|
252
|
+
logger.info(`Removing old texture \"${originalUri}\" → \"${newUri}\"`);
|
|
253
253
|
rmSync(originalPath);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.11.
|
|
1
|
+
export declare const version = "2.11.2-next.699e3f9";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.11.
|
|
1
|
+
export const version = "2.11.2-next.699e3f9";
|
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.2-next.699e3f9",
|
|
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",
|