@needle-tools/gltf-build-pipeline 2.2.1-alpha.2 → 2.2.1-alpha.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/.temp/Go2.bin +0 -0
- package/.temp/textures/0_1.exr +0 -0
- package/.temp/textures/1_1.jpg +0 -0
- package/CHANGELOG.md +395 -394
- package/README.md +35 -35
- package/dist/cache/cache.d.ts +54 -54
- package/dist/cache/cache.js +257 -257
- package/dist/cache/index.d.ts +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +154 -154
- package/dist/config/index.d.ts +53 -53
- package/dist/config/index.js +152 -152
- package/dist/constants.d.ts +5 -5
- package/dist/constants.js +5 -5
- package/dist/extensions/NEEDLE_compression_texture/NEEDLE_compression_texture.d.ts +24 -24
- package/dist/extensions/NEEDLE_compression_texture/NEEDLE_compression_texture.js +54 -54
- package/dist/extensions/NEEDLE_compression_texture/index.d.ts +1 -1
- package/dist/extensions/NEEDLE_compression_texture/index.js +1 -1
- package/dist/extensions/NEEDLE_mesh_compression/NEEDLE_mesh_compression.d.ts +26 -26
- package/dist/extensions/NEEDLE_mesh_compression/NEEDLE_mesh_compression.js +85 -85
- package/dist/extensions/NEEDLE_mesh_compression/index.d.ts +1 -1
- package/dist/extensions/NEEDLE_mesh_compression/index.js +1 -1
- package/dist/extensions/NEEDLE_opaque/NEEDLE_opaque.d.ts +27 -27
- package/dist/extensions/NEEDLE_opaque/NEEDLE_opaque.js +897 -897
- package/dist/extensions/NEEDLE_opaque/index.d.ts +3 -3
- package/dist/extensions/NEEDLE_opaque/index.js +28 -28
- package/dist/extensions/NEEDLE_progressive/NEEDLE_progressive.d.ts +48 -48
- package/dist/extensions/NEEDLE_progressive/NEEDLE_progressive.js +69 -69
- package/dist/extensions/NEEDLE_progressive/index.d.ts +1 -1
- package/dist/extensions/NEEDLE_progressive/index.js +1 -1
- package/dist/extensions/NEEDLE_progressive_mesh_settings/index.d.ts +23 -23
- package/dist/extensions/NEEDLE_progressive_mesh_settings/index.js +41 -41
- package/dist/extensions/NEEDLE_progressive_texture_settings/index.d.ts +25 -25
- package/dist/extensions/NEEDLE_progressive_texture_settings/index.js +67 -67
- package/dist/extensions/index.d.ts +7 -7
- package/dist/extensions/index.js +17 -17
- package/dist/extensions/utils.d.ts +6 -6
- package/dist/extensions/utils.js +72 -72
- package/dist/functions/weld.3.d.ts +76 -76
- package/dist/functions/weld.3.js +414 -414
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -8
- package/dist/scripts/index.d.ts +2 -2
- package/dist/scripts/index.js +2 -2
- package/dist/scripts/pack-gltf.d.ts +16 -16
- package/dist/scripts/pack-gltf.js +120 -120
- package/dist/scripts/stats.d.ts +2 -2
- package/dist/scripts/stats.js +18 -18
- package/dist/transforms/index.d.ts +9 -9
- package/dist/transforms/index.js +9 -9
- package/dist/transforms/needle_animation_transform.d.ts +2 -2
- package/dist/transforms/needle_animation_transform.js +5 -5
- package/dist/transforms/needle_asset.d.ts +3 -3
- package/dist/transforms/needle_asset.js +35 -35
- package/dist/transforms/needle_common.d.ts +16 -16
- package/dist/transforms/needle_common.js +1 -1
- package/dist/transforms/needle_mesh_transform.d.ts +10 -10
- package/dist/transforms/needle_mesh_transform.js +140 -140
- package/dist/transforms/needle_progressive.d.ts +42 -42
- package/dist/transforms/needle_progressive.js +921 -921
- package/dist/transforms/needle_texture_transform.d.ts +13 -13
- package/dist/transforms/needle_texture_transform.js +202 -196
- package/dist/transforms/needle_toktx.d.ts +25 -25
- package/dist/transforms/needle_toktx.js +230 -230
- package/dist/transforms/needle_webp.d.ts +13 -13
- package/dist/transforms/needle_webp.js +37 -37
- package/dist/transforms/toktx.d.ts +52 -52
- package/dist/transforms/toktx.js +221 -221
- package/dist/transforms/toktx_types.d.ts +78 -78
- package/dist/transforms/toktx_types.js +62 -62
- package/dist/transforms/util.d.ts +21 -21
- package/dist/transforms/util.js +90 -90
- package/dist/utils/compression_utils.d.ts +2 -2
- package/dist/utils/compression_utils.js +6 -6
- package/dist/utils/fileutils.d.ts +6 -6
- package/dist/utils/fileutils.js +141 -141
- package/dist/utils/guid.d.ts +1 -1
- package/dist/utils/guid.js +5 -5
- package/dist/utils/index.d.ts +10 -9
- package/dist/utils/index.js +10 -9
- package/dist/utils/merge.d.ts +12 -12
- package/dist/utils/merge.js +31 -31
- package/dist/utils/mesh.d.ts +13 -13
- package/dist/utils/mesh.js +107 -107
- package/dist/utils/nodeio.d.ts +5 -5
- package/dist/utils/nodeio.js +14 -14
- package/dist/utils/stats.d.ts +54 -53
- package/dist/utils/stats.js +191 -166
- package/dist/utils/texture.d.ts +2 -2
- package/dist/utils/texture.js +8 -8
- package/dist/utils/validate.d.ts +5 -0
- package/dist/utils/validate.js +16 -0
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +5 -5
- package/package.json +77 -76
- package/scripts/clear-caches.mjs +3 -3
- package/scripts/defaults.mjs +11 -11
- package/scripts/fileutils.mjs +5 -5
- package/scripts/index.mjs +41 -41
- package/scripts/limit-caches.mjs +3 -3
- package/scripts/make-progressive.mjs +16 -16
- package/scripts/pack-gltf.mjs +107 -107
- package/tsconfig.json +19 -19
package/dist/utils/stats.js
CHANGED
|
@@ -1,166 +1,191 @@
|
|
|
1
|
-
import { getVersion } from "./version.js";
|
|
2
|
-
import { Document, ImageUtils } from "@gltf-transform/core";
|
|
3
|
-
import { getFileName } from "./fileutils.js";
|
|
4
|
-
import { statSync, writeFileSync } from "fs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
1
|
+
import { getVersion } from "./version.js";
|
|
2
|
+
import { Document, ImageUtils } from "@gltf-transform/core";
|
|
3
|
+
import { getFileName } from "./fileutils.js";
|
|
4
|
+
import { statSync, writeFileSync } from "fs";
|
|
5
|
+
import { isLOD } from "../transforms/needle_progressive.js";
|
|
6
|
+
export function printStats(stats, logger, config) {
|
|
7
|
+
const duration = Date.now() - stats.startTime;
|
|
8
|
+
const durationInMinutes = duration / 1000 / 60;
|
|
9
|
+
const msg = `[Needle Build Pipeline] v${getVersion()} — Finished compression \"${config?.usecase}\" of ${stats.totalFilesProcessed} files in ${durationInMinutes.toFixed(1)} minutes; total size ${stats.totalFileSizeInMBBefore.toFixed(1)} MB → ${stats.totalFileSizeInMB.toFixed(1)} MB, total GPU memory: ${stats.totalGPUMemoryInMB.toFixed(1)} MB`;
|
|
10
|
+
if (logger)
|
|
11
|
+
logger.info(msg);
|
|
12
|
+
else
|
|
13
|
+
console.log(msg);
|
|
14
|
+
}
|
|
15
|
+
class Stats {
|
|
16
|
+
/** Size in bytes */
|
|
17
|
+
size;
|
|
18
|
+
asset;
|
|
19
|
+
nodes;
|
|
20
|
+
materials;
|
|
21
|
+
meshes;
|
|
22
|
+
textures;
|
|
23
|
+
constructor(document, size) {
|
|
24
|
+
const root = document.getRoot();
|
|
25
|
+
const asset = root.getAsset();
|
|
26
|
+
this.asset = {
|
|
27
|
+
generator: asset.generator,
|
|
28
|
+
version: asset.version,
|
|
29
|
+
copyright: asset.copyright,
|
|
30
|
+
extras: asset.extras,
|
|
31
|
+
};
|
|
32
|
+
this.size = size;
|
|
33
|
+
this.nodes = root.listNodes().length;
|
|
34
|
+
this.materials = root.listMaterials().length;
|
|
35
|
+
this.meshes = calculateMeshInfo(document);
|
|
36
|
+
this.textures = calculateTextureInfo(document);
|
|
37
|
+
}
|
|
38
|
+
static combine(others, type) {
|
|
39
|
+
const res = new Stats(new Document(), 0);
|
|
40
|
+
let foundAny = false;
|
|
41
|
+
for (const other of others) {
|
|
42
|
+
if (type != undefined) {
|
|
43
|
+
const filename = other.filename;
|
|
44
|
+
if (filename) {
|
|
45
|
+
// skip main files if we only want LODs
|
|
46
|
+
if (isLOD(filename)) {
|
|
47
|
+
if (type === "main")
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// skip LODs if we only want main files
|
|
51
|
+
else {
|
|
52
|
+
if (type === "lods")
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
foundAny = true;
|
|
58
|
+
res.size += other.size;
|
|
59
|
+
res.nodes += other.nodes;
|
|
60
|
+
res.materials += other.materials;
|
|
61
|
+
res.meshes.addTo(other.meshes);
|
|
62
|
+
res.textures.addTo(other.textures);
|
|
63
|
+
}
|
|
64
|
+
if (!foundAny) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return res;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class FileStats extends Stats {
|
|
71
|
+
filename;
|
|
72
|
+
isLOD;
|
|
73
|
+
constructor(file, document) {
|
|
74
|
+
super(document, statSync(file).size);
|
|
75
|
+
this.filename = getFileName(file);
|
|
76
|
+
this.isLOD = isLOD(this.filename);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export class MeshInfo {
|
|
80
|
+
count = 0;
|
|
81
|
+
primitives = 0;
|
|
82
|
+
vertices = 0;
|
|
83
|
+
triangles = 0;
|
|
84
|
+
memory = 0;
|
|
85
|
+
formats = [];
|
|
86
|
+
addTo(other) {
|
|
87
|
+
this.count += other.count;
|
|
88
|
+
this.primitives += other.primitives;
|
|
89
|
+
this.vertices += other.vertices;
|
|
90
|
+
this.triangles += other.triangles;
|
|
91
|
+
this.memory += other.memory;
|
|
92
|
+
this.formats = Array.from(new Set(this.formats.concat(other.formats)));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export class TextureInfo {
|
|
96
|
+
count = 0;
|
|
97
|
+
memory = 0;
|
|
98
|
+
gpu_memory = 0;
|
|
99
|
+
formats = [];
|
|
100
|
+
addTo(other) {
|
|
101
|
+
this.count += other.count;
|
|
102
|
+
this.memory += other.memory;
|
|
103
|
+
this.gpu_memory += other.gpu_memory;
|
|
104
|
+
this.formats = Array.from(new Set(this.formats.concat(other.formats)));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a new filestats object from a file and a document
|
|
109
|
+
*/
|
|
110
|
+
export function createNewFilestats(file, document) {
|
|
111
|
+
const filestats = new FileStats(file, document);
|
|
112
|
+
return filestats;
|
|
113
|
+
}
|
|
114
|
+
export function writeFileStatsToFile(filestats, output_path) {
|
|
115
|
+
if (output_path == undefined) {
|
|
116
|
+
console.error("No stats output path provided");
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const res = {
|
|
120
|
+
sum: Stats.combine(filestats),
|
|
121
|
+
// main: Stats.combine(filestats, "main"),
|
|
122
|
+
// lods: Stats.combine(filestats, "lods"),
|
|
123
|
+
files: filestats,
|
|
124
|
+
};
|
|
125
|
+
const json = JSON.stringify(res);
|
|
126
|
+
writeFileSync(output_path, json);
|
|
127
|
+
return json;
|
|
128
|
+
}
|
|
129
|
+
function calculateMeshInfo(document) {
|
|
130
|
+
const root = document.getRoot();
|
|
131
|
+
const meshes = root.listMeshes();
|
|
132
|
+
const res = new MeshInfo();
|
|
133
|
+
res.count = meshes.length;
|
|
134
|
+
for (const mesh of root.listMeshes()) {
|
|
135
|
+
const primitives = mesh.listPrimitives();
|
|
136
|
+
res.primitives += primitives.length;
|
|
137
|
+
for (const prim of primitives) {
|
|
138
|
+
const positions = prim.getAttribute('POSITION');
|
|
139
|
+
const indices = prim.getIndices();
|
|
140
|
+
if (positions) {
|
|
141
|
+
res.vertices += positions.getCount();
|
|
142
|
+
}
|
|
143
|
+
if (indices) {
|
|
144
|
+
res.triangles += indices.getCount() / 3;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
res.triangles += positions.getCount() / 3;
|
|
148
|
+
}
|
|
149
|
+
const semantics = prim.listSemantics();
|
|
150
|
+
for (const semantic of semantics) {
|
|
151
|
+
const accessor = prim.getAttribute(semantic);
|
|
152
|
+
if (accessor) {
|
|
153
|
+
const buffer = accessor.getByteLength();
|
|
154
|
+
res.memory += buffer;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const extensions = root.listExtensionsUsed();
|
|
160
|
+
for (const ext of extensions) {
|
|
161
|
+
if (ext.extensionName.startsWith("EXT_meshopt_compression")) {
|
|
162
|
+
res.formats.push("meshopt");
|
|
163
|
+
}
|
|
164
|
+
else if (ext.extensionName.startsWith("KHR_draco_mesh_compression")) {
|
|
165
|
+
res.formats.push("draco");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// filter formats so we only have unique values
|
|
169
|
+
res.formats = Array.from(new Set(res.formats));
|
|
170
|
+
return res;
|
|
171
|
+
}
|
|
172
|
+
function calculateTextureInfo(document) {
|
|
173
|
+
const root = document.getRoot();
|
|
174
|
+
const textures = root.listTextures();
|
|
175
|
+
const res = new TextureInfo();
|
|
176
|
+
res.count = textures.length;
|
|
177
|
+
res.formats = textures.map(t => t.getMimeType());
|
|
178
|
+
res.gpu_memory = 0;
|
|
179
|
+
res.memory = 0;
|
|
180
|
+
for (const texture of textures) {
|
|
181
|
+
const image = texture.getImage();
|
|
182
|
+
const mimetype = texture.getMimeType();
|
|
183
|
+
if (image && mimetype) {
|
|
184
|
+
res.gpu_memory += ImageUtils.getVRAMByteLength(image, mimetype);
|
|
185
|
+
res.memory += image.byteLength;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// filter formats so we only have unique values
|
|
189
|
+
res.formats = Array.from(new Set(res.formats));
|
|
190
|
+
return res;
|
|
191
|
+
}
|
package/dist/utils/texture.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function isMultipleOfFour(value: number): boolean;
|
|
2
|
-
export declare function ceilMultipleOfFour(value: number): number;
|
|
1
|
+
export declare function isMultipleOfFour(value: number): boolean;
|
|
2
|
+
export declare function ceilMultipleOfFour(value: number): number;
|
package/dist/utils/texture.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function isMultipleOfFour(value) {
|
|
2
|
-
return value % 4 === 0;
|
|
3
|
-
}
|
|
4
|
-
export function ceilMultipleOfFour(value) {
|
|
5
|
-
if (value <= 4)
|
|
6
|
-
return 4;
|
|
7
|
-
return value % 4 ? value + 4 - (value % 4) : value;
|
|
8
|
-
}
|
|
1
|
+
export function isMultipleOfFour(value) {
|
|
2
|
+
return value % 4 === 0;
|
|
3
|
+
}
|
|
4
|
+
export function ceilMultipleOfFour(value) {
|
|
5
|
+
if (value <= 4)
|
|
6
|
+
return 4;
|
|
7
|
+
return value % 4 ? value + 4 - (value % 4) : value;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ImageUtils } from "@gltf-transform/core";
|
|
2
|
+
export function validateImageMimeType(mimetype, image) {
|
|
3
|
+
const actualMimeType = ImageUtils.getMimeType(image);
|
|
4
|
+
if (actualMimeType != null && actualMimeType != mimetype) {
|
|
5
|
+
console.error(`Expected image to be of type ${mimetype}, but was ${actualMimeType}`);
|
|
6
|
+
return {
|
|
7
|
+
error: true,
|
|
8
|
+
message: `Expected image to be of type ${mimetype}, but was ${actualMimeType}`,
|
|
9
|
+
mimeType: actualMimeType
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
else if (actualMimeType === null) {
|
|
13
|
+
console.warn("Could not determine image type");
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
package/dist/utils/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getVersion(_marklocal?: boolean): string;
|
|
1
|
+
export declare function getVersion(_marklocal?: boolean): string;
|
package/dist/utils/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import packageJson from "#package.json" assert { type: "json" };
|
|
2
|
-
export function getVersion(_marklocal = true) {
|
|
3
|
-
let res = packageJson.version;
|
|
4
|
-
return res;
|
|
5
|
-
}
|
|
1
|
+
import packageJson from "#package.json" assert { type: "json" };
|
|
2
|
+
export function getVersion(_marklocal = true) {
|
|
3
|
+
let res = packageJson.version;
|
|
4
|
+
return res;
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,76 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.2.1-alpha.
|
|
4
|
-
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"readme": "README.md",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Needle",
|
|
10
|
-
"email": "help@needle.tools",
|
|
11
|
-
"url": "https://needle.tools/"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/needle-tools/needle-gltf-extensions.git"
|
|
16
|
-
},
|
|
17
|
-
"bin": {
|
|
18
|
-
"gltf-build-pipeline": "dist/cli/index.js",
|
|
19
|
-
"needle-gltf": "dist/cli/index.js"
|
|
20
|
-
},
|
|
21
|
-
"imports": {
|
|
22
|
-
"#package.json": "./package.json"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"start": "node scripts/index.mjs",
|
|
26
|
-
"dev": "npm-watch compile",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"transform
|
|
32
|
-
"transform:
|
|
33
|
-
"pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"@img/sharp-darwin-
|
|
44
|
-
"@img/sharp-
|
|
45
|
-
"@img/sharp-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"@
|
|
50
|
-
"@gltf-transform/
|
|
51
|
-
"@gltf-transform/
|
|
52
|
-
"
|
|
53
|
-
"command-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"ndarray
|
|
60
|
-
"ndarray-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
+
"version": "2.2.1-alpha.3",
|
|
4
|
+
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"readme": "README.md",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Needle",
|
|
10
|
+
"email": "help@needle.tools",
|
|
11
|
+
"url": "https://needle.tools/"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/needle-tools/needle-gltf-extensions.git"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"gltf-build-pipeline": "dist/cli/index.js",
|
|
19
|
+
"needle-gltf": "dist/cli/index.js"
|
|
20
|
+
},
|
|
21
|
+
"imports": {
|
|
22
|
+
"#package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"start": "node scripts/index.mjs",
|
|
26
|
+
"dev": "npm-watch compile",
|
|
27
|
+
"publish": "npm run compile && npm publish --access public",
|
|
28
|
+
"compile": "node tools/prebuild.mjs && (tsc || exit 1) && node tools/postbuild.mjs",
|
|
29
|
+
"clear-caches": "node scripts/clear-caches.mjs",
|
|
30
|
+
"limit-caches": "node scripts/limit-caches.mjs",
|
|
31
|
+
"transform": "node scripts/index.mjs",
|
|
32
|
+
"transform:make-progressive": "node scripts/make-progressive.mjs",
|
|
33
|
+
"transform:pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
|
|
34
|
+
"pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
|
|
35
|
+
"dev:pack-gltf": "npm run compile && node scripts/pack-gltf.mjs"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^18.7.23",
|
|
39
|
+
"npm-watch": "^0.13.0",
|
|
40
|
+
"typescript": "^4.9.5"
|
|
41
|
+
},
|
|
42
|
+
"optionalDependencies": {
|
|
43
|
+
"@img/sharp-darwin-arm64": "^0.33.4",
|
|
44
|
+
"@img/sharp-darwin-x64": "^0.33.4",
|
|
45
|
+
"@img/sharp-linux-arm": "^0.33.4",
|
|
46
|
+
"@img/sharp-win32-x64": "^0.33.4"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@donmccurdy/caporal": "~0.0.10",
|
|
50
|
+
"@gltf-transform/core": "^4.0.1",
|
|
51
|
+
"@gltf-transform/extensions": "^4.0.1",
|
|
52
|
+
"@gltf-transform/functions": "^4.0.1",
|
|
53
|
+
"command-exists": "^1.2.9",
|
|
54
|
+
"command-line-args": "^5.2.1",
|
|
55
|
+
"draco3dgltf": "^1.5.3",
|
|
56
|
+
"glob": "^7.2.0",
|
|
57
|
+
"meshoptimizer": "^0.18.1",
|
|
58
|
+
"micromatch": "^4.0.5",
|
|
59
|
+
"ndarray": "^1.0.19",
|
|
60
|
+
"ndarray-lanczos": "^0.3.0",
|
|
61
|
+
"ndarray-pixels": "^2.0.1",
|
|
62
|
+
"p-limit": "3.1.0",
|
|
63
|
+
"semver": "^7.3.7",
|
|
64
|
+
"sharp": "^0.33.4",
|
|
65
|
+
"tmp": "^0.2.1",
|
|
66
|
+
"uuid": "^9.0.1"
|
|
67
|
+
},
|
|
68
|
+
"watch": {
|
|
69
|
+
"compile": {
|
|
70
|
+
"patterns": [
|
|
71
|
+
"src"
|
|
72
|
+
],
|
|
73
|
+
"extensions": "ts",
|
|
74
|
+
"quiet": false
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
package/scripts/clear-caches.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { clearCache } from '../dist/cache/index.js';
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
import { clearCache } from '../dist/cache/index.js';
|
|
3
|
+
|
|
4
4
|
clearCache();
|
package/scripts/defaults.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
|
|
2
|
-
import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS } from "../dist/extensions/NEEDLE_opaque/index.js";
|
|
3
|
-
import { NEEDLE_progressive } from '../dist/index.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function registerExtensions(node) {
|
|
7
|
-
node.registerExtensions(ALL_EXTENSIONS);
|
|
8
|
-
node.registerExtensions(NEEDLE_EXTENSIONS);
|
|
9
|
-
node.registerExtensions([
|
|
10
|
-
NEEDLE_progressive
|
|
11
|
-
])
|
|
1
|
+
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
|
|
2
|
+
import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS } from "../dist/extensions/NEEDLE_opaque/index.js";
|
|
3
|
+
import { NEEDLE_progressive } from '../dist/index.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export function registerExtensions(node) {
|
|
7
|
+
node.registerExtensions(ALL_EXTENSIONS);
|
|
8
|
+
node.registerExtensions(NEEDLE_EXTENSIONS);
|
|
9
|
+
node.registerExtensions([
|
|
10
|
+
NEEDLE_progressive
|
|
11
|
+
])
|
|
12
12
|
}
|
package/scripts/fileutils.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { foreachGLTF as foreach } from '../dist/index.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export function foreachGLTF(args, callback) {
|
|
5
|
-
return foreach(args, callback);
|
|
1
|
+
import { foreachGLTF as foreach } from '../dist/index.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export function foreachGLTF(args, callback) {
|
|
5
|
+
return foreach(args, callback);
|
|
6
6
|
}
|