@needle-tools/gltf-build-pipeline 2.9.3 → 2.9.4
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,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.9.1] - 2024-05-23
|
|
8
|
+
- change: `product` usecase uses `UASTC` compression for 'normalTexture'
|
|
9
|
+
|
|
7
10
|
## [2.9.0] - 2024-05-22
|
|
8
11
|
- add: initial texture compression mode support for `world` and `product`
|
|
9
12
|
|
|
@@ -97,7 +97,7 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
97
97
|
const compressionSettings = ext?.model;
|
|
98
98
|
// is a user has configured a texture explictly to NOT be compressed
|
|
99
99
|
// we should respect that
|
|
100
|
-
if (
|
|
100
|
+
if (compressionSettings?.mode === "none") {
|
|
101
101
|
logger.info(`→ Skipping texture compression for ${texture.getName()} [${index}] as configured in the texture extension`);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
@@ -125,12 +125,17 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
125
125
|
break;
|
|
126
126
|
case "product":
|
|
127
127
|
switch (compressionSettings.slot) {
|
|
128
|
-
|
|
128
|
+
default:
|
|
129
|
+
compressionSettings.mode = "ETC1S";
|
|
130
|
+
break;
|
|
129
131
|
case "normalTexture":
|
|
132
|
+
compressionSettings.mode = "UASTC";
|
|
133
|
+
break;
|
|
134
|
+
case "baseColorTexture":
|
|
130
135
|
case "metallicRoughnessTexture":
|
|
131
136
|
case "lightmapTexture":
|
|
132
137
|
compressionSettings.mode = "webp";
|
|
133
|
-
compressionSettings.quality = 0.
|
|
138
|
+
compressionSettings.quality = 0.8;
|
|
134
139
|
break;
|
|
135
140
|
}
|
|
136
141
|
break;
|
|
@@ -211,6 +216,7 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
211
216
|
successfullyProcessed = await context.webPContext.process(index, texture, {
|
|
212
217
|
...webpOptions,
|
|
213
218
|
quality: .95,
|
|
219
|
+
slot: slots.join(","),
|
|
214
220
|
}, context);
|
|
215
221
|
}
|
|
216
222
|
else if (canRunToktx) {
|
|
@@ -10,6 +10,6 @@ export declare class NeedleWebPContext implements INeedleTextureTransformContext
|
|
|
10
10
|
private compressed;
|
|
11
11
|
constructor(options: NeedleWebPOptions);
|
|
12
12
|
prepare(document: Document): Promise<void>;
|
|
13
|
-
process(index: number, texture: Texture, settings: Pick<NEEDLE_compression_texture_schema, "quality"> & Partial<sharp.WebpOptions>, context: NeedleTransformContext): Promise<boolean>;
|
|
13
|
+
process(index: number, texture: Texture, settings: Pick<NEEDLE_compression_texture_schema, "quality" | "slot"> & Partial<sharp.WebpOptions>, context: NeedleTransformContext): Promise<boolean>;
|
|
14
14
|
finalize(document: Document): Promise<void>;
|
|
15
15
|
}
|
|
@@ -35,7 +35,7 @@ export class NeedleWebPContext {
|
|
|
35
35
|
options.quality = undefined; // If quality is 0 we use the default value
|
|
36
36
|
}
|
|
37
37
|
// console.log(options);
|
|
38
|
-
this.logger.info(
|
|
38
|
+
this.logger.info(`webp:texture[${index}] ${texture.getName()}: Slots → [${settings.slot}] with quality '${options.quality === undefined ? 'default' : options.quality}'`);
|
|
39
39
|
const buffer = await sharp(texture.getImage()).toFormat('webp', options).toBuffer();
|
|
40
40
|
texture
|
|
41
41
|
.setMimeType('image/webp')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.9.
|
|
1
|
+
export declare const version = "2.9.4";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.9.
|
|
1
|
+
export const version = "2.9.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.4",
|
|
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",
|