math-rust-lib 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/math_rust_lib.d.ts +61 -0
- package/math_rust_lib.js +593 -0
- package/math_rust_lib_bg.wasm +0 -0
- package/package.json +11 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class Mat4 {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
static from_values(val: Float32Array): Mat4;
|
|
8
|
+
static perspective(fov: number, aspect: number, near: number, far: number): Mat4;
|
|
9
|
+
set_identity(): Mat4;
|
|
10
|
+
scale_in_place(sx: number, sy: number, sz: number): Mat4;
|
|
11
|
+
static to_quat_from_array(m: Float32Array, offset: number): Quat;
|
|
12
|
+
translate_in_place(tx: number, ty: number, tz: number): Mat4;
|
|
13
|
+
scale_in_place_by_vec3(scale: Vec3): Mat4;
|
|
14
|
+
constructor(val: Float32Array);
|
|
15
|
+
set(val: Float32Array): void;
|
|
16
|
+
static look_at(eye: Vec3, target: Vec3, up: Vec3): Mat4;
|
|
17
|
+
to_quat(): Quat;
|
|
18
|
+
static identity(): Mat4;
|
|
19
|
+
multiply(other: Mat4): Mat4;
|
|
20
|
+
static from_quat(x: number, y: number, z: number, w: number): Mat4;
|
|
21
|
+
readonly values: Float32Array;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class Quat {
|
|
25
|
+
free(): void;
|
|
26
|
+
[Symbol.dispose](): void;
|
|
27
|
+
to_euler_angles(): Vec3;
|
|
28
|
+
constructor(x: number, y: number, z: number, w: number);
|
|
29
|
+
clone(): Quat;
|
|
30
|
+
multiply(other: Quat): Quat;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
z: number;
|
|
34
|
+
w: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class Vec3 {
|
|
38
|
+
free(): void;
|
|
39
|
+
[Symbol.dispose](): void;
|
|
40
|
+
length_squared(): number;
|
|
41
|
+
add(other: Vec3): Vec3;
|
|
42
|
+
dot(other: Vec3): number;
|
|
43
|
+
constructor(x: number, y: number, z: number);
|
|
44
|
+
set(x: number, y: number, z: number): Vec3;
|
|
45
|
+
clone(): Vec3;
|
|
46
|
+
cross(other: Vec3): Vec3;
|
|
47
|
+
scale(scalar: number): Vec3;
|
|
48
|
+
length(): number;
|
|
49
|
+
subtract(other: Vec3): Vec3;
|
|
50
|
+
to_array(): Float32Array;
|
|
51
|
+
normalize(): Vec3;
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
z: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function cross(a: Vec3, b: Vec3): Vec3;
|
|
58
|
+
|
|
59
|
+
export function ease_in_out(t: number): number;
|
|
60
|
+
|
|
61
|
+
export function lerp(start: Vec3, end: Vec3, t: number): Vec3;
|
package/math_rust_lib.js
ADDED
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
|
|
2
|
+
let imports = {};
|
|
3
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
|
+
|
|
5
|
+
function _assertClass(instance, klass) {
|
|
6
|
+
if (!(instance instanceof klass)) {
|
|
7
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
12
|
+
ptr = ptr >>> 0;
|
|
13
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
17
|
+
function getFloat32ArrayMemory0() {
|
|
18
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
19
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
20
|
+
}
|
|
21
|
+
return cachedFloat32ArrayMemory0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getStringFromWasm0(ptr, len) {
|
|
25
|
+
ptr = ptr >>> 0;
|
|
26
|
+
return decodeText(ptr, len);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let cachedUint8ArrayMemory0 = null;
|
|
30
|
+
function getUint8ArrayMemory0() {
|
|
31
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
32
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
33
|
+
}
|
|
34
|
+
return cachedUint8ArrayMemory0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function passArrayF32ToWasm0(arg, malloc) {
|
|
38
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
39
|
+
getFloat32ArrayMemory0().set(arg, ptr / 4);
|
|
40
|
+
WASM_VECTOR_LEN = arg.length;
|
|
41
|
+
return ptr;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function takeFromExternrefTable0(idx) {
|
|
45
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
46
|
+
wasm.__externref_table_dealloc(idx);
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
51
|
+
cachedTextDecoder.decode();
|
|
52
|
+
function decodeText(ptr, len) {
|
|
53
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let WASM_VECTOR_LEN = 0;
|
|
57
|
+
|
|
58
|
+
const Mat4Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
59
|
+
? { register: () => {}, unregister: () => {} }
|
|
60
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_mat4_free(ptr >>> 0, 1));
|
|
61
|
+
|
|
62
|
+
const QuatFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
63
|
+
? { register: () => {}, unregister: () => {} }
|
|
64
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_quat_free(ptr >>> 0, 1));
|
|
65
|
+
|
|
66
|
+
const Vec3Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
67
|
+
? { register: () => {}, unregister: () => {} }
|
|
68
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vec3_free(ptr >>> 0, 1));
|
|
69
|
+
|
|
70
|
+
class Mat4 {
|
|
71
|
+
static __wrap(ptr) {
|
|
72
|
+
ptr = ptr >>> 0;
|
|
73
|
+
const obj = Object.create(Mat4.prototype);
|
|
74
|
+
obj.__wbg_ptr = ptr;
|
|
75
|
+
Mat4Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
__destroy_into_raw() {
|
|
79
|
+
const ptr = this.__wbg_ptr;
|
|
80
|
+
this.__wbg_ptr = 0;
|
|
81
|
+
Mat4Finalization.unregister(this);
|
|
82
|
+
return ptr;
|
|
83
|
+
}
|
|
84
|
+
free() {
|
|
85
|
+
const ptr = this.__destroy_into_raw();
|
|
86
|
+
wasm.__wbg_mat4_free(ptr, 0);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @param {Float32Array} val
|
|
90
|
+
* @returns {Mat4}
|
|
91
|
+
*/
|
|
92
|
+
static from_values(val) {
|
|
93
|
+
const ptr0 = passArrayF32ToWasm0(val, wasm.__wbindgen_malloc);
|
|
94
|
+
const len0 = WASM_VECTOR_LEN;
|
|
95
|
+
const ret = wasm.mat4_from_values(ptr0, len0);
|
|
96
|
+
if (ret[2]) {
|
|
97
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
98
|
+
}
|
|
99
|
+
return Mat4.__wrap(ret[0]);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @param {number} fov
|
|
103
|
+
* @param {number} aspect
|
|
104
|
+
* @param {number} near
|
|
105
|
+
* @param {number} far
|
|
106
|
+
* @returns {Mat4}
|
|
107
|
+
*/
|
|
108
|
+
static perspective(fov, aspect, near, far) {
|
|
109
|
+
const ret = wasm.mat4_perspective(fov, aspect, near, far);
|
|
110
|
+
return Mat4.__wrap(ret);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @returns {Mat4}
|
|
114
|
+
*/
|
|
115
|
+
set_identity() {
|
|
116
|
+
const ptr = this.__destroy_into_raw();
|
|
117
|
+
const ret = wasm.mat4_set_identity(ptr);
|
|
118
|
+
return Mat4.__wrap(ret);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* @param {number} sx
|
|
122
|
+
* @param {number} sy
|
|
123
|
+
* @param {number} sz
|
|
124
|
+
* @returns {Mat4}
|
|
125
|
+
*/
|
|
126
|
+
scale_in_place(sx, sy, sz) {
|
|
127
|
+
const ret = wasm.mat4_scale_in_place(this.__wbg_ptr, sx, sy, sz);
|
|
128
|
+
return Mat4.__wrap(ret);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @param {Float32Array} m
|
|
132
|
+
* @param {number} offset
|
|
133
|
+
* @returns {Quat}
|
|
134
|
+
*/
|
|
135
|
+
static to_quat_from_array(m, offset) {
|
|
136
|
+
const ptr0 = passArrayF32ToWasm0(m, wasm.__wbindgen_malloc);
|
|
137
|
+
const len0 = WASM_VECTOR_LEN;
|
|
138
|
+
const ret = wasm.mat4_to_quat_from_array(ptr0, len0, offset);
|
|
139
|
+
return Quat.__wrap(ret);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @param {number} tx
|
|
143
|
+
* @param {number} ty
|
|
144
|
+
* @param {number} tz
|
|
145
|
+
* @returns {Mat4}
|
|
146
|
+
*/
|
|
147
|
+
translate_in_place(tx, ty, tz) {
|
|
148
|
+
const ptr = this.__destroy_into_raw();
|
|
149
|
+
const ret = wasm.mat4_translate_in_place(ptr, tx, ty, tz);
|
|
150
|
+
return Mat4.__wrap(ret);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @param {Vec3} scale
|
|
154
|
+
* @returns {Mat4}
|
|
155
|
+
*/
|
|
156
|
+
scale_in_place_by_vec3(scale) {
|
|
157
|
+
_assertClass(scale, Vec3);
|
|
158
|
+
var ptr0 = scale.__destroy_into_raw();
|
|
159
|
+
const ret = wasm.mat4_scale_in_place_by_vec3(this.__wbg_ptr, ptr0);
|
|
160
|
+
return Mat4.__wrap(ret);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @param {Float32Array} val
|
|
164
|
+
*/
|
|
165
|
+
constructor(val) {
|
|
166
|
+
const ptr0 = passArrayF32ToWasm0(val, wasm.__wbindgen_malloc);
|
|
167
|
+
const len0 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.mat4_new(ptr0, len0);
|
|
169
|
+
this.__wbg_ptr = ret >>> 0;
|
|
170
|
+
Mat4Finalization.register(this, this.__wbg_ptr, this);
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @param {Float32Array} val
|
|
175
|
+
*/
|
|
176
|
+
set(val) {
|
|
177
|
+
const ptr = this.__destroy_into_raw();
|
|
178
|
+
const ptr0 = passArrayF32ToWasm0(val, wasm.__wbindgen_malloc);
|
|
179
|
+
const len0 = WASM_VECTOR_LEN;
|
|
180
|
+
wasm.mat4_set(ptr, ptr0, len0);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* @returns {Float32Array}
|
|
184
|
+
*/
|
|
185
|
+
get values() {
|
|
186
|
+
const ret = wasm.mat4_values(this.__wbg_ptr);
|
|
187
|
+
return ret;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @param {Vec3} eye
|
|
191
|
+
* @param {Vec3} target
|
|
192
|
+
* @param {Vec3} up
|
|
193
|
+
* @returns {Mat4}
|
|
194
|
+
*/
|
|
195
|
+
static look_at(eye, target, up) {
|
|
196
|
+
_assertClass(eye, Vec3);
|
|
197
|
+
var ptr0 = eye.__destroy_into_raw();
|
|
198
|
+
_assertClass(target, Vec3);
|
|
199
|
+
var ptr1 = target.__destroy_into_raw();
|
|
200
|
+
_assertClass(up, Vec3);
|
|
201
|
+
var ptr2 = up.__destroy_into_raw();
|
|
202
|
+
const ret = wasm.mat4_look_at(ptr0, ptr1, ptr2);
|
|
203
|
+
return Mat4.__wrap(ret);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @returns {Quat}
|
|
207
|
+
*/
|
|
208
|
+
to_quat() {
|
|
209
|
+
const ptr = this.__destroy_into_raw();
|
|
210
|
+
const ret = wasm.mat4_to_quat(ptr);
|
|
211
|
+
return Quat.__wrap(ret);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @returns {Mat4}
|
|
215
|
+
*/
|
|
216
|
+
static identity() {
|
|
217
|
+
const ret = wasm.mat4_identity();
|
|
218
|
+
return Mat4.__wrap(ret);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @param {Mat4} other
|
|
222
|
+
* @returns {Mat4}
|
|
223
|
+
*/
|
|
224
|
+
multiply(other) {
|
|
225
|
+
_assertClass(other, Mat4);
|
|
226
|
+
var ptr0 = other.__destroy_into_raw();
|
|
227
|
+
const ret = wasm.mat4_multiply(this.__wbg_ptr, ptr0);
|
|
228
|
+
return Mat4.__wrap(ret);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @param {number} x
|
|
232
|
+
* @param {number} y
|
|
233
|
+
* @param {number} z
|
|
234
|
+
* @param {number} w
|
|
235
|
+
* @returns {Mat4}
|
|
236
|
+
*/
|
|
237
|
+
static from_quat(x, y, z, w) {
|
|
238
|
+
const ret = wasm.mat4_from_quat(x, y, z, w);
|
|
239
|
+
return Mat4.__wrap(ret);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (Symbol.dispose) Mat4.prototype[Symbol.dispose] = Mat4.prototype.free;
|
|
243
|
+
exports.Mat4 = Mat4;
|
|
244
|
+
|
|
245
|
+
class Quat {
|
|
246
|
+
static __wrap(ptr) {
|
|
247
|
+
ptr = ptr >>> 0;
|
|
248
|
+
const obj = Object.create(Quat.prototype);
|
|
249
|
+
obj.__wbg_ptr = ptr;
|
|
250
|
+
QuatFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
251
|
+
return obj;
|
|
252
|
+
}
|
|
253
|
+
__destroy_into_raw() {
|
|
254
|
+
const ptr = this.__wbg_ptr;
|
|
255
|
+
this.__wbg_ptr = 0;
|
|
256
|
+
QuatFinalization.unregister(this);
|
|
257
|
+
return ptr;
|
|
258
|
+
}
|
|
259
|
+
free() {
|
|
260
|
+
const ptr = this.__destroy_into_raw();
|
|
261
|
+
wasm.__wbg_quat_free(ptr, 0);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* @returns {number}
|
|
265
|
+
*/
|
|
266
|
+
get x() {
|
|
267
|
+
const ret = wasm.__wbg_get_quat_x(this.__wbg_ptr);
|
|
268
|
+
return ret;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @param {number} arg0
|
|
272
|
+
*/
|
|
273
|
+
set x(arg0) {
|
|
274
|
+
wasm.__wbg_set_quat_x(this.__wbg_ptr, arg0);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @returns {number}
|
|
278
|
+
*/
|
|
279
|
+
get y() {
|
|
280
|
+
const ret = wasm.__wbg_get_quat_y(this.__wbg_ptr);
|
|
281
|
+
return ret;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* @param {number} arg0
|
|
285
|
+
*/
|
|
286
|
+
set y(arg0) {
|
|
287
|
+
wasm.__wbg_set_quat_y(this.__wbg_ptr, arg0);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* @returns {number}
|
|
291
|
+
*/
|
|
292
|
+
get z() {
|
|
293
|
+
const ret = wasm.__wbg_get_quat_z(this.__wbg_ptr);
|
|
294
|
+
return ret;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* @param {number} arg0
|
|
298
|
+
*/
|
|
299
|
+
set z(arg0) {
|
|
300
|
+
wasm.__wbg_set_quat_z(this.__wbg_ptr, arg0);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* @returns {number}
|
|
304
|
+
*/
|
|
305
|
+
get w() {
|
|
306
|
+
const ret = wasm.__wbg_get_quat_w(this.__wbg_ptr);
|
|
307
|
+
return ret;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* @param {number} arg0
|
|
311
|
+
*/
|
|
312
|
+
set w(arg0) {
|
|
313
|
+
wasm.__wbg_set_quat_w(this.__wbg_ptr, arg0);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* @returns {Vec3}
|
|
317
|
+
*/
|
|
318
|
+
to_euler_angles() {
|
|
319
|
+
const ret = wasm.quat_to_euler_angles(this.__wbg_ptr);
|
|
320
|
+
return Vec3.__wrap(ret);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* @param {number} x
|
|
324
|
+
* @param {number} y
|
|
325
|
+
* @param {number} z
|
|
326
|
+
* @param {number} w
|
|
327
|
+
*/
|
|
328
|
+
constructor(x, y, z, w) {
|
|
329
|
+
const ret = wasm.quat_new(x, y, z, w);
|
|
330
|
+
this.__wbg_ptr = ret >>> 0;
|
|
331
|
+
QuatFinalization.register(this, this.__wbg_ptr, this);
|
|
332
|
+
return this;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* @returns {Quat}
|
|
336
|
+
*/
|
|
337
|
+
clone() {
|
|
338
|
+
const ret = wasm.quat_clone(this.__wbg_ptr);
|
|
339
|
+
return Quat.__wrap(ret);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @param {Quat} other
|
|
343
|
+
* @returns {Quat}
|
|
344
|
+
*/
|
|
345
|
+
multiply(other) {
|
|
346
|
+
_assertClass(other, Quat);
|
|
347
|
+
var ptr0 = other.__destroy_into_raw();
|
|
348
|
+
const ret = wasm.quat_multiply(this.__wbg_ptr, ptr0);
|
|
349
|
+
return Quat.__wrap(ret);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (Symbol.dispose) Quat.prototype[Symbol.dispose] = Quat.prototype.free;
|
|
353
|
+
exports.Quat = Quat;
|
|
354
|
+
|
|
355
|
+
class Vec3 {
|
|
356
|
+
static __wrap(ptr) {
|
|
357
|
+
ptr = ptr >>> 0;
|
|
358
|
+
const obj = Object.create(Vec3.prototype);
|
|
359
|
+
obj.__wbg_ptr = ptr;
|
|
360
|
+
Vec3Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
361
|
+
return obj;
|
|
362
|
+
}
|
|
363
|
+
__destroy_into_raw() {
|
|
364
|
+
const ptr = this.__wbg_ptr;
|
|
365
|
+
this.__wbg_ptr = 0;
|
|
366
|
+
Vec3Finalization.unregister(this);
|
|
367
|
+
return ptr;
|
|
368
|
+
}
|
|
369
|
+
free() {
|
|
370
|
+
const ptr = this.__destroy_into_raw();
|
|
371
|
+
wasm.__wbg_vec3_free(ptr, 0);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @returns {number}
|
|
375
|
+
*/
|
|
376
|
+
get x() {
|
|
377
|
+
const ret = wasm.__wbg_get_quat_x(this.__wbg_ptr);
|
|
378
|
+
return ret;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* @param {number} arg0
|
|
382
|
+
*/
|
|
383
|
+
set x(arg0) {
|
|
384
|
+
wasm.__wbg_set_quat_x(this.__wbg_ptr, arg0);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @returns {number}
|
|
388
|
+
*/
|
|
389
|
+
get y() {
|
|
390
|
+
const ret = wasm.__wbg_get_quat_y(this.__wbg_ptr);
|
|
391
|
+
return ret;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @param {number} arg0
|
|
395
|
+
*/
|
|
396
|
+
set y(arg0) {
|
|
397
|
+
wasm.__wbg_set_quat_y(this.__wbg_ptr, arg0);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* @returns {number}
|
|
401
|
+
*/
|
|
402
|
+
get z() {
|
|
403
|
+
const ret = wasm.__wbg_get_quat_z(this.__wbg_ptr);
|
|
404
|
+
return ret;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @param {number} arg0
|
|
408
|
+
*/
|
|
409
|
+
set z(arg0) {
|
|
410
|
+
wasm.__wbg_set_quat_z(this.__wbg_ptr, arg0);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @returns {number}
|
|
414
|
+
*/
|
|
415
|
+
length_squared() {
|
|
416
|
+
const ret = wasm.vec3_length_squared(this.__wbg_ptr);
|
|
417
|
+
return ret;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* @param {Vec3} other
|
|
421
|
+
* @returns {Vec3}
|
|
422
|
+
*/
|
|
423
|
+
add(other) {
|
|
424
|
+
_assertClass(other, Vec3);
|
|
425
|
+
var ptr0 = other.__destroy_into_raw();
|
|
426
|
+
const ret = wasm.vec3_add(this.__wbg_ptr, ptr0);
|
|
427
|
+
return Vec3.__wrap(ret);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* @param {Vec3} other
|
|
431
|
+
* @returns {number}
|
|
432
|
+
*/
|
|
433
|
+
dot(other) {
|
|
434
|
+
_assertClass(other, Vec3);
|
|
435
|
+
var ptr0 = other.__destroy_into_raw();
|
|
436
|
+
const ret = wasm.vec3_dot(this.__wbg_ptr, ptr0);
|
|
437
|
+
return ret;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* @param {number} x
|
|
441
|
+
* @param {number} y
|
|
442
|
+
* @param {number} z
|
|
443
|
+
*/
|
|
444
|
+
constructor(x, y, z) {
|
|
445
|
+
const ret = wasm.vec3_new(x, y, z);
|
|
446
|
+
this.__wbg_ptr = ret >>> 0;
|
|
447
|
+
Vec3Finalization.register(this, this.__wbg_ptr, this);
|
|
448
|
+
return this;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* @param {number} x
|
|
452
|
+
* @param {number} y
|
|
453
|
+
* @param {number} z
|
|
454
|
+
* @returns {Vec3}
|
|
455
|
+
*/
|
|
456
|
+
set(x, y, z) {
|
|
457
|
+
const ret = wasm.vec3_set(this.__wbg_ptr, x, y, z);
|
|
458
|
+
return Vec3.__wrap(ret);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* @returns {Vec3}
|
|
462
|
+
*/
|
|
463
|
+
clone() {
|
|
464
|
+
const ret = wasm.vec3_clone(this.__wbg_ptr);
|
|
465
|
+
return Vec3.__wrap(ret);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* @param {Vec3} other
|
|
469
|
+
* @returns {Vec3}
|
|
470
|
+
*/
|
|
471
|
+
cross(other) {
|
|
472
|
+
_assertClass(other, Vec3);
|
|
473
|
+
var ptr0 = other.__destroy_into_raw();
|
|
474
|
+
const ret = wasm.vec3_cross(this.__wbg_ptr, ptr0);
|
|
475
|
+
return Vec3.__wrap(ret);
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* @param {number} scalar
|
|
479
|
+
* @returns {Vec3}
|
|
480
|
+
*/
|
|
481
|
+
scale(scalar) {
|
|
482
|
+
const ret = wasm.vec3_scale(this.__wbg_ptr, scalar);
|
|
483
|
+
return Vec3.__wrap(ret);
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* @returns {number}
|
|
487
|
+
*/
|
|
488
|
+
length() {
|
|
489
|
+
const ret = wasm.vec3_length(this.__wbg_ptr);
|
|
490
|
+
return ret;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* @param {Vec3} other
|
|
494
|
+
* @returns {Vec3}
|
|
495
|
+
*/
|
|
496
|
+
subtract(other) {
|
|
497
|
+
_assertClass(other, Vec3);
|
|
498
|
+
var ptr0 = other.__destroy_into_raw();
|
|
499
|
+
const ret = wasm.vec3_subtract(this.__wbg_ptr, ptr0);
|
|
500
|
+
return Vec3.__wrap(ret);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* @returns {Float32Array}
|
|
504
|
+
*/
|
|
505
|
+
to_array() {
|
|
506
|
+
const ret = wasm.vec3_to_array(this.__wbg_ptr);
|
|
507
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
508
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
509
|
+
return v1;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* @returns {Vec3}
|
|
513
|
+
*/
|
|
514
|
+
normalize() {
|
|
515
|
+
const ret = wasm.vec3_normalize(this.__wbg_ptr);
|
|
516
|
+
return Vec3.__wrap(ret);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
if (Symbol.dispose) Vec3.prototype[Symbol.dispose] = Vec3.prototype.free;
|
|
520
|
+
exports.Vec3 = Vec3;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @param {Vec3} a
|
|
524
|
+
* @param {Vec3} b
|
|
525
|
+
* @returns {Vec3}
|
|
526
|
+
*/
|
|
527
|
+
function cross(a, b) {
|
|
528
|
+
_assertClass(a, Vec3);
|
|
529
|
+
var ptr0 = a.__destroy_into_raw();
|
|
530
|
+
_assertClass(b, Vec3);
|
|
531
|
+
var ptr1 = b.__destroy_into_raw();
|
|
532
|
+
const ret = wasm.cross(ptr0, ptr1);
|
|
533
|
+
return Vec3.__wrap(ret);
|
|
534
|
+
}
|
|
535
|
+
exports.cross = cross;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @param {number} t
|
|
539
|
+
* @returns {number}
|
|
540
|
+
*/
|
|
541
|
+
function ease_in_out(t) {
|
|
542
|
+
const ret = wasm.ease_in_out(t);
|
|
543
|
+
return ret;
|
|
544
|
+
}
|
|
545
|
+
exports.ease_in_out = ease_in_out;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* @param {Vec3} start
|
|
549
|
+
* @param {Vec3} end
|
|
550
|
+
* @param {number} t
|
|
551
|
+
* @returns {Vec3}
|
|
552
|
+
*/
|
|
553
|
+
function lerp(start, end, t) {
|
|
554
|
+
_assertClass(start, Vec3);
|
|
555
|
+
var ptr0 = start.__destroy_into_raw();
|
|
556
|
+
_assertClass(end, Vec3);
|
|
557
|
+
var ptr1 = end.__destroy_into_raw();
|
|
558
|
+
const ret = wasm.lerp(ptr0, ptr1, t);
|
|
559
|
+
return Vec3.__wrap(ret);
|
|
560
|
+
}
|
|
561
|
+
exports.lerp = lerp;
|
|
562
|
+
|
|
563
|
+
exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
564
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
exports.__wbg_new_from_slice_41e2764a343e3cb1 = function(arg0, arg1) {
|
|
568
|
+
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
569
|
+
return ret;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
573
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
574
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
575
|
+
return ret;
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
exports.__wbindgen_init_externref_table = function() {
|
|
579
|
+
const table = wasm.__wbindgen_externrefs;
|
|
580
|
+
const offset = table.grow(4);
|
|
581
|
+
table.set(0, undefined);
|
|
582
|
+
table.set(offset + 0, undefined);
|
|
583
|
+
table.set(offset + 1, null);
|
|
584
|
+
table.set(offset + 2, true);
|
|
585
|
+
table.set(offset + 3, false);
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const wasmPath = `${__dirname}/math_rust_lib_bg.wasm`;
|
|
589
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
590
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
591
|
+
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
592
|
+
|
|
593
|
+
wasm.__wbindgen_start();
|
|
Binary file
|