@needle-tools/gltf-build-pipeline 2.9.0 → 2.9.1

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.
@@ -117,11 +117,10 @@ async function processTexture(texture, index, document, logger, context) {
117
117
  const canRunToktx = context.noToktx !== true;
118
118
  const originalUri = texture.getURI();
119
119
  if (compressionSettings && compressionSettings.mode !== "auto") {
120
- let mode = compressionSettings.mode;
121
120
  // Handle highlevel modes
122
- switch (mode) {
121
+ switch (compressionSettings.mode) {
123
122
  case "world":
124
- mode = "ETC1S";
123
+ compressionSettings.mode = "ETC1S";
125
124
  break;
126
125
  case "product":
127
126
  switch (compressionSettings.slot) {
@@ -129,12 +128,13 @@ async function processTexture(texture, index, document, logger, context) {
129
128
  case "normalTexture":
130
129
  case "metallicRoughnessTexture":
131
130
  case "lightmapTexture":
132
- mode = "webp";
131
+ compressionSettings.mode = "webp";
132
+ compressionSettings.quality = 0.95;
133
133
  break;
134
134
  }
135
135
  break;
136
136
  }
137
- switch (mode) {
137
+ switch (compressionSettings.mode) {
138
138
  case "webp":
139
139
  if (cached) {
140
140
  texture.setImage(cached).setMimeType("image/webp");
@@ -164,7 +164,6 @@ async function processTexture(texture, index, document, logger, context) {
164
164
  else {
165
165
  let mimeType = "image/ktx2";
166
166
  let ktx2Format = undefined;
167
- let webpOptions = {};
168
167
  const slots = listTextureSlots(texture);
169
168
  const size = texture.getSize();
170
169
  const isVRM = context.file?.toLowerCase().endsWith(".vrm");
@@ -179,6 +178,7 @@ async function processTexture(texture, index, document, logger, context) {
179
178
  // mimetype = "image/webp";
180
179
  // }
181
180
  // }
181
+ const webpOptions = {};
182
182
  if (slots.includes("lightmapTexture") || isLightmap(texture)) {
183
183
  mimeType = "image/webp";
184
184
  }
@@ -189,6 +189,7 @@ async function processTexture(texture, index, document, logger, context) {
189
189
  }
190
190
  // For product compression we automatically select webP if the texture is used in a PBR material
191
191
  // https://linear.app/needle/issue/NE-6458
192
+ // TODO: this should probably moved to the top and we should create a compression settings object
192
193
  else if (context.config.usecase === "product") {
193
194
  const shouldUseWebp = slots.includes("normalTexture") || slots.includes("metallicRoughnessTexture");
194
195
  if (shouldUseWebp) {
@@ -1 +1 @@
1
- export declare const version = "2.9.0";
1
+ export declare const version = "2.9.1";
@@ -1 +1 @@
1
- export const version = "2.9.0";
1
+ export const version = "2.9.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
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",