@margoengine/loaders 0.1.0 → 1.0.0
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/LICENSE +201 -201
- package/NOTICE +4 -4
- package/README.md +1666 -1198
- package/dist/crease.d.ts +7 -0
- package/dist/crease.js +67 -0
- package/dist/dae-common.js +1 -1
- package/dist/dae-kinematics.d.ts +65 -0
- package/dist/dae-kinematics.js +461 -0
- package/dist/dae.d.ts +9 -4
- package/dist/dae.js +16 -5
- package/dist/dxf-hatch.d.ts +8 -0
- package/dist/dxf-hatch.js +346 -0
- package/dist/dxf-leaders.d.ts +59 -0
- package/dist/dxf-leaders.js +258 -0
- package/dist/dxf.d.ts +42 -1
- package/dist/dxf.js +226 -15
- package/dist/engine.d.ts +5 -0
- package/dist/engine.js +3 -0
- package/dist/gcode.d.ts +37 -0
- package/dist/gcode.js +91 -0
- package/dist/geometry.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/mtl.d.ts +8 -3
- package/dist/mtl.js +91 -10
- package/dist/nrrd.d.ts +12 -5
- package/dist/nrrd.js +68 -26
- package/dist/obj.d.ts +3 -1
- package/dist/obj.js +7 -1
- package/dist/render.d.ts +9 -4
- package/dist/render.js +31 -3
- package/dist/shared/asset-url.js +82 -82
- package/dist/shared/crc32.d.ts +2 -2
- package/dist/shared/crc32.js +47 -47
- package/dist/shared/errors.js +36 -36
- package/dist/shared/inflate.js +284 -284
- package/dist/shared/normals.js +26 -26
- package/dist/shared/scene-scope.js +54 -54
- package/dist/shared/trailing-data.js +45 -42
- package/dist/threemf-beam-reader.d.ts +19 -0
- package/dist/threemf-beam-reader.js +165 -0
- package/dist/threemf-beams.d.ts +52 -0
- package/dist/threemf-beams.js +268 -0
- package/dist/threemf-boolean-read.d.ts +10 -0
- package/dist/threemf-boolean-read.js +113 -0
- package/dist/threemf-boolean.d.ts +59 -0
- package/dist/threemf-boolean.js +20 -0
- package/dist/threemf-csg.d.ts +14 -0
- package/dist/threemf-csg.js +193 -0
- package/dist/threemf-displacement-read.d.ts +8 -0
- package/dist/threemf-displacement-read.js +213 -0
- package/dist/threemf-displacement.d.ts +71 -0
- package/dist/threemf-displacement.js +18 -0
- package/dist/threemf-evaluate.d.ts +36 -0
- package/dist/threemf-evaluate.js +86 -0
- package/dist/threemf-functions.d.ts +33 -0
- package/dist/threemf-functions.js +359 -0
- package/dist/threemf-lattice-mesh.d.ts +9 -0
- package/dist/threemf-lattice-mesh.js +115 -0
- package/dist/threemf-lattice.js +10 -145
- package/dist/threemf-levelset.d.ts +23 -0
- package/dist/threemf-levelset.js +105 -0
- package/dist/threemf-materials.d.ts +89 -2
- package/dist/threemf-materials.js +194 -11
- package/dist/threemf-mesh.d.ts +21 -6
- package/dist/threemf-mesh.js +266 -45
- package/dist/threemf-secure.d.ts +50 -0
- package/dist/threemf-secure.js +153 -0
- package/dist/threemf-tessellate.d.ts +37 -0
- package/dist/threemf-tessellate.js +277 -0
- package/dist/threemf-volume-colour.d.ts +25 -0
- package/dist/threemf-volume-colour.js +233 -0
- package/dist/threemf-volume-sample.d.ts +8 -0
- package/dist/threemf-volume-sample.js +65 -0
- package/dist/threemf-volumetric-read.d.ts +15 -0
- package/dist/threemf-volumetric-read.js +539 -0
- package/dist/threemf-volumetric.d.ts +177 -0
- package/dist/threemf-volumetric.js +28 -0
- package/dist/threemf.d.ts +73 -4
- package/dist/threemf.js +235 -41
- package/dist/types.d.ts +18 -0
- package/dist/workers/usd.js +1 -1
- package/package.json +291 -246
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// Tessellates and moves a 3MF displacement mesh as the Displacement Extension specification defines it
|
|
2
|
+
// (https://github.com/3MFConsortium/spec_displacement, chapters 2 to 5). The specification leaves the subdivision to
|
|
3
|
+
// the consumer. Here an edge segment is split at its middle until it meets its target, and the target depends only on
|
|
4
|
+
// the segment, so both triangles on a segment decide alike and no crack opens: the per-edge factors of Fisher,
|
|
5
|
+
// Fatahalian, Boulos, Akeley, Mark and Hanrahan, "DiagSplit: parallel, crack-free, adaptive tessellation for
|
|
6
|
+
// micropolygon rendering", ACM Transactions on Graphics 28(5), 2009
|
|
7
|
+
// (https://graphics.stanford.edu/~mdfisher/Data/DiagSplit.pdf), applied as the barycentric edge-split patterns of
|
|
8
|
+
// Boubekeur and Schlick, "Generic adaptive mesh refinement", GPU Gems 3 chapter 5, 2007
|
|
9
|
+
// (https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch05.html).
|
|
10
|
+
import { cornerProperty } from './threemf.js';
|
|
11
|
+
import { LoaderError } from './types.js';
|
|
12
|
+
import { floats, uints } from './util.js';
|
|
13
|
+
const F = '3MF';
|
|
14
|
+
const NONE = 0xffffffff;
|
|
15
|
+
/** The barycentric weight of a corner: midpoints stay exact. */
|
|
16
|
+
const ONE = 2 ** 30;
|
|
17
|
+
/** Interpolated displacement vectors turn at most this far between two samples. */
|
|
18
|
+
const TURN = Math.cos(Math.PI / 12);
|
|
19
|
+
const wrap = (style, x, size) => {
|
|
20
|
+
if (style === 'clamp')
|
|
21
|
+
return Math.min(size - 1, Math.max(x, 0));
|
|
22
|
+
if (style === 'none')
|
|
23
|
+
return x >= 0 && x < size ? x : -1;
|
|
24
|
+
const turns = Math.floor(x / size);
|
|
25
|
+
return style === 'mirror' && turns % 2 !== 0 ? (turns + 1) * size - x - 1 : x - turns * size;
|
|
26
|
+
};
|
|
27
|
+
/** The displacement at `(u, v)` along a unit vector, in model units (chapter 2). */
|
|
28
|
+
export function displacementAt({ map, height, offset }, u, v) {
|
|
29
|
+
const { width, height: rows, data, channel, tileU, tileV } = map;
|
|
30
|
+
if ((tileU === 'none' && (u < 0 || u > 1)) || (tileV === 'none' && (v < 0 || v > 1)))
|
|
31
|
+
return 0;
|
|
32
|
+
const texel = (i, j) => {
|
|
33
|
+
const row = wrap(tileV, i, rows), column = wrap(tileU, j, width);
|
|
34
|
+
return row < 0 || column < 0 ? 0 : data[(row * width + column) * 4 + channel] / 65535;
|
|
35
|
+
};
|
|
36
|
+
// Image rows run down from the top, v up from the bottom; texel centres are at halves.
|
|
37
|
+
const i = (1 - v) * rows - 0.5, j = u * width - 0.5;
|
|
38
|
+
if (map.nearest)
|
|
39
|
+
return texel(Math.round(i), Math.round(j)) * height + offset;
|
|
40
|
+
const i0 = Math.floor(i), j0 = Math.floor(j), a = i - i0, b = j - j0;
|
|
41
|
+
return ((texel(i0, j0) * (1 - a) * (1 - b) +
|
|
42
|
+
texel(i0, j0 + 1) * (1 - a) * b +
|
|
43
|
+
texel(i0 + 1, j0) * a * (1 - b) +
|
|
44
|
+
texel(i0 + 1, j0 + 1) * a * b) *
|
|
45
|
+
height +
|
|
46
|
+
offset);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The displaced surface of one mesh as a new triangle mesh in the same object coordinates: welded where triangles meet
|
|
50
|
+
* in one point, and joined where their displaced edges part (section 5.2: directly when both sides use the same
|
|
51
|
+
* vectors, through the base edge when not). `groups[t]` and `corners[3 t + k]` give triangle `t`'s displacement group
|
|
52
|
+
* (-1 for none) and corner coordinates. Property colors follow their base triangle; a colour gradient is interpolated.
|
|
53
|
+
*/
|
|
54
|
+
export function tessellate(model, object, mesh, groups, corners, { samplesPerTexel, maxSegments, maxTriangles }) {
|
|
55
|
+
const vertexCount = mesh.vertices.length / 3, triangleCount = mesh.triangles.length / 3, depthCap = Math.floor(Math.log2(maxSegments)), vertices = floats(), triangles = uints(), pids = uints(), properties = uints(), flat = [], welded = new Map();
|
|
56
|
+
const faces = [];
|
|
57
|
+
for (let t = 0; t < triangleCount; t++) {
|
|
58
|
+
const face = { corners: [], group: groups[t], field: [] };
|
|
59
|
+
for (let k = 0; k < 3; k++) {
|
|
60
|
+
const vertex = mesh.triangles.array[t * 3 + k];
|
|
61
|
+
if (vertex >= vertexCount)
|
|
62
|
+
throw new LoaderError(F, 'range', `triangle index ${vertex} of object ${object.id} is outside 0..${vertexCount - 1}`);
|
|
63
|
+
face.corners.push({ vertex, position: [...mesh.vertices.array.subarray(vertex * 3, vertex * 3 + 3)] });
|
|
64
|
+
if (face.group) {
|
|
65
|
+
const at = corners[t * 3 + k] * 3, { coordinates, vectors } = face.group;
|
|
66
|
+
face.field.push([...coordinates.subarray(at, at + 3), ...vectors.subarray(at, at + 3)]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
faces.push(face);
|
|
70
|
+
}
|
|
71
|
+
/** `values` of the corners with a weight, summed in the order of their vertices, so both sides of an edge agree. */
|
|
72
|
+
const blend = (face, w, values) => {
|
|
73
|
+
const used = [0, 1, 2].filter((k) => w[k] > 0).sort((a, b) => face.corners[a].vertex - face.corners[b].vertex);
|
|
74
|
+
return values[0].map((_, i) => used.reduce((sum, k) => sum + (w[k] / ONE) * values[k][i], 0));
|
|
75
|
+
};
|
|
76
|
+
const unit = (v) => {
|
|
77
|
+
const length = Math.hypot(v[3], v[4], v[5]) || 1;
|
|
78
|
+
return [v[3] / length, v[4] / length, v[5] / length];
|
|
79
|
+
};
|
|
80
|
+
/** The vertex at weights `w` of a triangle, on its base or displaced; `shared` ones weld with equal points. */
|
|
81
|
+
const vertex = (face, w, displaced, shared) => {
|
|
82
|
+
const p = blend(face, w, face.corners.map((c) => c.position));
|
|
83
|
+
if (displaced && face.group) {
|
|
84
|
+
const field = blend(face, w, face.field), n = unit(field), d = displacementAt(face.group, field[0], field[1]) * field[2];
|
|
85
|
+
for (let k = 0; k < 3; k++)
|
|
86
|
+
p[k] += d * n[k];
|
|
87
|
+
}
|
|
88
|
+
const x = Math.fround(p[0]), y = Math.fround(p[1]), z = Math.fround(p[2]);
|
|
89
|
+
if (!Number.isFinite(x + y + z))
|
|
90
|
+
throw new LoaderError(F, 'range', `object ${object.id} displaces a point out of range`);
|
|
91
|
+
const key = shared ? `${x},${y},${z}` : '';
|
|
92
|
+
let id = shared ? welded.get(key) : undefined;
|
|
93
|
+
if (id === undefined) {
|
|
94
|
+
id = vertices.length / 3;
|
|
95
|
+
vertices.push3(x, y, z);
|
|
96
|
+
if (shared)
|
|
97
|
+
welded.set(key, id);
|
|
98
|
+
}
|
|
99
|
+
return id;
|
|
100
|
+
};
|
|
101
|
+
/** Segments an edge needs for its picture and its turning vectors, as a depth of halvings. */
|
|
102
|
+
const depths = new Map(), sides = new Map(), edgeKey = (face, k) => {
|
|
103
|
+
const a = face.corners[k].vertex, b = face.corners[(k + 1) % 3].vertex;
|
|
104
|
+
return a < b ? `${a}:${b}` : `${b}:${a}`;
|
|
105
|
+
};
|
|
106
|
+
/** The texels between two points of a displaced triangle, times the samples asked for. */
|
|
107
|
+
const texels = ({ map }, p, q) => Math.hypot((p[0] - q[0]) * map.width, (p[1] - q[1]) * map.height) * samplesPerTexel;
|
|
108
|
+
const turns = (p, q) => {
|
|
109
|
+
const a = unit(p), b = unit(q);
|
|
110
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
111
|
+
};
|
|
112
|
+
faces.forEach((face, t) => {
|
|
113
|
+
for (let k = 0; k < 3; k++) {
|
|
114
|
+
const key = edgeKey(face, k), { group, field } = face;
|
|
115
|
+
let depth = 0;
|
|
116
|
+
if (group && (group.height !== 0 || group.offset !== 0)) {
|
|
117
|
+
const p = field[k], q = field[(k + 1) % 3], angle = Math.acos(Math.max(-1, Math.min(1, turns(p, q)))), segments = Math.max(texels(group, p, q), angle / Math.acos(TURN));
|
|
118
|
+
depth = Math.min(depthCap, Math.max(0, Math.ceil(Math.log2(segments) - 1e-6)));
|
|
119
|
+
}
|
|
120
|
+
depths.set(key, Math.max(depths.get(key) ?? 0, depth));
|
|
121
|
+
let list = sides.get(key);
|
|
122
|
+
if (!list)
|
|
123
|
+
sides.set(key, (list = []));
|
|
124
|
+
list.push([t, k]);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
// Synthetic colours for the points inside a triangle whose corners differ.
|
|
128
|
+
let gradient;
|
|
129
|
+
const colorsOf = (t) => [0, 1, 2].map((k) => {
|
|
130
|
+
const property = cornerProperty(model, object, mesh, t, k);
|
|
131
|
+
return property && model.properties.get(property.id)?.[property.index];
|
|
132
|
+
});
|
|
133
|
+
const emit = (ids, t, weights) => {
|
|
134
|
+
if (ids[0] === ids[1] || ids[1] === ids[2] || ids[2] === ids[0])
|
|
135
|
+
return;
|
|
136
|
+
if (triangles.length / 3 >= maxTriangles)
|
|
137
|
+
throw new LoaderError(F, 'limit', `the displaced surface of object ${object.id} exceeds ${maxTriangles} triangles; lower samplesPerTexel or maxSegments, or raise maxTriangles`);
|
|
138
|
+
triangles.push3(ids[0], ids[1], ids[2]);
|
|
139
|
+
const colors = colorsOf(t), [a, b, c] = colors;
|
|
140
|
+
flat.push(a);
|
|
141
|
+
if (weights && a && b && c && (String(a) !== String(b) || String(a) !== String(c))) {
|
|
142
|
+
if (!gradient) {
|
|
143
|
+
gradient = { index: model.propertyIds.length, colors: [] };
|
|
144
|
+
const id = `\0displaced ${object.id}`;
|
|
145
|
+
model.propertyIds.push(id);
|
|
146
|
+
model.properties.set(id, gradient.colors);
|
|
147
|
+
}
|
|
148
|
+
const first = gradient.colors.length;
|
|
149
|
+
for (const w of weights)
|
|
150
|
+
gradient.colors.push([0, 1, 2, 3].map((i) => (w[0] * a[i] + w[1] * b[i] + w[2] * c[i]) / ONE));
|
|
151
|
+
pids.push(gradient.index);
|
|
152
|
+
properties.push3(first, first + 1, first + 2);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const p = mesh.p.array[t * 3];
|
|
156
|
+
pids.push(mesh.pid.array[t] ?? NONE);
|
|
157
|
+
properties.push3(p, p, p);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
faces.forEach((face, t) => {
|
|
161
|
+
const cache = new Map();
|
|
162
|
+
const at = (w) => {
|
|
163
|
+
const key = `${w[1]},${w[2]}`;
|
|
164
|
+
let id = cache.get(key);
|
|
165
|
+
if (id === undefined)
|
|
166
|
+
cache.set(key, (id = vertex(face, w, true, w.includes(0))));
|
|
167
|
+
return id;
|
|
168
|
+
};
|
|
169
|
+
const split = (p, q) => {
|
|
170
|
+
const extent = Math.max(Math.abs(p[0] - q[0]), Math.abs(p[1] - q[1]), Math.abs(p[2] - q[2])), opposite = [0, 1, 2].find((k) => p[k] === 0 && q[k] === 0);
|
|
171
|
+
if (opposite !== undefined) {
|
|
172
|
+
if (extent <= ONE / 2 ** depths.get(edgeKey(face, (opposite + 1) % 3)))
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// The inside of an undisplaced or unmoved triangle stays coarse.
|
|
177
|
+
if (!face.group || (!face.group.height && !face.group.offset) || extent <= ONE / 2 ** depthCap)
|
|
178
|
+
return;
|
|
179
|
+
const a = blend(face, p, face.field), b = blend(face, q, face.field);
|
|
180
|
+
if (texels(face.group, a, b) <= 1 + 1e-6 && turns(a, b) >= TURN - 1e-9)
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
return [(p[0] + q[0]) / 2, (p[1] + q[1]) / 2, (p[2] + q[2]) / 2];
|
|
184
|
+
};
|
|
185
|
+
const length = (p, q) => {
|
|
186
|
+
const base = face.corners.map((c) => c.position), a = blend(face, p, base), b = blend(face, q, base);
|
|
187
|
+
return Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
|
|
188
|
+
};
|
|
189
|
+
const stack = [
|
|
190
|
+
[
|
|
191
|
+
[ONE, 0, 0],
|
|
192
|
+
[0, ONE, 0],
|
|
193
|
+
[0, 0, ONE],
|
|
194
|
+
],
|
|
195
|
+
];
|
|
196
|
+
while (stack.length) {
|
|
197
|
+
let corner = stack.pop();
|
|
198
|
+
let middle = corner.map((p, k) => split(p, corner[(k + 1) % 3]));
|
|
199
|
+
const count = middle.filter(Boolean).length;
|
|
200
|
+
if (!count) {
|
|
201
|
+
emit(corner.map(at), t, corner);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (count === 3) {
|
|
205
|
+
const [a, b, c] = corner, [ab, bc, ca] = middle;
|
|
206
|
+
stack.push([a, ab, ca], [ab, b, bc], [ca, bc, c], [ab, bc, ca]);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// Turn the triangle so that AB is split and, with two splits, CA is not.
|
|
210
|
+
const first = [0, 1, 2].find((k) => middle[k] && (count === 1 || !middle[(k + 2) % 3])), turned = (list) => [...list.slice(first), ...list.slice(0, first)];
|
|
211
|
+
corner = turned(corner);
|
|
212
|
+
middle = turned(middle);
|
|
213
|
+
const [a, b, c] = corner, [ab, bc] = middle;
|
|
214
|
+
if (count === 1)
|
|
215
|
+
stack.push([a, ab, c], [ab, b, c]);
|
|
216
|
+
else if (length(a, bc) <= length(ab, c))
|
|
217
|
+
stack.push([ab, b, bc], [a, ab, bc], [a, bc, c]);
|
|
218
|
+
else
|
|
219
|
+
stack.push([ab, b, bc], [a, ab, c], [ab, bc, c]);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
// Join the sides of each edge where their surfaces part.
|
|
224
|
+
for (const [key, list] of sides) {
|
|
225
|
+
if (list.length !== 2)
|
|
226
|
+
continue;
|
|
227
|
+
const [[t, k], [u, j]] = list, one = faces[t], two = faces[u], from = one.corners[k].vertex, to = one.corners[(k + 1) % 3].vertex;
|
|
228
|
+
if (two.corners[j].vertex !== to || two.corners[(j + 1) % 3].vertex !== from)
|
|
229
|
+
continue;
|
|
230
|
+
const segments = 2 ** depths.get(key);
|
|
231
|
+
/** The weights of step `i` along an edge, from corner `a` to corner `b` of its triangle. */
|
|
232
|
+
const step = (a, b, i) => {
|
|
233
|
+
const w = [0, 0, 0];
|
|
234
|
+
w[a] = ONE - (i * ONE) / segments;
|
|
235
|
+
w[b] = (i * ONE) / segments;
|
|
236
|
+
return w;
|
|
237
|
+
};
|
|
238
|
+
/** The points of triangle `face` from corner `a` to corner `b`. */
|
|
239
|
+
const line = (face, a, b, displaced) => Array.from({ length: segments + 1 }, (_, i) => vertex(face, step(a, b, i), displaced, true));
|
|
240
|
+
const left = line(one, k, (k + 1) % 3, true), right = line(two, (j + 1) % 3, j, true);
|
|
241
|
+
// A joining triangle takes the colours along the edge of a displaced side.
|
|
242
|
+
const shown = one.group ? t : u, colour = (i) => (one.group ? step(k, (k + 1) % 3, i) : step((j + 1) % 3, j, i));
|
|
243
|
+
const strip = (x, y) => {
|
|
244
|
+
for (let i = 0; i < segments; i++) {
|
|
245
|
+
emit([x[i + 1], x[i], y[i]], shown, [colour(i + 1), colour(i), colour(i)]);
|
|
246
|
+
emit([x[i + 1], y[i], y[i + 1]], shown, [colour(i + 1), colour(i), colour(i + 1)]);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
const alike = (a, b) => {
|
|
250
|
+
if (!one.group || !two.group)
|
|
251
|
+
return true;
|
|
252
|
+
const p = unit(one.field[a]), q = unit(two.field[b]);
|
|
253
|
+
return Math.hypot(p[0] - q[0], p[1] - q[1], p[2] - q[2]) < 1e-5;
|
|
254
|
+
};
|
|
255
|
+
if (alike(k, (j + 1) % 3) && alike((k + 1) % 3, j)) {
|
|
256
|
+
if (left.every((id, i) => id === right[i]))
|
|
257
|
+
continue;
|
|
258
|
+
strip(left, right);
|
|
259
|
+
// The corners of a vertex close over its base point, one cap for each such edge that parts there.
|
|
260
|
+
for (const [i, x, y] of [
|
|
261
|
+
[0, right, left],
|
|
262
|
+
[segments, left, right],
|
|
263
|
+
]) {
|
|
264
|
+
if (x[i] === y[i])
|
|
265
|
+
continue;
|
|
266
|
+
const base = vertex(one, step(k, (k + 1) % 3, i), false, true);
|
|
267
|
+
emit([x[i], y[i], base], shown, [colour(i), colour(i), colour(i)]);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
const base = line(one, k, (k + 1) % 3, false);
|
|
272
|
+
strip(left, base);
|
|
273
|
+
strip(base, right);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return { vertices, triangles, pid: pids, p: properties, flat };
|
|
277
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ThreeMFMesh, type ThreeMFModel, type ThreeMFObject } from './threemf.js';
|
|
2
|
+
import { type FieldScope } from './threemf-functions.js';
|
|
3
|
+
import type { ThreeMFSampledField } from './threemf-volumetric.js';
|
|
4
|
+
/** The most samples along the longest side of a shape. */
|
|
5
|
+
export declare const MAX_COLOUR_SAMPLES = 512;
|
|
6
|
+
/** What colours a solid: each field's `transform` takes the mesh's coordinates to its function's. */
|
|
7
|
+
export interface VolumeFill {
|
|
8
|
+
scope: FieldScope;
|
|
9
|
+
/** The color function, or with `bases` the mixing contribution of each base material. */
|
|
10
|
+
fields: ThreeMFSampledField[];
|
|
11
|
+
/** A composite's base materials: their sRGB display colors, in the order of the fields. */
|
|
12
|
+
bases?: [number, number, number, number][];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The mesh with its volume colour: a new mesh of the same surface, split until no side is longer than the spacing
|
|
16
|
+
* (the longest side of the bounding box over `resolution`, or half of the smallest `minfeaturesize` of its fills).
|
|
17
|
+
*/
|
|
18
|
+
export declare function colourMesh(model: ThreeMFModel, object: ThreeMFObject, mesh: ThreeMFMesh, { resolution, maxTriangles }: {
|
|
19
|
+
resolution: number;
|
|
20
|
+
maxTriangles: number;
|
|
21
|
+
}): {
|
|
22
|
+
mesh: ThreeMFMesh;
|
|
23
|
+
spacing: number;
|
|
24
|
+
coarse: boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// Samples the colour of a 3MF volume data resource (volumetric extension sections 5.2.1 to 5.2.3,
|
|
2
|
+
// https://github.com/3MFConsortium/spec_volumetric) onto the triangles of its shape. The function is read at each
|
|
3
|
+
// vertex in object coordinates, its channels clipped to 0..1 as linear sRGB. A volume with a composite and no color is
|
|
4
|
+
// drawn in its mixture: the base materials' display colors in the sampled ratios, mixed in linear light as the
|
|
5
|
+
// materials extension shows a composite material, and in equal parts where the contributions add to under 1e-5, where
|
|
6
|
+
// the extension leaves the mixture to the consumer. A triangle the file gives a surface property keeps that property,
|
|
7
|
+
// which the specification puts above the volume's. Triangles are split at the middle of
|
|
8
|
+
// every side longer than the sample spacing; whether a side splits depends on the side alone, so the triangles on both
|
|
9
|
+
// sides decide alike and no crack opens (Fisher and others, "DiagSplit", ACM Transactions on Graphics 28(5), 2009,
|
|
10
|
+
// https://graphics.stanford.edu/~mdfisher/Data/DiagSplit.pdf; patterns of Boubekeur and Schlick, "Generic adaptive mesh
|
|
11
|
+
// refinement", GPU Gems 3 chapter 5, 2007).
|
|
12
|
+
import { LinearToSRGB, SRGBToLinear } from '@margoengine/math/color';
|
|
13
|
+
import { cornerProperty } from './threemf.js';
|
|
14
|
+
import { compileField } from './threemf-functions.js';
|
|
15
|
+
import { LoaderError } from './types.js';
|
|
16
|
+
import { floats, uints } from './util.js';
|
|
17
|
+
const F = '3MF';
|
|
18
|
+
const NONE = 0xffffffff;
|
|
19
|
+
/** The most samples along the longest side of a shape. */
|
|
20
|
+
export const MAX_COLOUR_SAMPLES = 512;
|
|
21
|
+
/** The least sum of mixing contributions the extension lets a file have. */
|
|
22
|
+
const LEAST_MIX = 1e-5;
|
|
23
|
+
/** One field over the points: its output's numbers at a vertex, with the fallback value where it is undefined. */
|
|
24
|
+
function reader(scope, field, points) {
|
|
25
|
+
const { functionId, channel, fallback, transform: m = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] } = field, pos = new Float64Array(3), program = compileField(scope, functionId, new Map([['pos', pos]])), output = program.outputs.get(channel), value = (i) => (Number.isFinite(output[i]) ? output[i] : fallback);
|
|
26
|
+
return (v) => {
|
|
27
|
+
const x = points[v * 3], y = points[v * 3 + 1], z = points[v * 3 + 2];
|
|
28
|
+
for (let k = 0; k < 3; k++)
|
|
29
|
+
pos[k] = x * m[k] + y * m[3 + k] + z * m[6 + k] + m[9 + k];
|
|
30
|
+
program.run();
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const unit = (x) => Math.min(1, Math.max(0, x));
|
|
35
|
+
/** The sRGB colour a fill gives each vertex. */
|
|
36
|
+
function shade({ scope, fields, bases }, points) {
|
|
37
|
+
const readers = fields.map((field) => reader(scope, field, points));
|
|
38
|
+
if (!bases)
|
|
39
|
+
return (v) => {
|
|
40
|
+
const value = readers[0](v), channel = (i) => LinearToSRGB(unit(value(i)));
|
|
41
|
+
return [channel(0), channel(1), channel(2), 1];
|
|
42
|
+
};
|
|
43
|
+
const linear = bases.map((c) => [SRGBToLinear(c[0]), SRGBToLinear(c[1]), SRGBToLinear(c[2]), c[3]]), weights = new Float64Array(readers.length);
|
|
44
|
+
return (v) => {
|
|
45
|
+
let total = 0;
|
|
46
|
+
for (let i = 0; i < readers.length; i++)
|
|
47
|
+
total += weights[i] = unit(readers[i](v)(0));
|
|
48
|
+
if (total < LEAST_MIX) {
|
|
49
|
+
weights.fill(1);
|
|
50
|
+
total = weights.length;
|
|
51
|
+
}
|
|
52
|
+
const [r, g, b, a] = [0, 1, 2, 3].map((c) => weights.reduce((sum, w, i) => sum + w * linear[i][c], 0) / total);
|
|
53
|
+
return [LinearToSRGB(r), LinearToSRGB(g), LinearToSRGB(b), a];
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The mesh with its volume colour: a new mesh of the same surface, split until no side is longer than the spacing
|
|
58
|
+
* (the longest side of the bounding box over `resolution`, or half of the smallest `minfeaturesize` of its fills).
|
|
59
|
+
*/
|
|
60
|
+
export function colourMesh(model, object, mesh, { resolution, maxTriangles }) {
|
|
61
|
+
const source = mesh.vertices.array, count = mesh.vertices.length / 3, triangleCount = mesh.triangles.length / 3, points = Array.from(source.subarray(0, count * 3)), low = [Infinity, Infinity, Infinity], high = [-Infinity, -Infinity, -Infinity];
|
|
62
|
+
for (let i = 0; i < points.length; i++) {
|
|
63
|
+
low[i % 3] = Math.min(low[i % 3], points[i]);
|
|
64
|
+
high[i % 3] = Math.max(high[i % 3], points[i]);
|
|
65
|
+
}
|
|
66
|
+
const longest = Math.max(0, ...high.map((v, k) => v - low[k])), fills = mesh.fills ?? [mesh.fill], minFeatureSize = fills
|
|
67
|
+
.flatMap((fill) => fill?.fields ?? [])
|
|
68
|
+
.reduce((least, { minFeatureSize: size }) => (size > 0 && (!least || size < least) ? size : least), 0), spacing = Math.max(longest / MAX_COLOUR_SAMPLES, Math.min(longest / resolution, minFeatureSize > 0 ? minFeatureSize / 2 : Infinity));
|
|
69
|
+
const middles = new Map();
|
|
70
|
+
const middle = (a, b) => {
|
|
71
|
+
const key = a < b ? `${a}:${b}` : `${b}:${a}`;
|
|
72
|
+
let id = middles.get(key);
|
|
73
|
+
if (id === undefined) {
|
|
74
|
+
id = points.length / 3;
|
|
75
|
+
for (let k = 0; k < 3; k++)
|
|
76
|
+
points.push((points[a * 3 + k] + points[b * 3 + k]) / 2);
|
|
77
|
+
middles.set(key, id);
|
|
78
|
+
}
|
|
79
|
+
return id;
|
|
80
|
+
};
|
|
81
|
+
const length = (a, b) => Math.hypot(points[a * 3] - points[b * 3], points[a * 3 + 1] - points[b * 3 + 1], points[a * 3 + 2] - points[b * 3 + 2]);
|
|
82
|
+
/** Each fill's compiled function and the colours it has given, a property group of the mesh once used. */
|
|
83
|
+
const samplers = new Map();
|
|
84
|
+
const sampler = (fill) => {
|
|
85
|
+
const found = samplers.get(fill);
|
|
86
|
+
if (found)
|
|
87
|
+
return found;
|
|
88
|
+
const colourAt = shade(fill, points), colours = [], made = {
|
|
89
|
+
colours,
|
|
90
|
+
group: -1,
|
|
91
|
+
at: (v) => (colours[v] ??= colourAt(v)),
|
|
92
|
+
};
|
|
93
|
+
samplers.set(fill, made);
|
|
94
|
+
return made;
|
|
95
|
+
};
|
|
96
|
+
const vertices = floats(), triangles = uints(), pids = uints(), properties = uints(), flat = [], between = [];
|
|
97
|
+
let betweenGroup = -1;
|
|
98
|
+
/** Adds a property group of colours to the model and returns its place. */
|
|
99
|
+
const group = (colours, name) => {
|
|
100
|
+
const at = model.propertyIds.length, id = `\0${name} ${at} ${object.id}`;
|
|
101
|
+
model.propertyIds.push(id);
|
|
102
|
+
model.properties.set(id, colours);
|
|
103
|
+
return at;
|
|
104
|
+
};
|
|
105
|
+
const alike = (a, b) => String(a) === String(b);
|
|
106
|
+
const emit = (t, ids, weights, surface) => {
|
|
107
|
+
if (triangles.length / 3 >= maxTriangles)
|
|
108
|
+
throw new LoaderError(F, 'limit', `the colour samples of object ${object.id.slice(0, 32)} exceed ${maxTriangles} triangles; lower colorResolution or raise maxTriangles`);
|
|
109
|
+
triangles.push3(ids[0], ids[1], ids[2]);
|
|
110
|
+
const [a, b, c] = surface;
|
|
111
|
+
if (a && b && c) {
|
|
112
|
+
flat.push(mesh.flat ? mesh.flat[t] : a);
|
|
113
|
+
if (alike(a, b) && alike(a, c)) {
|
|
114
|
+
const p = mesh.p.array[t * 3];
|
|
115
|
+
pids.push(mesh.pid.array[t] ?? NONE);
|
|
116
|
+
properties.push3(p, p, p);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (betweenGroup < 0)
|
|
120
|
+
betweenGroup = group(between, 'surface colour');
|
|
121
|
+
pids.push(betweenGroup);
|
|
122
|
+
for (const w of weights)
|
|
123
|
+
between.push([0, 1, 2, 3].map((i) => w[0] * a[i] + w[1] * b[i] + w[2] * c[i]));
|
|
124
|
+
properties.push3(between.length - 3, between.length - 2, between.length - 1);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const fill = mesh.fills ? mesh.fills[t] : mesh.fill;
|
|
128
|
+
if (!fill) {
|
|
129
|
+
// No property and no volume colour here: the triangle stays as it was.
|
|
130
|
+
flat.push(mesh.flat?.[t] ?? a);
|
|
131
|
+
pids.push(mesh.pid.array[t] ?? NONE);
|
|
132
|
+
const p = mesh.p.array[t * 3];
|
|
133
|
+
properties.push3(p, p, p);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const from = sampler(fill), colours = ids.map((v) => from.at(v));
|
|
137
|
+
// A triangle of one colour names it for its group; one that changes colour is drawn by its corners.
|
|
138
|
+
flat.push(alike(colours[0], colours[1]) && alike(colours[0], colours[2]) ? colours[0] : undefined);
|
|
139
|
+
if (from.group < 0)
|
|
140
|
+
from.group = group(from.colours, 'volume colour');
|
|
141
|
+
pids.push(from.group);
|
|
142
|
+
properties.push3(ids[0], ids[1], ids[2]);
|
|
143
|
+
};
|
|
144
|
+
for (let t = 0; t < triangleCount; t++) {
|
|
145
|
+
const corners = [0, 1, 2].map((k) => mesh.triangles.array[t * 3 + k]);
|
|
146
|
+
if (corners.some((v) => v >= count))
|
|
147
|
+
throw new LoaderError(F, 'range', `a triangle index of object ${object.id} is outside 0..${count - 1}`);
|
|
148
|
+
const surface = [0, 1, 2].map((k) => {
|
|
149
|
+
const property = cornerProperty(model, object, mesh, t, k);
|
|
150
|
+
return property && model.properties.get(property.id)?.[property.index];
|
|
151
|
+
});
|
|
152
|
+
const stack = [
|
|
153
|
+
[
|
|
154
|
+
corners,
|
|
155
|
+
[
|
|
156
|
+
[1, 0, 0],
|
|
157
|
+
[0, 1, 0],
|
|
158
|
+
[0, 0, 1],
|
|
159
|
+
],
|
|
160
|
+
],
|
|
161
|
+
];
|
|
162
|
+
while (stack.length) {
|
|
163
|
+
let [ids, weights] = stack.pop();
|
|
164
|
+
let split = ids.map((a, k) => length(a, ids[(k + 1) % 3]) > spacing * (1 + 1e-9));
|
|
165
|
+
const parts = split.filter(Boolean).length;
|
|
166
|
+
if (!parts) {
|
|
167
|
+
emit(t, ids, weights, surface);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// Turn the triangle so that AB is split and, with two splits, CA is not.
|
|
171
|
+
const first = parts === 3 ? 0 : [0, 1, 2].find((k) => split[k] && (parts === 1 || !split[(k + 2) % 3])), turn = (list) => [...list.slice(first), ...list.slice(0, first)];
|
|
172
|
+
ids = turn(ids);
|
|
173
|
+
weights = turn(weights);
|
|
174
|
+
split = turn(split);
|
|
175
|
+
const [a, b, c] = ids, [wa, wb, wc] = weights, half = (p, q) => [(p[0] + q[0]) / 2, (p[1] + q[1]) / 2, (p[2] + q[2]) / 2], ab = middle(a, b), wab = half(wa, wb);
|
|
176
|
+
if (parts === 1)
|
|
177
|
+
stack.push([
|
|
178
|
+
[a, ab, c],
|
|
179
|
+
[wa, wab, wc],
|
|
180
|
+
], [
|
|
181
|
+
[ab, b, c],
|
|
182
|
+
[wab, wb, wc],
|
|
183
|
+
]);
|
|
184
|
+
else {
|
|
185
|
+
const bc = middle(b, c), wbc = half(wb, wc);
|
|
186
|
+
stack.push([
|
|
187
|
+
[ab, b, bc],
|
|
188
|
+
[wab, wb, wbc],
|
|
189
|
+
]);
|
|
190
|
+
if (parts === 3) {
|
|
191
|
+
const ca = middle(c, a), wca = half(wc, wa);
|
|
192
|
+
stack.push([
|
|
193
|
+
[a, ab, ca],
|
|
194
|
+
[wa, wab, wca],
|
|
195
|
+
], [
|
|
196
|
+
[ca, bc, c],
|
|
197
|
+
[wca, wbc, wc],
|
|
198
|
+
], [
|
|
199
|
+
[ab, bc, ca],
|
|
200
|
+
[wab, wbc, wca],
|
|
201
|
+
]);
|
|
202
|
+
}
|
|
203
|
+
else if (length(a, bc) <= length(ab, c))
|
|
204
|
+
stack.push([
|
|
205
|
+
[a, ab, bc],
|
|
206
|
+
[wa, wab, wbc],
|
|
207
|
+
], [
|
|
208
|
+
[a, bc, c],
|
|
209
|
+
[wa, wbc, wc],
|
|
210
|
+
]);
|
|
211
|
+
else
|
|
212
|
+
stack.push([
|
|
213
|
+
[a, ab, c],
|
|
214
|
+
[wa, wab, wc],
|
|
215
|
+
], [
|
|
216
|
+
[ab, bc, c],
|
|
217
|
+
[wab, wbc, wc],
|
|
218
|
+
]);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
for (let i = 0; i < points.length; i += 3)
|
|
223
|
+
vertices.push3(points[i], points[i + 1], points[i + 2]);
|
|
224
|
+
// Property indices are vertex numbers: every place up to the last holds a colour.
|
|
225
|
+
for (const { colours } of samplers.values())
|
|
226
|
+
for (let v = 0; v < colours.length; v++)
|
|
227
|
+
colours[v] ??= [1, 1, 1, 1];
|
|
228
|
+
return {
|
|
229
|
+
mesh: { vertices, triangles, pid: pids, p: properties, flat },
|
|
230
|
+
spacing,
|
|
231
|
+
coarse: minFeatureSize > 0 && spacing > minFeatureSize / 2,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FieldScope } from './threemf-functions.js';
|
|
2
|
+
import type { ThreeMFVolumeData, ThreeMFVolumeSamples } from './threemf-volumetric.js';
|
|
3
|
+
/**
|
|
4
|
+
* The volume data at `positions` (x, y, z for each point, in the shape's object coordinates).
|
|
5
|
+
*
|
|
6
|
+
* @throws TypeError for positions that are not whole triples of finite numbers.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sampleVolume(scope: FieldScope, volume: ThreeMFVolumeData, positions: ArrayLike<number>): ThreeMFVolumeSamples;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Reads a 3MF volume data resource at points of its shape (volumetric extension chapter 5,
|
|
2
|
+
// https://github.com/3MFConsortium/spec_volumetric): the color (section 5.2.1), the mixing ratios of a composite
|
|
3
|
+
// (5.2.2 and 5.2.3: each mapping clipped to 0..1 and divided by their sum) and every property (5.2.4).
|
|
4
|
+
import { LinearToSRGB } from '@margoengine/math/color';
|
|
5
|
+
import { compileField } from './threemf-functions.js';
|
|
6
|
+
import { LoaderError } from './types.js';
|
|
7
|
+
const F = '3MF';
|
|
8
|
+
/** The least sum of mixing contributions the extension lets a file have; under it a point has no mixture. */
|
|
9
|
+
const LEAST_MIX = 1e-5;
|
|
10
|
+
/** One field at `count` points: its output's numbers for each, the fallback value where it is undefined. */
|
|
11
|
+
function field(scope, given, positions, count) {
|
|
12
|
+
const { functionId, channel, fallback, transform: m = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] } = given, pos = new Float64Array(3), program = compileField(scope, functionId, new Map([['pos', pos]])), output = program.outputs.get(channel);
|
|
13
|
+
if (!(output instanceof Float64Array))
|
|
14
|
+
throw new LoaderError(F, 'unsupported', `output ${channel.slice(0, 64)} is not a number, vector or matrix`);
|
|
15
|
+
const size = output.length, values = new Float32Array(count * size);
|
|
16
|
+
for (let p = 0; p < count; p++) {
|
|
17
|
+
const x = positions[p * 3], y = positions[p * 3 + 1], z = positions[p * 3 + 2];
|
|
18
|
+
for (let k = 0; k < 3; k++)
|
|
19
|
+
pos[k] = x * m[k] + y * m[3 + k] + z * m[6 + k] + m[9 + k];
|
|
20
|
+
program.run();
|
|
21
|
+
for (let i = 0; i < size; i++)
|
|
22
|
+
values[p * size + i] = Number.isFinite(output[i]) ? output[i] : fallback;
|
|
23
|
+
}
|
|
24
|
+
return { size, values };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The volume data at `positions` (x, y, z for each point, in the shape's object coordinates).
|
|
28
|
+
*
|
|
29
|
+
* @throws TypeError for positions that are not whole triples of finite numbers.
|
|
30
|
+
*/
|
|
31
|
+
export function sampleVolume(scope, volume, positions) {
|
|
32
|
+
const length = positions?.length;
|
|
33
|
+
if (!(Number.isInteger(length) && length % 3 === 0))
|
|
34
|
+
throw new TypeError('Volume samples need x, y and z for each point; give an array of whole triples.');
|
|
35
|
+
for (let i = 0; i < length; i++)
|
|
36
|
+
if (!Number.isFinite(positions[i]))
|
|
37
|
+
throw new TypeError('Volume sample positions must be finite numbers.');
|
|
38
|
+
const count = length / 3, { color, composite } = volume, result = {
|
|
39
|
+
properties: volume.properties.map((property) => ({
|
|
40
|
+
name: property.name,
|
|
41
|
+
namespace: property.namespace,
|
|
42
|
+
required: property.required,
|
|
43
|
+
...field(scope, property, positions, count),
|
|
44
|
+
})),
|
|
45
|
+
};
|
|
46
|
+
if (color) {
|
|
47
|
+
const { values } = field(scope, color, positions, count);
|
|
48
|
+
result.colors = values.map((v) => LinearToSRGB(Math.min(1, Math.max(0, v))));
|
|
49
|
+
}
|
|
50
|
+
if (composite) {
|
|
51
|
+
const materials = composite.mappings.length, ratios = new Float32Array(count * materials);
|
|
52
|
+
composite.mappings.forEach((mapping, i) => {
|
|
53
|
+
const { values } = field(scope, mapping, positions, count);
|
|
54
|
+
for (let p = 0; p < count; p++)
|
|
55
|
+
ratios[p * materials + i] = Math.min(1, Math.max(0, values[p]));
|
|
56
|
+
});
|
|
57
|
+
for (let p = 0; p < count; p++) {
|
|
58
|
+
const own = ratios.subarray(p * materials, (p + 1) * materials), sum = own.reduce((a, b) => a + b, 0);
|
|
59
|
+
for (let i = 0; i < materials; i++)
|
|
60
|
+
own[i] = sum < LEAST_MIX ? 0 : own[i] / sum;
|
|
61
|
+
}
|
|
62
|
+
result.composite = { baseMaterialId: composite.baseMaterialId, materials, ratios };
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ThreeMFBeamLattice } from './threemf-lattice.js';
|
|
2
|
+
import type { ThreeMFVolumetricObject, ThreeMFVolumetricOptions, ThreeMFVolumetricResult } from './threemf-volumetric.js';
|
|
3
|
+
import type { ThreeMFExtension, ThreeMFMesh, ThreeMFModel } from './threemf.js';
|
|
4
|
+
/**
|
|
5
|
+
* The volumetric reader's hooks. `addLattices` runs for each model part once its level sets are meshed and before its
|
|
6
|
+
* colours are sampled; `surfaces` holds the part's meshes without lattice triangles.
|
|
7
|
+
*/
|
|
8
|
+
export declare function volumetricStage(options: ThreeMFVolumetricOptions, addLattices?: (model: ThreeMFModel, lattices: ReadonlyMap<string, ThreeMFBeamLattice>, surfaces: ReadonlyMap<string, ThreeMFMesh>, modelPath: string | undefined) => Promise<void>): {
|
|
9
|
+
hooks: ThreeMFExtension;
|
|
10
|
+
paint: (models: ReadonlyMap<string, ThreeMFModel>) => void;
|
|
11
|
+
/** The `sample` of an object with volume data, built or only read by another shape. */
|
|
12
|
+
sampleOf: (objectId: string, modelPath: string | undefined) => ThreeMFVolumetricObject['sample'];
|
|
13
|
+
/** What the reader adds to the core result, once the build has been walked. */
|
|
14
|
+
result(): Pick<ThreeMFVolumetricResult, 'images' | 'functions' | 'volumes' | 'objects'>;
|
|
15
|
+
};
|