@needle-tools/gltf-build-pipeline 2.9.2 → 2.9.3
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.
|
@@ -113,7 +113,8 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
113
113
|
logger.info(`→ Using cached texture ${texture.getName()} [${index}] – ${(cached.length / 1024).toFixed(0)} KB`);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
let
|
|
116
|
+
let successfullyProcessed = false;
|
|
117
|
+
let useDefaultCompression = true;
|
|
117
118
|
const canRunToktx = context.noToktx !== true;
|
|
118
119
|
const originalUri = texture.getURI();
|
|
119
120
|
if (compressionSettings && compressionSettings.mode !== "auto") {
|
|
@@ -141,7 +142,8 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
144
|
await resizeTextureIfNecessary(texture);
|
|
144
|
-
|
|
145
|
+
useDefaultCompression = false;
|
|
146
|
+
successfullyProcessed = await context.webPContext.process(index, texture, compressionSettings, context);
|
|
145
147
|
break;
|
|
146
148
|
case "ETC1S":
|
|
147
149
|
if (cached) {
|
|
@@ -149,7 +151,8 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
149
151
|
return;
|
|
150
152
|
}
|
|
151
153
|
await resizeTextureIfNecessary(texture);
|
|
152
|
-
|
|
154
|
+
useDefaultCompression = false;
|
|
155
|
+
successfullyProcessed = await context.toktxContext.process(index, texture, compressionSettings, context);
|
|
153
156
|
break;
|
|
154
157
|
case "UASTC":
|
|
155
158
|
if (cached) {
|
|
@@ -157,11 +160,12 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
157
160
|
return;
|
|
158
161
|
}
|
|
159
162
|
await resizeTextureIfNecessary(texture);
|
|
160
|
-
|
|
163
|
+
useDefaultCompression = false;
|
|
164
|
+
successfullyProcessed = await context.toktxContext.process(index, texture, compressionSettings, context);
|
|
161
165
|
break;
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
|
-
|
|
168
|
+
if (useDefaultCompression) {
|
|
165
169
|
let mimeType = "image/ktx2";
|
|
166
170
|
let ktx2Format = undefined;
|
|
167
171
|
const slots = listTextureSlots(texture);
|
|
@@ -204,7 +208,7 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
204
208
|
}
|
|
205
209
|
await resizeTextureIfNecessary(texture);
|
|
206
210
|
if (mimeType === "image/webp") {
|
|
207
|
-
|
|
211
|
+
successfullyProcessed = await context.webPContext.process(index, texture, {
|
|
208
212
|
...webpOptions,
|
|
209
213
|
quality: .95,
|
|
210
214
|
}, context);
|
|
@@ -217,18 +221,18 @@ async function processTexture(texture, index, document, logger, context) {
|
|
|
217
221
|
if (ktx2Format || isVRM) {
|
|
218
222
|
options = { mode: ktx2Format || "ETC1S" };
|
|
219
223
|
}
|
|
220
|
-
|
|
224
|
+
successfullyProcessed = await context.toktxContext.process(index, texture, options, context);
|
|
221
225
|
}
|
|
222
226
|
else {
|
|
223
227
|
console.log("Toktx not found: Skipping texture compression: " + originalMimeType);
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
|
-
if (context.useCache &&
|
|
230
|
+
if (context.useCache && successfullyProcessed && key) {
|
|
227
231
|
const data = texture.getImage();
|
|
228
232
|
if (data)
|
|
229
233
|
addToCache(key, data);
|
|
230
234
|
}
|
|
231
|
-
if (
|
|
235
|
+
if (successfullyProcessed) {
|
|
232
236
|
const newUri = texture.getURI();
|
|
233
237
|
if (originalUri && originalUri != newUri) {
|
|
234
238
|
const inDirectory = dirname(context.file);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.9.
|
|
1
|
+
export declare const version = "2.9.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.9.
|
|
1
|
+
export const version = "2.9.3";
|
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.3",
|
|
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",
|