math-rust-lib 0.1.1 → 0.1.3

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.
@@ -10,7 +10,9 @@ export class Mat4 {
10
10
  scale_in_place(sx: number, sy: number, sz: number): Mat4;
11
11
  static to_quat_from_array(m: Float32Array, offset: number): Quat;
12
12
  translate_in_place(tx: number, ty: number, tz: number): Mat4;
13
+ static from_position_rotation(position: Vec3, rotation: Quat): Mat4;
13
14
  scale_in_place_by_vec3(scale: Vec3): Mat4;
15
+ static from_position_rotation_to_ref(position: Vec3, rotation: Quat, result: Mat4): void;
14
16
  constructor(val: Float32Array);
15
17
  set(val: Float32Array): void;
16
18
  static look_at(eye: Vec3, target: Vec3, up: Vec3): Mat4;
@@ -31,11 +33,12 @@ export class Quat {
31
33
  static rotation_yaw_pitch_roll(yaw: number, pitch: number, roll: number): Quat;
32
34
  static from_unit_vectors_to_ref(vec_from: Vec3, vec_to: Vec3, result: Quat, epsilon: number): Quat;
33
35
  constructor(x: number, y: number, z: number, w: number);
34
- set(x: number, y: number, z: number): Quat;
36
+ set(x: number, y: number, z: number, w: number): Quat;
35
37
  clone(): Quat;
36
38
  static slerp(a: Quat, b: Quat, t: number): Quat;
37
39
  static identity(): Quat;
38
40
  multiply(other: Quat): Quat;
41
+ to_array(): Float32Array;
39
42
  normalize(): Quat;
40
43
  x: number;
41
44
  y: number;
package/math_rust_lib.js CHANGED
@@ -149,6 +149,17 @@ class Mat4 {
149
149
  const ret = wasm.mat4_translate_in_place(ptr, tx, ty, tz);
150
150
  return Mat4.__wrap(ret);
151
151
  }
152
+ /**
153
+ * @param {Vec3} position
154
+ * @param {Quat} rotation
155
+ * @returns {Mat4}
156
+ */
157
+ static from_position_rotation(position, rotation) {
158
+ _assertClass(position, Vec3);
159
+ _assertClass(rotation, Quat);
160
+ const ret = wasm.mat4_from_position_rotation(position.__wbg_ptr, rotation.__wbg_ptr);
161
+ return Mat4.__wrap(ret);
162
+ }
152
163
  /**
153
164
  * @param {Vec3} scale
154
165
  * @returns {Mat4}
@@ -159,6 +170,17 @@ class Mat4 {
159
170
  const ret = wasm.mat4_scale_in_place_by_vec3(this.__wbg_ptr, ptr0);
160
171
  return Mat4.__wrap(ret);
161
172
  }
173
+ /**
174
+ * @param {Vec3} position
175
+ * @param {Quat} rotation
176
+ * @param {Mat4} result
177
+ */
178
+ static from_position_rotation_to_ref(position, rotation, result) {
179
+ _assertClass(position, Vec3);
180
+ _assertClass(rotation, Quat);
181
+ _assertClass(result, Mat4);
182
+ wasm.mat4_from_position_rotation_to_ref(position.__wbg_ptr, rotation.__wbg_ptr, result.__wbg_ptr);
183
+ }
162
184
  /**
163
185
  * @param {Float32Array} val
164
186
  */
@@ -391,11 +413,12 @@ class Quat {
391
413
  * @param {number} x
392
414
  * @param {number} y
393
415
  * @param {number} z
416
+ * @param {number} w
394
417
  * @returns {Quat}
395
418
  */
396
- set(x, y, z) {
419
+ set(x, y, z, w) {
397
420
  const ptr = this.__destroy_into_raw();
398
- const ret = wasm.quat_set(ptr, x, y, z);
421
+ const ret = wasm.quat_set(ptr, x, y, z, w);
399
422
  return Quat.__wrap(ret);
400
423
  }
401
424
  /**
@@ -434,6 +457,15 @@ class Quat {
434
457
  const ret = wasm.quat_multiply(this.__wbg_ptr, ptr0);
435
458
  return Quat.__wrap(ret);
436
459
  }
460
+ /**
461
+ * @returns {Float32Array}
462
+ */
463
+ to_array() {
464
+ const ret = wasm.quat_to_array(this.__wbg_ptr);
465
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
466
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
467
+ return v1;
468
+ }
437
469
  /**
438
470
  * @returns {Quat}
439
471
  */
Binary file
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "math-rust-lib",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/GOH23/math-rust-lib"
8
+ },
4
9
  "files": [
5
10
  "math_rust_lib_bg.wasm",
6
11
  "math_rust_lib.js",