@needle-tools/gltf-build-pipeline 2.8.1-alpha.0 → 2.8.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ 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.8.1] - 2024-04-17
8
+ - bump version
9
+
7
10
  ## [2.8.1-alpha.0] - 2024-03-26
8
11
  - Fix: Issue where cache key gets longer depending on the primitive count
9
12
  - Fix: Cache key not taking index buffer into account
@@ -4,6 +4,7 @@ import { MeshoptEncoder, MeshoptSimplifier } from "meshoptimizer";
4
4
  import { NEEDLE_mesh_compression, NEEDLE_mesh_compression_model_root } from "../extensions/index.js";
5
5
  import { weldPrimitive } from "../functions/weld.3.js";
6
6
  import { calculateMeshDensity } from "../utils/mesh.js";
7
+ import { isMeshLOD } from "./needle_progressive.js";
7
8
  const NAME = 'needle_mesh_transform';
8
9
  /**
9
10
  * Which compression type for a model should be used. This should be respected when creating LOD meshes and the appropriate extension should be added to the LOD mesh so it receives the same mesh compression as the parent mesh
@@ -66,6 +67,7 @@ export const needle_mesh_transform = function (context) {
66
67
  };
67
68
  };
68
69
  async function applyMeshCompression(document, transform_context, context) {
70
+ const isLOD = isMeshLOD(context.file);
69
71
  const compressionModel = determineMeshCompression(document, context.file); // document.getRoot().getExtension(NEEDLE_mesh_compression.EXTENSION_NAME) as NEEDLE_mesh_compression_property;
70
72
  if (compressionModel) {
71
73
  // const rootModel = rootExtension.model as NEEDLE_mesh_compression_model_root;
@@ -76,7 +78,9 @@ async function applyMeshCompression(document, transform_context, context) {
76
78
  }
77
79
  document.getLogger().info(`[${NAME}]: ${compressionModel.compression.toUpperCase()} → will apply ${compressionModel.compression} mesh compression`);
78
80
  if (compressionModel.compression === "draco") {
79
- const transform = draco();
81
+ const transform = draco({
82
+ quantizationVolume: isLOD ? "scene" : undefined
83
+ });
80
84
  return transform(document, transform_context);
81
85
  }
82
86
  else if (compressionModel.compression === "meshopt") {
@@ -87,7 +91,10 @@ async function applyMeshCompression(document, transform_context, context) {
87
91
  }
88
92
  // by default we still want to run draco if the root doesnt have a compression model configured
89
93
  document.getLogger().info(`[${NAME}]: → will apply draco mesh compression (default)`);
90
- return draco()(document, transform_context);
94
+ const transform = draco({
95
+ quantizationVolume: isLOD ? "scene" : undefined
96
+ });
97
+ return transform(document, transform_context);
91
98
  }
92
99
  async function simplifierTransform(document, _context, meshContext) {
93
100
  const simplifier = MeshoptSimplifier;
@@ -660,7 +660,7 @@ export function make_progressive_meshes(filePath, _options, opts) {
660
660
  const vertexDifference = lastMeshInfo.totalVertexCount - meshInfo.totalVertexCount;
661
661
  const diff01 = vertexDifference / lastMeshInfo.totalVertexCount;
662
662
  if (vertexDifference < 0) {
663
- console.log(`WARN: ❌ [${NAME}] Flag mesh LOD ${level}: vertex count did increase (${-vertexDifference.toFixed(0)} vertices, ${(-diff01 * 100).toFixed(4)}%) → LOD ${level} will be omitted. \"${mesh.getName()}\" at \"${lodInfo.path}\" ${JSON.stringify(lastMeshInfo)} → ${JSON.stringify(meshInfo)}`);
663
+ console.log(`WARN: [${NAME}] Flag mesh LOD ${level}: vertex count did increase (${-vertexDifference.toFixed(0)} vertices, ${(-diff01 * 100).toFixed(4)}%) → LOD ${level} will be omitted. \"${mesh.getName()}\" at \"${lodInfo.path}\" ${JSON.stringify(lastMeshInfo)} → ${JSON.stringify(meshInfo)}`);
664
664
  shouldOmitLevel = true;
665
665
  }
666
666
  else if (vertexDifference < 32 || diff01 < 0.05) {
@@ -851,7 +851,6 @@ async function createMeshLod(inputFileName, doc, basePath, level, mesh, meshInfo
851
851
  const tasks = new Array();
852
852
  // let didRunSimplification = false;
853
853
  const clonedAttributes = new Map();
854
- debugger;
855
854
  for (const prim of primitives) {
856
855
  const newPrim = newDoc.createPrimitive();
857
856
  newMesh.addPrimitive(newPrim);
@@ -1 +1 @@
1
- export declare const version = "2.8.1-alpha.0";
1
+ export declare const version = "2.8.1";
@@ -1 +1 @@
1
- export const version = "2.8.1-alpha.0";
1
+ export const version = "2.8.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.8.1-alpha.0",
3
+ "version": "2.8.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",