@needle-tools/gltf-build-pipeline 2.11.0-next.0ac327c → 2.11.0-next.340ffdd

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.
@@ -194,6 +194,7 @@ export async function compressPrimitive(document, mesh, prim, index, weldOptions
194
194
  if (!res)
195
195
  return;
196
196
  }
197
+ // TODO: enable regularize once it's available: https://github.com/zeux/meshoptimizer/pull/914/files
197
198
  logger.debug(`simplify: primitive[${index}] of mesh "${mesh.getName()}" → ratio: ${meshOptions.ratio}, error: ${meshOptions.error}, lockBorder: ${meshOptions.lockBorder}`);
198
199
  return simplifyPrimitive(prim, meshOptions);
199
200
  }
@@ -546,10 +546,10 @@ export function make_progressive_meshes(filePath, _options, opts) {
546
546
  },
547
547
  ];
548
548
  for (let l = 0; l < MAX_LODS; l++) {
549
- // const t = l / MAX_LODS;
549
+ const t = l / (MAX_LODS - 1);
550
550
  const latest = LODS[LODS.length - 1];
551
551
  const ratio = latest.ratio * .5;
552
- let error = 0.003;
552
+ let error = 0.003 + t * .01; // using max 1%, example mesh: https://linear.app/needle/issue/NE-6653
553
553
  if (opts.config.usecase === "product") {
554
554
  error *= .5;
555
555
  }
@@ -827,7 +827,16 @@ async function createMeshLod(inputFileName, doc, basePath, level, mesh, meshInfo
827
827
  if (cachedValue && meta) {
828
828
  logger.info(`[${NAME}] LOD ${level} loaded from cache for \"${mesh.getName()}\"`);
829
829
  writeFileSync(outPath, cachedValue);
830
- return { level, path: fileName, success: true, cacheKey, content_hash: hash, lodMeshInfo: meta.meshInfo, density: meta.density, densities: meta.densities };
830
+ return {
831
+ level,
832
+ path: fileName,
833
+ success: true,
834
+ cacheKey,
835
+ content_hash: hash,
836
+ lodMeshInfo: meta.meshInfo,
837
+ density: meta.density,
838
+ densities: meta.densities
839
+ };
831
840
  }
832
841
  }
833
842
  const newDoc = new Document();
@@ -941,7 +950,16 @@ async function createMeshLod(inputFileName, doc, basePath, level, mesh, meshInfo
941
950
  const newMeshInformation = getMeshInformation(newMesh);
942
951
  if (newMeshInformation.totalVertexCount < 4) {
943
952
  logger.error(`[${NAME}] mesh LOD ${level} is has less than 4 vertices → skipping`);
944
- return { level, path: fileName, success: false, cacheKey: cacheKey, content_hash: hash, lodMeshInfo: null, density: null, densities: null };
953
+ return {
954
+ level,
955
+ path: fileName,
956
+ success: false,
957
+ cacheKey: cacheKey,
958
+ content_hash: hash,
959
+ lodMeshInfo: null,
960
+ density: null,
961
+ densities: null
962
+ };
945
963
  }
946
964
  let density = 0;
947
965
  const densities = new Array(newMesh.listPrimitives().length);
@@ -1 +1 @@
1
- export declare const version = "2.11.0-next.0ac327c";
1
+ export declare const version = "2.11.0-next.340ffdd";
@@ -1 +1 @@
1
- export const version = "2.11.0-next.0ac327c";
1
+ export const version = "2.11.0-next.340ffdd";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.11.0-next.0ac327c",
3
+ "version": "2.11.0-next.340ffdd",
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",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@donmccurdy/caporal": "~0.0.10",
51
- "@gltf-transform/core": "4.1.4",
52
- "@gltf-transform/extensions": "4.1.4",
53
- "@gltf-transform/functions": "4.1.4",
51
+ "@gltf-transform/core": "4.2.1",
52
+ "@gltf-transform/extensions": "4.2.1",
53
+ "@gltf-transform/functions": "4.2.1",
54
54
  "command-exists": "^1.2.9",
55
55
  "command-line-args": "^5.2.1",
56
56
  "draco3dgltf": "^1.5.3",
57
57
  "glob": "^7.2.0",
58
- "meshoptimizer": "^0.18.1",
58
+ "meshoptimizer": "0.24.0",
59
59
  "micromatch": "^4.0.5",
60
60
  "ndarray": "^1.0.19",
61
61
  "ndarray-lanczos": "^0.3.0",