@needle-tools/gltf-build-pipeline 2.2.0-alpha.6 → 2.2.0-alpha.7
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 -1
- package/dist/transforms/needle_progressive.js +29 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,10 @@ 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.2.0-alpha.
|
|
7
|
+
## [2.2.0-alpha.7] - 2023-06-13
|
|
8
8
|
- fix: progressive transform of converted GLB files where meshes don't have indicies
|
|
9
|
+
- fix: skip progressive texture generation for textures for textures that already match the lowest LOD size
|
|
10
|
+
- fix: if compression is set to None the LOD textures should respect that setting and also not be compressed
|
|
9
11
|
|
|
10
12
|
## [2.2.0-alpha.5] - 2023-06-06
|
|
11
13
|
- add: CLI `--progressive` option to `transform` command (default is true)
|
|
@@ -172,11 +172,15 @@ export function make_progressive_textures(filePath, _options = TEXTURE_RESIZE_DE
|
|
|
172
172
|
logger.debug(`[${NAME}] Skipping because progressive extension is not available. ${textureIndex}`);
|
|
173
173
|
continue;
|
|
174
174
|
}
|
|
175
|
+
/** This is the current texture's size */
|
|
176
|
+
const currentSize = Math.min(...texture.getSize());
|
|
177
|
+
if (currentSize <= settings.maxSize) {
|
|
178
|
+
logger.debug(`[${NAME}] Skipping, texture[${textureIndex}] is already smaller than the requested size: ${currentSize}px <= ${settings.maxSize}px`);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
175
181
|
const textureGuid = settings.guid?.length ? settings.guid : generateGuid(filename + "_texture_" + index.toString());
|
|
176
182
|
/** This is the size of the texture that is embedded in the glTF. No LOD should be smaller than this */
|
|
177
183
|
const maxSize = settings.maxSize;
|
|
178
|
-
/** This is the current texture's size */
|
|
179
|
-
const currentSize = Math.min(...texture.getSize());
|
|
180
184
|
const LOD_LEVEL = new Array();
|
|
181
185
|
LOD_LEVEL.push({ size: currentSize });
|
|
182
186
|
let generateLods = true; //opts.config?.usecase === "world";
|
|
@@ -313,27 +317,32 @@ async function createTextureLod(args, opts) {
|
|
|
313
317
|
// Make sure the material is used
|
|
314
318
|
createMeshForMaterial(newDoc, newMaterial, slot_index++);
|
|
315
319
|
}
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
320
|
+
const compressionSettingsExt = texture.getExtension(NEEDLE_compression_texture.EXTENSION_NAME);
|
|
321
|
+
if (compressionSettingsExt !== undefined && compressionSettingsExt !== null && compressionSettingsExt.getExtensionDefinition) {
|
|
318
322
|
logger.info("> Pass compression extension to new texture");
|
|
319
323
|
const newExt = newDoc.createExtension(NEEDLE_compression_texture);
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
324
|
+
const compressionSettings = compressionSettingsExt.getExtensionDefinition();
|
|
325
|
+
if (compressionSettings?.mode === "none") {
|
|
326
|
+
// if the mode is set to None then we keep that setting for the new texture
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
switch (opts.config.usecase) {
|
|
330
|
+
// For world scenarios we use ETC1S
|
|
331
|
+
case "world":
|
|
332
|
+
compressionSettings.mode = "ETC1S";
|
|
333
|
+
break;
|
|
334
|
+
case "product":
|
|
335
|
+
compressionSettings.mode = detectTextureCompressionMode(slots);
|
|
336
|
+
compressionSettings.quality = 100;
|
|
337
|
+
break;
|
|
338
|
+
default:
|
|
339
|
+
compressionSettings.mode = detectTextureCompressionMode(slots);
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
333
342
|
}
|
|
334
|
-
|
|
335
|
-
const
|
|
336
|
-
newTexture.setExtension(NEEDLE_compression_texture.EXTENSION_NAME,
|
|
343
|
+
compressionSettings.slot = slots[0];
|
|
344
|
+
const newCompressionSettings = newExt.create(compressionSettings);
|
|
345
|
+
newTexture.setExtension(NEEDLE_compression_texture.EXTENSION_NAME, newCompressionSettings);
|
|
337
346
|
}
|
|
338
347
|
// add progressive texture extension
|
|
339
348
|
const progressiveExt = newDoc.createExtension(NEEDLE_progressive);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.7",
|
|
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",
|