@needle-tools/gltf-build-pipeline 2.2.0-alpha.8 → 2.2.1-alpha

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,11 +4,18 @@ 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.2.0-alpha.8] - 2023-06-13
7
+ ## [2.2.1-alpha] - 2023-06-15
8
+ - fix: issue with progressive mesh cache key calculation when running multiple transform processes with different configurations
9
+
10
+ ## [2.2.0-alpha.11] - 2023-06-14
11
+ - fix: issue where progressive transform with un-indexed meshes would fail
12
+
13
+ ## [2.2.0-alpha.10] - 2023-06-13
8
14
  - fix: progressive transform of converted GLB files where meshes don't have indicies
9
15
  - fix: skip progressive texture generation for textures for textures that already match the lowest LOD size
10
16
  - fix: if compression is set to None the LOD textures should respect that setting and also not be compressed
11
17
  - fix: fallback mesh density calculation for meshes that aren't indexed
18
+ - fix: NEEDLE_mesh_compression extension falsely overriding primitive extensions
12
19
 
13
20
  ## [2.2.0-alpha.5] - 2023-06-06
14
21
  - add: CLI `--progressive` option to `transform` command (default is true)
@@ -62,7 +62,7 @@ export class NEEDLE_mesh_compression extends Extension {
62
62
  if (ext) {
63
63
  const prim = meshDef.primitives[i];
64
64
  if (prim) {
65
- prim.extensions = meshDef.extensions || {};
65
+ prim.extensions = prim.extensions || {};
66
66
  prim.extensions[EXTENSION_NAME] = ext.model;
67
67
  }
68
68
  }
@@ -709,7 +709,7 @@ function clonePrimitiveData(prim, logger) {
709
709
  return null;
710
710
  }
711
711
  const prevIndices = prim.getIndices();
712
- const indices = !prevIndices ? null : new Uint32Array(prevIndices.getArray());
712
+ const indices = !prevIndices ? new Uint32Array() : new Uint32Array(prevIndices.getArray());
713
713
  const attributes = {};
714
714
  for (const attr of semantics) {
715
715
  logger.info(`[${NAME}] Clone attribute ${attr}`);
@@ -754,15 +754,18 @@ async function createMeshLod(doc, basePath, level, mesh, meshInfo, guid, lodLeve
754
754
  mesh["needle:mesh-hash"] = hash;
755
755
  }
756
756
  hash += getHash(lodLevel);
757
- hash += getHash(opts.config);
757
+ hash += getHash({
758
+ guid,
759
+ config: opts.config,
760
+ });
758
761
  if (opts.useCache !== false) {
759
762
  cacheKey = `mesh_lod_${level}_${hash}`;
760
763
  const cachedValue = tryGetFromCache(cacheKey);
761
764
  const meta = tryGetMetaFromCache(cacheKey);
762
765
  if (cachedValue && meta) {
763
- logger.info(`[${NAME}] LOD ${level} loaded ${(cachedValue.length / 1024).toFixed()} KB from cache for \"${mesh.getName()}\"`);
766
+ logger.info(`[${NAME}] LOD ${level} loaded from cache for \"${mesh.getName()}\"`);
764
767
  writeFileSync(outPath, cachedValue);
765
- return { level, path: fileName, success: true, cacheKey: cacheKey, content_hash: hash, lodMeshInfo: meta.meshInfo, density: meta.density };
768
+ return { level, path: fileName, success: true, cacheKey, content_hash: hash, lodMeshInfo: meta.meshInfo, density: meta.density };
766
769
  }
767
770
  }
768
771
  const newDoc = new Document();
@@ -95,11 +95,13 @@ async function processTexture(texture, index, document, logger, context) {
95
95
  const key = context.useCache ? (getKey(texture) + getHash(context.config)) : undefined;
96
96
  let cached = context.useCache && key ? tryGetFromCache(key) : undefined;
97
97
  if (cached) {
98
- logger.debug(`> Using cached texture ${texture.getName()} [${index}] – ${(cached.length / 1024).toFixed(0)} KB`);
99
98
  if (cached.length <= 0) {
100
99
  logger.warn(`WARN: Cached texture ${texture.getName()} [${index}] is empty. Will reprocess.`);
101
100
  cached = undefined;
102
101
  }
102
+ else {
103
+ logger.info(`→ Using cached texture ${texture.getName()} [${index}] – ${(cached.length / 1024).toFixed(0)} KB`);
104
+ }
103
105
  }
104
106
  let successFullyProcessed = false;
105
107
  const canRunToktx = context.noToktx !== true;
@@ -95,7 +95,6 @@ export function calculateMeshDensity(prim) {
95
95
  size[2] = bounds.max[2] - bounds.min[2];
96
96
  const volume = size[0] * size[1] * size[2];
97
97
  const density = count / volume;
98
- debugger;
99
98
  return density;
100
99
  }
101
100
  return -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.2.0-alpha.8",
3
+ "version": "2.2.1-alpha",
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",