@needle-tools/gltf-build-pipeline 2.15.9 → 2.15.10-next.6fede52

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.
@@ -1,4 +1,4 @@
1
- import { Extension, ExtensionProperty, PropertyType } from '@gltf-transform/core';
1
+ import { Extension, ExtensionProperty, PropertyType, TextureChannel } from '@gltf-transform/core';
2
2
  import { existsSync, readFileSync } from 'fs';
3
3
  import { join, dirname } from 'path';
4
4
  import { isLightmap } from '../../utils/texture.js';
@@ -21,8 +21,8 @@ class LightmapProperty extends ExtensionProperty {
21
21
  return Object.assign(super.getDefaults(), {});
22
22
  }
23
23
  /** Public wrapper around protected setRef to register references */
24
- setReference(name, value) {
25
- this.setRef(name, value);
24
+ setReference(name, value, attributes) {
25
+ this.setRef(name, value, attributes);
26
26
  }
27
27
  }
28
28
  /**
@@ -142,8 +142,9 @@ export class NEEDLE_lightmaps_ext extends Extension {
142
142
  if (texture) {
143
143
  this.resolved.push({ entry, texture, inputTextureDef });
144
144
  // Set a reference so gltf-transform won't prune/dedup this texture
145
- const refName = `lightmap_${entry.pointer}`;
146
- this.lightmapProp.setReference(refName, texture);
145
+ const refName = `lightmapTexture_${entry.pointer}`;
146
+ const channels = TextureChannel.R | TextureChannel.G | TextureChannel.B | TextureChannel.A;
147
+ this.lightmapProp.setReference(refName, texture, { channels });
147
148
  // Also keep a reference to the buffer
148
149
  const buffer = this.document.getRoot().listBuffers()[0];
149
150
  if (buffer) {
@@ -160,8 +161,9 @@ export class NEEDLE_lightmaps_ext extends Extension {
160
161
  for (const tex of textures) {
161
162
  if (isLightmap(tex) && tex.getMimeType() !== 'image/exr') {
162
163
  const refName = `lightmapTexture_${tex.getName()}`;
163
- this.lightmapProp.setReference(refName, tex);
164
- logger.info(`Found lightmap texture "${tex.getName()}" (${tex.getMimeType()}) in ${EXTENSION_NAME}`);
164
+ const channels = TextureChannel.R | TextureChannel.G | TextureChannel.B | TextureChannel.A;
165
+ this.lightmapProp.setReference(refName, tex, { channels });
166
+ logger.info(`[NEEDLE_lightmaps] Found lightmap texture "${tex.getName()}" (${tex.getMimeType()}) in ${EXTENSION_NAME}`);
165
167
  }
166
168
  }
167
169
  return this;
@@ -200,7 +200,7 @@ export function createOpaqueExtension(name, types, opts) {
200
200
  prop.setReference("lightmapTexture", tex, { channels: TextureChannel.R | TextureChannel.G | TextureChannel.B | TextureChannel.A });
201
201
  const texDef = textureDefinitions[i]; // @TODO: textureDefinitions and textures might not be in the same order - we need to find the texture by source index instead of assuming the order is the same
202
202
  const name = tex.getName() || texDef?.name;
203
- logger.info(`Found lightmap texture \"${name}\" (${tex.getMimeType()}) in ${EXTENSION_NAME}`);
203
+ logger.debug(`Found lightmap texture \"${name}\" (${tex.getMimeType()}) in ${EXTENSION_NAME}`);
204
204
  }
205
205
  }
206
206
  }
@@ -376,6 +376,11 @@ async function createTextureLod(args, opts) {
376
376
  setLightmapName(newTexture);
377
377
  break;
378
378
  default:
379
+ if (slot.startsWith("lightmapTexture_") || slot.startsWith("lightmap_")) {
380
+ newMaterial.setBaseColorTexture(newTexture);
381
+ setLightmapName(newTexture);
382
+ break;
383
+ }
379
384
  if (slot.startsWith("/textures/")) {
380
385
  // Ensure the texture is using the alpha channel since we don't know what slots the original texture was used for
381
386
  // see https://linear.app/needle/issue/NE-4985
@@ -1 +1 @@
1
- export declare const version = "2.15.9";
1
+ export declare const version = "2.15.10-next.6fede52";
@@ -1 +1 @@
1
- export const version = "2.15.9";
1
+ export const version = "2.15.10-next.6fede52";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.15.9",
3
+ "version": "2.15.10-next.6fede52",
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",
@@ -55,10 +55,10 @@
55
55
  "vitest": "^3.1.1"
56
56
  },
57
57
  "optionalDependencies": {
58
- "@img/sharp-darwin-arm64": "^0.33.4",
59
- "@img/sharp-darwin-x64": "^0.33.4",
60
- "@img/sharp-linux-arm": "^0.33.4",
61
- "@img/sharp-win32-x64": "^0.33.4"
58
+ "@img/sharp-darwin-arm64": "^0.34.5",
59
+ "@img/sharp-darwin-x64": "^0.34.5",
60
+ "@img/sharp-linux-arm": "^0.34.5",
61
+ "@img/sharp-win32-x64": "^0.34.5"
62
62
  },
63
63
  "dependencies": {
64
64
  "@donmccurdy/caporal": "~0.0.10",
@@ -73,10 +73,10 @@
73
73
  "micromatch": "^4.0.5",
74
74
  "ndarray": "^1.0.19",
75
75
  "ndarray-lanczos": "^0.3.0",
76
- "ndarray-pixels": "^2.0.1",
76
+ "ndarray-pixels": "^5.0.1",
77
77
  "p-limit": "3.1.0",
78
78
  "semver": "^7.3.7",
79
- "sharp": "^0.33.4",
79
+ "sharp": "^0.34.5",
80
80
  "tmp": "^0.2.1",
81
81
  "uuid": "^9.0.1",
82
82
  "xxhash-wasm": "^1.1.0"