@needle-tools/gltf-build-pipeline 1.1.2 → 1.1.3

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
+ ## [1.1.3] - 2023-05-24
8
+ - minor change adding info about reduced size after processing gltf files
9
+
7
10
  ## [1.1.2] - 2023-05-24
8
11
  - fix: wasm out of memory error caused by starting to many compression processes at once
9
12
 
package/pack-gltf.mjs CHANGED
@@ -72,6 +72,7 @@ const packedFiles = new Set();
72
72
  let totalGPUMemoryInMB = 0;
73
73
  let totalFilesProcessed = 0;
74
74
  let totalFileSizeInMB = 0;
75
+ let totalFileSizeInMBBefore = 0;
75
76
 
76
77
  async function packFile(file) {
77
78
  if (!existsSync(file)) {
@@ -87,7 +88,7 @@ async function packFile(file) {
87
88
  console.log("→ Begin packing: " + file);
88
89
 
89
90
  try {
90
- const prevSize = statSync(file).size;
91
+ const prevSizeInMB = statSync(file).size / 1024 / 1024;
91
92
  const startTime = Date.now();
92
93
  const io = new NodeIO()
93
94
  .registerExtensions(ALL_EXTENSIONS)
@@ -123,10 +124,11 @@ async function packFile(file) {
123
124
  const sizeInMB = statSync(file).size / 1024 / 1024;
124
125
  const filename = path.basename(file);
125
126
  const gpuMemoryInMB = totalGPUTextureMemmory / 1024 / 1024;
126
- console.log(`← Compressing done in ${(duration / 1000).toFixed(1)} sec, ${(prevSize / 1024 / 1024).toFixed(1)} MB → ${sizeInMB.toFixed(1)} MB (GPU: ${gpuMemoryInMB.toFixed(1)} MB textures): ${filename} at ${file}`);
127
+ console.log(`← Compressing done in ${(duration / 1000).toFixed(1)} sec, ${prevSizeInMB.toFixed(1)} MB → ${sizeInMB.toFixed(1)} MB (GPU: ${gpuMemoryInMB.toFixed(1)} MB textures): ${filename} at ${file}`);
127
128
 
128
129
  totalFilesProcessed++;
129
130
  totalFileSizeInMB += sizeInMB;
131
+ totalFileSizeInMBBefore += prevSizeInMB;
130
132
  totalGPUMemoryInMB += gpuMemoryInMB;
131
133
  return true;
132
134
  }
@@ -143,5 +145,5 @@ foreachGLTF(process.argv, async (file) => {
143
145
  }).then(() => {
144
146
  const duration = Date.now() - startTime;
145
147
  const durationInMinutes = duration / 1000 / 60;
146
- console.log(`Finished packing ${totalFilesProcessed} files in ${durationInMinutes.toFixed(1)} minutes; total size: ${totalFileSizeInMB.toFixed(1)} MB, total GPU memory: ${totalGPUMemoryInMB.toFixed(1)} MB`);
148
+ console.log(`Finished packing ${totalFilesProcessed} files in ${durationInMinutes.toFixed(1)} minutes; total size ${totalFileSizeInMBBefore.toFixed(1)} MB → ${totalFileSizeInMB.toFixed(1)} MB, total GPU memory: ${totalGPUMemoryInMB.toFixed(1)} MB`);
147
149
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
5
  "main": "index.mjs",
6
6
  "type": "module",