math-rust-lib 0.2.0 → 0.2.2

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.
@@ -0,0 +1,730 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+ function _assertClass(instance, klass) {
7
+ if (!(instance instanceof klass)) {
8
+ throw new Error(`expected instance of ${klass.name}`);
9
+ }
10
+ }
11
+
12
+ function getArrayF32FromWasm0(ptr, len) {
13
+ ptr = ptr >>> 0;
14
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
15
+ }
16
+
17
+ let cachedFloat32ArrayMemory0 = null;
18
+ function getFloat32ArrayMemory0() {
19
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
20
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
21
+ }
22
+ return cachedFloat32ArrayMemory0;
23
+ }
24
+
25
+ function getStringFromWasm0(ptr, len) {
26
+ ptr = ptr >>> 0;
27
+ return decodeText(ptr, len);
28
+ }
29
+
30
+ let cachedUint8ArrayMemory0 = null;
31
+ function getUint8ArrayMemory0() {
32
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
33
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
34
+ }
35
+ return cachedUint8ArrayMemory0;
36
+ }
37
+
38
+ function passArrayF32ToWasm0(arg, malloc) {
39
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
40
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
41
+ WASM_VECTOR_LEN = arg.length;
42
+ return ptr;
43
+ }
44
+
45
+ function takeFromExternrefTable0(idx) {
46
+ const value = wasm.__wbindgen_externrefs.get(idx);
47
+ wasm.__externref_table_dealloc(idx);
48
+ return value;
49
+ }
50
+
51
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
52
+ cachedTextDecoder.decode();
53
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
54
+ let numBytesDecoded = 0;
55
+ function decodeText(ptr, len) {
56
+ numBytesDecoded += len;
57
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
58
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
59
+ cachedTextDecoder.decode();
60
+ numBytesDecoded = len;
61
+ }
62
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
63
+ }
64
+
65
+ let WASM_VECTOR_LEN = 0;
66
+
67
+ const Mat4Finalization = (typeof FinalizationRegistry === 'undefined')
68
+ ? { register: () => {}, unregister: () => {} }
69
+ : new FinalizationRegistry(ptr => wasm.__wbg_mat4_free(ptr >>> 0, 1));
70
+
71
+ const QuatFinalization = (typeof FinalizationRegistry === 'undefined')
72
+ ? { register: () => {}, unregister: () => {} }
73
+ : new FinalizationRegistry(ptr => wasm.__wbg_quat_free(ptr >>> 0, 1));
74
+
75
+ const Vec3Finalization = (typeof FinalizationRegistry === 'undefined')
76
+ ? { register: () => {}, unregister: () => {} }
77
+ : new FinalizationRegistry(ptr => wasm.__wbg_vec3_free(ptr >>> 0, 1));
78
+
79
+ export class Mat4 {
80
+ static __wrap(ptr) {
81
+ ptr = ptr >>> 0;
82
+ const obj = Object.create(Mat4.prototype);
83
+ obj.__wbg_ptr = ptr;
84
+ Mat4Finalization.register(obj, obj.__wbg_ptr, obj);
85
+ return obj;
86
+ }
87
+ __destroy_into_raw() {
88
+ const ptr = this.__wbg_ptr;
89
+ this.__wbg_ptr = 0;
90
+ Mat4Finalization.unregister(this);
91
+ return ptr;
92
+ }
93
+ free() {
94
+ const ptr = this.__destroy_into_raw();
95
+ wasm.__wbg_mat4_free(ptr, 0);
96
+ }
97
+ /**
98
+ * @param {Float32Array} val
99
+ * @returns {Mat4}
100
+ */
101
+ static from_values(val) {
102
+ const ptr0 = passArrayF32ToWasm0(val, wasm.__wbindgen_malloc);
103
+ const len0 = WASM_VECTOR_LEN;
104
+ const ret = wasm.mat4_from_values(ptr0, len0);
105
+ if (ret[2]) {
106
+ throw takeFromExternrefTable0(ret[1]);
107
+ }
108
+ return Mat4.__wrap(ret[0]);
109
+ }
110
+ /**
111
+ * @param {number} fov
112
+ * @param {number} aspect
113
+ * @param {number} near
114
+ * @param {number} far
115
+ * @returns {Mat4}
116
+ */
117
+ static perspective(fov, aspect, near, far) {
118
+ const ret = wasm.mat4_perspective(fov, aspect, near, far);
119
+ return Mat4.__wrap(ret);
120
+ }
121
+ /**
122
+ * @returns {Vec3}
123
+ */
124
+ get_position() {
125
+ const ret = wasm.mat4_get_position(this.__wbg_ptr);
126
+ return Vec3.__wrap(ret);
127
+ }
128
+ /**
129
+ * @returns {Mat4}
130
+ */
131
+ set_identity() {
132
+ const ptr = this.__destroy_into_raw();
133
+ const ret = wasm.mat4_set_identity(ptr);
134
+ return Mat4.__wrap(ret);
135
+ }
136
+ /**
137
+ * @param {number} sx
138
+ * @param {number} sy
139
+ * @param {number} sz
140
+ * @returns {Mat4}
141
+ */
142
+ scale_in_place(sx, sy, sz) {
143
+ const ret = wasm.mat4_scale_in_place(this.__wbg_ptr, sx, sy, sz);
144
+ return Mat4.__wrap(ret);
145
+ }
146
+ /**
147
+ * @param {Float32Array} m
148
+ * @param {number} offset
149
+ * @returns {Quat}
150
+ */
151
+ static to_quat_from_array(m, offset) {
152
+ const ptr0 = passArrayF32ToWasm0(m, wasm.__wbindgen_malloc);
153
+ const len0 = WASM_VECTOR_LEN;
154
+ const ret = wasm.mat4_to_quat_from_array(ptr0, len0, offset);
155
+ return Quat.__wrap(ret);
156
+ }
157
+ /**
158
+ * @param {number} tx
159
+ * @param {number} ty
160
+ * @param {number} tz
161
+ * @returns {Mat4}
162
+ */
163
+ translate_in_place(tx, ty, tz) {
164
+ const ptr = this.__destroy_into_raw();
165
+ const ret = wasm.mat4_translate_in_place(ptr, tx, ty, tz);
166
+ return Mat4.__wrap(ret);
167
+ }
168
+ /**
169
+ * @param {Vec3} position
170
+ * @param {Quat} rotation
171
+ * @returns {Mat4}
172
+ */
173
+ static from_position_rotation(position, rotation) {
174
+ _assertClass(position, Vec3);
175
+ _assertClass(rotation, Quat);
176
+ const ret = wasm.mat4_from_position_rotation(position.__wbg_ptr, rotation.__wbg_ptr);
177
+ return Mat4.__wrap(ret);
178
+ }
179
+ /**
180
+ * @param {Vec3} scale
181
+ * @returns {Mat4}
182
+ */
183
+ scale_in_place_by_vec3(scale) {
184
+ _assertClass(scale, Vec3);
185
+ var ptr0 = scale.__destroy_into_raw();
186
+ const ret = wasm.mat4_scale_in_place_by_vec3(this.__wbg_ptr, ptr0);
187
+ return Mat4.__wrap(ret);
188
+ }
189
+ /**
190
+ * @param {Vec3} position
191
+ * @param {Quat} rotation
192
+ * @param {Mat4} result
193
+ */
194
+ static from_position_rotation_to_ref(position, rotation, result) {
195
+ _assertClass(position, Vec3);
196
+ _assertClass(rotation, Quat);
197
+ _assertClass(result, Mat4);
198
+ wasm.mat4_from_position_rotation_to_ref(position.__wbg_ptr, rotation.__wbg_ptr, result.__wbg_ptr);
199
+ }
200
+ /**
201
+ * @param {Float32Array} val
202
+ */
203
+ constructor(val) {
204
+ const ptr0 = passArrayF32ToWasm0(val, wasm.__wbindgen_malloc);
205
+ const len0 = WASM_VECTOR_LEN;
206
+ const ret = wasm.mat4_new(ptr0, len0);
207
+ this.__wbg_ptr = ret >>> 0;
208
+ Mat4Finalization.register(this, this.__wbg_ptr, this);
209
+ return this;
210
+ }
211
+ /**
212
+ * @param {Float32Array} val
213
+ */
214
+ set(val) {
215
+ const ptr = this.__destroy_into_raw();
216
+ const ptr0 = passArrayF32ToWasm0(val, wasm.__wbindgen_malloc);
217
+ const len0 = WASM_VECTOR_LEN;
218
+ wasm.mat4_set(ptr, ptr0, len0);
219
+ }
220
+ /**
221
+ * @returns {Float32Array}
222
+ */
223
+ get values() {
224
+ const ret = wasm.mat4_values(this.__wbg_ptr);
225
+ return ret;
226
+ }
227
+ /**
228
+ * @returns {Mat4}
229
+ */
230
+ inverse() {
231
+ const ret = wasm.mat4_inverse(this.__wbg_ptr);
232
+ return Mat4.__wrap(ret);
233
+ }
234
+ /**
235
+ * @param {Vec3} eye
236
+ * @param {Vec3} target
237
+ * @param {Vec3} up
238
+ * @returns {Mat4}
239
+ */
240
+ static look_at(eye, target, up) {
241
+ _assertClass(eye, Vec3);
242
+ var ptr0 = eye.__destroy_into_raw();
243
+ _assertClass(target, Vec3);
244
+ var ptr1 = target.__destroy_into_raw();
245
+ _assertClass(up, Vec3);
246
+ var ptr2 = up.__destroy_into_raw();
247
+ const ret = wasm.mat4_look_at(ptr0, ptr1, ptr2);
248
+ return Mat4.__wrap(ret);
249
+ }
250
+ /**
251
+ * @returns {Quat}
252
+ */
253
+ to_quat() {
254
+ const ptr = this.__destroy_into_raw();
255
+ const ret = wasm.mat4_to_quat(ptr);
256
+ return Quat.__wrap(ret);
257
+ }
258
+ /**
259
+ * @returns {Mat4}
260
+ */
261
+ static identity() {
262
+ const ret = wasm.mat4_identity();
263
+ return Mat4.__wrap(ret);
264
+ }
265
+ /**
266
+ * @param {Mat4} other
267
+ * @returns {Mat4}
268
+ */
269
+ multiply(other) {
270
+ _assertClass(other, Mat4);
271
+ var ptr0 = other.__destroy_into_raw();
272
+ const ret = wasm.mat4_multiply(this.__wbg_ptr, ptr0);
273
+ return Mat4.__wrap(ret);
274
+ }
275
+ /**
276
+ * @param {number} x
277
+ * @param {number} y
278
+ * @param {number} z
279
+ * @param {number} w
280
+ * @returns {Mat4}
281
+ */
282
+ static from_quat(x, y, z, w) {
283
+ const ret = wasm.mat4_from_quat(x, y, z, w);
284
+ return Mat4.__wrap(ret);
285
+ }
286
+ }
287
+ if (Symbol.dispose) Mat4.prototype[Symbol.dispose] = Mat4.prototype.free;
288
+
289
+ export class Quat {
290
+ static __wrap(ptr) {
291
+ ptr = ptr >>> 0;
292
+ const obj = Object.create(Quat.prototype);
293
+ obj.__wbg_ptr = ptr;
294
+ QuatFinalization.register(obj, obj.__wbg_ptr, obj);
295
+ return obj;
296
+ }
297
+ __destroy_into_raw() {
298
+ const ptr = this.__wbg_ptr;
299
+ this.__wbg_ptr = 0;
300
+ QuatFinalization.unregister(this);
301
+ return ptr;
302
+ }
303
+ free() {
304
+ const ptr = this.__destroy_into_raw();
305
+ wasm.__wbg_quat_free(ptr, 0);
306
+ }
307
+ /**
308
+ * @returns {number}
309
+ */
310
+ get x() {
311
+ const ret = wasm.__wbg_get_quat_x(this.__wbg_ptr);
312
+ return ret;
313
+ }
314
+ /**
315
+ * @param {number} arg0
316
+ */
317
+ set x(arg0) {
318
+ wasm.__wbg_set_quat_x(this.__wbg_ptr, arg0);
319
+ }
320
+ /**
321
+ * @returns {number}
322
+ */
323
+ get y() {
324
+ const ret = wasm.__wbg_get_quat_y(this.__wbg_ptr);
325
+ return ret;
326
+ }
327
+ /**
328
+ * @param {number} arg0
329
+ */
330
+ set y(arg0) {
331
+ wasm.__wbg_set_quat_y(this.__wbg_ptr, arg0);
332
+ }
333
+ /**
334
+ * @returns {number}
335
+ */
336
+ get z() {
337
+ const ret = wasm.__wbg_get_quat_z(this.__wbg_ptr);
338
+ return ret;
339
+ }
340
+ /**
341
+ * @param {number} arg0
342
+ */
343
+ set z(arg0) {
344
+ wasm.__wbg_set_quat_z(this.__wbg_ptr, arg0);
345
+ }
346
+ /**
347
+ * @returns {number}
348
+ */
349
+ get w() {
350
+ const ret = wasm.__wbg_get_quat_w(this.__wbg_ptr);
351
+ return ret;
352
+ }
353
+ /**
354
+ * @param {number} arg0
355
+ */
356
+ set w(arg0) {
357
+ wasm.__wbg_set_quat_w(this.__wbg_ptr, arg0);
358
+ }
359
+ /**
360
+ * @param {number} rot_x
361
+ * @param {number} rot_y
362
+ * @param {number} rot_z
363
+ * @returns {Quat}
364
+ */
365
+ static from_euler(rot_x, rot_y, rot_z) {
366
+ const ret = wasm.quat_from_euler(rot_x, rot_y, rot_z);
367
+ return Quat.__wrap(ret);
368
+ }
369
+ /**
370
+ * @param {Vec3} v
371
+ * @returns {Vec3}
372
+ */
373
+ rotate_vec(v) {
374
+ _assertClass(v, Vec3);
375
+ var ptr0 = v.__destroy_into_raw();
376
+ const ret = wasm.quat_rotate_vec(this.__wbg_ptr, ptr0);
377
+ return Vec3.__wrap(ret);
378
+ }
379
+ /**
380
+ * @returns {Vec3}
381
+ */
382
+ to_euler_angles() {
383
+ const ret = wasm.quat_to_euler_angles(this.__wbg_ptr);
384
+ return Vec3.__wrap(ret);
385
+ }
386
+ /**
387
+ * @param {Vec3} vec_from
388
+ * @param {Vec3} vec_to
389
+ * @param {number} epsilon
390
+ * @returns {Quat}
391
+ */
392
+ static from_unit_vectors(vec_from, vec_to, epsilon) {
393
+ _assertClass(vec_from, Vec3);
394
+ _assertClass(vec_to, Vec3);
395
+ const ret = wasm.quat_from_unit_vectors(vec_from.__wbg_ptr, vec_to.__wbg_ptr, epsilon);
396
+ return Quat.__wrap(ret);
397
+ }
398
+ /**
399
+ * @param {number} yaw
400
+ * @param {number} pitch
401
+ * @param {number} roll
402
+ * @returns {Quat}
403
+ */
404
+ static rotation_yaw_pitch_roll(yaw, pitch, roll) {
405
+ const ret = wasm.quat_rotation_yaw_pitch_roll(yaw, pitch, roll);
406
+ return Quat.__wrap(ret);
407
+ }
408
+ /**
409
+ * @param {Vec3} vec_from
410
+ * @param {Vec3} vec_to
411
+ * @param {Quat} result
412
+ * @param {number} epsilon
413
+ * @returns {Quat}
414
+ */
415
+ static from_unit_vectors_to_ref(vec_from, vec_to, result, epsilon) {
416
+ _assertClass(vec_from, Vec3);
417
+ _assertClass(vec_to, Vec3);
418
+ _assertClass(result, Quat);
419
+ const ret = wasm.quat_from_unit_vectors_to_ref(vec_from.__wbg_ptr, vec_to.__wbg_ptr, result.__wbg_ptr, epsilon);
420
+ return Quat.__wrap(ret);
421
+ }
422
+ /**
423
+ * @param {number} x
424
+ * @param {number} y
425
+ * @param {number} z
426
+ * @param {number} w
427
+ */
428
+ constructor(x, y, z, w) {
429
+ const ret = wasm.quat_new(x, y, z, w);
430
+ this.__wbg_ptr = ret >>> 0;
431
+ QuatFinalization.register(this, this.__wbg_ptr, this);
432
+ return this;
433
+ }
434
+ /**
435
+ * @param {number} x
436
+ * @param {number} y
437
+ * @param {number} z
438
+ * @param {number} w
439
+ * @returns {Quat}
440
+ */
441
+ set(x, y, z, w) {
442
+ const ptr = this.__destroy_into_raw();
443
+ const ret = wasm.quat_set(ptr, x, y, z, w);
444
+ return Quat.__wrap(ret);
445
+ }
446
+ /**
447
+ * @returns {Quat}
448
+ */
449
+ clone() {
450
+ const ret = wasm.quat_clone(this.__wbg_ptr);
451
+ return Quat.__wrap(ret);
452
+ }
453
+ /**
454
+ * @param {Quat} a
455
+ * @param {Quat} b
456
+ * @param {number} t
457
+ * @returns {Quat}
458
+ */
459
+ static slerp(a, b, t) {
460
+ _assertClass(a, Quat);
461
+ _assertClass(b, Quat);
462
+ const ret = wasm.quat_slerp(a.__wbg_ptr, b.__wbg_ptr, t);
463
+ return Quat.__wrap(ret);
464
+ }
465
+ /**
466
+ * @returns {Quat}
467
+ */
468
+ static identity() {
469
+ const ret = wasm.quat_identity();
470
+ return Quat.__wrap(ret);
471
+ }
472
+ /**
473
+ * @param {Quat} other
474
+ * @returns {Quat}
475
+ */
476
+ multiply(other) {
477
+ _assertClass(other, Quat);
478
+ var ptr0 = other.__destroy_into_raw();
479
+ const ret = wasm.quat_multiply(this.__wbg_ptr, ptr0);
480
+ return Quat.__wrap(ret);
481
+ }
482
+ /**
483
+ * @returns {Float32Array}
484
+ */
485
+ to_array() {
486
+ const ret = wasm.quat_to_array(this.__wbg_ptr);
487
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
488
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
489
+ return v1;
490
+ }
491
+ /**
492
+ * @returns {Quat}
493
+ */
494
+ normalize() {
495
+ const ptr = this.__destroy_into_raw();
496
+ const ret = wasm.quat_normalize(ptr);
497
+ return Quat.__wrap(ret);
498
+ }
499
+ }
500
+ if (Symbol.dispose) Quat.prototype[Symbol.dispose] = Quat.prototype.free;
501
+
502
+ export class Vec3 {
503
+ static __wrap(ptr) {
504
+ ptr = ptr >>> 0;
505
+ const obj = Object.create(Vec3.prototype);
506
+ obj.__wbg_ptr = ptr;
507
+ Vec3Finalization.register(obj, obj.__wbg_ptr, obj);
508
+ return obj;
509
+ }
510
+ __destroy_into_raw() {
511
+ const ptr = this.__wbg_ptr;
512
+ this.__wbg_ptr = 0;
513
+ Vec3Finalization.unregister(this);
514
+ return ptr;
515
+ }
516
+ free() {
517
+ const ptr = this.__destroy_into_raw();
518
+ wasm.__wbg_vec3_free(ptr, 0);
519
+ }
520
+ /**
521
+ * @returns {number}
522
+ */
523
+ get x() {
524
+ const ret = wasm.__wbg_get_vec3_x(this.__wbg_ptr);
525
+ return ret;
526
+ }
527
+ /**
528
+ * @param {number} arg0
529
+ */
530
+ set x(arg0) {
531
+ wasm.__wbg_set_vec3_x(this.__wbg_ptr, arg0);
532
+ }
533
+ /**
534
+ * @returns {number}
535
+ */
536
+ get y() {
537
+ const ret = wasm.__wbg_get_vec3_y(this.__wbg_ptr);
538
+ return ret;
539
+ }
540
+ /**
541
+ * @param {number} arg0
542
+ */
543
+ set y(arg0) {
544
+ wasm.__wbg_set_vec3_y(this.__wbg_ptr, arg0);
545
+ }
546
+ /**
547
+ * @returns {number}
548
+ */
549
+ get z() {
550
+ const ret = wasm.__wbg_get_vec3_z(this.__wbg_ptr);
551
+ return ret;
552
+ }
553
+ /**
554
+ * @param {number} arg0
555
+ */
556
+ set z(arg0) {
557
+ wasm.__wbg_set_vec3_z(this.__wbg_ptr, arg0);
558
+ }
559
+ /**
560
+ * @returns {number}
561
+ */
562
+ length_squared() {
563
+ const ret = wasm.vec3_length_squared(this.__wbg_ptr);
564
+ return ret;
565
+ }
566
+ /**
567
+ * @param {Vec3} other
568
+ * @returns {Vec3}
569
+ */
570
+ add(other) {
571
+ _assertClass(other, Vec3);
572
+ var ptr0 = other.__destroy_into_raw();
573
+ const ret = wasm.vec3_add(this.__wbg_ptr, ptr0);
574
+ return Vec3.__wrap(ret);
575
+ }
576
+ /**
577
+ * @param {Vec3} other
578
+ * @returns {number}
579
+ */
580
+ dot(other) {
581
+ _assertClass(other, Vec3);
582
+ var ptr0 = other.__destroy_into_raw();
583
+ const ret = wasm.vec3_dot(this.__wbg_ptr, ptr0);
584
+ return ret;
585
+ }
586
+ /**
587
+ * @param {number} x
588
+ * @param {number} y
589
+ * @param {number} z
590
+ */
591
+ constructor(x, y, z) {
592
+ const ret = wasm.vec3_new(x, y, z);
593
+ this.__wbg_ptr = ret >>> 0;
594
+ Vec3Finalization.register(this, this.__wbg_ptr, this);
595
+ return this;
596
+ }
597
+ /**
598
+ * @param {number} x
599
+ * @param {number} y
600
+ * @param {number} z
601
+ * @returns {Vec3}
602
+ */
603
+ set(x, y, z) {
604
+ const ret = wasm.vec3_set(this.__wbg_ptr, x, y, z);
605
+ return Vec3.__wrap(ret);
606
+ }
607
+ /**
608
+ * @returns {Vec3}
609
+ */
610
+ clone() {
611
+ const ret = wasm.vec3_clone(this.__wbg_ptr);
612
+ return Vec3.__wrap(ret);
613
+ }
614
+ /**
615
+ * @param {Vec3} other
616
+ * @returns {Vec3}
617
+ */
618
+ cross(other) {
619
+ _assertClass(other, Vec3);
620
+ var ptr0 = other.__destroy_into_raw();
621
+ const ret = wasm.vec3_cross(this.__wbg_ptr, ptr0);
622
+ return Vec3.__wrap(ret);
623
+ }
624
+ /**
625
+ * @param {number} scalar
626
+ * @returns {Vec3}
627
+ */
628
+ scale(scalar) {
629
+ const ret = wasm.vec3_scale(this.__wbg_ptr, scalar);
630
+ return Vec3.__wrap(ret);
631
+ }
632
+ /**
633
+ * @returns {number}
634
+ */
635
+ length() {
636
+ const ret = wasm.vec3_length(this.__wbg_ptr);
637
+ return ret;
638
+ }
639
+ /**
640
+ * @param {Vec3} other
641
+ * @returns {Vec3}
642
+ */
643
+ subtract(other) {
644
+ const ptr = this.__destroy_into_raw();
645
+ _assertClass(other, Vec3);
646
+ var ptr0 = other.__destroy_into_raw();
647
+ const ret = wasm.vec3_subtract(ptr, ptr0);
648
+ return Vec3.__wrap(ret);
649
+ }
650
+ /**
651
+ * @returns {Float32Array}
652
+ */
653
+ to_array() {
654
+ const ret = wasm.vec3_to_array(this.__wbg_ptr);
655
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
656
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
657
+ return v1;
658
+ }
659
+ /**
660
+ * @returns {Vec3}
661
+ */
662
+ normalize() {
663
+ const ret = wasm.vec3_normalize(this.__wbg_ptr);
664
+ return Vec3.__wrap(ret);
665
+ }
666
+ }
667
+ if (Symbol.dispose) Vec3.prototype[Symbol.dispose] = Vec3.prototype.free;
668
+
669
+ /**
670
+ * @param {Vec3} a
671
+ * @param {Vec3} b
672
+ * @returns {Vec3}
673
+ */
674
+ export function cross(a, b) {
675
+ _assertClass(a, Vec3);
676
+ var ptr0 = a.__destroy_into_raw();
677
+ _assertClass(b, Vec3);
678
+ var ptr1 = b.__destroy_into_raw();
679
+ const ret = wasm.cross(ptr0, ptr1);
680
+ return Vec3.__wrap(ret);
681
+ }
682
+
683
+ /**
684
+ * @param {number} t
685
+ * @returns {number}
686
+ */
687
+ export function ease_in_out(t) {
688
+ const ret = wasm.ease_in_out(t);
689
+ return ret;
690
+ }
691
+
692
+ /**
693
+ * @param {Vec3} start
694
+ * @param {Vec3} end
695
+ * @param {number} t
696
+ * @returns {Vec3}
697
+ */
698
+ export function lerp(start, end, t) {
699
+ _assertClass(start, Vec3);
700
+ var ptr0 = start.__destroy_into_raw();
701
+ _assertClass(end, Vec3);
702
+ var ptr1 = end.__destroy_into_raw();
703
+ const ret = wasm.lerp(ptr0, ptr1, t);
704
+ return Vec3.__wrap(ret);
705
+ }
706
+
707
+ export function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) {
708
+ throw new Error(getStringFromWasm0(arg0, arg1));
709
+ };
710
+
711
+ export function __wbg_new_from_slice_41e2764a343e3cb1(arg0, arg1) {
712
+ const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
713
+ return ret;
714
+ };
715
+
716
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
717
+ // Cast intrinsic for `Ref(String) -> Externref`.
718
+ const ret = getStringFromWasm0(arg0, arg1);
719
+ return ret;
720
+ };
721
+
722
+ export function __wbindgen_init_externref_table() {
723
+ const table = wasm.__wbindgen_externrefs;
724
+ const offset = table.grow(4);
725
+ table.set(0, undefined);
726
+ table.set(offset + 0, undefined);
727
+ table.set(offset + 1, null);
728
+ table.set(offset + 2, true);
729
+ table.set(offset + 3, false);
730
+ };
Binary file