@margoengine/loaders 0.0.0-stage → 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 -0
- package/NOTICE +4 -0
- package/README.md +1665 -2
- package/dist/3dm.d.ts +161 -0
- package/dist/3dm.js +289 -0
- package/dist/3ds.d.ts +124 -0
- package/dist/3ds.js +392 -0
- package/dist/acclaim.d.ts +90 -0
- package/dist/acclaim.js +312 -0
- package/dist/amf.d.ts +45 -0
- package/dist/amf.js +256 -0
- package/dist/babylon.d.ts +197 -0
- package/dist/babylon.js +701 -0
- package/dist/common.d.ts +7 -0
- package/dist/common.js +6 -0
- package/dist/crease.d.ts +7 -0
- package/dist/crease.js +67 -0
- package/dist/dae-animation.d.ts +66 -0
- package/dist/dae-animation.js +266 -0
- package/dist/dae-common.d.ts +95 -0
- package/dist/dae-common.js +226 -0
- package/dist/dae-controllers.d.ts +57 -0
- package/dist/dae-controllers.js +164 -0
- package/dist/dae-kinematics.d.ts +65 -0
- package/dist/dae-kinematics.js +461 -0
- package/dist/dae-pose.d.ts +131 -0
- package/dist/dae-pose.js +381 -0
- package/dist/dae-scene.d.ts +203 -0
- package/dist/dae-scene.js +279 -0
- package/dist/dae.d.ts +166 -0
- package/dist/dae.js +644 -0
- package/dist/detect.d.ts +20 -0
- package/dist/detect.js +72 -0
- 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 +122 -0
- package/dist/dxf.js +985 -0
- package/dist/engine.d.ts +41 -0
- package/dist/engine.js +120 -0
- package/dist/font-opentype.d.ts +14 -0
- package/dist/font-opentype.js +33 -0
- package/dist/font-woff.d.ts +23 -0
- package/dist/font-woff.js +293 -0
- package/dist/font.d.ts +41 -0
- package/dist/font.js +26 -0
- package/dist/gcode.d.ts +92 -0
- package/dist/gcode.js +369 -0
- package/dist/geo-model.d.ts +84 -0
- package/dist/geo-model.js +220 -0
- package/dist/geo-mvt.d.ts +15 -0
- package/dist/geo-mvt.js +302 -0
- package/dist/geo-shp.d.ts +15 -0
- package/dist/geo-shp.js +234 -0
- package/dist/geo-xml.d.ts +6 -0
- package/dist/geo-xml.js +165 -0
- package/dist/geo.d.ts +8 -0
- package/dist/geo.js +59 -0
- package/dist/geometry.d.ts +60 -0
- package/dist/geometry.js +273 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +28 -0
- package/dist/kmz.d.ts +78 -0
- package/dist/kmz.js +173 -0
- package/dist/las.d.ts +92 -0
- package/dist/las.js +110 -0
- package/dist/ldraw.d.ts +118 -0
- package/dist/ldraw.js +474 -0
- package/dist/load.d.ts +72 -0
- package/dist/load.js +205 -0
- package/dist/lottie.d.ts +154 -0
- package/dist/lottie.js +893 -0
- package/dist/lwo.d.ts +81 -0
- package/dist/lwo.js +454 -0
- package/dist/lzf.d.ts +13 -0
- package/dist/lzf.js +56 -0
- package/dist/materialx.d.ts +120 -0
- package/dist/materialx.js +563 -0
- package/dist/md2.d.ts +52 -0
- package/dist/md2.js +112 -0
- package/dist/mmcif.d.ts +14 -0
- package/dist/mmcif.js +246 -0
- package/dist/mmd.d.ts +244 -0
- package/dist/mmd.js +958 -0
- package/dist/mocap.d.ts +71 -0
- package/dist/mocap.js +178 -0
- package/dist/molecule-common.d.ts +4 -0
- package/dist/molecule-common.js +54 -0
- package/dist/mtl.d.ts +125 -0
- package/dist/mtl.js +550 -0
- package/dist/normals.d.ts +7 -0
- package/dist/normals.js +31 -0
- package/dist/nrrd.d.ts +70 -0
- package/dist/nrrd.js +785 -0
- package/dist/nurbs.d.ts +118 -0
- package/dist/nurbs.js +265 -0
- package/dist/obj.d.ts +145 -0
- package/dist/obj.js +462 -0
- package/dist/off.d.ts +10 -0
- package/dist/off.js +155 -0
- package/dist/outline-font.d.ts +87 -0
- package/dist/outline-font.js +110 -0
- package/dist/outline.d.ts +20 -0
- package/dist/outline.js +215 -0
- package/dist/pcd.d.ts +34 -0
- package/dist/pcd.js +258 -0
- package/dist/pdb.d.ts +67 -0
- package/dist/pdb.js +126 -0
- package/dist/ply.d.ts +35 -0
- package/dist/ply.js +392 -0
- package/dist/polygon.d.ts +9 -0
- package/dist/polygon.js +49 -0
- package/dist/prwm.d.ts +24 -0
- package/dist/prwm.js +114 -0
- package/dist/render.d.ts +32 -0
- package/dist/render.js +181 -0
- package/dist/sfnt-cff.d.ts +37 -0
- package/dist/sfnt-cff.js +749 -0
- package/dist/sfnt-layout.d.ts +24 -0
- package/dist/sfnt-layout.js +266 -0
- package/dist/sfnt-reader.d.ts +28 -0
- package/dist/sfnt-reader.js +87 -0
- package/dist/sfnt-variation.d.ts +40 -0
- package/dist/sfnt-variation.js +318 -0
- package/dist/shared/asset-url.js +82 -0
- package/dist/shared/crc32.d.ts +2 -0
- package/dist/shared/crc32.js +47 -0
- package/dist/shared/errors.js +36 -0
- package/dist/shared/inflate.js +284 -0
- package/dist/shared/normals.js +26 -0
- package/dist/shared/scene-scope.js +56 -0
- package/dist/shared/trailing-data.js +45 -0
- package/dist/stl.d.ts +64 -0
- package/dist/stl.js +309 -0
- package/dist/svg.d.ts +90 -0
- package/dist/svg.js +1007 -0
- package/dist/tds.d.ts +2 -0
- package/dist/tds.js +2 -0
- package/dist/textures.d.ts +42 -0
- package/dist/textures.js +53 -0
- 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.d.ts +139 -0
- package/dist/threemf-lattice.js +379 -0
- package/dist/threemf-levelset.d.ts +23 -0
- package/dist/threemf-levelset.js +105 -0
- package/dist/threemf-materials.d.ts +162 -0
- package/dist/threemf-materials.js +497 -0
- package/dist/threemf-mesh.d.ts +75 -0
- package/dist/threemf-mesh.js +422 -0
- 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 +170 -0
- package/dist/threemf.js +609 -0
- package/dist/tilt.d.ts +62 -0
- package/dist/tilt.js +186 -0
- package/dist/tmx.d.ts +151 -0
- package/dist/tmx.js +394 -0
- package/dist/ttf.d.ts +78 -0
- package/dist/ttf.js +568 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.js +35 -0
- package/dist/usd.d.ts +2 -0
- package/dist/usd.js +2 -0
- package/dist/usd.worker.d.ts +1 -0
- package/dist/usdz.d.ts +50 -0
- package/dist/usdz.js +646 -0
- package/dist/util.d.ts +75 -0
- package/dist/util.js +241 -0
- package/dist/vdb.d.ts +111 -0
- package/dist/vdb.js +663 -0
- package/dist/vrml.d.ts +53 -0
- package/dist/vrml.js +532 -0
- package/dist/vtk-cells.d.ts +29 -0
- package/dist/vtk-cells.js +211 -0
- package/dist/vtk-legacy.d.ts +57 -0
- package/dist/vtk-legacy.js +439 -0
- package/dist/vtk-reader.d.ts +19 -0
- package/dist/vtk-reader.js +134 -0
- package/dist/vtk-xml.d.ts +96 -0
- package/dist/vtk-xml.js +578 -0
- package/dist/vtk.d.ts +13 -0
- package/dist/vtk.js +234 -0
- package/dist/woff-glyf.d.ts +17 -0
- package/dist/woff-glyf.js +215 -0
- package/dist/worker.d.ts +10 -0
- package/dist/worker.js +93 -0
- package/dist/workers/usd.js +3 -0
- package/dist/xfile.d.ts +99 -0
- package/dist/xfile.js +706 -0
- package/dist/xml.d.ts +107 -0
- package/dist/xml.js +843 -0
- package/dist/xyz.d.ts +16 -0
- package/dist/xyz.js +110 -0
- package/dist/zip.d.ts +38 -0
- package/dist/zip.js +150 -0
- package/package.json +289 -4
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Shared COLLADA reading helpers: element lookup, number lists, sources, transform stacks and the Y-up meter
|
|
2
|
+
// conversion. Internal to the loaders package.
|
|
3
|
+
import { invertMatrix } from '@margoengine/math/mat4';
|
|
4
|
+
import { LoaderError } from './types.js';
|
|
5
|
+
export const F = 'DAE';
|
|
6
|
+
export const kid = (e, name) => e?.children.find((c) => c.name === name);
|
|
7
|
+
export const kids = (e, name) => e?.children.filter((c) => c.name === name) ?? [];
|
|
8
|
+
export const ref = (url) => (url?.startsWith('#') ? url.slice(1) : (url ?? ''));
|
|
9
|
+
export function numbers(text, what) {
|
|
10
|
+
const trimmed = text.trim();
|
|
11
|
+
if (!trimmed)
|
|
12
|
+
return [];
|
|
13
|
+
const parts = trimmed.split(/\s+/), out = new Array(parts.length);
|
|
14
|
+
for (let i = 0; i < parts.length; i++) {
|
|
15
|
+
const value = Number(parts[i]);
|
|
16
|
+
if (Number.isNaN(value) && !/^[+-]?nan$/i.test(parts[i]))
|
|
17
|
+
throw new LoaderError(F, 'syntax', `${what} has the invalid number "${parts[i].slice(0, 32)}"`);
|
|
18
|
+
out[i] = value;
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
export function integer(value, fallback, what) {
|
|
23
|
+
if (value === undefined)
|
|
24
|
+
return fallback;
|
|
25
|
+
const number = Number(value);
|
|
26
|
+
if (!Number.isSafeInteger(number) || number < 0)
|
|
27
|
+
throw new LoaderError(F, 'syntax', `${what} must be a non-negative integer, got "${value.slice(0, 32)}"`);
|
|
28
|
+
return number;
|
|
29
|
+
}
|
|
30
|
+
const ARRAYS = ['float_array', 'Name_array', 'IDREF_array', 'int_array'];
|
|
31
|
+
/** Reads a source; `names` allows `Name_array` and `IDREF_array` (else only number arrays are accepted). */
|
|
32
|
+
export function readSource(e, ids, names = false) {
|
|
33
|
+
const id = e.attributes.id ?? '', accessor = kid(kid(e, 'technique_common'), 'accessor'), linked = ids.get(ref(accessor?.attributes.source)), array = linked && ARRAYS.includes(linked.name) ? linked : e.children.find((c) => ARRAYS.includes(c.name)), text = array?.name === 'Name_array' || array?.name === 'IDREF_array';
|
|
34
|
+
if (!accessor || !array || (text && !names))
|
|
35
|
+
throw new LoaderError(F, 'syntax', `source "${id}" has no ${names ? 'array' : 'float_array'} with an accessor`);
|
|
36
|
+
const tokens = text ? array.text.trim().split(/\s+/).filter(Boolean) : undefined, data = text ? [] : numbers(array.text, `${array.name} of source "${id}"`), length = tokens ? tokens.length : data.length, count = integer(accessor.attributes.count, 0, `accessor count of source "${id}"`), stride = integer(accessor.attributes.stride, 1, `accessor stride of source "${id}"`), offset = integer(accessor.attributes.offset, 0, `accessor offset of source "${id}"`), declared = kids(accessor, 'param'), params = [];
|
|
37
|
+
declared.forEach((p, i) => p.attributes.name !== undefined && params.push(i));
|
|
38
|
+
if (!declared.length)
|
|
39
|
+
for (let i = 0; i < stride; i++)
|
|
40
|
+
params.push(i);
|
|
41
|
+
if (count && offset + (count - 1) * stride + Math.max(1, ...params.map((p) => p + 1)) > length)
|
|
42
|
+
throw new LoaderError(F, 'truncated', `source "${id}" declares ${count} x ${stride} values but its array holds ${length}`);
|
|
43
|
+
const source = { id, data, stride, offset, count, params, kind: array.name };
|
|
44
|
+
if (tokens)
|
|
45
|
+
source.names = tokens;
|
|
46
|
+
return source;
|
|
47
|
+
}
|
|
48
|
+
/** `width` consecutive values of element `index` of a source, from the start of its stride. */
|
|
49
|
+
export function block(source, index, width) {
|
|
50
|
+
const at = source.offset + index * source.stride;
|
|
51
|
+
if (at + width > source.data.length)
|
|
52
|
+
throw new LoaderError(F, 'truncated', `source "${source.id}" element ${index} needs ${width} values`);
|
|
53
|
+
return source.data.slice(at, at + width);
|
|
54
|
+
}
|
|
55
|
+
/** The sources of a `<skin>`, `<morph>` or `<animation>` by id, read lazily. */
|
|
56
|
+
export function sourcesOf(e, ids, what) {
|
|
57
|
+
const cache = new Map();
|
|
58
|
+
return (url) => {
|
|
59
|
+
const id = ref(url);
|
|
60
|
+
let source = cache.get(id);
|
|
61
|
+
if (!source) {
|
|
62
|
+
const element = kids(e, 'source').find((s) => s.attributes.id === id) ?? ids.get(id);
|
|
63
|
+
if (element?.name !== 'source')
|
|
64
|
+
throw new LoaderError(F, 'syntax', `${what} input names no source "${id}"`);
|
|
65
|
+
cache.set(id, (source = readSource(element, ids, true)));
|
|
66
|
+
}
|
|
67
|
+
return source;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export const IDENTITY = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
71
|
+
/** Column-major a * b. */
|
|
72
|
+
export function multiply(a, b) {
|
|
73
|
+
const out = new Array(16);
|
|
74
|
+
for (let c = 0; c < 4; c++)
|
|
75
|
+
for (let r = 0; r < 4; r++) {
|
|
76
|
+
let sum = 0;
|
|
77
|
+
for (let k = 0; k < 4; k++)
|
|
78
|
+
sum += a[k * 4 + r] * b[c * 4 + k];
|
|
79
|
+
out[c * 4 + r] = sum;
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
/** Column-major matrix from 16 row-major values (COLLADA writes matrices row by row). */
|
|
84
|
+
export const fromRows = (rows) => Array.from({ length: 16 }, (_, i) => rows[(i % 4) * 4 + Math.floor(i / 4)]);
|
|
85
|
+
/** Column-major inverse, or undefined when singular. */
|
|
86
|
+
export function invert(m) {
|
|
87
|
+
const out = invertMatrix(m, new Array(16));
|
|
88
|
+
return out ?? undefined;
|
|
89
|
+
}
|
|
90
|
+
export const TRANSFORM_SIZES = { matrix: 16, translate: 3, rotate: 4, scale: 3, lookat: 9, skew: 7 };
|
|
91
|
+
const unit = (x, y, z) => {
|
|
92
|
+
const length = Math.hypot(x, y, z);
|
|
93
|
+
return length > 1e-12 && Number.isFinite(length) ? [x / length, y / length, z / length] : undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* A `<lookat>` (eye, interest point, up) as the matrix that places a frame looking down its -Z at the eye: columns
|
|
97
|
+
* side = forward x up, true up = side x forward, -forward and the eye, forward being interest - eye. Undefined when
|
|
98
|
+
* the eye is the interest point or up is parallel to the view.
|
|
99
|
+
*/
|
|
100
|
+
export function lookatMatrix(v) {
|
|
101
|
+
const f = unit(v[3] - v[0], v[4] - v[1], v[5] - v[2]), s = f && unit(f[1] * v[8] - f[2] * v[7], f[2] * v[6] - f[0] * v[8], f[0] * v[7] - f[1] * v[6]);
|
|
102
|
+
if (!f || !s)
|
|
103
|
+
return;
|
|
104
|
+
const u = [s[1] * f[2] - s[2] * f[1], s[2] * f[0] - s[0] * f[2], s[0] * f[1] - s[1] * f[0]];
|
|
105
|
+
return [s[0], s[1], s[2], 0, u[0], u[1], u[2], 0, -f[0], -f[1], -f[2], 0, v[0], v[1], v[2], 1];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A `<skew>` (degrees, rotation axis a, translation axis t) as the RenderMan skew the spec adopts: points slide
|
|
109
|
+
* parallel to t, so that a turns by the angle toward t in their common plane: M = I + k t d^T, d being the unit part
|
|
110
|
+
* of a perpendicular to t and k = cot(phi - angle) - cot(phi) for phi the angle from t to a (tan(angle) when they are
|
|
111
|
+
* perpendicular). Undefined when t is zero, a is parallel to t, or a would turn onto or past t.
|
|
112
|
+
*/
|
|
113
|
+
export function skewMatrix(v) {
|
|
114
|
+
const t = unit(v[4], v[5], v[6]);
|
|
115
|
+
if (!t)
|
|
116
|
+
return;
|
|
117
|
+
const along = v[1] * t[0] + v[2] * t[1] + v[3] * t[2], d = unit(v[1] - along * t[0], v[2] - along * t[1], v[3] - along * t[2]);
|
|
118
|
+
if (!d)
|
|
119
|
+
return;
|
|
120
|
+
const across = v[1] * d[0] + v[2] * d[1] + v[3] * d[2], turned = Math.atan2(across, along) - (v[0] * Math.PI) / 180;
|
|
121
|
+
if (!(Math.sin(turned) > 1e-9))
|
|
122
|
+
return;
|
|
123
|
+
const k = Math.cos(turned) / Math.sin(turned) - along / across, m = [...IDENTITY];
|
|
124
|
+
for (let c = 0; c < 3; c++)
|
|
125
|
+
for (let r = 0; r < 3; r++)
|
|
126
|
+
m[c * 4 + r] += k * t[r] * d[c];
|
|
127
|
+
return m;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The stack in document order, each element post-multiplying. A degenerate `lookat` keeps only its eye translation
|
|
131
|
+
* and a degenerate `skew` is skipped (parseDAE warns about both).
|
|
132
|
+
*/
|
|
133
|
+
export function stackMatrix(transforms) {
|
|
134
|
+
let m = IDENTITY;
|
|
135
|
+
for (const { type, values: v } of transforms)
|
|
136
|
+
if (type === 'matrix')
|
|
137
|
+
m = multiply(m, fromRows(v));
|
|
138
|
+
else if (type === 'translate')
|
|
139
|
+
m = multiply(m, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, v[0], v[1], v[2], 1]);
|
|
140
|
+
else if (type === 'scale')
|
|
141
|
+
m = multiply(m, [v[0], 0, 0, 0, 0, v[1], 0, 0, 0, 0, v[2], 0, 0, 0, 0, 1]);
|
|
142
|
+
else if (type === 'lookat')
|
|
143
|
+
m = multiply(m, lookatMatrix(v) ?? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, v[0], v[1], v[2], 1]);
|
|
144
|
+
else if (type === 'skew')
|
|
145
|
+
m = multiply(m, skewMatrix(v) ?? IDENTITY);
|
|
146
|
+
else if (type === 'rotate') {
|
|
147
|
+
const length = Math.hypot(v[0], v[1], v[2]);
|
|
148
|
+
if (!length)
|
|
149
|
+
continue;
|
|
150
|
+
const x = v[0] / length, y = v[1] / length, z = v[2] / length, angle = (v[3] * Math.PI) / 180, c = Math.cos(angle), s = Math.sin(angle), t = 1 - c;
|
|
151
|
+
m = multiply(m, [
|
|
152
|
+
t * x * x + c,
|
|
153
|
+
t * x * y + s * z,
|
|
154
|
+
t * x * z - s * y,
|
|
155
|
+
0,
|
|
156
|
+
t * x * y - s * z,
|
|
157
|
+
t * y * y + c,
|
|
158
|
+
t * y * z + s * x,
|
|
159
|
+
0,
|
|
160
|
+
t * x * z + s * y,
|
|
161
|
+
t * y * z - s * x,
|
|
162
|
+
t * z * z + c,
|
|
163
|
+
0,
|
|
164
|
+
0,
|
|
165
|
+
0,
|
|
166
|
+
0,
|
|
167
|
+
1,
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
return m;
|
|
171
|
+
}
|
|
172
|
+
export const AXES = {
|
|
173
|
+
Y_UP: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
174
|
+
// Row-major rotations taking the file's axes to Y-up (COLLADA 1.4.1 up_axis table).
|
|
175
|
+
Z_UP: [1, 0, 0, 0, 0, 1, 0, -1, 0],
|
|
176
|
+
X_UP: [0, -1, 0, 1, 0, 0, 0, 0, 1],
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* M' = C M C^-1 with C = meter * R: rotations keep their axes in Y-up, translations scale to meters. The same
|
|
180
|
+
* conversion serves node transforms, bind shape and inverse bind matrices, so skinning stays consistent.
|
|
181
|
+
*/
|
|
182
|
+
export function converter(upAxis, meter) {
|
|
183
|
+
const axis = AXES[upAxis], C = [...IDENTITY], inverse = [...IDENTITY];
|
|
184
|
+
for (let r = 0; r < 3; r++)
|
|
185
|
+
for (let c = 0; c < 3; c++) {
|
|
186
|
+
C[c * 4 + r] = meter * axis[r * 3 + c];
|
|
187
|
+
inverse[r * 4 + c] = axis[r * 3 + c] / meter;
|
|
188
|
+
}
|
|
189
|
+
return (m) => multiply(multiply(C, m), inverse);
|
|
190
|
+
}
|
|
191
|
+
/** Cofactors of a column-major matrix's 3x3 part (the inverse transpose times the determinant), and the determinant. */
|
|
192
|
+
export function cofactors(m) {
|
|
193
|
+
const n = [
|
|
194
|
+
m[5] * m[10] - m[6] * m[9],
|
|
195
|
+
m[6] * m[8] - m[4] * m[10],
|
|
196
|
+
m[4] * m[9] - m[5] * m[8],
|
|
197
|
+
m[2] * m[9] - m[1] * m[10],
|
|
198
|
+
m[0] * m[10] - m[2] * m[8],
|
|
199
|
+
m[1] * m[8] - m[0] * m[9],
|
|
200
|
+
m[1] * m[6] - m[2] * m[5],
|
|
201
|
+
m[2] * m[4] - m[0] * m[6],
|
|
202
|
+
m[0] * m[5] - m[1] * m[4],
|
|
203
|
+
];
|
|
204
|
+
return { n, determinant: m[0] * n[0] + m[1] * n[1] + m[2] * n[2] };
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Transforms xyz points (and normals) by a column-major matrix into `out` arrays at `at`; normals use the cofactor
|
|
208
|
+
* matrix, renormalised, with the determinant's sign removed.
|
|
209
|
+
*/
|
|
210
|
+
export function transformInto(m, positions, normals, i, outPositions, outNormals, at, co = cofactors(m)) {
|
|
211
|
+
const x = positions[i], y = positions[i + 1], z = positions[i + 2];
|
|
212
|
+
for (let r = 0; r < 3; r++)
|
|
213
|
+
outPositions[at + r] = m[r] * x + m[4 + r] * y + m[8 + r] * z + m[12 + r];
|
|
214
|
+
if (!normals || !outNormals)
|
|
215
|
+
return;
|
|
216
|
+
const { n, determinant } = co, a = normals[i], b = normals[i + 1], c = normals[i + 2];
|
|
217
|
+
let nx = n[0] * a + n[3] * b + n[6] * c, ny = n[1] * a + n[4] * b + n[7] * c, nz = n[2] * a + n[5] * b + n[8] * c;
|
|
218
|
+
// Cofactors carry the determinant's sign; the normal transform (inverse transpose) does not.
|
|
219
|
+
const length = (Math.hypot(nx, ny, nz) || 1) * (determinant < 0 ? -1 : 1);
|
|
220
|
+
nx /= length;
|
|
221
|
+
ny /= length;
|
|
222
|
+
nz /= length;
|
|
223
|
+
outNormals[at] = nx;
|
|
224
|
+
outNormals[at + 1] = ny;
|
|
225
|
+
outNormals[at + 2] = nz;
|
|
226
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Matrix } from './dae-common.js';
|
|
2
|
+
import type { XMLElement } from './xml.js';
|
|
3
|
+
/**
|
|
4
|
+
* A `<skin>` controller in Y-up meters. Influences are per `<vertices>` position (the geometry's
|
|
5
|
+
* `positionIndices` values), four each: the strongest four of the file's, renormalised to sum 1.
|
|
6
|
+
*/
|
|
7
|
+
export interface DAESkin {
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
/** Index into `LoadedDAE.geometries` of the skinned mesh (the morph's base mesh when it skins a morph). */
|
|
11
|
+
geometry: number;
|
|
12
|
+
/** Index into `LoadedDAE.morphs` when the skin's source is a morph controller. */
|
|
13
|
+
morph?: number;
|
|
14
|
+
/** `bind_shape_matrix`, column-major, converted to Y-up meters; applied to the mesh before skinning. */
|
|
15
|
+
bindShapeMatrix: number[];
|
|
16
|
+
/** Joint names as written: sids (`Name_array`) or node ids (`IDREF_array`). */
|
|
17
|
+
joints: string[];
|
|
18
|
+
/** 16 column-major numbers per joint, converted to Y-up meters. */
|
|
19
|
+
inverseBindMatrices: Float64Array;
|
|
20
|
+
/** Four joint indices per position, into `joints`; -1 is the bind shape itself (the mesh unmoved by joints). */
|
|
21
|
+
vertexJoints: Int32Array;
|
|
22
|
+
/** Four weights per position matching `vertexJoints`, summing to 1; all zero for a position without weights. */
|
|
23
|
+
vertexWeights: Float32Array;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A `<morph>` controller: `NORMALIZED` gives (1 - sum w) base + sum w target, `RELATIVE` gives base + sum w target,
|
|
27
|
+
* position by position (targets share the base mesh's `<vertices>` numbering).
|
|
28
|
+
*/
|
|
29
|
+
export interface DAEMorph {
|
|
30
|
+
id: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
method: 'NORMALIZED' | 'RELATIVE';
|
|
33
|
+
/** Index into `LoadedDAE.geometries` of the base mesh. */
|
|
34
|
+
base: number;
|
|
35
|
+
/** Index into `LoadedDAE.geometries` of each target mesh. */
|
|
36
|
+
targets: number[];
|
|
37
|
+
/** Default weight of each target (`MORPH_WEIGHT`). */
|
|
38
|
+
weights: number[];
|
|
39
|
+
/** Id of the `MORPH_WEIGHT` source, which animation channels may address instead of the controller. */
|
|
40
|
+
weightsSource?: string;
|
|
41
|
+
}
|
|
42
|
+
/** What an `<instance_controller>` resolves to. */
|
|
43
|
+
export interface ControllerRef {
|
|
44
|
+
geometry: number;
|
|
45
|
+
skin?: number;
|
|
46
|
+
morph?: number;
|
|
47
|
+
/** The skin's joints are node ids (`IDREF_array`), not sids. */
|
|
48
|
+
idref?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Highest position index a geometry uses, plus one. */
|
|
51
|
+
export declare function positionCount(indices: Uint32Array): number;
|
|
52
|
+
/** Reads `library_controllers`: morphs first, so a skin may wrap one. */
|
|
53
|
+
export declare function readControllers(root: XMLElement, ids: Map<string, XMLElement>, geometryIndex: Map<string, number>, positionIndices: (geometry: number) => Uint32Array, convert: (m: ArrayLike<number>) => Matrix, warn: (message: string) => void): {
|
|
54
|
+
skins: DAESkin[];
|
|
55
|
+
morphs: DAEMorph[];
|
|
56
|
+
controllers: Map<string, ControllerRef>;
|
|
57
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// COLLADA <controller> reading: <skin> (bind shape, joints, inverse bind matrices, vertex weights) and <morph>
|
|
2
|
+
// (NORMALIZED and RELATIVE targets with default weights). Written from the COLLADA 1.4.1 and 1.5 specifications.
|
|
3
|
+
import { LoaderError } from './types.js';
|
|
4
|
+
import { block, F, fromRows, integer, kid, kids, numbers, ref, sourcesOf, } from './dae-common.js';
|
|
5
|
+
/** Most influences kept per vertex, as the engine's skinning takes them. */
|
|
6
|
+
const MAX_INFLUENCES = 4;
|
|
7
|
+
/** Highest position index a geometry uses, plus one. */
|
|
8
|
+
export function positionCount(indices) {
|
|
9
|
+
let count = 0;
|
|
10
|
+
for (let i = 0; i < indices.length; i++)
|
|
11
|
+
if (indices[i] >= count)
|
|
12
|
+
count = indices[i] + 1;
|
|
13
|
+
return count;
|
|
14
|
+
}
|
|
15
|
+
function readMorph(controller, morph, ids, geometryIndex, positions, warn) {
|
|
16
|
+
const id = controller.attributes.id ?? '', what = `morph "${id}"`, base = geometryIndex.get(ref(morph.attributes.source));
|
|
17
|
+
if (base === undefined) {
|
|
18
|
+
warn(`${what} is not imported: its source "${morph.attributes.source}" is not an imported mesh`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const method = morph.attributes.method ?? 'NORMALIZED';
|
|
22
|
+
if (method !== 'NORMALIZED' && method !== 'RELATIVE')
|
|
23
|
+
throw new LoaderError(F, 'syntax', `${what} method "${method.slice(0, 32)}" is not NORMALIZED or RELATIVE`);
|
|
24
|
+
const source = sourcesOf(morph, ids, what), inputs = kids(kid(morph, 'targets'), 'input'), targetInput = inputs.find((i) => i.attributes.semantic === 'MORPH_TARGET'), weightInput = inputs.find((i) => i.attributes.semantic === 'MORPH_WEIGHT');
|
|
25
|
+
if (!targetInput || !weightInput)
|
|
26
|
+
throw new LoaderError(F, 'syntax', `${what} <targets> needs MORPH_TARGET and MORPH_WEIGHT inputs`);
|
|
27
|
+
const names = source(targetInput.attributes.source).names ?? [], weightSource = source(weightInput.attributes.source), weights = weightSource.data.slice(weightSource.offset, weightSource.offset + names.length);
|
|
28
|
+
if (weights.length !== names.length || !weights.every(Number.isFinite))
|
|
29
|
+
throw new LoaderError(F, 'syntax', `${what} has ${names.length} targets but ${weights.length} finite weights`);
|
|
30
|
+
const targets = [];
|
|
31
|
+
for (const name of names) {
|
|
32
|
+
const target = geometryIndex.get(ref(name));
|
|
33
|
+
if (target === undefined) {
|
|
34
|
+
warn(`${what} is not imported: target "${name}" is not an imported mesh`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (positions(target) > positions(base)) {
|
|
38
|
+
warn(`${what} is not imported: target "${name}" has more positions than the base mesh`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
targets.push(target);
|
|
42
|
+
}
|
|
43
|
+
const result = { id, method, base, targets, weights };
|
|
44
|
+
if (controller.attributes.name !== undefined)
|
|
45
|
+
result.name = controller.attributes.name;
|
|
46
|
+
if (weightSource.id)
|
|
47
|
+
result.weightsSource = weightSource.id;
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
function readSkin(controller, skin, ids, base, count, convert) {
|
|
51
|
+
const id = controller.attributes.id ?? '', what = `skin "${id}"`, source = sourcesOf(skin, ids, what), matrix = kid(skin, 'bind_shape_matrix'), bindShape = matrix ? numbers(matrix.text, `${what} bind_shape_matrix`) : undefined;
|
|
52
|
+
if (bindShape && (bindShape.length !== 16 || !bindShape.every(Number.isFinite)))
|
|
53
|
+
throw new LoaderError(F, 'syntax', `${what} bind_shape_matrix needs 16 finite numbers, got ${bindShape.length}`);
|
|
54
|
+
const jointInputs = kids(kid(skin, 'joints'), 'input'), jointInput = jointInputs.find((i) => i.attributes.semantic === 'JOINT'), bindInput = jointInputs.find((i) => i.attributes.semantic === 'INV_BIND_MATRIX');
|
|
55
|
+
if (!jointInput || !bindInput)
|
|
56
|
+
throw new LoaderError(F, 'syntax', `${what} <joints> needs JOINT and INV_BIND_MATRIX inputs`);
|
|
57
|
+
const jointSource = source(jointInput.attributes.source), names = jointSource.names ?? [], joints = names.slice(jointSource.offset, jointSource.offset + (jointSource.count || names.length)), idref = jointSource.kind === 'IDREF_array', binds = source(bindInput.attributes.source);
|
|
58
|
+
if (!joints.length)
|
|
59
|
+
throw new LoaderError(F, 'syntax', `${what} has no joints`);
|
|
60
|
+
if (binds.count < joints.length || binds.stride < 16)
|
|
61
|
+
throw new LoaderError(F, 'syntax', `${what} has ${joints.length} joints but ${binds.count} inverse bind matrices`);
|
|
62
|
+
const inverseBindMatrices = new Float64Array(joints.length * 16);
|
|
63
|
+
for (let j = 0; j < joints.length; j++) {
|
|
64
|
+
const rows = block(binds, j, 16);
|
|
65
|
+
if (!rows.every(Number.isFinite))
|
|
66
|
+
throw new LoaderError(F, 'syntax', `${what} inverse bind matrix ${j} is not finite`);
|
|
67
|
+
inverseBindMatrices.set(convert(fromRows(rows)), j * 16);
|
|
68
|
+
}
|
|
69
|
+
const weightsElement = kid(skin, 'vertex_weights');
|
|
70
|
+
if (!weightsElement)
|
|
71
|
+
throw new LoaderError(F, 'syntax', `${what} has no <vertex_weights>`);
|
|
72
|
+
const inputs = kids(weightsElement, 'input'), stride = Math.max(0, ...inputs.map((i) => integer(i.attributes.offset, 0, `${what} input offset`) + 1)), jointAt = inputs.find((i) => i.attributes.semantic === 'JOINT'), weightAt = inputs.find((i) => i.attributes.semantic === 'WEIGHT');
|
|
73
|
+
if (!jointAt || !weightAt)
|
|
74
|
+
throw new LoaderError(F, 'syntax', `${what} <vertex_weights> needs JOINT and WEIGHT inputs`);
|
|
75
|
+
const jointOffset = integer(jointAt.attributes.offset, 0, `${what} input offset`), weightOffset = integer(weightAt.attributes.offset, 0, `${what} input offset`), weightSource = source(weightAt.attributes.source), vertices = integer(weightsElement.attributes.count, 0, `${what} vertex_weights count`), vcount = numbers(kid(weightsElement, 'vcount')?.text ?? '', `${what} <vcount>`), v = numbers(kid(weightsElement, 'v')?.text ?? '', `${what} <v>`);
|
|
76
|
+
if (vcount.length !== vertices)
|
|
77
|
+
throw new LoaderError(F, 'syntax', `${what} <vcount> has ${vcount.length} entries for ${vertices} vertices`);
|
|
78
|
+
if (vertices < count)
|
|
79
|
+
throw new LoaderError(F, 'range', `${what} weights ${vertices} vertices but its mesh has ${count} positions`);
|
|
80
|
+
const vertexJoints = new Int32Array(count * MAX_INFLUENCES), vertexWeights = new Float32Array(count * MAX_INFLUENCES), pairs = [];
|
|
81
|
+
let at = 0;
|
|
82
|
+
for (let vertex = 0; vertex < vertices; vertex++) {
|
|
83
|
+
const n = vcount[vertex];
|
|
84
|
+
if (!Number.isSafeInteger(n) || n < 0 || (at + n) * stride > v.length)
|
|
85
|
+
throw new LoaderError(F, 'syntax', `${what} <vcount> does not match its <v> indices`);
|
|
86
|
+
pairs.length = 0;
|
|
87
|
+
for (let k = 0; k < n; k++, at++) {
|
|
88
|
+
const joint = v[at * stride + jointOffset], index = v[at * stride + weightOffset];
|
|
89
|
+
if (!(Number.isInteger(joint) && joint >= -1 && joint < joints.length))
|
|
90
|
+
throw new LoaderError(F, 'range', `${what} joint index ${joint} is outside -1..${joints.length - 1}`);
|
|
91
|
+
if (!(Number.isInteger(index) && index >= 0 && index < weightSource.count))
|
|
92
|
+
throw new LoaderError(F, 'range', `${what} weight index ${index} is outside 0..${weightSource.count - 1}`);
|
|
93
|
+
const weight = weightSource.data[weightSource.offset + index * weightSource.stride];
|
|
94
|
+
if (Number.isFinite(weight) && weight > 0)
|
|
95
|
+
pairs.push([joint, weight]);
|
|
96
|
+
}
|
|
97
|
+
if (vertex >= count)
|
|
98
|
+
continue;
|
|
99
|
+
pairs.sort((a, b) => b[1] - a[1]);
|
|
100
|
+
let sum = 0;
|
|
101
|
+
for (let k = 0; k < MAX_INFLUENCES && k < pairs.length; k++)
|
|
102
|
+
sum += pairs[k][1];
|
|
103
|
+
for (let k = 0; k < MAX_INFLUENCES; k++) {
|
|
104
|
+
const pair = pairs[k];
|
|
105
|
+
vertexJoints[vertex * MAX_INFLUENCES + k] = pair ? pair[0] : 0;
|
|
106
|
+
vertexWeights[vertex * MAX_INFLUENCES + k] = pair && sum > 0 ? pair[1] / sum : 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const result = {
|
|
110
|
+
id,
|
|
111
|
+
geometry: base.geometry,
|
|
112
|
+
bindShapeMatrix: bindShape
|
|
113
|
+
? convert(fromRows(bindShape))
|
|
114
|
+
: convert([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
|
|
115
|
+
joints,
|
|
116
|
+
inverseBindMatrices,
|
|
117
|
+
vertexJoints,
|
|
118
|
+
vertexWeights,
|
|
119
|
+
};
|
|
120
|
+
if (base.morph !== undefined)
|
|
121
|
+
result.morph = base.morph;
|
|
122
|
+
if (controller.attributes.name !== undefined)
|
|
123
|
+
result.name = controller.attributes.name;
|
|
124
|
+
return { skin: result, idref };
|
|
125
|
+
}
|
|
126
|
+
/** Reads `library_controllers`: morphs first, so a skin may wrap one. */
|
|
127
|
+
export function readControllers(root, ids, geometryIndex, positionIndices, convert, warn) {
|
|
128
|
+
const all = kids(kid(root, 'library_controllers'), 'controller'), skins = [], morphs = [], controllers = new Map(), counts = new Map(), positions = (geometry) => {
|
|
129
|
+
let count = counts.get(geometry);
|
|
130
|
+
if (count === undefined)
|
|
131
|
+
counts.set(geometry, (count = positionCount(positionIndices(geometry))));
|
|
132
|
+
return count;
|
|
133
|
+
};
|
|
134
|
+
for (const controller of all) {
|
|
135
|
+
const morph = kid(controller, 'morph');
|
|
136
|
+
if (!morph)
|
|
137
|
+
continue;
|
|
138
|
+
const loaded = readMorph(controller, morph, ids, geometryIndex, positions, warn);
|
|
139
|
+
if (!loaded)
|
|
140
|
+
continue;
|
|
141
|
+
controllers.set(loaded.id, { geometry: loaded.base, morph: morphs.length });
|
|
142
|
+
morphs.push(loaded);
|
|
143
|
+
}
|
|
144
|
+
for (const controller of all) {
|
|
145
|
+
const skin = kid(controller, 'skin'), id = controller.attributes.id ?? '';
|
|
146
|
+
if (!skin) {
|
|
147
|
+
if (!kid(controller, 'morph'))
|
|
148
|
+
warn(`controller "${id}" is neither a skin nor a morph and is not imported`);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const sourceId = ref(skin.attributes.source), geometry = geometryIndex.get(sourceId), wrapped = controllers.get(sourceId), base = geometry !== undefined ? { geometry } : wrapped?.morph !== undefined ? wrapped : undefined;
|
|
152
|
+
if (!base) {
|
|
153
|
+
warn(`skin "${id}" is not imported: its source "${skin.attributes.source}" is not an imported mesh or morph`);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const { skin: loaded, idref } = readSkin(controller, skin, ids, base, positions(base.geometry), convert);
|
|
157
|
+
const entry = { geometry: base.geometry, skin: skins.length, idref };
|
|
158
|
+
if (base.morph !== undefined)
|
|
159
|
+
entry.morph = base.morph;
|
|
160
|
+
controllers.set(id, entry);
|
|
161
|
+
skins.push(loaded);
|
|
162
|
+
}
|
|
163
|
+
return { skins, morphs, controllers };
|
|
164
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type DAENode, type DAEParseOptions, type LoadedDAE } from './dae.js';
|
|
2
|
+
import type { DAEPose } from './dae-pose.js';
|
|
3
|
+
import type { BinaryInput } from './util.js';
|
|
4
|
+
/** A node transform a joint axis drives. */
|
|
5
|
+
export interface DAEJointTarget {
|
|
6
|
+
node: DAENode;
|
|
7
|
+
/** Index into `node.transforms`: a `rotate` for a revolute axis, a `translate` for a prismatic one. */
|
|
8
|
+
transform: number;
|
|
9
|
+
}
|
|
10
|
+
/** One degree of freedom: a `<revolute>` or `<prismatic>` of one instance of a joint. */
|
|
11
|
+
export interface DAEJointAxis {
|
|
12
|
+
/**
|
|
13
|
+
* The key {@link poseDAEJoints} takes: the joint's SID, with the axis SID or the whole instance path added only when
|
|
14
|
+
* needed to tell axes apart.
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
/** The SIDs from the kinematics scene down to the axis, joined by `/`; unique in the file. */
|
|
18
|
+
path: string;
|
|
19
|
+
/** The `<joint>`'s name, else its SID or id. */
|
|
20
|
+
joint: string;
|
|
21
|
+
type: 'revolute' | 'prismatic';
|
|
22
|
+
/** Unit axis of rotation or travel in the driven node's frame, Y-up. */
|
|
23
|
+
axis: [number, number, number];
|
|
24
|
+
/** Lower limit: degrees for revolute, meters for prismatic. `axis_info` limits replace the joint's own. */
|
|
25
|
+
min?: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
/** The value the file binds the axis at (degrees or meters). */
|
|
28
|
+
value: number;
|
|
29
|
+
/** `axis_info` `<active>`: false for a passive axis. Default true. */
|
|
30
|
+
active: boolean;
|
|
31
|
+
/** `axis_info` `<locked>`: a locked axis stays at `value`. Default false. */
|
|
32
|
+
locked: boolean;
|
|
33
|
+
/** `axis_info` `<index>`: the axis' number in the controller's order. */
|
|
34
|
+
index?: number;
|
|
35
|
+
/** Motion `axis_info` bounds, per second (squared, cubed), in the axis' units. */
|
|
36
|
+
speed?: number;
|
|
37
|
+
acceleration?: number;
|
|
38
|
+
deceleration?: number;
|
|
39
|
+
jerk?: number;
|
|
40
|
+
/** The node transforms `bind_joint_axis` ties to this axis; empty when the file binds none. */
|
|
41
|
+
targets: DAEJointTarget[];
|
|
42
|
+
}
|
|
43
|
+
/** A parsed COLLADA document with its joint axes. */
|
|
44
|
+
export interface DAEKinematicScene extends LoadedDAE {
|
|
45
|
+
/** Every joint axis of the instanced kinematics scenes, in document order. */
|
|
46
|
+
joints: DAEJointAxis[];
|
|
47
|
+
}
|
|
48
|
+
/** Options of {@link poseDAEJoints}. */
|
|
49
|
+
export interface DAEJointPoseOptions {
|
|
50
|
+
/** Hold values inside the axis' `min` and `max`. Default true. */
|
|
51
|
+
clamp?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `parseDAE` plus the document's COLLADA 1.5 kinematics: `joints` lists every revolute and prismatic axis of the
|
|
55
|
+
* instanced kinematics scenes with its limits, its `axis_info` data and the node transforms it drives. What cannot be
|
|
56
|
+
* resolved is reported in `warnings`. Formulas, closed-loop attachments and tool frames are not evaluated.
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseDAEKinematics(input: BinaryInput | string, options?: DAEParseOptions): DAEKinematicScene;
|
|
59
|
+
/**
|
|
60
|
+
* The scene with its joints at the given values (degrees for revolute axes, meters for prismatic ones), for
|
|
61
|
+
* `flattenDAE` or your own meshes: `world` holds every node's matrix. An axis left out stands at its `value`. Each
|
|
62
|
+
* bound transform becomes the axis' motion: a rotation about `axis`, or a translation along it. Values are held
|
|
63
|
+
* inside the limits unless `clamp` is false.
|
|
64
|
+
*/
|
|
65
|
+
export declare function poseDAEJoints(dae: DAEKinematicScene, values?: Readonly<Record<string, number>>, options?: DAEJointPoseOptions): DAEPose;
|