@needle-tools/gltf-build-pipeline 2.15.7 → 2.15.8-next.3674f4f

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.
@@ -146,7 +146,7 @@ export class NeedlePmremContext {
146
146
  const dstSizestr = ktx2Bytes.length < 100 * 1024
147
147
  ? `${(ktx2Bytes.length / 1024).toFixed(0)} KB`
148
148
  : `${(ktx2Bytes.length / (1024 * 1024)).toFixed(2)} MB`;
149
- this.logger.info(`pmrem:texture[${index}] ${name}: ${sizeStr} EXR → ${dstSizestr} KTX2`);
149
+ this.logger.info(`pmrem:texture[${index}] ${name}: ${sizeStr} EXR → ${dstSizestr} KTX2 (${texture.getURI() || texture.getName() || name})`);
150
150
  this.convertedTextures.push(texture);
151
151
  this.processed++;
152
152
  return true;
@@ -172,16 +172,24 @@ export class NeedlePmremContext {
172
172
  return cached;
173
173
  }
174
174
  }
175
- // 1. Run PMREM on the EXR bytes
176
- this.logger.info(`pmrem:texture[${index}] ${name}: Running PMREM...`);
175
+ // 1. Run PMREM on the EXR bytes (synchronous WASM — may take a while)
176
+ const inputSize = exrBytes.byteLength < 100 * 1024
177
+ ? `${(exrBytes.byteLength / 1024).toFixed(0)} KB`
178
+ : `${(exrBytes.byteLength / (1024 * 1024)).toFixed(2)} MB`;
179
+ this.logger.info(`pmrem:texture[${index}] ${name}: Running PMREM WASM (${inputSize} EXR) — this may take a while...`);
180
+ // Yield to allow log to flush before blocking WASM call
181
+ await new Promise(r => setTimeout(r, 0));
182
+ const t0 = Date.now();
177
183
  const pmremExrBytes = this.wasmModule.pmrem_exr(exrBytes);
184
+ const elapsed = ((Date.now() - t0) / 1000).toFixed(1);
185
+ this.logger.info(`pmrem:texture[${index}] ${name}: PMREM done in ${elapsed}s (${(pmremExrBytes.byteLength / 1024 / 1024).toFixed(1)} MB)`);
178
186
  // 2. Write PMREM EXR to temp file
179
187
  const id = uuid();
180
188
  const tempExr = join(this.tmpDir, `${id}.pmrem.exr`);
181
189
  const tempKtx2 = join(this.tmpDir, `${id}.ktx2`);
182
190
  writeFileSync(tempExr, Buffer.from(pmremExrBytes));
183
191
  // 3. Encode to KTX2 HDR via basisu
184
- this.logger.debug(`pmrem:texture[${index}] ${name}: Encoding KTX2 HDR...`);
192
+ this.logger.info(`pmrem:texture[${index}] ${name}: Encoding KTX2 HDR...`);
185
193
  const variant = 'hdr4x4'; // 6x6 needs an update in Needle
186
194
  await encodeKTX2WithBasisu(this.basisuExe, tempExr, tempKtx2, variant, true);
187
195
  if (!existsSync(tempKtx2)) {
@@ -204,7 +204,10 @@ export class NeedleToktxContext {
204
204
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
205
205
  const [status, stdout, stderr] = await waitExit(spawn('ktx', params, { env: this.env }));
206
206
  if (status !== 0) {
207
- logger.error(`${prefix}: Failed → \n\n${stderr.toString()}`);
207
+ logger.error(`${prefix}: ktx create failed (exit code ${status}) → \n\n${stderr.toString()}`);
208
+ }
209
+ else if (!existsSync(outPath)) {
210
+ logger.error(`${prefix}: ktx create reported success but output file is missing: ${outPath}\n\nstdout: ${stdout}\nstderr: ${stderr}`);
208
211
  }
209
212
  else {
210
213
  const result = await fs.readFile(outPath);
@@ -1 +1 @@
1
- export declare const version = "2.15.7";
1
+ export declare const version = "2.15.8-next.3674f4f";
@@ -1 +1 @@
1
- export const version = "2.15.7";
1
+ export const version = "2.15.8-next.3674f4f";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.15.7",
3
+ "version": "2.15.8-next.3674f4f",
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",
Binary file