@woosh/meep-engine 2.92.23 → 2.93.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/build/meep.cjs +99 -129
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +99 -129
- package/package.json +6 -4
- package/src/core/geom/Quaternion.d.ts +29 -14
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +63 -99
- package/src/core/math/spline/spline_hermite3.d.ts +4 -3
- package/src/core/math/spline/spline_hermite3.d.ts.map +1 -1
- package/src/core/math/spline/spline_hermite3.js +4 -3
- package/src/engine/animation/clip/AnimationClip.d.ts +4 -0
- package/src/engine/animation/clip/AnimationClip.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationClip.js +23 -0
- package/src/engine/animation/clip/AnimationClipBinding.d.ts +14 -0
- package/src/engine/animation/clip/AnimationClipBinding.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationClipBinding.js +94 -0
- package/src/engine/animation/clip/AnimationTrack.d.ts +45 -0
- package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationTrack.js +83 -0
- package/src/engine/animation/clip/AnimationTrackBinding.d.ts +25 -0
- package/src/engine/animation/clip/AnimationTrackBinding.d.ts.map +1 -0
- package/src/engine/animation/clip/AnimationTrackBinding.js +42 -0
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts +9 -0
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -0
- package/src/engine/animation/{curve → clip}/ecd_bind_animation_curve.js +28 -20
- package/src/engine/animation/curve/AnimationCurve.d.ts +31 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +81 -23
- package/src/engine/animation/curve/AnimationCurve.spec.js +37 -2
- package/src/engine/animation/curve/Keyframe.d.ts +8 -0
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +53 -44
- package/src/engine/animation/curve/Keyframe.spec.d.ts +2 -0
- package/src/engine/animation/curve/Keyframe.spec.d.ts.map +1 -0
- package/src/engine/animation/curve/Keyframe.spec.js +31 -0
- package/src/engine/animation/curve/binding/BoundQuaternionWriter.d.ts.map +1 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.d.ts +14 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.d.ts.map +1 -0
- package/src/engine/animation/curve/binding/BoundValueWriter.js +19 -0
- package/src/engine/animation/curve/binding/BoundVector3Writer.d.ts.map +1 -0
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.d.ts +2 -2
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +5 -3
- package/src/engine/animation/curve/EntityNodeAnimationClip.d.ts +0 -4
- package/src/engine/animation/curve/EntityNodeAnimationClip.d.ts.map +0 -1
- package/src/engine/animation/curve/EntityNodeAnimationClip.js +0 -24
- package/src/engine/animation/curve/ecd_bind_animation_curve.d.ts +0 -8
- package/src/engine/animation/curve/ecd_bind_animation_curve.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.d.ts +0 -27
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.js +0 -61
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.d.ts +0 -8
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.js +0 -10
- package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.d.ts.map +0 -1
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundQuaternionWriter.d.ts +0 -0
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundQuaternionWriter.js +0 -0
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundVector3Writer.d.ts +0 -0
- /package/src/engine/{graphics/ecs/mesh-v2/aggregate/animation → animation/curve/binding}/BoundVector3Writer.js +0 -0
package/build/meep.module.js
CHANGED
|
@@ -3143,6 +3143,9 @@ const forward = new Vector3$1();
|
|
|
3143
3143
|
const up = new Vector3$1();
|
|
3144
3144
|
const right = new Vector3$1();
|
|
3145
3145
|
|
|
3146
|
+
const sin$1 = Math.sin;
|
|
3147
|
+
const cos$1 = Math.cos;
|
|
3148
|
+
|
|
3146
3149
|
let Quaternion$1 = class Quaternion {
|
|
3147
3150
|
/**
|
|
3148
3151
|
*
|
|
@@ -3178,6 +3181,8 @@ let Quaternion$1 = class Quaternion {
|
|
|
3178
3181
|
this.onChanged = new Signal();
|
|
3179
3182
|
}
|
|
3180
3183
|
|
|
3184
|
+
// Making Quaternion comply to array interface
|
|
3185
|
+
|
|
3181
3186
|
get 0() {
|
|
3182
3187
|
return this.x;
|
|
3183
3188
|
}
|
|
@@ -3210,6 +3215,19 @@ let Quaternion$1 = class Quaternion {
|
|
|
3210
3215
|
this.w = v;
|
|
3211
3216
|
}
|
|
3212
3217
|
|
|
3218
|
+
/**
|
|
3219
|
+
* Making quaternion iterable
|
|
3220
|
+
*/
|
|
3221
|
+
* [Symbol.iterator]() {
|
|
3222
|
+
|
|
3223
|
+
yield this.x;
|
|
3224
|
+
yield this.y;
|
|
3225
|
+
yield this.z;
|
|
3226
|
+
yield this.w;
|
|
3227
|
+
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
|
|
3213
3231
|
/**
|
|
3214
3232
|
*
|
|
3215
3233
|
* @param {number} fx forward vector
|
|
@@ -3250,58 +3268,22 @@ let Quaternion$1 = class Quaternion {
|
|
|
3250
3268
|
|
|
3251
3269
|
// construct partial transform matrix
|
|
3252
3270
|
const m00 = right.x;
|
|
3253
|
-
const
|
|
3254
|
-
const
|
|
3255
|
-
const m10 = up.x;
|
|
3256
|
-
const m11 = up.y;
|
|
3257
|
-
const m12 = up.z;
|
|
3258
|
-
const m20 = forward.x;
|
|
3259
|
-
const m21 = forward.y;
|
|
3260
|
-
const m22 = forward.z;
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
const num8 = (m00 + m11) + m22;
|
|
3264
|
-
|
|
3265
|
-
let _x, _y, _z, _w;
|
|
3266
|
-
|
|
3267
|
-
if (num8 > 0) {
|
|
3268
|
-
let num = Math.sqrt(num8 + 1);
|
|
3269
|
-
_w = num * 0.5;
|
|
3270
|
-
num = 0.5 / num;
|
|
3271
|
-
_x = (m12 - m21) * num;
|
|
3272
|
-
_y = (m20 - m02) * num;
|
|
3273
|
-
_z = (m01 - m10) * num;
|
|
3274
|
-
} else if ((m00 >= m11) && (m00 >= m22)) {
|
|
3275
|
-
|
|
3276
|
-
const num7 = Math.sqrt(((1 + m00) - m11) - m22);
|
|
3277
|
-
const num4 = 0.5 / num7;
|
|
3278
|
-
|
|
3279
|
-
_x = 0.5 * num7;
|
|
3280
|
-
_y = (m01 + m10) * num4;
|
|
3281
|
-
_z = (m02 + m20) * num4;
|
|
3282
|
-
_w = (m12 - m21) * num4;
|
|
3283
|
-
|
|
3284
|
-
} else if (m11 > m22) {
|
|
3271
|
+
const m10 = right.y;
|
|
3272
|
+
const m20 = right.z;
|
|
3285
3273
|
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
_x = (m10 + m01) * num3;
|
|
3290
|
-
_y = 0.5 * num6;
|
|
3291
|
-
_z = (m21 + m12) * num3;
|
|
3292
|
-
_w = (m20 - m02) * num3;
|
|
3293
|
-
} else {
|
|
3294
|
-
|
|
3295
|
-
const num5 = Math.sqrt(((1 + m22) - m00) - m11);
|
|
3296
|
-
const num2 = 0.5 / num5;
|
|
3274
|
+
const m01 = up.x;
|
|
3275
|
+
const m11 = up.y;
|
|
3276
|
+
const m21 = up.z;
|
|
3297
3277
|
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
_w = (m01 - m10) * num2;
|
|
3302
|
-
}
|
|
3278
|
+
const m02 = forward.x;
|
|
3279
|
+
const m12 = forward.y;
|
|
3280
|
+
const m22 = forward.z;
|
|
3303
3281
|
|
|
3304
|
-
this.
|
|
3282
|
+
this.__setFromRotationMatrix(
|
|
3283
|
+
m00, m01, m02,
|
|
3284
|
+
m10, m11, m12,
|
|
3285
|
+
m20, m21, m22
|
|
3286
|
+
);
|
|
3305
3287
|
}
|
|
3306
3288
|
|
|
3307
3289
|
/**
|
|
@@ -3309,13 +3291,24 @@ let Quaternion$1 = class Quaternion {
|
|
|
3309
3291
|
* @param {Vector3} vForward
|
|
3310
3292
|
* @param {Vector3} [vUp=Vector3.up]
|
|
3311
3293
|
*
|
|
3312
|
-
* @source http://answers.unity3d.com/questions/467614/what-is-the-source-code-of-quaternionlookrotation.html
|
|
3313
3294
|
*/
|
|
3314
3295
|
lookRotation(vForward, vUp = Vector3$1.up) {
|
|
3315
3296
|
|
|
3316
3297
|
this._lookRotation(vForward.x, vForward.y, vForward.z, vUp.x, vUp.y, vUp.z);
|
|
3317
3298
|
}
|
|
3318
3299
|
|
|
3300
|
+
/**
|
|
3301
|
+
*
|
|
3302
|
+
* @param {Quaternion} other
|
|
3303
|
+
* @return {number}
|
|
3304
|
+
*/
|
|
3305
|
+
dot(other) {
|
|
3306
|
+
return this.x * other.x
|
|
3307
|
+
+ this.y * other.y
|
|
3308
|
+
+ this.z * other.z
|
|
3309
|
+
+ this.w * other.w
|
|
3310
|
+
;
|
|
3311
|
+
}
|
|
3319
3312
|
|
|
3320
3313
|
/**
|
|
3321
3314
|
*
|
|
@@ -3335,14 +3328,14 @@ let Quaternion$1 = class Quaternion {
|
|
|
3335
3328
|
const z = this.z;
|
|
3336
3329
|
const w = this.w;
|
|
3337
3330
|
|
|
3338
|
-
const
|
|
3331
|
+
const length_sqr = x * x + y * y + z * z + w * w;
|
|
3339
3332
|
|
|
3340
|
-
if (
|
|
3333
|
+
if (length_sqr === 0) {
|
|
3341
3334
|
this.set(0, 0, 0, 0);
|
|
3342
3335
|
return;
|
|
3343
3336
|
}
|
|
3344
3337
|
|
|
3345
|
-
const invDot = 1.0 /
|
|
3338
|
+
const invDot = 1.0 / length_sqr;
|
|
3346
3339
|
|
|
3347
3340
|
const _x = -x * invDot;
|
|
3348
3341
|
const _y = -y * invDot;
|
|
@@ -3396,8 +3389,8 @@ let Quaternion$1 = class Quaternion {
|
|
|
3396
3389
|
_fromAxisAngle(ax, ay, az, angle) {
|
|
3397
3390
|
const halfAngle = angle * 0.5;
|
|
3398
3391
|
|
|
3399
|
-
const sinA2 =
|
|
3400
|
-
const cosA2 =
|
|
3392
|
+
const sinA2 = sin$1(halfAngle);
|
|
3393
|
+
const cosA2 = cos$1(halfAngle);
|
|
3401
3394
|
|
|
3402
3395
|
const qx = ax * sinA2;
|
|
3403
3396
|
const qy = ay * sinA2;
|
|
@@ -3478,7 +3471,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3478
3471
|
toAxisAngle(axis) {
|
|
3479
3472
|
const rad = Math.acos(this.w) * 2.0;
|
|
3480
3473
|
|
|
3481
|
-
const s =
|
|
3474
|
+
const s = sin$1(rad * 0.5);
|
|
3482
3475
|
|
|
3483
3476
|
if (Math.abs(s) > EPSILON) {
|
|
3484
3477
|
axis.set(
|
|
@@ -3521,7 +3514,6 @@ let Quaternion$1 = class Quaternion {
|
|
|
3521
3514
|
}
|
|
3522
3515
|
|
|
3523
3516
|
/**
|
|
3524
|
-
* @see http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
|
|
3525
3517
|
* @param {Quaternion} other
|
|
3526
3518
|
*/
|
|
3527
3519
|
multiply(other) {
|
|
@@ -3561,6 +3553,8 @@ let Quaternion$1 = class Quaternion {
|
|
|
3561
3553
|
*/
|
|
3562
3554
|
_multiplyQuaternions(ax, ay, az, aw, bx, by, bz, bw) {
|
|
3563
3555
|
|
|
3556
|
+
// see http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
|
|
3557
|
+
|
|
3564
3558
|
const x = ax * bw + aw * bx + ay * bz - az * by;
|
|
3565
3559
|
const y = ay * bw + aw * by + az * bx - ax * bz;
|
|
3566
3560
|
const z = az * bw + aw * bz + ax * by - ay * bx;
|
|
@@ -3650,7 +3644,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3650
3644
|
* @param {number} x
|
|
3651
3645
|
* @param {number} y
|
|
3652
3646
|
* @param {number} z
|
|
3653
|
-
* @param {String} order a combination of capital letters X,Y,Z. Examples: XYZ, YXZ
|
|
3647
|
+
* @param {String} [order] a combination of capital letters X,Y,Z. Examples: XYZ, YXZ
|
|
3654
3648
|
* @returns {Quaternion}
|
|
3655
3649
|
*/
|
|
3656
3650
|
__setFromEuler(x, y, z, order = 'XYZ') {
|
|
@@ -3681,6 +3675,8 @@ let Quaternion$1 = class Quaternion {
|
|
|
3681
3675
|
|
|
3682
3676
|
this.fromEulerAnglesXZY(x, y, z);
|
|
3683
3677
|
|
|
3678
|
+
} else {
|
|
3679
|
+
throw new Error(`Invalid order '${order}', bust be 3 capital letters consisting of X,Y and Z`);
|
|
3684
3680
|
}
|
|
3685
3681
|
|
|
3686
3682
|
return this;
|
|
@@ -3805,16 +3801,13 @@ let Quaternion$1 = class Quaternion {
|
|
|
3805
3801
|
const half_y = y * 0.5;
|
|
3806
3802
|
const half_z = z * 0.5;
|
|
3807
3803
|
|
|
3808
|
-
const
|
|
3809
|
-
const
|
|
3804
|
+
const s1 = sin$1(half_x);
|
|
3805
|
+
const s2 = sin$1(half_y);
|
|
3806
|
+
const s3 = sin$1(half_z);
|
|
3810
3807
|
|
|
3811
|
-
const
|
|
3812
|
-
const
|
|
3813
|
-
const
|
|
3814
|
-
|
|
3815
|
-
const c1 = cos(half_x);
|
|
3816
|
-
const c2 = cos(half_y);
|
|
3817
|
-
const c3 = cos(half_z);
|
|
3808
|
+
const c1 = cos$1(half_x);
|
|
3809
|
+
const c2 = cos$1(half_y);
|
|
3810
|
+
const c3 = cos$1(half_z);
|
|
3818
3811
|
|
|
3819
3812
|
const _x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
3820
3813
|
const _y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
@@ -3838,16 +3831,13 @@ let Quaternion$1 = class Quaternion {
|
|
|
3838
3831
|
const scaled_y = y * 0.5;
|
|
3839
3832
|
const scaled_z = z * 0.5;
|
|
3840
3833
|
|
|
3841
|
-
const
|
|
3842
|
-
const
|
|
3843
|
-
|
|
3844
|
-
const s1 = sin(scaled_x);
|
|
3845
|
-
const s2 = sin(scaled_y);
|
|
3846
|
-
const s3 = sin(scaled_z);
|
|
3834
|
+
const s1 = sin$1(scaled_x);
|
|
3835
|
+
const s2 = sin$1(scaled_y);
|
|
3836
|
+
const s3 = sin$1(scaled_z);
|
|
3847
3837
|
|
|
3848
|
-
const c1 = cos(scaled_x);
|
|
3849
|
-
const c2 = cos(scaled_y);
|
|
3850
|
-
const c3 = cos(scaled_z);
|
|
3838
|
+
const c1 = cos$1(scaled_x);
|
|
3839
|
+
const c2 = cos$1(scaled_y);
|
|
3840
|
+
const c3 = cos$1(scaled_z);
|
|
3851
3841
|
|
|
3852
3842
|
const _x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
3853
3843
|
const _y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
@@ -3871,16 +3861,13 @@ let Quaternion$1 = class Quaternion {
|
|
|
3871
3861
|
const scaled_y = y * 0.5;
|
|
3872
3862
|
const scaled_z = z * 0.5;
|
|
3873
3863
|
|
|
3874
|
-
const
|
|
3875
|
-
const
|
|
3876
|
-
|
|
3877
|
-
const s1 = sin(scaled_x);
|
|
3878
|
-
const s2 = sin(scaled_y);
|
|
3879
|
-
const s3 = sin(scaled_z);
|
|
3864
|
+
const s1 = sin$1(scaled_x);
|
|
3865
|
+
const s2 = sin$1(scaled_y);
|
|
3866
|
+
const s3 = sin$1(scaled_z);
|
|
3880
3867
|
|
|
3881
|
-
const c1 = cos(scaled_x);
|
|
3882
|
-
const c2 = cos(scaled_y);
|
|
3883
|
-
const c3 = cos(scaled_z);
|
|
3868
|
+
const c1 = cos$1(scaled_x);
|
|
3869
|
+
const c2 = cos$1(scaled_y);
|
|
3870
|
+
const c3 = cos$1(scaled_z);
|
|
3884
3871
|
|
|
3885
3872
|
const _x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
3886
3873
|
const _y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
@@ -3904,16 +3891,13 @@ let Quaternion$1 = class Quaternion {
|
|
|
3904
3891
|
const scaled_y = y * 0.5;
|
|
3905
3892
|
const scaled_z = z * 0.5;
|
|
3906
3893
|
|
|
3907
|
-
const
|
|
3908
|
-
const
|
|
3894
|
+
const s1 = sin$1(scaled_x);
|
|
3895
|
+
const s2 = sin$1(scaled_y);
|
|
3896
|
+
const s3 = sin$1(scaled_z);
|
|
3909
3897
|
|
|
3910
|
-
const
|
|
3911
|
-
const
|
|
3912
|
-
const
|
|
3913
|
-
|
|
3914
|
-
const c1 = cos(scaled_x);
|
|
3915
|
-
const c2 = cos(scaled_y);
|
|
3916
|
-
const c3 = cos(scaled_z);
|
|
3898
|
+
const c1 = cos$1(scaled_x);
|
|
3899
|
+
const c2 = cos$1(scaled_y);
|
|
3900
|
+
const c3 = cos$1(scaled_z);
|
|
3917
3901
|
|
|
3918
3902
|
const _x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
3919
3903
|
const _y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
@@ -3937,16 +3921,13 @@ let Quaternion$1 = class Quaternion {
|
|
|
3937
3921
|
const scaled_y = y * 0.5;
|
|
3938
3922
|
const scaled_z = z * 0.5;
|
|
3939
3923
|
|
|
3940
|
-
const
|
|
3941
|
-
const
|
|
3942
|
-
|
|
3943
|
-
const s1 = sin(scaled_x);
|
|
3944
|
-
const s2 = sin(scaled_y);
|
|
3945
|
-
const s3 = sin(scaled_z);
|
|
3924
|
+
const s1 = sin$1(scaled_x);
|
|
3925
|
+
const s2 = sin$1(scaled_y);
|
|
3926
|
+
const s3 = sin$1(scaled_z);
|
|
3946
3927
|
|
|
3947
|
-
const c1 = cos(scaled_x);
|
|
3948
|
-
const c2 = cos(scaled_y);
|
|
3949
|
-
const c3 = cos(scaled_z);
|
|
3928
|
+
const c1 = cos$1(scaled_x);
|
|
3929
|
+
const c2 = cos$1(scaled_y);
|
|
3930
|
+
const c3 = cos$1(scaled_z);
|
|
3950
3931
|
|
|
3951
3932
|
const _x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
3952
3933
|
const _y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
@@ -3970,16 +3951,13 @@ let Quaternion$1 = class Quaternion {
|
|
|
3970
3951
|
const scaled_y = y * 0.5;
|
|
3971
3952
|
const scaled_z = z * 0.5;
|
|
3972
3953
|
|
|
3973
|
-
const
|
|
3974
|
-
const
|
|
3954
|
+
const s1 = sin$1(scaled_x);
|
|
3955
|
+
const s2 = sin$1(scaled_y);
|
|
3956
|
+
const s3 = sin$1(scaled_z);
|
|
3975
3957
|
|
|
3976
|
-
const
|
|
3977
|
-
const
|
|
3978
|
-
const
|
|
3979
|
-
|
|
3980
|
-
const c1 = cos(scaled_x);
|
|
3981
|
-
const c2 = cos(scaled_y);
|
|
3982
|
-
const c3 = cos(scaled_z);
|
|
3958
|
+
const c1 = cos$1(scaled_x);
|
|
3959
|
+
const c2 = cos$1(scaled_y);
|
|
3960
|
+
const c3 = cos$1(scaled_z);
|
|
3983
3961
|
|
|
3984
3962
|
const _x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
3985
3963
|
const _y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
@@ -4153,7 +4131,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
4153
4131
|
}
|
|
4154
4132
|
|
|
4155
4133
|
/**
|
|
4156
|
-
*
|
|
4134
|
+
* @deprecated
|
|
4157
4135
|
* @param {Matrix4} m
|
|
4158
4136
|
*/
|
|
4159
4137
|
setFromRotationMatrix(m) {
|
|
@@ -4309,9 +4287,9 @@ let Quaternion$1 = class Quaternion {
|
|
|
4309
4287
|
if ((1.0 - cosom) > EPSILON) {
|
|
4310
4288
|
// standard case (slerp)
|
|
4311
4289
|
omega = Math.acos(cosom);
|
|
4312
|
-
sinom =
|
|
4313
|
-
scale0 =
|
|
4314
|
-
scale1 =
|
|
4290
|
+
sinom = sin$1(omega);
|
|
4291
|
+
scale0 = sin$1((1.0 - t) * omega) / sinom;
|
|
4292
|
+
scale1 = sin$1(t * omega) / sinom;
|
|
4315
4293
|
} else {
|
|
4316
4294
|
// "from" and "to" quaternions are very close
|
|
4317
4295
|
// ... so we can do a linear interpolation
|
|
@@ -4567,15 +4545,6 @@ let Quaternion$1 = class Quaternion {
|
|
|
4567
4545
|
&& epsilonEquals(this.w, w, tolerance);
|
|
4568
4546
|
}
|
|
4569
4547
|
|
|
4570
|
-
* [Symbol.iterator]() {
|
|
4571
|
-
|
|
4572
|
-
yield this.x;
|
|
4573
|
-
yield this.y;
|
|
4574
|
-
yield this.z;
|
|
4575
|
-
yield this.w;
|
|
4576
|
-
|
|
4577
|
-
}
|
|
4578
|
-
|
|
4579
4548
|
/**
|
|
4580
4549
|
* Based on http://planning.cs.uiuc.edu/node198.html
|
|
4581
4550
|
* @param {function():number} [random]
|
|
@@ -4592,10 +4561,10 @@ let Quaternion$1 = class Quaternion {
|
|
|
4592
4561
|
const u3 = 2 * Math.PI * random();
|
|
4593
4562
|
|
|
4594
4563
|
return this.set(
|
|
4595
|
-
sqrt1u1 *
|
|
4596
|
-
sqrtu1 *
|
|
4597
|
-
sqrtu1 *
|
|
4598
|
-
sqrt1u1 *
|
|
4564
|
+
sqrt1u1 * cos$1(u2),
|
|
4565
|
+
sqrtu1 * sin$1(u3),
|
|
4566
|
+
sqrtu1 * cos$1(u3),
|
|
4567
|
+
sqrt1u1 * sin$1(u2),
|
|
4599
4568
|
);
|
|
4600
4569
|
}
|
|
4601
4570
|
|
|
@@ -4643,6 +4612,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
4643
4612
|
const angle = from.angleTo(to);
|
|
4644
4613
|
|
|
4645
4614
|
if (angle === 0) {
|
|
4615
|
+
// we're already where we need tobe. Also - avoid division by 0
|
|
4646
4616
|
result.copy(to);
|
|
4647
4617
|
} else {
|
|
4648
4618
|
// clamp to 1, to make sure we don't overshoot
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Fully featured ECS game engine written in JavaScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.93.1",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -37,9 +37,6 @@
|
|
|
37
37
|
"package.json",
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
|
-
"optionalDependencies": {
|
|
41
|
-
"three": "0.136.0"
|
|
42
|
-
},
|
|
43
40
|
"dependencies": {
|
|
44
41
|
"fastest-levenshtein": "1.0.16",
|
|
45
42
|
"gl-matrix": "3.4.3",
|
|
@@ -51,6 +48,11 @@
|
|
|
51
48
|
"peerDependencies": {
|
|
52
49
|
"three": ">=0.135.0"
|
|
53
50
|
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"three": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@babel/core": "7.22.15",
|
|
56
58
|
"@babel/preset-env": "7.22.15",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import {Matrix4} from "three";
|
|
1
2
|
import Signal from "../events/signal/Signal";
|
|
2
|
-
import {Matrix4, Quaternion as ThreeQuaternion} from "three";
|
|
3
3
|
import Vector3 from "./Vector3";
|
|
4
4
|
|
|
5
5
|
interface Vector3Like {
|
|
@@ -8,11 +8,18 @@ interface Vector3Like {
|
|
|
8
8
|
z: number
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
interface QuaternionLike {
|
|
12
|
+
x: number
|
|
13
|
+
y: number
|
|
14
|
+
z: number
|
|
15
|
+
w: number
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
export default class Quaternion {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
x: number
|
|
20
|
+
y: number
|
|
21
|
+
z: number
|
|
22
|
+
w: number
|
|
16
23
|
|
|
17
24
|
0: number
|
|
18
25
|
1: number
|
|
@@ -23,13 +30,11 @@ export default class Quaternion {
|
|
|
23
30
|
|
|
24
31
|
set(x: number, y: number, z: number, w: number): void
|
|
25
32
|
|
|
26
|
-
copy(other:
|
|
27
|
-
copy(other: ThreeQuaternion): void
|
|
28
|
-
copy(other: { x: number, y: number, z: number, w: number }): void
|
|
33
|
+
copy(other: QuaternionLike): void
|
|
29
34
|
|
|
30
35
|
clone(): Quaternion
|
|
31
36
|
|
|
32
|
-
random(random?:()=>number):void
|
|
37
|
+
random(random?: () => number): void
|
|
33
38
|
|
|
34
39
|
equals(other: { x: number, y: number, z: number, w: number }): boolean
|
|
35
40
|
|
|
@@ -39,10 +44,22 @@ export default class Quaternion {
|
|
|
39
44
|
|
|
40
45
|
normalize(): void
|
|
41
46
|
|
|
42
|
-
length():number
|
|
47
|
+
length(): number
|
|
43
48
|
|
|
44
49
|
__setFromEuler(x: number, y: number, z: number, order?: string): void
|
|
45
50
|
|
|
51
|
+
fromEulerAnglesXYZ(x: number, y: number, z: number): void
|
|
52
|
+
|
|
53
|
+
fromEulerAnglesYXZ(y: number, x: number, z: number): void
|
|
54
|
+
|
|
55
|
+
fromEulerAnglesZXY(z: number, x: number, y: number): void
|
|
56
|
+
|
|
57
|
+
fromEulerAnglesZYX(z: number, y: number, x: number): void
|
|
58
|
+
|
|
59
|
+
fromEulerAnglesYZX(y: number, z: number, x: number): void
|
|
60
|
+
|
|
61
|
+
fromEulerAnglesXZY(x: number, z: number, y: number): void
|
|
62
|
+
|
|
46
63
|
setFromRotationMatrix(m: Matrix4): void
|
|
47
64
|
|
|
48
65
|
setRotationMatrix(matrix: ArrayLike<number>): void
|
|
@@ -57,11 +74,9 @@ export default class Quaternion {
|
|
|
57
74
|
|
|
58
75
|
toEulerAnglesXYZ(v3: { set(x: number, y: number, z: number): any }): void
|
|
59
76
|
|
|
60
|
-
fromEulerAnglesXYZ(x: number, y: number, z: number): void
|
|
61
|
-
|
|
62
77
|
fromAxisAngle(axis: Vector3Like, angle: number): void
|
|
63
78
|
|
|
64
|
-
toAxisAngle(axis: Vector3):number
|
|
79
|
+
toAxisAngle(axis: Vector3): number
|
|
65
80
|
|
|
66
81
|
computeTwistAngle(axis: Vector3Like): number
|
|
67
82
|
|
|
@@ -79,5 +94,5 @@ export default class Quaternion {
|
|
|
79
94
|
|
|
80
95
|
asArray(): number[]
|
|
81
96
|
|
|
82
|
-
static readonly identity:Quaternion
|
|
97
|
+
static readonly identity: Quaternion
|
|
83
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Quaternion.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Quaternion.js"],"names":[],"mappings":";AA0BA;IAk7CI;;;;OAIG;IACH,kCAFa,UAAU,CAQtB;IAED;;;;;;OAMG;IACH,0BALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,UAAU,CAQtB;IAED;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