@needle-tools/gltf-build-pipeline 2.2.1-alpha.2 → 2.2.1-alpha.4
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 +933 -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/mesh.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
export function getMeshInformation(mesh) {
|
|
2
|
-
let maxVertexCount = 0;
|
|
3
|
-
let totalIndexCount = 0;
|
|
4
|
-
const totalVertexCount = mesh.listPrimitives().reduce((acc, prim) => {
|
|
5
|
-
const indices = prim.getIndices()?.getCount() || 0;
|
|
6
|
-
totalIndexCount += indices;
|
|
7
|
-
const vertices = prim.getAttribute('POSITION')?.getCount() || 0;
|
|
8
|
-
maxVertexCount = Math.max(maxVertexCount, vertices);
|
|
9
|
-
return acc + vertices;
|
|
10
|
-
}, 0);
|
|
11
|
-
return {
|
|
12
|
-
maxVertexCount,
|
|
13
|
-
totalVertexCount,
|
|
14
|
-
totalIndexCount,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Calculate the density of a mesh.
|
|
19
|
-
* @param prim - The primitive to calculate the density for.
|
|
20
|
-
* @returns The density of the mesh or -1 if the mesh is not indexed.
|
|
21
|
-
*/
|
|
22
|
-
export function calculateMeshDensity(prim) {
|
|
23
|
-
const bounds = {
|
|
24
|
-
min: [Infinity, Infinity, Infinity],
|
|
25
|
-
max: [-Infinity, -Infinity, -Infinity],
|
|
26
|
-
};
|
|
27
|
-
const position = prim.getAttribute('POSITION');
|
|
28
|
-
if (!position)
|
|
29
|
-
return -1;
|
|
30
|
-
let tempVec3 = [0, 0, 0];
|
|
31
|
-
for (let i = 0; i < position.getCount(); i++) {
|
|
32
|
-
tempVec3 = position.getElement(i, tempVec3);
|
|
33
|
-
expandBounds(tempVec3, bounds);
|
|
34
|
-
}
|
|
35
|
-
const indices = prim.getIndices();
|
|
36
|
-
let area = 0;
|
|
37
|
-
if (indices) {
|
|
38
|
-
// calculate surface area
|
|
39
|
-
const numIndices = indices.getCount();
|
|
40
|
-
const indexArray = indices.getArray();
|
|
41
|
-
const v0 = [0, 0, 0];
|
|
42
|
-
const v1 = [0, 0, 0];
|
|
43
|
-
const v2 = [0, 0, 0];
|
|
44
|
-
const e1 = [0, 0, 0];
|
|
45
|
-
const e2 = [0, 0, 0];
|
|
46
|
-
const boundSizeX = bounds.max[0] - bounds.min[0];
|
|
47
|
-
const boundSizeY = bounds.max[1] - bounds.min[1];
|
|
48
|
-
const boundSizeZ = bounds.max[2] - bounds.min[2];
|
|
49
|
-
const maxBounds = Math.max(boundSizeX, boundSizeY, boundSizeZ);
|
|
50
|
-
for (let i = 0; i < numIndices; i += 3) {
|
|
51
|
-
const i0 = indexArray[i + 0];
|
|
52
|
-
const i1 = indexArray[i + 1];
|
|
53
|
-
const i2 = indexArray[i + 2];
|
|
54
|
-
position.getElement(i0, v0);
|
|
55
|
-
position.getElement(i1, v1);
|
|
56
|
-
position.getElement(i2, v2);
|
|
57
|
-
e1[0] = v1[0] - v0[0];
|
|
58
|
-
e1[1] = v1[1] - v0[1];
|
|
59
|
-
e1[2] = v1[2] - v0[2];
|
|
60
|
-
e2[0] = v2[0] - v0[0];
|
|
61
|
-
e2[1] = v2[1] - v0[1];
|
|
62
|
-
e2[2] = v2[2] - v0[2];
|
|
63
|
-
// Normalize vertex distance in mesh bounds
|
|
64
|
-
e1[0] /= maxBounds;
|
|
65
|
-
e1[1] /= maxBounds;
|
|
66
|
-
e1[2] /= maxBounds;
|
|
67
|
-
e2[0] /= maxBounds;
|
|
68
|
-
e2[1] /= maxBounds;
|
|
69
|
-
e2[2] /= maxBounds;
|
|
70
|
-
// Cross product to get the area of the triangle
|
|
71
|
-
const cross = [
|
|
72
|
-
e1[1] * e2[2] - e1[2] * e2[1],
|
|
73
|
-
e1[2] * e2[0] - e1[0] * e2[2],
|
|
74
|
-
e1[0] * e2[1] - e1[1] * e2[0]
|
|
75
|
-
];
|
|
76
|
-
// Add the area (half the magnitude of the cross product) to the total
|
|
77
|
-
area += Math.sqrt(cross[0] * cross[0] + cross[1] * cross[1] + cross[2] * cross[2]) / 2;
|
|
78
|
-
}
|
|
79
|
-
const count = indices.getCount() / 3;
|
|
80
|
-
const density = count / area;
|
|
81
|
-
// const size = [0, 0, 0] as vec3;
|
|
82
|
-
// size[0] = bounds.max[0] - bounds.min[0];
|
|
83
|
-
// size[1] = bounds.max[1] - bounds.min[1];
|
|
84
|
-
// size[2] = bounds.max[2] - bounds.min[2];
|
|
85
|
-
// const volume = size[0] * size[1] * size[2];
|
|
86
|
-
// const density = count / volume;
|
|
87
|
-
return density;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
// calculate density if the mesh is not indexed
|
|
91
|
-
const count = position.getCount();
|
|
92
|
-
const size = [0, 0, 0];
|
|
93
|
-
size[0] = bounds.max[0] - bounds.min[0];
|
|
94
|
-
size[1] = bounds.max[1] - bounds.min[1];
|
|
95
|
-
size[2] = bounds.max[2] - bounds.min[2];
|
|
96
|
-
const volume = size[0] * size[1] * size[2];
|
|
97
|
-
const density = count / volume;
|
|
98
|
-
return density;
|
|
99
|
-
}
|
|
100
|
-
return -1;
|
|
101
|
-
function expandBounds(point, target) {
|
|
102
|
-
for (let i = 0; i < 3; i++) {
|
|
103
|
-
target.min[i] = Math.min(point[i], target.min[i]);
|
|
104
|
-
target.max[i] = Math.max(point[i], target.max[i]);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
1
|
+
export function getMeshInformation(mesh) {
|
|
2
|
+
let maxVertexCount = 0;
|
|
3
|
+
let totalIndexCount = 0;
|
|
4
|
+
const totalVertexCount = mesh.listPrimitives().reduce((acc, prim) => {
|
|
5
|
+
const indices = prim.getIndices()?.getCount() || 0;
|
|
6
|
+
totalIndexCount += indices;
|
|
7
|
+
const vertices = prim.getAttribute('POSITION')?.getCount() || 0;
|
|
8
|
+
maxVertexCount = Math.max(maxVertexCount, vertices);
|
|
9
|
+
return acc + vertices;
|
|
10
|
+
}, 0);
|
|
11
|
+
return {
|
|
12
|
+
maxVertexCount,
|
|
13
|
+
totalVertexCount,
|
|
14
|
+
totalIndexCount,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Calculate the density of a mesh.
|
|
19
|
+
* @param prim - The primitive to calculate the density for.
|
|
20
|
+
* @returns The density of the mesh or -1 if the mesh is not indexed.
|
|
21
|
+
*/
|
|
22
|
+
export function calculateMeshDensity(prim) {
|
|
23
|
+
const bounds = {
|
|
24
|
+
min: [Infinity, Infinity, Infinity],
|
|
25
|
+
max: [-Infinity, -Infinity, -Infinity],
|
|
26
|
+
};
|
|
27
|
+
const position = prim.getAttribute('POSITION');
|
|
28
|
+
if (!position)
|
|
29
|
+
return -1;
|
|
30
|
+
let tempVec3 = [0, 0, 0];
|
|
31
|
+
for (let i = 0; i < position.getCount(); i++) {
|
|
32
|
+
tempVec3 = position.getElement(i, tempVec3);
|
|
33
|
+
expandBounds(tempVec3, bounds);
|
|
34
|
+
}
|
|
35
|
+
const indices = prim.getIndices();
|
|
36
|
+
let area = 0;
|
|
37
|
+
if (indices) {
|
|
38
|
+
// calculate surface area
|
|
39
|
+
const numIndices = indices.getCount();
|
|
40
|
+
const indexArray = indices.getArray();
|
|
41
|
+
const v0 = [0, 0, 0];
|
|
42
|
+
const v1 = [0, 0, 0];
|
|
43
|
+
const v2 = [0, 0, 0];
|
|
44
|
+
const e1 = [0, 0, 0];
|
|
45
|
+
const e2 = [0, 0, 0];
|
|
46
|
+
const boundSizeX = bounds.max[0] - bounds.min[0];
|
|
47
|
+
const boundSizeY = bounds.max[1] - bounds.min[1];
|
|
48
|
+
const boundSizeZ = bounds.max[2] - bounds.min[2];
|
|
49
|
+
const maxBounds = Math.max(boundSizeX, boundSizeY, boundSizeZ);
|
|
50
|
+
for (let i = 0; i < numIndices; i += 3) {
|
|
51
|
+
const i0 = indexArray[i + 0];
|
|
52
|
+
const i1 = indexArray[i + 1];
|
|
53
|
+
const i2 = indexArray[i + 2];
|
|
54
|
+
position.getElement(i0, v0);
|
|
55
|
+
position.getElement(i1, v1);
|
|
56
|
+
position.getElement(i2, v2);
|
|
57
|
+
e1[0] = v1[0] - v0[0];
|
|
58
|
+
e1[1] = v1[1] - v0[1];
|
|
59
|
+
e1[2] = v1[2] - v0[2];
|
|
60
|
+
e2[0] = v2[0] - v0[0];
|
|
61
|
+
e2[1] = v2[1] - v0[1];
|
|
62
|
+
e2[2] = v2[2] - v0[2];
|
|
63
|
+
// Normalize vertex distance in mesh bounds
|
|
64
|
+
e1[0] /= maxBounds;
|
|
65
|
+
e1[1] /= maxBounds;
|
|
66
|
+
e1[2] /= maxBounds;
|
|
67
|
+
e2[0] /= maxBounds;
|
|
68
|
+
e2[1] /= maxBounds;
|
|
69
|
+
e2[2] /= maxBounds;
|
|
70
|
+
// Cross product to get the area of the triangle
|
|
71
|
+
const cross = [
|
|
72
|
+
e1[1] * e2[2] - e1[2] * e2[1],
|
|
73
|
+
e1[2] * e2[0] - e1[0] * e2[2],
|
|
74
|
+
e1[0] * e2[1] - e1[1] * e2[0]
|
|
75
|
+
];
|
|
76
|
+
// Add the area (half the magnitude of the cross product) to the total
|
|
77
|
+
area += Math.sqrt(cross[0] * cross[0] + cross[1] * cross[1] + cross[2] * cross[2]) / 2;
|
|
78
|
+
}
|
|
79
|
+
const count = indices.getCount() / 3;
|
|
80
|
+
const density = count / area;
|
|
81
|
+
// const size = [0, 0, 0] as vec3;
|
|
82
|
+
// size[0] = bounds.max[0] - bounds.min[0];
|
|
83
|
+
// size[1] = bounds.max[1] - bounds.min[1];
|
|
84
|
+
// size[2] = bounds.max[2] - bounds.min[2];
|
|
85
|
+
// const volume = size[0] * size[1] * size[2];
|
|
86
|
+
// const density = count / volume;
|
|
87
|
+
return density;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// calculate density if the mesh is not indexed
|
|
91
|
+
const count = position.getCount();
|
|
92
|
+
const size = [0, 0, 0];
|
|
93
|
+
size[0] = bounds.max[0] - bounds.min[0];
|
|
94
|
+
size[1] = bounds.max[1] - bounds.min[1];
|
|
95
|
+
size[2] = bounds.max[2] - bounds.min[2];
|
|
96
|
+
const volume = size[0] * size[1] * size[2];
|
|
97
|
+
const density = count / volume;
|
|
98
|
+
return density;
|
|
99
|
+
}
|
|
100
|
+
return -1;
|
|
101
|
+
function expandBounds(point, target) {
|
|
102
|
+
for (let i = 0; i < 3; i++) {
|
|
103
|
+
target.min[i] = Math.min(point[i], target.min[i]);
|
|
104
|
+
target.max[i] = Math.max(point[i], target.max[i]);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
package/dist/utils/nodeio.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeIO, Document } from "@gltf-transform/core";
|
|
2
|
-
/**
|
|
3
|
-
* Handle writing glTf, GLB and VRM files
|
|
4
|
-
*/
|
|
5
|
-
export declare function writeNodeIO(nodeio: NodeIO, filename: string, document: Document): Promise<string>;
|
|
1
|
+
import { NodeIO, Document } from "@gltf-transform/core";
|
|
2
|
+
/**
|
|
3
|
+
* Handle writing glTf, GLB and VRM files
|
|
4
|
+
*/
|
|
5
|
+
export declare function writeNodeIO(nodeio: NodeIO, filename: string, document: Document): Promise<string>;
|
package/dist/utils/nodeio.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { writeFile } from "fs/promises";
|
|
2
|
-
/**
|
|
3
|
-
* Handle writing glTf, GLB and VRM files
|
|
4
|
-
*/
|
|
5
|
-
export async function writeNodeIO(nodeio, filename, document) {
|
|
6
|
-
// see https://github.com/donmccurdy/glTF-Transform/issues/1390
|
|
7
|
-
if (filename.endsWith(".vrm")) {
|
|
8
|
-
const bin = await nodeio.writeBinary(document);
|
|
9
|
-
await writeFile(filename, bin);
|
|
10
|
-
}
|
|
11
|
-
else
|
|
12
|
-
await nodeio.write(filename, document);
|
|
13
|
-
return filename;
|
|
14
|
-
}
|
|
1
|
+
import { writeFile } from "fs/promises";
|
|
2
|
+
/**
|
|
3
|
+
* Handle writing glTf, GLB and VRM files
|
|
4
|
+
*/
|
|
5
|
+
export async function writeNodeIO(nodeio, filename, document) {
|
|
6
|
+
// see https://github.com/donmccurdy/glTF-Transform/issues/1390
|
|
7
|
+
if (filename.endsWith(".vrm")) {
|
|
8
|
+
const bin = await nodeio.writeBinary(document);
|
|
9
|
+
await writeFile(filename, bin);
|
|
10
|
+
}
|
|
11
|
+
else
|
|
12
|
+
await nodeio.write(filename, document);
|
|
13
|
+
return filename;
|
|
14
|
+
}
|
package/dist/utils/stats.d.ts
CHANGED
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { Logger } from "@donmccurdy/caporal";
|
|
2
|
-
import { Document, Logger as _Logger } from "@gltf-transform/core";
|
|
3
|
-
import { Config } from "../config/index.js";
|
|
4
|
-
export type ProcessStats = {
|
|
5
|
-
startTime: number;
|
|
6
|
-
totalGPUMemoryInMB: number;
|
|
7
|
-
totalFilesProcessed: number;
|
|
8
|
-
totalFileSizeInMB: number;
|
|
9
|
-
totalFileSizeInMBBefore: number;
|
|
10
|
-
};
|
|
11
|
-
export declare function printStats(stats: ProcessStats, logger: Logger | _Logger, config: Config): void;
|
|
12
|
-
declare class Stats {
|
|
13
|
-
/** Size in bytes */
|
|
14
|
-
size: number;
|
|
15
|
-
asset: {
|
|
16
|
-
version: string;
|
|
17
|
-
generator?: string;
|
|
18
|
-
copyright?: string;
|
|
19
|
-
extras: any;
|
|
20
|
-
};
|
|
21
|
-
nodes: number;
|
|
22
|
-
materials: number;
|
|
23
|
-
meshes: MeshInfo;
|
|
24
|
-
textures: TextureInfo;
|
|
25
|
-
constructor(document: Document, size: number);
|
|
26
|
-
static combine(others: Stats[]): Stats;
|
|
27
|
-
}
|
|
28
|
-
export declare class FileStats extends Stats {
|
|
29
|
-
readonly filename: string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare function
|
|
53
|
-
export
|
|
1
|
+
import { Logger } from "@donmccurdy/caporal";
|
|
2
|
+
import { Document, Logger as _Logger } from "@gltf-transform/core";
|
|
3
|
+
import { Config } from "../config/index.js";
|
|
4
|
+
export type ProcessStats = {
|
|
5
|
+
startTime: number;
|
|
6
|
+
totalGPUMemoryInMB: number;
|
|
7
|
+
totalFilesProcessed: number;
|
|
8
|
+
totalFileSizeInMB: number;
|
|
9
|
+
totalFileSizeInMBBefore: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function printStats(stats: ProcessStats, logger: Logger | _Logger, config: Config): void;
|
|
12
|
+
declare class Stats {
|
|
13
|
+
/** Size in bytes */
|
|
14
|
+
size: number;
|
|
15
|
+
asset: {
|
|
16
|
+
version: string;
|
|
17
|
+
generator?: string;
|
|
18
|
+
copyright?: string;
|
|
19
|
+
extras: any;
|
|
20
|
+
};
|
|
21
|
+
nodes: number;
|
|
22
|
+
materials: number;
|
|
23
|
+
meshes: MeshInfo;
|
|
24
|
+
textures: TextureInfo;
|
|
25
|
+
constructor(document: Document, size: number);
|
|
26
|
+
static combine(others: Stats[], type?: "main" | "lods"): Stats | null;
|
|
27
|
+
}
|
|
28
|
+
export declare class FileStats extends Stats {
|
|
29
|
+
readonly filename: string;
|
|
30
|
+
readonly isLOD: boolean;
|
|
31
|
+
constructor(file: string, document: Document);
|
|
32
|
+
}
|
|
33
|
+
export declare class MeshInfo {
|
|
34
|
+
count: number;
|
|
35
|
+
primitives: number;
|
|
36
|
+
vertices: number;
|
|
37
|
+
triangles: number;
|
|
38
|
+
memory: number;
|
|
39
|
+
formats: string[];
|
|
40
|
+
addTo(other: MeshInfo): void;
|
|
41
|
+
}
|
|
42
|
+
export declare class TextureInfo {
|
|
43
|
+
count: number;
|
|
44
|
+
memory: number;
|
|
45
|
+
gpu_memory: number;
|
|
46
|
+
formats: string[];
|
|
47
|
+
addTo(other: TextureInfo): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a new filestats object from a file and a document
|
|
51
|
+
*/
|
|
52
|
+
export declare function createNewFilestats(file: string, document: Document): FileStats;
|
|
53
|
+
export declare function writeFileStatsToFile(filestats: FileStats[], output_path: string): string | null;
|
|
54
|
+
export {};
|