math-rust-lib 0.1.2 → 0.2.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 +4 -0
- package/math_rust_lib.js +36 -0
- package/math_rust_lib_bg.wasm +0 -0
- package/package.json +1 -1
package/math_rust_lib.d.ts
CHANGED
|
@@ -6,13 +6,17 @@ export class Mat4 {
|
|
|
6
6
|
[Symbol.dispose](): void;
|
|
7
7
|
static from_values(val: Float32Array): Mat4;
|
|
8
8
|
static perspective(fov: number, aspect: number, near: number, far: number): Mat4;
|
|
9
|
+
get_position(): Vec3;
|
|
9
10
|
set_identity(): Mat4;
|
|
10
11
|
scale_in_place(sx: number, sy: number, sz: number): Mat4;
|
|
11
12
|
static to_quat_from_array(m: Float32Array, offset: number): Quat;
|
|
12
13
|
translate_in_place(tx: number, ty: number, tz: number): Mat4;
|
|
14
|
+
static from_position_rotation(position: Vec3, rotation: Quat): Mat4;
|
|
13
15
|
scale_in_place_by_vec3(scale: Vec3): Mat4;
|
|
16
|
+
static from_position_rotation_to_ref(position: Vec3, rotation: Quat, result: Mat4): void;
|
|
14
17
|
constructor(val: Float32Array);
|
|
15
18
|
set(val: Float32Array): void;
|
|
19
|
+
inverse(): Mat4;
|
|
16
20
|
static look_at(eye: Vec3, target: Vec3, up: Vec3): Mat4;
|
|
17
21
|
to_quat(): Quat;
|
|
18
22
|
static identity(): Mat4;
|
package/math_rust_lib.js
CHANGED
|
@@ -109,6 +109,13 @@ class Mat4 {
|
|
|
109
109
|
const ret = wasm.mat4_perspective(fov, aspect, near, far);
|
|
110
110
|
return Mat4.__wrap(ret);
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* @returns {Vec3}
|
|
114
|
+
*/
|
|
115
|
+
get_position() {
|
|
116
|
+
const ret = wasm.mat4_get_position(this.__wbg_ptr);
|
|
117
|
+
return Vec3.__wrap(ret);
|
|
118
|
+
}
|
|
112
119
|
/**
|
|
113
120
|
* @returns {Mat4}
|
|
114
121
|
*/
|
|
@@ -149,6 +156,17 @@ class Mat4 {
|
|
|
149
156
|
const ret = wasm.mat4_translate_in_place(ptr, tx, ty, tz);
|
|
150
157
|
return Mat4.__wrap(ret);
|
|
151
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* @param {Vec3} position
|
|
161
|
+
* @param {Quat} rotation
|
|
162
|
+
* @returns {Mat4}
|
|
163
|
+
*/
|
|
164
|
+
static from_position_rotation(position, rotation) {
|
|
165
|
+
_assertClass(position, Vec3);
|
|
166
|
+
_assertClass(rotation, Quat);
|
|
167
|
+
const ret = wasm.mat4_from_position_rotation(position.__wbg_ptr, rotation.__wbg_ptr);
|
|
168
|
+
return Mat4.__wrap(ret);
|
|
169
|
+
}
|
|
152
170
|
/**
|
|
153
171
|
* @param {Vec3} scale
|
|
154
172
|
* @returns {Mat4}
|
|
@@ -159,6 +177,17 @@ class Mat4 {
|
|
|
159
177
|
const ret = wasm.mat4_scale_in_place_by_vec3(this.__wbg_ptr, ptr0);
|
|
160
178
|
return Mat4.__wrap(ret);
|
|
161
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* @param {Vec3} position
|
|
182
|
+
* @param {Quat} rotation
|
|
183
|
+
* @param {Mat4} result
|
|
184
|
+
*/
|
|
185
|
+
static from_position_rotation_to_ref(position, rotation, result) {
|
|
186
|
+
_assertClass(position, Vec3);
|
|
187
|
+
_assertClass(rotation, Quat);
|
|
188
|
+
_assertClass(result, Mat4);
|
|
189
|
+
wasm.mat4_from_position_rotation_to_ref(position.__wbg_ptr, rotation.__wbg_ptr, result.__wbg_ptr);
|
|
190
|
+
}
|
|
162
191
|
/**
|
|
163
192
|
* @param {Float32Array} val
|
|
164
193
|
*/
|
|
@@ -186,6 +215,13 @@ class Mat4 {
|
|
|
186
215
|
const ret = wasm.mat4_values(this.__wbg_ptr);
|
|
187
216
|
return ret;
|
|
188
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* @returns {Mat4}
|
|
220
|
+
*/
|
|
221
|
+
inverse() {
|
|
222
|
+
const ret = wasm.mat4_inverse(this.__wbg_ptr);
|
|
223
|
+
return Mat4.__wrap(ret);
|
|
224
|
+
}
|
|
189
225
|
/**
|
|
190
226
|
* @param {Vec3} eye
|
|
191
227
|
* @param {Vec3} target
|
package/math_rust_lib_bg.wasm
CHANGED
|
Binary file
|