@lovelace_lol/embody 0.0.1
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 +21 -0
- package/README.md +2411 -0
- package/dist/authoring/boneAuthoring.d.ts +132 -0
- package/dist/camera/annotationCameraAngles.d.ts +28 -0
- package/dist/camera/cameraRelativeGaze.d.ts +15 -0
- package/dist/camera/rustAnnotationCameraCore.d.ts +136 -0
- package/dist/cljs.cjs +362 -0
- package/dist/cljs.cjs.map +1 -0
- package/dist/cljs.d.ts +5 -0
- package/dist/cljs.js +359 -0
- package/dist/cljs.js.map +1 -0
- package/dist/core/TsClipCompiler.d.ts +51 -0
- package/dist/core/TsRuntimeCore.d.ts +40 -0
- package/dist/core/WasmRuntimeCore.d.ts +55 -0
- package/dist/core/compositeAxis.d.ts +4 -0
- package/dist/core/contracts/abi.d.ts +70 -0
- package/dist/core/contracts/clip.d.ts +44 -0
- package/dist/core/contracts/frame.d.ts +27 -0
- package/dist/core/contracts/host.d.ts +28 -0
- package/dist/core/contracts/ids.d.ts +15 -0
- package/dist/core/contracts/index.d.ts +10 -0
- package/dist/core/contracts/model.d.ts +31 -0
- package/dist/core/contracts/primitives.d.ts +17 -0
- package/dist/core/contracts/skeletonFit.d.ts +41 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/types.d.ts +472 -0
- package/dist/core.cjs +1065 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.js +1040 -0
- package/dist/core.js.map +1 -0
- package/dist/engines/three/Embody.d.ts +373 -0
- package/dist/engines/three/ThreeAnimationRuntime.d.ts +203 -0
- package/dist/engines/three/ThreeClipAdapter.d.ts +24 -0
- package/dist/engines/three/ThreeFrameApplier.d.ts +68 -0
- package/dist/engines/three/ThreeModelInspector.d.ts +54 -0
- package/dist/engines/three/bakedClipPartitioning.d.ts +16 -0
- package/dist/engines/three/balanceUtils.d.ts +3 -0
- package/dist/engines/three/characterHost.d.ts +80 -0
- package/dist/engines/three/characterScene.d.ts +98 -0
- package/dist/engines/three/hair/HairPhysicsController.d.ts +124 -0
- package/dist/engines/three/index.d.ts +20 -0
- package/dist/engines/three/modelLoader.d.ts +61 -0
- package/dist/engines/three/profileTestScene.d.ts +52 -0
- package/dist/engines/three/types.d.ts +20 -0
- package/dist/hair/appearance.d.ts +29 -0
- package/dist/index.cjs +15431 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +15141 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/Animation.d.ts +315 -0
- package/dist/interfaces/EmbodyRuntime.d.ts +90 -0
- package/dist/interfaces/Hair.d.ts +181 -0
- package/dist/interfaces/HairPhysics.d.ts +90 -0
- package/dist/interfaces/index.d.ts +11 -0
- package/dist/mappings/extendPresetWithProfile.d.ts +17 -0
- package/dist/mappings/types.d.ts +309 -0
- package/dist/mappings/visemeSystem.d.ts +26 -0
- package/dist/physics/HairPhysics.d.ts +86 -0
- package/dist/physics/RustHairPhysics.d.ts +18 -0
- package/dist/physics/index.d.ts +6 -0
- package/dist/preset.cjs +2000 -0
- package/dist/preset.cjs.map +1 -0
- package/dist/preset.js +1997 -0
- package/dist/preset.js.map +1 -0
- package/dist/presets/bettaFish.d.ts +328 -0
- package/dist/presets/cc4.d.ts +145 -0
- package/dist/presets/index.d.ts +27 -0
- package/dist/profiles/resolveProfileConfig.d.ts +36 -0
- package/dist/profiles/types.d.ts +118 -0
- package/dist/regions/normalizeRegionTree.d.ts +6 -0
- package/dist/regions/regionMapping.d.ts +17 -0
- package/dist/regions/types.d.ts +122 -0
- package/dist/skeletonTemplates/humanoidSkeletonTemplates.d.ts +32 -0
- package/dist/test/setupWasm.d.ts +1 -0
- package/dist/three.cjs +10115 -0
- package/dist/three.cjs.map +1 -0
- package/dist/three.js +10086 -0
- package/dist/three.js.map +1 -0
- package/dist/validation/analyzeModel.d.ts +68 -0
- package/dist/validation/extractModelData.d.ts +90 -0
- package/dist/validation/generateMappingCorrections.d.ts +32 -0
- package/dist/validation/geometryHelpers.d.ts +66 -0
- package/dist/validation/types.d.ts +10 -0
- package/dist/validation/validateMappings.d.ts +77 -0
- package/dist/wasm/LICENSE +21 -0
- package/dist/wasm/README.md +72 -0
- package/dist/wasm/embody_wasm.d.ts +531 -0
- package/dist/wasm/embody_wasm.js +1635 -0
- package/dist/wasm/embody_wasm_bg.wasm +0 -0
- package/dist/wasm/embody_wasm_bg.wasm.d.ts +107 -0
- package/dist/wasm.cjs +302 -0
- package/dist/wasm.cjs.map +1 -0
- package/dist/wasm.d.ts +43 -0
- package/dist/wasm.js +268 -0
- package/dist/wasm.js.map +1 -0
- package/dist/wasmTypes.d.ts +121 -0
- package/package.json +99 -0
|
@@ -0,0 +1,1635 @@
|
|
|
1
|
+
/* @ts-self-types="./embody_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Spherical camera flight between two camera poses.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the DPthree camera transition: orbital interpolation with a
|
|
7
|
+
* pullback arc so large rotations do not pass through the model.
|
|
8
|
+
* `sample(elapsed_ms)` returns
|
|
9
|
+
* `[posX, posY, posZ, targetX, targetY, targetZ, done]`.
|
|
10
|
+
*/
|
|
11
|
+
export class CameraFlight {
|
|
12
|
+
__destroy_into_raw() {
|
|
13
|
+
const ptr = this.__wbg_ptr;
|
|
14
|
+
this.__wbg_ptr = 0;
|
|
15
|
+
CameraFlightFinalization.unregister(this);
|
|
16
|
+
return ptr;
|
|
17
|
+
}
|
|
18
|
+
free() {
|
|
19
|
+
const ptr = this.__destroy_into_raw();
|
|
20
|
+
wasm.__wbg_cameraflight_free(ptr, 0);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @returns {number}
|
|
24
|
+
*/
|
|
25
|
+
duration_ms() {
|
|
26
|
+
const ret = wasm.cameraflight_duration_ms(this.__wbg_ptr);
|
|
27
|
+
return ret;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param {Float32Array} start_position
|
|
31
|
+
* @param {Float32Array} start_target
|
|
32
|
+
* @param {Float32Array} end_position
|
|
33
|
+
* @param {Float32Array} end_target
|
|
34
|
+
* @param {number} duration_ms
|
|
35
|
+
*/
|
|
36
|
+
constructor(start_position, start_target, end_position, end_target, duration_ms) {
|
|
37
|
+
const ptr0 = passArrayF32ToWasm0(start_position, wasm.__wbindgen_malloc);
|
|
38
|
+
const len0 = WASM_VECTOR_LEN;
|
|
39
|
+
const ptr1 = passArrayF32ToWasm0(start_target, wasm.__wbindgen_malloc);
|
|
40
|
+
const len1 = WASM_VECTOR_LEN;
|
|
41
|
+
const ptr2 = passArrayF32ToWasm0(end_position, wasm.__wbindgen_malloc);
|
|
42
|
+
const len2 = WASM_VECTOR_LEN;
|
|
43
|
+
const ptr3 = passArrayF32ToWasm0(end_target, wasm.__wbindgen_malloc);
|
|
44
|
+
const len3 = WASM_VECTOR_LEN;
|
|
45
|
+
const ret = wasm.cameraflight_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, duration_ms);
|
|
46
|
+
this.__wbg_ptr = ret;
|
|
47
|
+
CameraFlightFinalization.register(this, this.__wbg_ptr, this);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param {number} elapsed_ms
|
|
52
|
+
* @returns {Float32Array}
|
|
53
|
+
*/
|
|
54
|
+
sample(elapsed_ms) {
|
|
55
|
+
const ret = wasm.cameraflight_sample(this.__wbg_ptr, elapsed_ms);
|
|
56
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
57
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
58
|
+
return v1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (Symbol.dispose) CameraFlight.prototype[Symbol.dispose] = CameraFlight.prototype.free;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Full 360-degree eased orbit around a center point.
|
|
65
|
+
* `sample(elapsed_ms)` returns
|
|
66
|
+
* `[posX, posY, posZ, targetX, targetY, targetZ, done]`.
|
|
67
|
+
*/
|
|
68
|
+
export class CameraOrbit {
|
|
69
|
+
__destroy_into_raw() {
|
|
70
|
+
const ptr = this.__wbg_ptr;
|
|
71
|
+
this.__wbg_ptr = 0;
|
|
72
|
+
CameraOrbitFinalization.unregister(this);
|
|
73
|
+
return ptr;
|
|
74
|
+
}
|
|
75
|
+
free() {
|
|
76
|
+
const ptr = this.__destroy_into_raw();
|
|
77
|
+
wasm.__wbg_cameraorbit_free(ptr, 0);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
duration_ms() {
|
|
83
|
+
const ret = wasm.cameraorbit_duration_ms(this.__wbg_ptr);
|
|
84
|
+
return ret;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param {Float32Array} center
|
|
88
|
+
* @param {number} radius
|
|
89
|
+
* @param {number} height
|
|
90
|
+
* @param {number} duration_ms
|
|
91
|
+
*/
|
|
92
|
+
constructor(center, radius, height, duration_ms) {
|
|
93
|
+
const ptr0 = passArrayF32ToWasm0(center, wasm.__wbindgen_malloc);
|
|
94
|
+
const len0 = WASM_VECTOR_LEN;
|
|
95
|
+
const ret = wasm.cameraorbit_new(ptr0, len0, radius, height, duration_ms);
|
|
96
|
+
this.__wbg_ptr = ret;
|
|
97
|
+
CameraOrbitFinalization.register(this, this.__wbg_ptr, this);
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @param {number} elapsed_ms
|
|
102
|
+
* @returns {Float32Array}
|
|
103
|
+
*/
|
|
104
|
+
sample(elapsed_ms) {
|
|
105
|
+
const ret = wasm.cameraorbit_sample(this.__wbg_ptr, elapsed_ms);
|
|
106
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
107
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
108
|
+
return v1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (Symbol.dispose) CameraOrbit.prototype[Symbol.dispose] = CameraOrbit.prototype.free;
|
|
112
|
+
|
|
113
|
+
export class HairPhysicsSolver {
|
|
114
|
+
__destroy_into_raw() {
|
|
115
|
+
const ptr = this.__wbg_ptr;
|
|
116
|
+
this.__wbg_ptr = 0;
|
|
117
|
+
HairPhysicsSolverFinalization.unregister(this);
|
|
118
|
+
return ptr;
|
|
119
|
+
}
|
|
120
|
+
free() {
|
|
121
|
+
const ptr = this.__destroy_into_raw();
|
|
122
|
+
wasm.__wbg_hairphysicssolver_free(ptr, 0);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @returns {Float32Array}
|
|
126
|
+
*/
|
|
127
|
+
get_config() {
|
|
128
|
+
const ret = wasm.hairphysicssolver_get_config(this.__wbg_ptr);
|
|
129
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
130
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
131
|
+
return v1;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* @returns {Float32Array}
|
|
135
|
+
*/
|
|
136
|
+
get_state() {
|
|
137
|
+
const ret = wasm.hairphysicssolver_get_state(this.__wbg_ptr);
|
|
138
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
139
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
140
|
+
return v1;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @param {Float32Array} config_values
|
|
144
|
+
*/
|
|
145
|
+
constructor(config_values) {
|
|
146
|
+
const ptr0 = passArrayF32ToWasm0(config_values, wasm.__wbindgen_malloc);
|
|
147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
148
|
+
const ret = wasm.hairphysicssolver_new(ptr0, len0);
|
|
149
|
+
this.__wbg_ptr = ret;
|
|
150
|
+
HairPhysicsSolverFinalization.register(this, this.__wbg_ptr, this);
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
reset() {
|
|
154
|
+
wasm.hairphysicssolver_reset(this.__wbg_ptr);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* @param {Float32Array} config_values
|
|
158
|
+
*/
|
|
159
|
+
set_config(config_values) {
|
|
160
|
+
const ptr0 = passArrayF32ToWasm0(config_values, wasm.__wbindgen_malloc);
|
|
161
|
+
const len0 = WASM_VECTOR_LEN;
|
|
162
|
+
wasm.hairphysicssolver_set_config(this.__wbg_ptr, ptr0, len0);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @param {number} dt
|
|
166
|
+
* @param {Float32Array} head_values
|
|
167
|
+
* @returns {Float32Array}
|
|
168
|
+
*/
|
|
169
|
+
update(dt, head_values) {
|
|
170
|
+
const ptr0 = passArrayF32ToWasm0(head_values, wasm.__wbindgen_malloc);
|
|
171
|
+
const len0 = WASM_VECTOR_LEN;
|
|
172
|
+
const ret = wasm.hairphysicssolver_update(this.__wbg_ptr, dt, ptr0, len0);
|
|
173
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
174
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
175
|
+
return v2;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (Symbol.dispose) HairPhysicsSolver.prototype[Symbol.dispose] = HairPhysicsSolver.prototype.free;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Host-neutral live morph runtime. Owns AU/viseme/mix state and emits packed
|
|
182
|
+
* morph frame deltas. Engine objects never enter this struct.
|
|
183
|
+
*/
|
|
184
|
+
export class RuntimeCore {
|
|
185
|
+
__destroy_into_raw() {
|
|
186
|
+
const ptr = this.__wbg_ptr;
|
|
187
|
+
this.__wbg_ptr = 0;
|
|
188
|
+
RuntimeCoreFinalization.unregister(this);
|
|
189
|
+
return ptr;
|
|
190
|
+
}
|
|
191
|
+
free() {
|
|
192
|
+
const ptr = this.__destroy_into_raw();
|
|
193
|
+
wasm.__wbg_runtimecore_free(ptr, 0);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @returns {number}
|
|
197
|
+
*/
|
|
198
|
+
active_transition_count() {
|
|
199
|
+
const ret = wasm.runtimecore_active_transition_count(this.__wbg_ptr);
|
|
200
|
+
return ret >>> 0;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* @returns {number}
|
|
204
|
+
*/
|
|
205
|
+
static au_morph_binding_stride() {
|
|
206
|
+
const ret = wasm.runtimecore_au_morph_binding_stride();
|
|
207
|
+
return ret >>> 0;
|
|
208
|
+
}
|
|
209
|
+
clear() {
|
|
210
|
+
wasm.runtimecore_clear(this.__wbg_ptr);
|
|
211
|
+
}
|
|
212
|
+
clear_transitions() {
|
|
213
|
+
wasm.runtimecore_clear_transitions(this.__wbg_ptr);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Configure the core from the profile and model descriptor JSON hosts
|
|
217
|
+
* already have. All binding compilation (mesh/morph/bone name resolution,
|
|
218
|
+
* composite axes, translations, jaw, viseme slots, mix defaults,
|
|
219
|
+
* continuum pairs) happens here, inside the core.
|
|
220
|
+
* @param {string} profile_json
|
|
221
|
+
* @param {string} model_json
|
|
222
|
+
*/
|
|
223
|
+
configure(profile_json, model_json) {
|
|
224
|
+
const ptr0 = passStringToWasm0(profile_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ptr1 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
227
|
+
const len1 = WASM_VECTOR_LEN;
|
|
228
|
+
const ret = wasm.runtimecore_configure(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
229
|
+
if (ret[1]) {
|
|
230
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Configure from a complete profile without applying an embedded preset.
|
|
235
|
+
*
|
|
236
|
+
* This path is intentionally strict so a host cannot accidentally select
|
|
237
|
+
* exact mode for an incomplete custom profile and silently get an inert
|
|
238
|
+
* runtime. Preset fallback remains an explicit host decision.
|
|
239
|
+
* @param {string} profile_json
|
|
240
|
+
* @param {string} model_json
|
|
241
|
+
*/
|
|
242
|
+
configure_exact_profile(profile_json, model_json) {
|
|
243
|
+
const ptr0 = passStringToWasm0(profile_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
244
|
+
const len0 = WASM_VECTOR_LEN;
|
|
245
|
+
const ptr1 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
246
|
+
const len1 = WASM_VECTOR_LEN;
|
|
247
|
+
const ret = wasm.runtimecore_configure_exact_profile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
248
|
+
if (ret[1]) {
|
|
249
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Configure from an embedded preset id + optional override JSON + model
|
|
254
|
+
* descriptor JSON. The CC4 (etc.) preset data lives in the Wasm core;
|
|
255
|
+
* hosts only pass the preset id and overrides.
|
|
256
|
+
* @param {string} preset_id
|
|
257
|
+
* @param {string} override_json
|
|
258
|
+
* @param {string} model_json
|
|
259
|
+
*/
|
|
260
|
+
configure_with_preset(preset_id, override_json, model_json) {
|
|
261
|
+
const ptr0 = passStringToWasm0(preset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
262
|
+
const len0 = WASM_VECTOR_LEN;
|
|
263
|
+
const ptr1 = passStringToWasm0(override_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
264
|
+
const len1 = WASM_VECTOR_LEN;
|
|
265
|
+
const ptr2 = passStringToWasm0(model_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
266
|
+
const len2 = WASM_VECTOR_LEN;
|
|
267
|
+
const ret = wasm.runtimecore_configure_with_preset(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
268
|
+
if (ret[1]) {
|
|
269
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Packed bone FrameDelta rows: `[bone_id, px, py, pz, qx, qy, qz, qw, flags] * N`
|
|
274
|
+
* flags: bit0 = has_position, bit1 = has_rotation. Mirrors
|
|
275
|
+
* TsRuntimeCore.collectBoneWrites: composite rotations relative to rest,
|
|
276
|
+
* AU-driven translations added to rest position, and viseme jaw rotation.
|
|
277
|
+
* @returns {Float32Array}
|
|
278
|
+
*/
|
|
279
|
+
evaluate_bone_frame_delta() {
|
|
280
|
+
const ret = wasm.runtimecore_evaluate_bone_frame_delta(this.__wbg_ptr);
|
|
281
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
282
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
283
|
+
return v1;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Packed morph FrameDelta rows: `[mesh_id, morph_target_id, value, mode] * N`
|
|
287
|
+
* @returns {Float32Array}
|
|
288
|
+
*/
|
|
289
|
+
evaluate_morph_frame_delta() {
|
|
290
|
+
const ret = wasm.runtimecore_evaluate_morph_frame_delta(this.__wbg_ptr);
|
|
291
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
292
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
293
|
+
return v1;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @param {number} id
|
|
297
|
+
* @returns {number}
|
|
298
|
+
*/
|
|
299
|
+
get_au(id) {
|
|
300
|
+
const ret = wasm.runtimecore_get_au(this.__wbg_ptr, id);
|
|
301
|
+
return ret;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @param {number} neg_au
|
|
305
|
+
* @param {number} pos_au
|
|
306
|
+
* @returns {number}
|
|
307
|
+
*/
|
|
308
|
+
get_continuum(neg_au, pos_au) {
|
|
309
|
+
const ret = wasm.runtimecore_get_continuum(this.__wbg_ptr, neg_au, pos_au);
|
|
310
|
+
return ret;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Packed rows: `[au_id, side, mesh_id, morph_target_id, weight] * N`
|
|
314
|
+
* side: 0=left, 1=right, 2=center
|
|
315
|
+
* @param {Float32Array} values
|
|
316
|
+
*/
|
|
317
|
+
load_au_morph_bindings(values) {
|
|
318
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
319
|
+
const len0 = WASM_VECTOR_LEN;
|
|
320
|
+
wasm.runtimecore_load_au_morph_bindings(this.__wbg_ptr, ptr0, len0);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Packed rows: `[bone_id, px, py, pz, qx, qy, qz, qw] * N`
|
|
324
|
+
* @param {Float32Array} values
|
|
325
|
+
*/
|
|
326
|
+
load_bone_rest_transforms(values) {
|
|
327
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
328
|
+
const len0 = WASM_VECTOR_LEN;
|
|
329
|
+
wasm.runtimecore_load_bone_rest_transforms(this.__wbg_ptr, ptr0, len0);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Packed rows: `[au_id, bone_id, axis(0=x,1=y,2=z), scale, max_units] * N`
|
|
333
|
+
* @param {Float32Array} values
|
|
334
|
+
*/
|
|
335
|
+
load_bone_translations(values) {
|
|
336
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
337
|
+
const len0 = WASM_VECTOR_LEN;
|
|
338
|
+
wasm.runtimecore_load_bone_translations(this.__wbg_ptr, ptr0, len0);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Variable-length blocks, one per composite axis:
|
|
342
|
+
* header `[bone_id, axis, has_directional, value_rows, binding_rows, 0, 0, 0]`,
|
|
343
|
+
* then value rows `[au_id, group, side] * value_rows`,
|
|
344
|
+
* then binding rows `[au_id, group, side, channel, scale, max_degrees] * binding_rows`.
|
|
345
|
+
* Axes must be packed grouped per bone in application order (yaw, pitch, roll).
|
|
346
|
+
* @param {Float32Array} values
|
|
347
|
+
*/
|
|
348
|
+
load_composite_axes(values) {
|
|
349
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
350
|
+
const len0 = WASM_VECTOR_LEN;
|
|
351
|
+
wasm.runtimecore_load_composite_axes(this.__wbg_ptr, ptr0, len0);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Packed row: `[bone_id, channel, scale, max_degrees]`; empty slice clears.
|
|
355
|
+
* @param {Float32Array} values
|
|
356
|
+
*/
|
|
357
|
+
load_jaw_binding(values) {
|
|
358
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
359
|
+
const len0 = WASM_VECTOR_LEN;
|
|
360
|
+
wasm.runtimecore_load_jaw_binding(this.__wbg_ptr, ptr0, len0);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @param {Float32Array} values
|
|
364
|
+
*/
|
|
365
|
+
load_viseme_jaw_amounts(values) {
|
|
366
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
367
|
+
const len0 = WASM_VECTOR_LEN;
|
|
368
|
+
wasm.runtimecore_load_viseme_jaw_amounts(this.__wbg_ptr, ptr0, len0);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Packed rows: `[viseme_index, mesh_id, morph_target_id, weight] * N`
|
|
372
|
+
* @param {Float32Array} values
|
|
373
|
+
*/
|
|
374
|
+
load_viseme_morph_bindings(values) {
|
|
375
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
376
|
+
const len0 = WASM_VECTOR_LEN;
|
|
377
|
+
wasm.runtimecore_load_viseme_morph_bindings(this.__wbg_ptr, ptr0, len0);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @param {number} viseme_slot_count
|
|
381
|
+
*/
|
|
382
|
+
constructor(viseme_slot_count) {
|
|
383
|
+
const ret = wasm.runtimecore_new(viseme_slot_count);
|
|
384
|
+
this.__wbg_ptr = ret;
|
|
385
|
+
RuntimeCoreFinalization.register(this, this.__wbg_ptr, this);
|
|
386
|
+
return this;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* @param {number} id
|
|
390
|
+
* @param {number} value
|
|
391
|
+
* @param {number} balance
|
|
392
|
+
*/
|
|
393
|
+
set_au(id, value, balance) {
|
|
394
|
+
wasm.runtimecore_set_au(this.__wbg_ptr, id, value, balance);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* @param {number} id
|
|
398
|
+
* @param {number} weight
|
|
399
|
+
*/
|
|
400
|
+
set_au_mix_weight(id, weight) {
|
|
401
|
+
wasm.runtimecore_set_au_mix_weight(this.__wbg_ptr, id, weight);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Continuum-aware AU set. Negative values route through the configured
|
|
405
|
+
* continuum pair (e.g. eyes left/right) exactly like the legacy runtime.
|
|
406
|
+
* @param {number} id
|
|
407
|
+
* @param {number} value
|
|
408
|
+
* @param {number} balance
|
|
409
|
+
*/
|
|
410
|
+
set_au_signed(id, value, balance) {
|
|
411
|
+
wasm.runtimecore_set_au_signed(this.__wbg_ptr, id, value, balance);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* @param {number} neg_au
|
|
415
|
+
* @param {number} pos_au
|
|
416
|
+
* @param {number} value
|
|
417
|
+
* @param {number} balance
|
|
418
|
+
*/
|
|
419
|
+
set_continuum(neg_au, pos_au, value, balance) {
|
|
420
|
+
wasm.runtimecore_set_continuum(this.__wbg_ptr, neg_au, pos_au, value, balance);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* @param {Uint32Array} ids
|
|
424
|
+
*/
|
|
425
|
+
set_mixed_aus(ids) {
|
|
426
|
+
const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
|
|
427
|
+
const len0 = WASM_VECTOR_LEN;
|
|
428
|
+
wasm.runtimecore_set_mixed_aus(this.__wbg_ptr, ptr0, len0);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @param {number} index
|
|
432
|
+
* @param {number} value
|
|
433
|
+
*/
|
|
434
|
+
set_viseme(index, value) {
|
|
435
|
+
wasm.runtimecore_set_viseme(this.__wbg_ptr, index, value);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* @param {number} index
|
|
439
|
+
* @param {number} jaw_scale
|
|
440
|
+
*/
|
|
441
|
+
set_viseme_jaw_scale(index, jaw_scale) {
|
|
442
|
+
wasm.runtimecore_set_viseme_jaw_scale(this.__wbg_ptr, index, jaw_scale);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* @param {number} count
|
|
446
|
+
*/
|
|
447
|
+
set_viseme_slot_count(count) {
|
|
448
|
+
wasm.runtimecore_set_viseme_slot_count(this.__wbg_ptr, count);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Start (or replace) an eased AU transition. Advanced by `update`.
|
|
452
|
+
* @param {number} id
|
|
453
|
+
* @param {number} to
|
|
454
|
+
* @param {number} duration_ms
|
|
455
|
+
* @param {number} balance
|
|
456
|
+
*/
|
|
457
|
+
transition_au(id, to, duration_ms, balance) {
|
|
458
|
+
wasm.runtimecore_transition_au(this.__wbg_ptr, id, to, duration_ms, balance);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* @param {number} index
|
|
462
|
+
* @param {number} to
|
|
463
|
+
* @param {number} duration_ms
|
|
464
|
+
* @param {number} jaw_scale
|
|
465
|
+
*/
|
|
466
|
+
transition_viseme(index, to, duration_ms, jaw_scale) {
|
|
467
|
+
wasm.runtimecore_transition_viseme(this.__wbg_ptr, index, to, duration_ms, jaw_scale);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Advance all running transitions by `dt` seconds and write the eased
|
|
471
|
+
* values into the core state. Returns the number of still-active
|
|
472
|
+
* transitions so hosts know whether a frame delta re-evaluation is due.
|
|
473
|
+
* @param {number} dt_seconds
|
|
474
|
+
* @returns {number}
|
|
475
|
+
*/
|
|
476
|
+
update(dt_seconds) {
|
|
477
|
+
const ret = wasm.runtimecore_update(this.__wbg_ptr, dt_seconds);
|
|
478
|
+
return ret >>> 0;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @returns {number}
|
|
482
|
+
*/
|
|
483
|
+
static viseme_morph_binding_stride() {
|
|
484
|
+
const ret = wasm.runtimecore_viseme_morph_binding_stride();
|
|
485
|
+
return ret >>> 0;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* @param {string} slot_id
|
|
489
|
+
* @returns {number}
|
|
490
|
+
*/
|
|
491
|
+
viseme_slot_index(slot_id) {
|
|
492
|
+
const ptr0 = passStringToWasm0(slot_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
493
|
+
const len0 = WASM_VECTOR_LEN;
|
|
494
|
+
const ret = wasm.runtimecore_viseme_slot_index(this.__wbg_ptr, ptr0, len0);
|
|
495
|
+
return ret;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (Symbol.dispose) RuntimeCore.prototype[Symbol.dispose] = RuntimeCore.prototype.free;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Analyze xyz vertex positions for a rough humanoid proportion signal.
|
|
502
|
+
*
|
|
503
|
+
* Input is a packed xyz buffer. `vertical_axis` is 0 for x, 1 for y, and 2 for z.
|
|
504
|
+
* Invalid or incomplete vertices are ignored.
|
|
505
|
+
*
|
|
506
|
+
* Output layout:
|
|
507
|
+
* [min_x, min_y, min_z, max_x, max_y, max_z,
|
|
508
|
+
* center_x, center_y, center_z,
|
|
509
|
+
* span_x, span_y, span_z,
|
|
510
|
+
* vertical_height, cross_axis_wide_span, cross_axis_narrow_span,
|
|
511
|
+
* humanoid_likelihood]
|
|
512
|
+
* @param {Float32Array} vertices
|
|
513
|
+
* @param {number} vertical_axis
|
|
514
|
+
* @returns {Float32Array}
|
|
515
|
+
*/
|
|
516
|
+
export function analyze_mesh_proportions(vertices, vertical_axis) {
|
|
517
|
+
const ptr0 = passArrayF32ToWasm0(vertices, wasm.__wbindgen_malloc);
|
|
518
|
+
const len0 = WASM_VECTOR_LEN;
|
|
519
|
+
const ret = wasm.analyze_mesh_proportions(ptr0, len0, vertical_axis);
|
|
520
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
521
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
522
|
+
return v2;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* @returns {number}
|
|
527
|
+
*/
|
|
528
|
+
export function annotation_camera_framing_stride() {
|
|
529
|
+
const ret = wasm.annotation_camera_framing_stride();
|
|
530
|
+
return ret >>> 0;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Build head-pitch gravity hair morph curves.
|
|
535
|
+
* @param {string} config_json
|
|
536
|
+
* @returns {string}
|
|
537
|
+
*/
|
|
538
|
+
export function build_hair_gravity_curves(config_json) {
|
|
539
|
+
let deferred3_0;
|
|
540
|
+
let deferred3_1;
|
|
541
|
+
try {
|
|
542
|
+
const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
543
|
+
const len0 = WASM_VECTOR_LEN;
|
|
544
|
+
const ret = wasm.build_hair_gravity_curves(ptr0, len0);
|
|
545
|
+
var ptr2 = ret[0];
|
|
546
|
+
var len2 = ret[1];
|
|
547
|
+
if (ret[3]) {
|
|
548
|
+
ptr2 = 0; len2 = 0;
|
|
549
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
550
|
+
}
|
|
551
|
+
deferred3_0 = ptr2;
|
|
552
|
+
deferred3_1 = len2;
|
|
553
|
+
return getStringFromWasm0(ptr2, len2);
|
|
554
|
+
} finally {
|
|
555
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Build idle/wind hair morph curves (JSON map of morphKey -> [{time,intensity}]).
|
|
561
|
+
* @param {string} config_json
|
|
562
|
+
* @param {number} duration_sec
|
|
563
|
+
* @returns {string}
|
|
564
|
+
*/
|
|
565
|
+
export function build_hair_idle_curves(config_json, duration_sec) {
|
|
566
|
+
let deferred3_0;
|
|
567
|
+
let deferred3_1;
|
|
568
|
+
try {
|
|
569
|
+
const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
570
|
+
const len0 = WASM_VECTOR_LEN;
|
|
571
|
+
const ret = wasm.build_hair_idle_curves(ptr0, len0, duration_sec);
|
|
572
|
+
var ptr2 = ret[0];
|
|
573
|
+
var len2 = ret[1];
|
|
574
|
+
if (ret[3]) {
|
|
575
|
+
ptr2 = 0; len2 = 0;
|
|
576
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
577
|
+
}
|
|
578
|
+
deferred3_0 = ptr2;
|
|
579
|
+
deferred3_1 = len2;
|
|
580
|
+
return getStringFromWasm0(ptr2, len2);
|
|
581
|
+
} finally {
|
|
582
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Build a directional hair impulse curve set.
|
|
588
|
+
* @param {string} config_json
|
|
589
|
+
* @param {number} duration_sec
|
|
590
|
+
* @param {number} horizontal
|
|
591
|
+
* @param {number} vertical
|
|
592
|
+
* @returns {string}
|
|
593
|
+
*/
|
|
594
|
+
export function build_hair_impulse_curves(config_json, duration_sec, horizontal, vertical) {
|
|
595
|
+
let deferred3_0;
|
|
596
|
+
let deferred3_1;
|
|
597
|
+
try {
|
|
598
|
+
const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
599
|
+
const len0 = WASM_VECTOR_LEN;
|
|
600
|
+
const ret = wasm.build_hair_impulse_curves(ptr0, len0, duration_sec, horizontal, vertical);
|
|
601
|
+
var ptr2 = ret[0];
|
|
602
|
+
var len2 = ret[1];
|
|
603
|
+
if (ret[3]) {
|
|
604
|
+
ptr2 = 0; len2 = 0;
|
|
605
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
606
|
+
}
|
|
607
|
+
deferred3_0 = ptr2;
|
|
608
|
+
deferred3_1 = len2;
|
|
609
|
+
return getStringFromWasm0(ptr2, len2);
|
|
610
|
+
} finally {
|
|
611
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* @returns {number}
|
|
617
|
+
*/
|
|
618
|
+
export function camera_flight_sample_stride() {
|
|
619
|
+
const ret = wasm.camera_flight_sample_stride();
|
|
620
|
+
return ret >>> 0;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Compile a clip track input (JSON) into host-neutral ClipIR JSON.
|
|
625
|
+
* @param {string} input_json
|
|
626
|
+
* @returns {string}
|
|
627
|
+
*/
|
|
628
|
+
export function compile_clip(input_json) {
|
|
629
|
+
let deferred3_0;
|
|
630
|
+
let deferred3_1;
|
|
631
|
+
try {
|
|
632
|
+
const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
633
|
+
const len0 = WASM_VECTOR_LEN;
|
|
634
|
+
const ret = wasm.compile_clip(ptr0, len0);
|
|
635
|
+
var ptr2 = ret[0];
|
|
636
|
+
var len2 = ret[1];
|
|
637
|
+
if (ret[3]) {
|
|
638
|
+
ptr2 = 0; len2 = 0;
|
|
639
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
640
|
+
}
|
|
641
|
+
deferred3_0 = ptr2;
|
|
642
|
+
deferred3_1 = len2;
|
|
643
|
+
return getStringFromWasm0(ptr2, len2);
|
|
644
|
+
} finally {
|
|
645
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Compile named intensity curves (JSON) into host-neutral ClipIR JSON.
|
|
651
|
+
* @param {string} input_json
|
|
652
|
+
* @returns {string}
|
|
653
|
+
*/
|
|
654
|
+
export function compile_clip_curves(input_json) {
|
|
655
|
+
let deferred3_0;
|
|
656
|
+
let deferred3_1;
|
|
657
|
+
try {
|
|
658
|
+
const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
659
|
+
const len0 = WASM_VECTOR_LEN;
|
|
660
|
+
const ret = wasm.compile_clip_curves(ptr0, len0);
|
|
661
|
+
var ptr2 = ret[0];
|
|
662
|
+
var len2 = ret[1];
|
|
663
|
+
if (ret[3]) {
|
|
664
|
+
ptr2 = 0; len2 = 0;
|
|
665
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
666
|
+
}
|
|
667
|
+
deferred3_0 = ptr2;
|
|
668
|
+
deferred3_1 = len2;
|
|
669
|
+
return getStringFromWasm0(ptr2, len2);
|
|
670
|
+
} finally {
|
|
671
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Compose user-facing manual adjustments onto a solved skeleton fit.
|
|
677
|
+
*
|
|
678
|
+
* `fit` must start with [scale, translate_x, translate_y, translate_z]. The
|
|
679
|
+
* output preserves those four fields after multiplying scale and adding offsets.
|
|
680
|
+
* @param {Float32Array} fit
|
|
681
|
+
* @param {number} scale_multiplier
|
|
682
|
+
* @param {number} offset_x
|
|
683
|
+
* @param {number} offset_y
|
|
684
|
+
* @param {number} offset_z
|
|
685
|
+
* @returns {Float32Array}
|
|
686
|
+
*/
|
|
687
|
+
export function compose_template_fit_adjustment(fit, scale_multiplier, offset_x, offset_y, offset_z) {
|
|
688
|
+
const ptr0 = passArrayF32ToWasm0(fit, wasm.__wbindgen_malloc);
|
|
689
|
+
const len0 = WASM_VECTOR_LEN;
|
|
690
|
+
const ret = wasm.compose_template_fit_adjustment(ptr0, len0, scale_multiplier, offset_x, offset_y, offset_z);
|
|
691
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
692
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
693
|
+
return v2;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* @param {number} fit_scale
|
|
698
|
+
* @param {Float32Array} fit_translation
|
|
699
|
+
* @param {number} manual_scale
|
|
700
|
+
* @param {Float32Array} manual_translation
|
|
701
|
+
* @returns {Float32Array}
|
|
702
|
+
*/
|
|
703
|
+
export function compose_template_skeleton_fit_transform(fit_scale, fit_translation, manual_scale, manual_translation) {
|
|
704
|
+
const ptr0 = passArrayF32ToWasm0(fit_translation, wasm.__wbindgen_malloc);
|
|
705
|
+
const len0 = WASM_VECTOR_LEN;
|
|
706
|
+
const ptr1 = passArrayF32ToWasm0(manual_translation, wasm.__wbindgen_malloc);
|
|
707
|
+
const len1 = WASM_VECTOR_LEN;
|
|
708
|
+
const ret = wasm.compose_template_skeleton_fit_transform(fit_scale, ptr0, len0, manual_scale, ptr1, len1);
|
|
709
|
+
var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
710
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
711
|
+
return v3;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* @returns {number}
|
|
716
|
+
*/
|
|
717
|
+
export function core_abi_version() {
|
|
718
|
+
const ret = wasm.core_abi_version();
|
|
719
|
+
return ret >>> 0;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* @returns {Float32Array}
|
|
724
|
+
*/
|
|
725
|
+
export function default_hair_physics_config_values() {
|
|
726
|
+
const ret = wasm.default_hair_physics_config_values();
|
|
727
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
728
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
729
|
+
return v1;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Padding factor for a focus target of the given max dimension.
|
|
734
|
+
* @param {number} size
|
|
735
|
+
* @param {number} close_up_padding
|
|
736
|
+
* @param {number} zoom_padding
|
|
737
|
+
* @param {number} full_body_padding
|
|
738
|
+
* @returns {number}
|
|
739
|
+
*/
|
|
740
|
+
export function focus_padding_factor(size, close_up_padding, zoom_padding, full_body_padding) {
|
|
741
|
+
const ret = wasm.focus_padding_factor(size, close_up_padding, zoom_padding, full_body_padding);
|
|
742
|
+
return ret;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Return the embedded preset JSON for a preset id (intake source of truth).
|
|
747
|
+
* @param {string} preset_id
|
|
748
|
+
* @returns {string}
|
|
749
|
+
*/
|
|
750
|
+
export function get_preset_json(preset_id) {
|
|
751
|
+
let deferred3_0;
|
|
752
|
+
let deferred3_1;
|
|
753
|
+
try {
|
|
754
|
+
const ptr0 = passStringToWasm0(preset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
755
|
+
const len0 = WASM_VECTOR_LEN;
|
|
756
|
+
const ret = wasm.get_preset_json(ptr0, len0);
|
|
757
|
+
var ptr2 = ret[0];
|
|
758
|
+
var len2 = ret[1];
|
|
759
|
+
if (ret[3]) {
|
|
760
|
+
ptr2 = 0; len2 = 0;
|
|
761
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
762
|
+
}
|
|
763
|
+
deferred3_0 = ptr2;
|
|
764
|
+
deferred3_1 = len2;
|
|
765
|
+
return getStringFromWasm0(ptr2, len2);
|
|
766
|
+
} finally {
|
|
767
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* @returns {number}
|
|
773
|
+
*/
|
|
774
|
+
export function hair_config_stride() {
|
|
775
|
+
const ret = wasm.hair_config_stride();
|
|
776
|
+
return ret >>> 0;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* @returns {number}
|
|
781
|
+
*/
|
|
782
|
+
export function hair_head_state_stride() {
|
|
783
|
+
const ret = wasm.hair_head_state_stride();
|
|
784
|
+
return ret >>> 0;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* @returns {number}
|
|
789
|
+
*/
|
|
790
|
+
export function hair_morph_output_stride() {
|
|
791
|
+
const ret = wasm.hair_morph_output_stride();
|
|
792
|
+
return ret >>> 0;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* @returns {number}
|
|
797
|
+
*/
|
|
798
|
+
export function hair_state_stride() {
|
|
799
|
+
const ret = wasm.hair_state_stride();
|
|
800
|
+
return ret >>> 0;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* True when the Wasm core ships the given preset id.
|
|
805
|
+
* @param {string} preset_id
|
|
806
|
+
* @returns {boolean}
|
|
807
|
+
*/
|
|
808
|
+
export function has_preset(preset_id) {
|
|
809
|
+
const ptr0 = passStringToWasm0(preset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
810
|
+
const len0 = WASM_VECTOR_LEN;
|
|
811
|
+
const ret = wasm.has_preset(ptr0, len0);
|
|
812
|
+
return ret !== 0;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Canonical embedded preset ids available inside the Wasm core.
|
|
817
|
+
* @returns {string[]}
|
|
818
|
+
*/
|
|
819
|
+
export function list_presets() {
|
|
820
|
+
const ret = wasm.list_presets();
|
|
821
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
822
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
823
|
+
return v1;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* @returns {number}
|
|
828
|
+
*/
|
|
829
|
+
export function marker_endpoint_stride() {
|
|
830
|
+
const ret = wasm.marker_endpoint_stride();
|
|
831
|
+
return ret >>> 0;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Marker show/hide animation factors at normalized time `t` in `[0, 1]`.
|
|
836
|
+
* Returns `[itemOpacityFactor, labelScaleFactor, lineOpacityFactor]`.
|
|
837
|
+
* @param {boolean} visible
|
|
838
|
+
* @param {number} t
|
|
839
|
+
* @returns {Float32Array}
|
|
840
|
+
*/
|
|
841
|
+
export function marker_visibility_animation_factors(visible, t) {
|
|
842
|
+
const ret = wasm.marker_visibility_animation_factors(visible, t);
|
|
843
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
844
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
845
|
+
return v1;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* @returns {number}
|
|
850
|
+
*/
|
|
851
|
+
export function marker_visibility_factors_stride() {
|
|
852
|
+
const ret = wasm.marker_visibility_factors_stride();
|
|
853
|
+
return ret >>> 0;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Merge overrides onto an embedded preset. Hosts that still need a JS Profile
|
|
858
|
+
* object for Mixer callbacks can use this; the runtime configure path should
|
|
859
|
+
* prefer `RuntimeCore.configure_with_preset`.
|
|
860
|
+
* @param {string} preset_id
|
|
861
|
+
* @param {string} override_json
|
|
862
|
+
* @returns {string}
|
|
863
|
+
*/
|
|
864
|
+
export function merge_embedded_preset(preset_id, override_json) {
|
|
865
|
+
let deferred4_0;
|
|
866
|
+
let deferred4_1;
|
|
867
|
+
try {
|
|
868
|
+
const ptr0 = passStringToWasm0(preset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
869
|
+
const len0 = WASM_VECTOR_LEN;
|
|
870
|
+
const ptr1 = passStringToWasm0(override_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
871
|
+
const len1 = WASM_VECTOR_LEN;
|
|
872
|
+
const ret = wasm.merge_embedded_preset(ptr0, len0, ptr1, len1);
|
|
873
|
+
var ptr3 = ret[0];
|
|
874
|
+
var len3 = ret[1];
|
|
875
|
+
if (ret[3]) {
|
|
876
|
+
ptr3 = 0; len3 = 0;
|
|
877
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
878
|
+
}
|
|
879
|
+
deferred4_0 = ptr3;
|
|
880
|
+
deferred4_1 = len3;
|
|
881
|
+
return getStringFromWasm0(ptr3, len3);
|
|
882
|
+
} finally {
|
|
883
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Merge a base preset profile with an extension profile (both JSON strings)
|
|
889
|
+
* using the engine's preset extension rules. Returns the merged profile JSON.
|
|
890
|
+
* @param {string} base_json
|
|
891
|
+
* @param {string} extension_json
|
|
892
|
+
* @returns {string}
|
|
893
|
+
*/
|
|
894
|
+
export function merge_preset_profile(base_json, extension_json) {
|
|
895
|
+
let deferred4_0;
|
|
896
|
+
let deferred4_1;
|
|
897
|
+
try {
|
|
898
|
+
const ptr0 = passStringToWasm0(base_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
899
|
+
const len0 = WASM_VECTOR_LEN;
|
|
900
|
+
const ptr1 = passStringToWasm0(extension_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
901
|
+
const len1 = WASM_VECTOR_LEN;
|
|
902
|
+
const ret = wasm.merge_preset_profile(ptr0, len0, ptr1, len1);
|
|
903
|
+
var ptr3 = ret[0];
|
|
904
|
+
var len3 = ret[1];
|
|
905
|
+
if (ret[3]) {
|
|
906
|
+
ptr3 = 0; len3 = 0;
|
|
907
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
908
|
+
}
|
|
909
|
+
deferred4_0 = ptr3;
|
|
910
|
+
deferred4_1 = len3;
|
|
911
|
+
return getStringFromWasm0(ptr3, len3);
|
|
912
|
+
} finally {
|
|
913
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* @returns {number}
|
|
919
|
+
*/
|
|
920
|
+
export function mesh_proportions_stride() {
|
|
921
|
+
const ret = wasm.mesh_proportions_stride();
|
|
922
|
+
return ret >>> 0;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* @param {number} angle
|
|
927
|
+
* @returns {number}
|
|
928
|
+
*/
|
|
929
|
+
export function normalize_camera_angle_degrees(angle) {
|
|
930
|
+
const ret = wasm.normalize_camera_angle_degrees(angle);
|
|
931
|
+
return ret;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* @param {Uint32Array} mesh_ids
|
|
936
|
+
* @param {Uint32Array} morph_target_ids
|
|
937
|
+
* @param {Float32Array} values
|
|
938
|
+
* @param {Uint8Array} modes
|
|
939
|
+
* @returns {Float32Array}
|
|
940
|
+
*/
|
|
941
|
+
export function pack_morph_frame_delta(mesh_ids, morph_target_ids, values, modes) {
|
|
942
|
+
const ptr0 = passArray32ToWasm0(mesh_ids, wasm.__wbindgen_malloc);
|
|
943
|
+
const len0 = WASM_VECTOR_LEN;
|
|
944
|
+
const ptr1 = passArray32ToWasm0(morph_target_ids, wasm.__wbindgen_malloc);
|
|
945
|
+
const len1 = WASM_VECTOR_LEN;
|
|
946
|
+
const ptr2 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
947
|
+
const len2 = WASM_VECTOR_LEN;
|
|
948
|
+
const ptr3 = passArray8ToWasm0(modes, wasm.__wbindgen_malloc);
|
|
949
|
+
const len3 = WASM_VECTOR_LEN;
|
|
950
|
+
const ret = wasm.pack_morph_frame_delta(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
951
|
+
var v5 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
952
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
953
|
+
return v5;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* @returns {number}
|
|
958
|
+
*/
|
|
959
|
+
export function packed_bone_frame_delta_stride() {
|
|
960
|
+
const ret = wasm.packed_bone_frame_delta_stride();
|
|
961
|
+
return ret >>> 0;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* @returns {number}
|
|
966
|
+
*/
|
|
967
|
+
export function packed_morph_frame_delta_stride() {
|
|
968
|
+
const ret = wasm.packed_morph_frame_delta_stride();
|
|
969
|
+
return ret >>> 0;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Whether a marker with a preferred viewing angle should show for the
|
|
974
|
+
* current camera orbit angle. Angles are degrees around the model Y axis.
|
|
975
|
+
* @param {number | null} [marker_angle]
|
|
976
|
+
* @param {number | null} [current_camera_angle]
|
|
977
|
+
* @param {number | null} [range_degrees]
|
|
978
|
+
* @returns {boolean}
|
|
979
|
+
*/
|
|
980
|
+
export function passes_marker_camera_angle_gate(marker_angle, current_camera_angle, range_degrees) {
|
|
981
|
+
const ret = wasm.passes_marker_camera_angle_gate(isLikeNone(marker_angle) ? Number.MAX_SAFE_INTEGER : Math.fround(marker_angle), isLikeNone(current_camera_angle) ? Number.MAX_SAFE_INTEGER : Math.fround(current_camera_angle), isLikeNone(range_degrees) ? Number.MAX_SAFE_INTEGER : Math.fround(range_degrees));
|
|
982
|
+
return ret !== 0;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Auto camera angle for small offset focus targets (eye closeups).
|
|
987
|
+
* Returns `undefined` when no auto angle applies.
|
|
988
|
+
* @param {number} horizontal_offset
|
|
989
|
+
* @param {Float32Array} focus_size
|
|
990
|
+
* @param {Float32Array} model_size
|
|
991
|
+
* @returns {number | undefined}
|
|
992
|
+
*/
|
|
993
|
+
export function resolve_auto_closeup_angle(horizontal_offset, focus_size, model_size) {
|
|
994
|
+
const ptr0 = passArrayF32ToWasm0(focus_size, wasm.__wbindgen_malloc);
|
|
995
|
+
const len0 = WASM_VECTOR_LEN;
|
|
996
|
+
const ptr1 = passArrayF32ToWasm0(model_size, wasm.__wbindgen_malloc);
|
|
997
|
+
const len1 = WASM_VECTOR_LEN;
|
|
998
|
+
const ret = wasm.resolve_auto_closeup_angle(horizontal_offset, ptr0, len0, ptr1, len1);
|
|
999
|
+
return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Direction the camera should approach from when focusing a region.
|
|
1004
|
+
* @param {Float32Array} model_quat
|
|
1005
|
+
* @param {number} effective_angle
|
|
1006
|
+
* @param {boolean} has_explicit_angle
|
|
1007
|
+
* @param {boolean} world_angle_space
|
|
1008
|
+
* @returns {Float32Array}
|
|
1009
|
+
*/
|
|
1010
|
+
export function resolve_focus_camera_direction(model_quat, effective_angle, has_explicit_angle, world_angle_space) {
|
|
1011
|
+
const ptr0 = passArrayF32ToWasm0(model_quat, wasm.__wbindgen_malloc);
|
|
1012
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1013
|
+
const ret = wasm.resolve_focus_camera_direction(ptr0, len0, effective_angle, has_explicit_angle, world_angle_space);
|
|
1014
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1015
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1016
|
+
return v2;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Clip a marker leader line (clip-space start/end, `[x, y, z, w]` each) to a
|
|
1021
|
+
* safe viewport rectangle. Returns `[visible, lineScale]` where `lineScale`
|
|
1022
|
+
* is the fraction of the line that stays on screen.
|
|
1023
|
+
* @param {Float32Array} start_clip
|
|
1024
|
+
* @param {Float32Array} end_clip
|
|
1025
|
+
* @param {number} safe_x
|
|
1026
|
+
* @param {number} safe_y
|
|
1027
|
+
* @param {number | null} [min_length_ratio]
|
|
1028
|
+
* @returns {Float32Array}
|
|
1029
|
+
*/
|
|
1030
|
+
export function resolve_viewport_constrained_line_scale(start_clip, end_clip, safe_x, safe_y, min_length_ratio) {
|
|
1031
|
+
const ptr0 = passArrayF32ToWasm0(start_clip, wasm.__wbindgen_malloc);
|
|
1032
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1033
|
+
const ptr1 = passArrayF32ToWasm0(end_clip, wasm.__wbindgen_malloc);
|
|
1034
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1035
|
+
const ret = wasm.resolve_viewport_constrained_line_scale(ptr0, len0, ptr1, len1, safe_x, safe_y, isLikeNone(min_length_ratio) ? Number.MAX_SAFE_INTEGER : Math.fround(min_length_ratio));
|
|
1036
|
+
var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1037
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1038
|
+
return v3;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Safe NDC bounds that keep a screen-space label plus a pixel gutter fully
|
|
1043
|
+
* on screen. Returns `[safeX, safeY]`.
|
|
1044
|
+
* @param {number} label_scale_x
|
|
1045
|
+
* @param {number} label_scale_y
|
|
1046
|
+
* @param {number} projection_x_scale
|
|
1047
|
+
* @param {number} projection_y_scale
|
|
1048
|
+
* @param {number} viewport_width
|
|
1049
|
+
* @param {number} viewport_height
|
|
1050
|
+
* @param {number | null} [edge_padding_px]
|
|
1051
|
+
* @returns {Float32Array}
|
|
1052
|
+
*/
|
|
1053
|
+
export function resolve_viewport_safe_bounds(label_scale_x, label_scale_y, projection_x_scale, projection_y_scale, viewport_width, viewport_height, edge_padding_px) {
|
|
1054
|
+
const ret = wasm.resolve_viewport_safe_bounds(label_scale_x, label_scale_y, projection_x_scale, projection_y_scale, viewport_width, viewport_height, isLikeNone(edge_padding_px) ? Number.MAX_SAFE_INTEGER : Math.fround(edge_padding_px));
|
|
1055
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1056
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1057
|
+
return v1;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Sinusoidal arc leader line points between two world positions.
|
|
1062
|
+
* Returns `(segments + 1) * 3` floats.
|
|
1063
|
+
* @param {Float32Array} start
|
|
1064
|
+
* @param {Float32Array} end
|
|
1065
|
+
* @param {number} segments
|
|
1066
|
+
* @returns {Float32Array}
|
|
1067
|
+
*/
|
|
1068
|
+
export function sample_marker_arc_curve(start, end, segments) {
|
|
1069
|
+
const ptr0 = passArrayF32ToWasm0(start, wasm.__wbindgen_malloc);
|
|
1070
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1071
|
+
const ptr1 = passArrayF32ToWasm0(end, wasm.__wbindgen_malloc);
|
|
1072
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1073
|
+
const ret = wasm.sample_marker_arc_curve(ptr0, len0, ptr1, len1, segments);
|
|
1074
|
+
var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1075
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1076
|
+
return v3;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Quadratic bezier leader line points between two world positions.
|
|
1081
|
+
* Returns `(segments + 1) * 3` floats.
|
|
1082
|
+
* @param {Float32Array} start
|
|
1083
|
+
* @param {Float32Array} end
|
|
1084
|
+
* @param {number} segments
|
|
1085
|
+
* @returns {Float32Array}
|
|
1086
|
+
*/
|
|
1087
|
+
export function sample_marker_bezier_curve(start, end, segments) {
|
|
1088
|
+
const ptr0 = passArrayF32ToWasm0(start, wasm.__wbindgen_malloc);
|
|
1089
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1090
|
+
const ptr1 = passArrayF32ToWasm0(end, wasm.__wbindgen_malloc);
|
|
1091
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1092
|
+
const ret = wasm.sample_marker_bezier_curve(ptr0, len0, ptr1, len1, segments);
|
|
1093
|
+
var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1094
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1095
|
+
return v3;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Separates overlapping marker endpoints while preserving each marker's
|
|
1100
|
+
* surface anchor and leader-line length.
|
|
1101
|
+
*
|
|
1102
|
+
* `starts` and `ends` are packed `[x, y, z, ...]` arrays. The output includes
|
|
1103
|
+
* one endpoint for every complete start/end pair. Proximity and rotation
|
|
1104
|
+
* constants match DPthree's marker layout, scaled to the current model height.
|
|
1105
|
+
* @param {Float32Array} starts
|
|
1106
|
+
* @param {Float32Array} ends
|
|
1107
|
+
* @param {Float32Array} model_center
|
|
1108
|
+
* @param {number} model_height
|
|
1109
|
+
* @returns {Float32Array}
|
|
1110
|
+
*/
|
|
1111
|
+
export function separate_overlapping_marker_endpoints(starts, ends, model_center, model_height) {
|
|
1112
|
+
const ptr0 = passArrayF32ToWasm0(starts, wasm.__wbindgen_malloc);
|
|
1113
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1114
|
+
const ptr1 = passArrayF32ToWasm0(ends, wasm.__wbindgen_malloc);
|
|
1115
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1116
|
+
const ptr2 = passArrayF32ToWasm0(model_center, wasm.__wbindgen_malloc);
|
|
1117
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1118
|
+
const ret = wasm.separate_overlapping_marker_endpoints(ptr0, len0, ptr1, len1, ptr2, len2, model_height);
|
|
1119
|
+
var v4 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1120
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1121
|
+
return v4;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Solo/expand/angle visibility rule for a marker.
|
|
1126
|
+
*
|
|
1127
|
+
* * `hidden_child` - the marker is a collapsed child of an expandable region.
|
|
1128
|
+
* * `soloed` - solo state: 0 = no solo, 1 = this marker is soloed,
|
|
1129
|
+
* 2 = another marker is soloed.
|
|
1130
|
+
* @param {boolean} hidden_child
|
|
1131
|
+
* @param {number} soloed
|
|
1132
|
+
* @param {number | null} [marker_angle]
|
|
1133
|
+
* @param {number | null} [current_camera_angle]
|
|
1134
|
+
* @returns {boolean}
|
|
1135
|
+
*/
|
|
1136
|
+
export function should_show_marker(hidden_child, soloed, marker_angle, current_camera_angle) {
|
|
1137
|
+
const ret = wasm.should_show_marker(hidden_child, soloed, isLikeNone(marker_angle) ? Number.MAX_SAFE_INTEGER : Math.fround(marker_angle), isLikeNone(current_camera_angle) ? Number.MAX_SAFE_INTEGER : Math.fround(current_camera_angle));
|
|
1138
|
+
return ret !== 0;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* @param {number} axis
|
|
1143
|
+
* @param {number} degrees
|
|
1144
|
+
* @param {number} value
|
|
1145
|
+
* @param {number} scale
|
|
1146
|
+
* @returns {Float32Array}
|
|
1147
|
+
*/
|
|
1148
|
+
export function solve_axis_quaternion(axis, degrees, value, scale) {
|
|
1149
|
+
const ret = wasm.solve_axis_quaternion(axis, degrees, value, scale);
|
|
1150
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1151
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1152
|
+
return v1;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* @param {number} base
|
|
1157
|
+
* @param {number} balance
|
|
1158
|
+
* @returns {Float32Array}
|
|
1159
|
+
*/
|
|
1160
|
+
export function solve_bilateral_values(base, balance) {
|
|
1161
|
+
const ret = wasm.solve_bilateral_values(base, balance);
|
|
1162
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1163
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1164
|
+
return v1;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Solve the camera framing for a focus target.
|
|
1169
|
+
*
|
|
1170
|
+
* * `focus_bounds` - `[centerX, centerY, centerZ, sizeX, sizeY, sizeZ]` of the focus box.
|
|
1171
|
+
* * `model_bounds` - same layout for the whole model, or empty when unavailable.
|
|
1172
|
+
* * `model_quat` - model world quaternion `[x, y, z, w]`, or empty for identity.
|
|
1173
|
+
* * `camera_angle` - explicit region camera angle (degrees), or `undefined`.
|
|
1174
|
+
* * `world_angle_space` - whether `camera_angle` is a world-space angle.
|
|
1175
|
+
*
|
|
1176
|
+
* Returns `[posX, posY, posZ, targetX, targetY, targetZ, distance]`.
|
|
1177
|
+
* @param {Float32Array} focus_bounds
|
|
1178
|
+
* @param {Float32Array} model_bounds
|
|
1179
|
+
* @param {Float32Array} model_quat
|
|
1180
|
+
* @param {number} fov_deg
|
|
1181
|
+
* @param {number} aspect
|
|
1182
|
+
* @param {number} min_distance
|
|
1183
|
+
* @param {number} close_up_padding
|
|
1184
|
+
* @param {number} zoom_padding
|
|
1185
|
+
* @param {number} full_body_padding
|
|
1186
|
+
* @param {number | null | undefined} override_padding
|
|
1187
|
+
* @param {number | null | undefined} camera_angle
|
|
1188
|
+
* @param {boolean} world_angle_space
|
|
1189
|
+
* @returns {Float32Array}
|
|
1190
|
+
*/
|
|
1191
|
+
export function solve_focus_framing(focus_bounds, model_bounds, model_quat, fov_deg, aspect, min_distance, close_up_padding, zoom_padding, full_body_padding, override_padding, camera_angle, world_angle_space) {
|
|
1192
|
+
const ptr0 = passArrayF32ToWasm0(focus_bounds, wasm.__wbindgen_malloc);
|
|
1193
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1194
|
+
const ptr1 = passArrayF32ToWasm0(model_bounds, wasm.__wbindgen_malloc);
|
|
1195
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1196
|
+
const ptr2 = passArrayF32ToWasm0(model_quat, wasm.__wbindgen_malloc);
|
|
1197
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1198
|
+
const ret = wasm.solve_focus_framing(ptr0, len0, ptr1, len1, ptr2, len2, fov_deg, aspect, min_distance, close_up_padding, zoom_padding, full_body_padding, isLikeNone(override_padding) ? Number.MAX_SAFE_INTEGER : Math.fround(override_padding), isLikeNone(camera_angle) ? Number.MAX_SAFE_INTEGER : Math.fround(camera_angle), world_angle_space);
|
|
1199
|
+
var v4 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1200
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1201
|
+
return v4;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Solve the hero full-body framing.
|
|
1206
|
+
*
|
|
1207
|
+
* * `box_min` / `box_max` - model bounding box corners.
|
|
1208
|
+
*
|
|
1209
|
+
* Returns `[posX, posY, posZ, targetX, targetY, targetZ, distance]`.
|
|
1210
|
+
* @param {Float32Array} box_min
|
|
1211
|
+
* @param {Float32Array} box_max
|
|
1212
|
+
* @param {Float32Array} model_quat
|
|
1213
|
+
* @param {number} fov_deg
|
|
1214
|
+
* @param {number} aspect
|
|
1215
|
+
* @param {number} min_distance
|
|
1216
|
+
* @param {number} full_body_padding
|
|
1217
|
+
* @param {number | null | undefined} override_padding
|
|
1218
|
+
* @param {number | null | undefined} camera_angle
|
|
1219
|
+
* @param {boolean} world_angle_space
|
|
1220
|
+
* @returns {Float32Array}
|
|
1221
|
+
*/
|
|
1222
|
+
export function solve_full_body_framing(box_min, box_max, model_quat, fov_deg, aspect, min_distance, full_body_padding, override_padding, camera_angle, world_angle_space) {
|
|
1223
|
+
const ptr0 = passArrayF32ToWasm0(box_min, wasm.__wbindgen_malloc);
|
|
1224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1225
|
+
const ptr1 = passArrayF32ToWasm0(box_max, wasm.__wbindgen_malloc);
|
|
1226
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1227
|
+
const ptr2 = passArrayF32ToWasm0(model_quat, wasm.__wbindgen_malloc);
|
|
1228
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1229
|
+
const ret = wasm.solve_full_body_framing(ptr0, len0, ptr1, len1, ptr2, len2, fov_deg, aspect, min_distance, full_body_padding, isLikeNone(override_padding) ? Number.MAX_SAFE_INTEGER : Math.fround(override_padding), isLikeNone(camera_angle) ? Number.MAX_SAFE_INTEGER : Math.fround(camera_angle), world_angle_space);
|
|
1230
|
+
var v4 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1231
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1232
|
+
return v4;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* @param {Float32Array} values
|
|
1237
|
+
* @param {Float32Array} balances
|
|
1238
|
+
* @param {Float32Array} mix_weights
|
|
1239
|
+
* @returns {Float32Array}
|
|
1240
|
+
*/
|
|
1241
|
+
export function solve_morph_batch(values, balances, mix_weights) {
|
|
1242
|
+
const ptr0 = passArrayF32ToWasm0(values, wasm.__wbindgen_malloc);
|
|
1243
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1244
|
+
const ptr1 = passArrayF32ToWasm0(balances, wasm.__wbindgen_malloc);
|
|
1245
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1246
|
+
const ptr2 = passArrayF32ToWasm0(mix_weights, wasm.__wbindgen_malloc);
|
|
1247
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1248
|
+
const ret = wasm.solve_morph_batch(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1249
|
+
var v4 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1250
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1251
|
+
return v4;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Solve a uniform scale and translation for placing a template skeleton inside a mesh.
|
|
1256
|
+
*
|
|
1257
|
+
* `template_bounds` is [min_x, min_y, min_z, max_x, max_y, max_z] in the
|
|
1258
|
+
* template skeleton's rest-pose coordinate space. `vertical_axis` is 0, 1, or 2.
|
|
1259
|
+
* `vertical_anchor` controls vertical placement: 0 aligns mins, 1 aligns centers,
|
|
1260
|
+
* 2 aligns maxes.
|
|
1261
|
+
*
|
|
1262
|
+
* Output layout:
|
|
1263
|
+
* [scale, translate_x, translate_y, translate_z,
|
|
1264
|
+
* mesh_humanoid_likelihood, mesh_height, template_height,
|
|
1265
|
+
* mesh_cross_axis_wide_span, template_cross_axis_wide_span, status]
|
|
1266
|
+
*
|
|
1267
|
+
* `status` is 1 for solved, 0 for invalid mesh input, and -1 for invalid template
|
|
1268
|
+
* bounds. This does not compute skin weights, inverse bind matrices, or pose
|
|
1269
|
+
* retargeting.
|
|
1270
|
+
* @param {Float32Array} mesh_vertices
|
|
1271
|
+
* @param {Float32Array} template_bounds
|
|
1272
|
+
* @param {number} vertical_axis
|
|
1273
|
+
* @param {number} vertical_anchor
|
|
1274
|
+
* @returns {Float32Array}
|
|
1275
|
+
*/
|
|
1276
|
+
export function solve_template_skeleton_fit(mesh_vertices, template_bounds, vertical_axis, vertical_anchor) {
|
|
1277
|
+
const ptr0 = passArrayF32ToWasm0(mesh_vertices, wasm.__wbindgen_malloc);
|
|
1278
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1279
|
+
const ptr1 = passArrayF32ToWasm0(template_bounds, wasm.__wbindgen_malloc);
|
|
1280
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1281
|
+
const ret = wasm.solve_template_skeleton_fit(ptr0, len0, ptr1, len1, vertical_axis, vertical_anchor);
|
|
1282
|
+
var v3 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1283
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1284
|
+
return v3;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* @returns {number}
|
|
1289
|
+
*/
|
|
1290
|
+
export function template_skeleton_fit_solution_stride() {
|
|
1291
|
+
const ret = wasm.template_skeleton_fit_solution_stride();
|
|
1292
|
+
return ret >>> 0;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* @returns {number}
|
|
1297
|
+
*/
|
|
1298
|
+
export function template_skeleton_fit_transform_stride() {
|
|
1299
|
+
const ret = wasm.template_skeleton_fit_transform_stride();
|
|
1300
|
+
return ret >>> 0;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* Validate generated template skeleton fit metadata from a compact Wasm ABI.
|
|
1305
|
+
*
|
|
1306
|
+
* String inputs carry host-owned ids. The packed f32 slice layout is:
|
|
1307
|
+
* [schema_version, metadata_kind, template_lookup_status, fit_status,
|
|
1308
|
+
* vertical_axis, vertical_anchor, fit_scale, translate_x, translate_y,
|
|
1309
|
+
* translate_z, solver_confidence, manual_scale_multiplier, manual_offset_x,
|
|
1310
|
+
* manual_offset_y, manual_offset_z].
|
|
1311
|
+
*
|
|
1312
|
+
* `metadata_kind` must be 1, which identifies generated template fit metadata
|
|
1313
|
+
* and keeps it separate from imported rig, skinning, or bind-pose data.
|
|
1314
|
+
*
|
|
1315
|
+
* The return value is a compact bitmask. 0 means valid.
|
|
1316
|
+
* @param {string} template_id
|
|
1317
|
+
* @param {string} source_character_id
|
|
1318
|
+
* @param {Float32Array} metadata
|
|
1319
|
+
* @returns {number}
|
|
1320
|
+
*/
|
|
1321
|
+
export function validate_generated_template_fit_metadata(template_id, source_character_id, metadata) {
|
|
1322
|
+
const ptr0 = passStringToWasm0(template_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1323
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1324
|
+
const ptr1 = passStringToWasm0(source_character_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1325
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1326
|
+
const ptr2 = passArrayF32ToWasm0(metadata, wasm.__wbindgen_malloc);
|
|
1327
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1328
|
+
const ret = wasm.validate_generated_template_fit_metadata(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1329
|
+
return ret >>> 0;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* World-space camera direction for a model-relative camera angle.
|
|
1334
|
+
* `model_quat` is the model's world quaternion `[x, y, z, w]`
|
|
1335
|
+
* (pass an empty slice for identity).
|
|
1336
|
+
* @param {Float32Array} model_quat
|
|
1337
|
+
* @param {number} camera_angle
|
|
1338
|
+
* @returns {Float32Array}
|
|
1339
|
+
*/
|
|
1340
|
+
export function world_direction_for_camera_angle(model_quat, camera_angle) {
|
|
1341
|
+
const ptr0 = passArrayF32ToWasm0(model_quat, wasm.__wbindgen_malloc);
|
|
1342
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1343
|
+
const ret = wasm.world_direction_for_camera_angle(ptr0, len0, camera_angle);
|
|
1344
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
1345
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1346
|
+
return v2;
|
|
1347
|
+
}
|
|
1348
|
+
function __wbg_get_imports() {
|
|
1349
|
+
const import0 = {
|
|
1350
|
+
__proto__: null,
|
|
1351
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
1352
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1353
|
+
return ret;
|
|
1354
|
+
},
|
|
1355
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
1356
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1357
|
+
},
|
|
1358
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1359
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1360
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1361
|
+
return ret;
|
|
1362
|
+
},
|
|
1363
|
+
__wbindgen_init_externref_table: function() {
|
|
1364
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1365
|
+
const offset = table.grow(4);
|
|
1366
|
+
table.set(0, undefined);
|
|
1367
|
+
table.set(offset + 0, undefined);
|
|
1368
|
+
table.set(offset + 1, null);
|
|
1369
|
+
table.set(offset + 2, true);
|
|
1370
|
+
table.set(offset + 3, false);
|
|
1371
|
+
},
|
|
1372
|
+
};
|
|
1373
|
+
return {
|
|
1374
|
+
__proto__: null,
|
|
1375
|
+
"./embody_wasm_bg.js": import0,
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
const CameraFlightFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1380
|
+
? { register: () => {}, unregister: () => {} }
|
|
1381
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_cameraflight_free(ptr, 1));
|
|
1382
|
+
const CameraOrbitFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1383
|
+
? { register: () => {}, unregister: () => {} }
|
|
1384
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_cameraorbit_free(ptr, 1));
|
|
1385
|
+
const HairPhysicsSolverFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1386
|
+
? { register: () => {}, unregister: () => {} }
|
|
1387
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_hairphysicssolver_free(ptr, 1));
|
|
1388
|
+
const RuntimeCoreFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1389
|
+
? { register: () => {}, unregister: () => {} }
|
|
1390
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_runtimecore_free(ptr, 1));
|
|
1391
|
+
|
|
1392
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
1393
|
+
ptr = ptr >>> 0;
|
|
1394
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1398
|
+
ptr = ptr >>> 0;
|
|
1399
|
+
const mem = getDataViewMemory0();
|
|
1400
|
+
const result = [];
|
|
1401
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1402
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
1403
|
+
}
|
|
1404
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
1405
|
+
return result;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
let cachedDataViewMemory0 = null;
|
|
1409
|
+
function getDataViewMemory0() {
|
|
1410
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1411
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1412
|
+
}
|
|
1413
|
+
return cachedDataViewMemory0;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
1417
|
+
function getFloat32ArrayMemory0() {
|
|
1418
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
1419
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
1420
|
+
}
|
|
1421
|
+
return cachedFloat32ArrayMemory0;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
function getStringFromWasm0(ptr, len) {
|
|
1425
|
+
return decodeText(ptr >>> 0, len);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
let cachedUint32ArrayMemory0 = null;
|
|
1429
|
+
function getUint32ArrayMemory0() {
|
|
1430
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
1431
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
1432
|
+
}
|
|
1433
|
+
return cachedUint32ArrayMemory0;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1437
|
+
function getUint8ArrayMemory0() {
|
|
1438
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1439
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1440
|
+
}
|
|
1441
|
+
return cachedUint8ArrayMemory0;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function isLikeNone(x) {
|
|
1445
|
+
return x === undefined || x === null;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
1449
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
1450
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
1451
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1452
|
+
return ptr;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1456
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1457
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1458
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1459
|
+
return ptr;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
function passArrayF32ToWasm0(arg, malloc) {
|
|
1463
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
1464
|
+
getFloat32ArrayMemory0().set(arg, ptr / 4);
|
|
1465
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1466
|
+
return ptr;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1470
|
+
if (realloc === undefined) {
|
|
1471
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1472
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1473
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1474
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1475
|
+
return ptr;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
let len = arg.length;
|
|
1479
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1480
|
+
|
|
1481
|
+
const mem = getUint8ArrayMemory0();
|
|
1482
|
+
|
|
1483
|
+
let offset = 0;
|
|
1484
|
+
|
|
1485
|
+
for (; offset < len; offset++) {
|
|
1486
|
+
const code = arg.charCodeAt(offset);
|
|
1487
|
+
if (code > 0x7F) break;
|
|
1488
|
+
mem[ptr + offset] = code;
|
|
1489
|
+
}
|
|
1490
|
+
if (offset !== len) {
|
|
1491
|
+
if (offset !== 0) {
|
|
1492
|
+
arg = arg.slice(offset);
|
|
1493
|
+
}
|
|
1494
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1495
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1496
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1497
|
+
|
|
1498
|
+
offset += ret.written;
|
|
1499
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
WASM_VECTOR_LEN = offset;
|
|
1503
|
+
return ptr;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
function takeFromExternrefTable0(idx) {
|
|
1507
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1508
|
+
wasm.__externref_table_dealloc(idx);
|
|
1509
|
+
return value;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1513
|
+
cachedTextDecoder.decode();
|
|
1514
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1515
|
+
let numBytesDecoded = 0;
|
|
1516
|
+
function decodeText(ptr, len) {
|
|
1517
|
+
numBytesDecoded += len;
|
|
1518
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1519
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1520
|
+
cachedTextDecoder.decode();
|
|
1521
|
+
numBytesDecoded = len;
|
|
1522
|
+
}
|
|
1523
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1527
|
+
|
|
1528
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1529
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1530
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1531
|
+
view.set(buf);
|
|
1532
|
+
return {
|
|
1533
|
+
read: arg.length,
|
|
1534
|
+
written: buf.length
|
|
1535
|
+
};
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
let WASM_VECTOR_LEN = 0;
|
|
1540
|
+
|
|
1541
|
+
let wasmModule, wasmInstance, wasm;
|
|
1542
|
+
function __wbg_finalize_init(instance, module) {
|
|
1543
|
+
wasmInstance = instance;
|
|
1544
|
+
wasm = instance.exports;
|
|
1545
|
+
wasmModule = module;
|
|
1546
|
+
cachedDataViewMemory0 = null;
|
|
1547
|
+
cachedFloat32ArrayMemory0 = null;
|
|
1548
|
+
cachedUint32ArrayMemory0 = null;
|
|
1549
|
+
cachedUint8ArrayMemory0 = null;
|
|
1550
|
+
wasm.__wbindgen_start();
|
|
1551
|
+
return wasm;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
async function __wbg_load(module, imports) {
|
|
1555
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1556
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1557
|
+
try {
|
|
1558
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1559
|
+
} catch (e) {
|
|
1560
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1561
|
+
|
|
1562
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1563
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
1564
|
+
|
|
1565
|
+
} else { throw e; }
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
const bytes = await module.arrayBuffer();
|
|
1570
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1571
|
+
} else {
|
|
1572
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1573
|
+
|
|
1574
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1575
|
+
return { instance, module };
|
|
1576
|
+
} else {
|
|
1577
|
+
return instance;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
function expectedResponseType(type) {
|
|
1582
|
+
switch (type) {
|
|
1583
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1584
|
+
}
|
|
1585
|
+
return false;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
function initSync(module) {
|
|
1590
|
+
if (wasm !== undefined) return wasm;
|
|
1591
|
+
|
|
1592
|
+
|
|
1593
|
+
if (module !== undefined) {
|
|
1594
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1595
|
+
({module} = module)
|
|
1596
|
+
} else {
|
|
1597
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
const imports = __wbg_get_imports();
|
|
1602
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1603
|
+
module = new WebAssembly.Module(module);
|
|
1604
|
+
}
|
|
1605
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1606
|
+
return __wbg_finalize_init(instance, module);
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
async function __wbg_init(module_or_path) {
|
|
1610
|
+
if (wasm !== undefined) return wasm;
|
|
1611
|
+
|
|
1612
|
+
|
|
1613
|
+
if (module_or_path !== undefined) {
|
|
1614
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1615
|
+
({module_or_path} = module_or_path)
|
|
1616
|
+
} else {
|
|
1617
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
if (module_or_path === undefined) {
|
|
1622
|
+
module_or_path = new URL('embody_wasm_bg.wasm', import.meta.url);
|
|
1623
|
+
}
|
|
1624
|
+
const imports = __wbg_get_imports();
|
|
1625
|
+
|
|
1626
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1627
|
+
module_or_path = fetch(module_or_path);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1631
|
+
|
|
1632
|
+
return __wbg_finalize_init(instance, module);
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
export { initSync, __wbg_init as default };
|