@babylonjs/core 5.43.2 → 5.45.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/Audio/sound.d.ts +0 -1
- package/Audio/sound.js +10 -10
- package/Audio/sound.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +7 -0
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Culling/ray.js +8 -2
- package/Culling/ray.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/engine.js +11 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.js +3 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +1 -0
- package/Inputs/scene.inputManager.js +8 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +3 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -0
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/ktx2decoderTypes.d.ts +215 -0
- package/Materials/Textures/ktx2decoderTypes.js +35 -0
- package/Materials/Textures/ktx2decoderTypes.js.map +1 -0
- package/Materials/Textures/texture.d.ts +1 -1
- package/Materials/Textures/texture.js.map +1 -1
- package/Maths/math.vector.js +155 -120
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/mesh.js +9 -0
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.d.ts +9 -1
- package/Meshes/transformNode.js +22 -7
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/khronosTextureContainer2.d.ts +68 -2
- package/Misc/khronosTextureContainer2.js +149 -1
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +2 -0
- package/Morph/morphTargetManager.js +8 -0
- package/Morph/morphTargetManager.js.map +1 -1
- package/assetContainer.d.ts +16 -1
- package/assetContainer.js +198 -41
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
package/Maths/math.vector.js
CHANGED
|
@@ -879,9 +879,10 @@ export class Vector3 {
|
|
|
879
879
|
* @returns the current updated Vector3
|
|
880
880
|
*/
|
|
881
881
|
addInPlaceFromFloats(x, y, z) {
|
|
882
|
-
this.
|
|
883
|
-
this.
|
|
884
|
-
this.
|
|
882
|
+
this._x += x;
|
|
883
|
+
this._y += y;
|
|
884
|
+
this._z += z;
|
|
885
|
+
this._isDirty = true;
|
|
885
886
|
return this;
|
|
886
887
|
}
|
|
887
888
|
/**
|
|
@@ -910,9 +911,10 @@ export class Vector3 {
|
|
|
910
911
|
* @returns the current updated Vector3
|
|
911
912
|
*/
|
|
912
913
|
subtractInPlace(otherVector) {
|
|
913
|
-
this.
|
|
914
|
-
this.
|
|
915
|
-
this.
|
|
914
|
+
this._x -= otherVector._x;
|
|
915
|
+
this._y -= otherVector._y;
|
|
916
|
+
this._z -= otherVector._z;
|
|
917
|
+
this._isDirty = true;
|
|
916
918
|
return this;
|
|
917
919
|
}
|
|
918
920
|
/**
|
|
@@ -971,9 +973,10 @@ export class Vector3 {
|
|
|
971
973
|
* @returns this
|
|
972
974
|
*/
|
|
973
975
|
negateInPlace() {
|
|
974
|
-
this.
|
|
975
|
-
this.
|
|
976
|
-
this.
|
|
976
|
+
this._x *= -1;
|
|
977
|
+
this._y *= -1;
|
|
978
|
+
this._z *= -1;
|
|
979
|
+
this._isDirty = true;
|
|
977
980
|
return this;
|
|
978
981
|
}
|
|
979
982
|
/**
|
|
@@ -992,9 +995,10 @@ export class Vector3 {
|
|
|
992
995
|
* @returns the current updated Vector3
|
|
993
996
|
*/
|
|
994
997
|
scaleInPlace(scale) {
|
|
995
|
-
this.
|
|
996
|
-
this.
|
|
997
|
-
this.
|
|
998
|
+
this._x *= scale;
|
|
999
|
+
this._y *= scale;
|
|
1000
|
+
this._z *= scale;
|
|
1001
|
+
this._isDirty = true;
|
|
998
1002
|
return this;
|
|
999
1003
|
}
|
|
1000
1004
|
/**
|
|
@@ -1057,13 +1061,14 @@ export class Vector3 {
|
|
|
1057
1061
|
* @returns the result
|
|
1058
1062
|
*/
|
|
1059
1063
|
applyRotationQuaternionToRef(q, result) {
|
|
1060
|
-
const ix = q.
|
|
1061
|
-
const iy = q.
|
|
1062
|
-
const iz = q.
|
|
1063
|
-
const iw = -q.
|
|
1064
|
-
result.
|
|
1065
|
-
result.
|
|
1066
|
-
result.
|
|
1064
|
+
const ix = q._w * this._x + q._y * this._z - q._z * this._y;
|
|
1065
|
+
const iy = q._w * this._y + q._z * this._x - q._x * this._z;
|
|
1066
|
+
const iz = q._w * this._z + q._x * this._y - q._y * this._x;
|
|
1067
|
+
const iw = -q._x * this._x - q._y * this._y - q._z * this._z;
|
|
1068
|
+
result._x = ix * q._w + iw * -q._x + iy * -q._z - iz * -q._y;
|
|
1069
|
+
result._y = iy * q._w + iw * -q._y + iz * -q._x - ix * -q._z;
|
|
1070
|
+
result._z = iz * q._w + iw * -q._z + ix * -q._y - iy * -q._x;
|
|
1071
|
+
result._isDirty = true;
|
|
1067
1072
|
return result;
|
|
1068
1073
|
}
|
|
1069
1074
|
/**
|
|
@@ -1174,9 +1179,10 @@ export class Vector3 {
|
|
|
1174
1179
|
* @returns the current updated Vector3
|
|
1175
1180
|
*/
|
|
1176
1181
|
multiplyInPlace(otherVector) {
|
|
1177
|
-
this.
|
|
1178
|
-
this.
|
|
1179
|
-
this.
|
|
1182
|
+
this._x *= otherVector._x;
|
|
1183
|
+
this._y *= otherVector._y;
|
|
1184
|
+
this._z *= otherVector._z;
|
|
1185
|
+
this._isDirty = true;
|
|
1180
1186
|
return this;
|
|
1181
1187
|
}
|
|
1182
1188
|
/**
|
|
@@ -1496,9 +1502,10 @@ export class Vector3 {
|
|
|
1496
1502
|
* @returns the current updated Vector3
|
|
1497
1503
|
*/
|
|
1498
1504
|
copyFromFloats(x, y, z) {
|
|
1499
|
-
this.
|
|
1500
|
-
this.
|
|
1501
|
-
this.
|
|
1505
|
+
this._x = x;
|
|
1506
|
+
this._y = y;
|
|
1507
|
+
this._z = z;
|
|
1508
|
+
this._isDirty = true;
|
|
1502
1509
|
return this;
|
|
1503
1510
|
}
|
|
1504
1511
|
/**
|
|
@@ -1519,7 +1526,8 @@ export class Vector3 {
|
|
|
1519
1526
|
* @returns the current updated Vector3
|
|
1520
1527
|
*/
|
|
1521
1528
|
setAll(v) {
|
|
1522
|
-
this.
|
|
1529
|
+
this._x = this._y = this._z = v;
|
|
1530
|
+
this._isDirty = true;
|
|
1523
1531
|
return this;
|
|
1524
1532
|
}
|
|
1525
1533
|
// Statics
|
|
@@ -1597,9 +1605,10 @@ export class Vector3 {
|
|
|
1597
1605
|
static PitchYawRollToMoveBetweenPointsToRef(start, target, ref) {
|
|
1598
1606
|
const diff = TmpVectors.Vector3[0];
|
|
1599
1607
|
target.subtractToRef(start, diff);
|
|
1600
|
-
ref.
|
|
1601
|
-
ref.
|
|
1602
|
-
ref.
|
|
1608
|
+
ref._y = Math.atan2(diff.x, diff.z) || 0;
|
|
1609
|
+
ref._x = Math.atan2(Math.sqrt(diff.x ** 2 + diff.z ** 2), diff.y) || 0;
|
|
1610
|
+
ref._z = 0;
|
|
1611
|
+
ref._isDirty = true;
|
|
1603
1612
|
return ref;
|
|
1604
1613
|
}
|
|
1605
1614
|
/**
|
|
@@ -1696,9 +1705,10 @@ export class Vector3 {
|
|
|
1696
1705
|
* @returns result input
|
|
1697
1706
|
*/
|
|
1698
1707
|
static FromArrayToRef(array, offset, result) {
|
|
1699
|
-
result.
|
|
1700
|
-
result.
|
|
1701
|
-
result.
|
|
1708
|
+
result._x = array[offset];
|
|
1709
|
+
result._y = array[offset + 1];
|
|
1710
|
+
result._z = array[offset + 2];
|
|
1711
|
+
result._isDirty = true;
|
|
1702
1712
|
return result;
|
|
1703
1713
|
}
|
|
1704
1714
|
/**
|
|
@@ -1872,9 +1882,10 @@ export class Vector3 {
|
|
|
1872
1882
|
const ry = x * m[1] + y * m[5] + z * m[9] + m[13];
|
|
1873
1883
|
const rz = x * m[2] + y * m[6] + z * m[10] + m[14];
|
|
1874
1884
|
const rw = 1 / (x * m[3] + y * m[7] + z * m[11] + m[15]);
|
|
1875
|
-
result.
|
|
1876
|
-
result.
|
|
1877
|
-
result.
|
|
1885
|
+
result._x = rx * rw;
|
|
1886
|
+
result._y = ry * rw;
|
|
1887
|
+
result._z = rz * rw;
|
|
1888
|
+
result._isDirty = true;
|
|
1878
1889
|
return result;
|
|
1879
1890
|
}
|
|
1880
1891
|
/**
|
|
@@ -1916,9 +1927,10 @@ export class Vector3 {
|
|
|
1916
1927
|
*/
|
|
1917
1928
|
static TransformNormalFromFloatsToRef(x, y, z, transformation, result) {
|
|
1918
1929
|
const m = transformation.m;
|
|
1919
|
-
result.
|
|
1920
|
-
result.
|
|
1921
|
-
result.
|
|
1930
|
+
result._x = x * m[0] + y * m[4] + z * m[8];
|
|
1931
|
+
result._y = x * m[1] + y * m[5] + z * m[9];
|
|
1932
|
+
result._z = x * m[2] + y * m[6] + z * m[10];
|
|
1933
|
+
result._isDirty = true;
|
|
1922
1934
|
return result;
|
|
1923
1935
|
}
|
|
1924
1936
|
/**
|
|
@@ -2051,9 +2063,10 @@ export class Vector3 {
|
|
|
2051
2063
|
*/
|
|
2052
2064
|
static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {
|
|
2053
2065
|
const t2 = time * time;
|
|
2054
|
-
result.
|
|
2055
|
-
result.
|
|
2056
|
-
result.
|
|
2066
|
+
result._x = (t2 - time) * 6 * value1._x + (3 * t2 - 4 * time + 1) * tangent1._x + (-t2 + time) * 6 * value2._x + (3 * t2 - 2 * time) * tangent2._x;
|
|
2067
|
+
result._y = (t2 - time) * 6 * value1._y + (3 * t2 - 4 * time + 1) * tangent1._y + (-t2 + time) * 6 * value2._y + (3 * t2 - 2 * time) * tangent2._y;
|
|
2068
|
+
result._z = (t2 - time) * 6 * value1._z + (3 * t2 - 4 * time + 1) * tangent1._z + (-t2 + time) * 6 * value2._z + (3 * t2 - 2 * time) * tangent2._z;
|
|
2069
|
+
result._isDirty = true;
|
|
2057
2070
|
return result;
|
|
2058
2071
|
}
|
|
2059
2072
|
/**
|
|
@@ -2079,9 +2092,10 @@ export class Vector3 {
|
|
|
2079
2092
|
* @returns result input
|
|
2080
2093
|
*/
|
|
2081
2094
|
static LerpToRef(start, end, amount, result) {
|
|
2082
|
-
result.
|
|
2083
|
-
result.
|
|
2084
|
-
result.
|
|
2095
|
+
result._x = start._x + (end._x - start._x) * amount;
|
|
2096
|
+
result._y = start._y + (end._y - start._y) * amount;
|
|
2097
|
+
result._z = start._z + (end._z - start._z) * amount;
|
|
2098
|
+
result._isDirty = true;
|
|
2085
2099
|
return result;
|
|
2086
2100
|
}
|
|
2087
2101
|
/**
|
|
@@ -3416,10 +3430,10 @@ export class Quaternion {
|
|
|
3416
3430
|
* @returns the current Quaternion object
|
|
3417
3431
|
*/
|
|
3418
3432
|
toArray(array, index = 0) {
|
|
3419
|
-
array[index] = this.
|
|
3420
|
-
array[index + 1] = this.
|
|
3421
|
-
array[index + 2] = this.
|
|
3422
|
-
array[index + 3] = this.
|
|
3433
|
+
array[index] = this._x;
|
|
3434
|
+
array[index + 1] = this._y;
|
|
3435
|
+
array[index + 2] = this._z;
|
|
3436
|
+
array[index + 3] = this._w;
|
|
3423
3437
|
return this;
|
|
3424
3438
|
}
|
|
3425
3439
|
/**
|
|
@@ -3460,10 +3474,11 @@ export class Quaternion {
|
|
|
3460
3474
|
* @returns the updated current quaternion
|
|
3461
3475
|
*/
|
|
3462
3476
|
copyFrom(other) {
|
|
3463
|
-
this.
|
|
3464
|
-
this.
|
|
3465
|
-
this.
|
|
3466
|
-
this.
|
|
3477
|
+
this._x = other._x;
|
|
3478
|
+
this._y = other._y;
|
|
3479
|
+
this._z = other._z;
|
|
3480
|
+
this._w = other._w;
|
|
3481
|
+
this._isDirty = true;
|
|
3467
3482
|
return this;
|
|
3468
3483
|
}
|
|
3469
3484
|
/**
|
|
@@ -3476,10 +3491,11 @@ export class Quaternion {
|
|
|
3476
3491
|
* @returns the updated current quaternion
|
|
3477
3492
|
*/
|
|
3478
3493
|
copyFromFloats(x, y, z, w) {
|
|
3479
|
-
this.
|
|
3480
|
-
this.
|
|
3481
|
-
this.
|
|
3482
|
-
this.
|
|
3494
|
+
this._x = x;
|
|
3495
|
+
this._y = y;
|
|
3496
|
+
this._z = z;
|
|
3497
|
+
this._w = w;
|
|
3498
|
+
this._isDirty = true;
|
|
3483
3499
|
return this;
|
|
3484
3500
|
}
|
|
3485
3501
|
/**
|
|
@@ -3514,6 +3530,7 @@ export class Quaternion {
|
|
|
3514
3530
|
this._y += other._y;
|
|
3515
3531
|
this._z += other._z;
|
|
3516
3532
|
this._w += other._w;
|
|
3533
|
+
this._isDirty = true;
|
|
3517
3534
|
return this;
|
|
3518
3535
|
}
|
|
3519
3536
|
/**
|
|
@@ -3536,6 +3553,7 @@ export class Quaternion {
|
|
|
3536
3553
|
this._y -= other._y;
|
|
3537
3554
|
this._z -= other._z;
|
|
3538
3555
|
this._w -= other._w;
|
|
3556
|
+
this._isDirty = true;
|
|
3539
3557
|
return this;
|
|
3540
3558
|
}
|
|
3541
3559
|
/**
|
|
@@ -3555,10 +3573,11 @@ export class Quaternion {
|
|
|
3555
3573
|
* @returns result input
|
|
3556
3574
|
*/
|
|
3557
3575
|
scaleToRef(scale, result) {
|
|
3558
|
-
result.
|
|
3559
|
-
result.
|
|
3560
|
-
result.
|
|
3561
|
-
result.
|
|
3576
|
+
result._x = this._x * scale;
|
|
3577
|
+
result._y = this._y * scale;
|
|
3578
|
+
result._z = this._z * scale;
|
|
3579
|
+
result._w = this._w * scale;
|
|
3580
|
+
result._isDirty = true;
|
|
3562
3581
|
return result;
|
|
3563
3582
|
}
|
|
3564
3583
|
/**
|
|
@@ -3568,10 +3587,11 @@ export class Quaternion {
|
|
|
3568
3587
|
* @returns the current modified quaternion
|
|
3569
3588
|
*/
|
|
3570
3589
|
scaleInPlace(value) {
|
|
3571
|
-
this.
|
|
3572
|
-
this.
|
|
3573
|
-
this.
|
|
3574
|
-
this.
|
|
3590
|
+
this._x *= value;
|
|
3591
|
+
this._y *= value;
|
|
3592
|
+
this._z *= value;
|
|
3593
|
+
this._w *= value;
|
|
3594
|
+
this._isDirty = true;
|
|
3575
3595
|
return this;
|
|
3576
3596
|
}
|
|
3577
3597
|
/**
|
|
@@ -3582,10 +3602,11 @@ export class Quaternion {
|
|
|
3582
3602
|
* @returns result input
|
|
3583
3603
|
*/
|
|
3584
3604
|
scaleAndAddToRef(scale, result) {
|
|
3585
|
-
result.
|
|
3586
|
-
result.
|
|
3587
|
-
result.
|
|
3588
|
-
result.
|
|
3605
|
+
result._x += this._x * scale;
|
|
3606
|
+
result._y += this._y * scale;
|
|
3607
|
+
result._z += this._z * scale;
|
|
3608
|
+
result._w += this._w * scale;
|
|
3609
|
+
result._isDirty = true;
|
|
3589
3610
|
return result;
|
|
3590
3611
|
}
|
|
3591
3612
|
/**
|
|
@@ -3640,9 +3661,10 @@ export class Quaternion {
|
|
|
3640
3661
|
* @returns the current updated quaternion
|
|
3641
3662
|
*/
|
|
3642
3663
|
conjugateInPlace() {
|
|
3643
|
-
this.
|
|
3644
|
-
this.
|
|
3645
|
-
this.
|
|
3664
|
+
this._x *= -1;
|
|
3665
|
+
this._y *= -1;
|
|
3666
|
+
this._z *= -1;
|
|
3667
|
+
this._isDirty = true;
|
|
3646
3668
|
return this;
|
|
3647
3669
|
}
|
|
3648
3670
|
/**
|
|
@@ -3750,23 +3772,26 @@ export class Quaternion {
|
|
|
3750
3772
|
const zAxisY = qy * qz - qx * qw;
|
|
3751
3773
|
const limit = 0.4999999;
|
|
3752
3774
|
if (zAxisY < -limit) {
|
|
3753
|
-
result.
|
|
3754
|
-
result.
|
|
3755
|
-
result.
|
|
3775
|
+
result._y = 2 * Math.atan2(qy, qw);
|
|
3776
|
+
result._x = Math.PI / 2;
|
|
3777
|
+
result._z = 0;
|
|
3778
|
+
result._isDirty = true;
|
|
3756
3779
|
}
|
|
3757
3780
|
else if (zAxisY > limit) {
|
|
3758
|
-
result.
|
|
3759
|
-
result.
|
|
3760
|
-
result.
|
|
3781
|
+
result._y = 2 * Math.atan2(qy, qw);
|
|
3782
|
+
result._x = -Math.PI / 2;
|
|
3783
|
+
result._z = 0;
|
|
3784
|
+
result._isDirty = true;
|
|
3761
3785
|
}
|
|
3762
3786
|
else {
|
|
3763
3787
|
const sqw = qw * qw;
|
|
3764
3788
|
const sqz = qz * qz;
|
|
3765
3789
|
const sqx = qx * qx;
|
|
3766
3790
|
const sqy = qy * qy;
|
|
3767
|
-
result.
|
|
3768
|
-
result.
|
|
3769
|
-
result.
|
|
3791
|
+
result._z = Math.atan2(2.0 * (qx * qy + qz * qw), -sqz - sqx + sqy + sqw);
|
|
3792
|
+
result._x = Math.asin(-2.0 * zAxisY);
|
|
3793
|
+
result._y = Math.atan2(2.0 * (qz * qx + qy * qw), sqz - sqx - sqy + sqw);
|
|
3794
|
+
result._isDirty = true;
|
|
3770
3795
|
}
|
|
3771
3796
|
return result;
|
|
3772
3797
|
}
|
|
@@ -3818,31 +3843,35 @@ export class Quaternion {
|
|
|
3818
3843
|
let s;
|
|
3819
3844
|
if (trace > 0) {
|
|
3820
3845
|
s = 0.5 / Math.sqrt(trace + 1.0);
|
|
3821
|
-
result.
|
|
3822
|
-
result.
|
|
3823
|
-
result.
|
|
3824
|
-
result.
|
|
3846
|
+
result._w = 0.25 / s;
|
|
3847
|
+
result._x = (m32 - m23) * s;
|
|
3848
|
+
result._y = (m13 - m31) * s;
|
|
3849
|
+
result._z = (m21 - m12) * s;
|
|
3850
|
+
result._isDirty = true;
|
|
3825
3851
|
}
|
|
3826
3852
|
else if (m11 > m22 && m11 > m33) {
|
|
3827
3853
|
s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);
|
|
3828
|
-
result.
|
|
3829
|
-
result.
|
|
3830
|
-
result.
|
|
3831
|
-
result.
|
|
3854
|
+
result._w = (m32 - m23) / s;
|
|
3855
|
+
result._x = 0.25 * s;
|
|
3856
|
+
result._y = (m12 + m21) / s;
|
|
3857
|
+
result._z = (m13 + m31) / s;
|
|
3858
|
+
result._isDirty = true;
|
|
3832
3859
|
}
|
|
3833
3860
|
else if (m22 > m33) {
|
|
3834
3861
|
s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);
|
|
3835
|
-
result.
|
|
3836
|
-
result.
|
|
3837
|
-
result.
|
|
3838
|
-
result.
|
|
3862
|
+
result._w = (m13 - m31) / s;
|
|
3863
|
+
result._x = (m12 + m21) / s;
|
|
3864
|
+
result._y = 0.25 * s;
|
|
3865
|
+
result._z = (m23 + m32) / s;
|
|
3866
|
+
result._isDirty = true;
|
|
3839
3867
|
}
|
|
3840
3868
|
else {
|
|
3841
3869
|
s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);
|
|
3842
|
-
result.
|
|
3843
|
-
result.
|
|
3844
|
-
result.
|
|
3845
|
-
result.
|
|
3870
|
+
result._w = (m21 - m12) / s;
|
|
3871
|
+
result._x = (m13 + m31) / s;
|
|
3872
|
+
result._y = (m23 + m32) / s;
|
|
3873
|
+
result._z = 0.25 * s;
|
|
3874
|
+
result._isDirty = true;
|
|
3846
3875
|
}
|
|
3847
3876
|
return result;
|
|
3848
3877
|
}
|
|
@@ -3946,10 +3975,11 @@ export class Quaternion {
|
|
|
3946
3975
|
static RotationAxisToRef(axis, angle, result) {
|
|
3947
3976
|
const sin = Math.sin(angle / 2);
|
|
3948
3977
|
axis.normalize();
|
|
3949
|
-
result.
|
|
3950
|
-
result.
|
|
3951
|
-
result.
|
|
3952
|
-
result.
|
|
3978
|
+
result._w = Math.cos(angle / 2);
|
|
3979
|
+
result._x = axis._x * sin;
|
|
3980
|
+
result._y = axis._y * sin;
|
|
3981
|
+
result._z = axis._z * sin;
|
|
3982
|
+
result._isDirty = true;
|
|
3953
3983
|
return result;
|
|
3954
3984
|
}
|
|
3955
3985
|
/**
|
|
@@ -3974,10 +4004,11 @@ export class Quaternion {
|
|
|
3974
4004
|
* @returns result input
|
|
3975
4005
|
*/
|
|
3976
4006
|
static FromArrayToRef(array, offset, result) {
|
|
3977
|
-
result.
|
|
3978
|
-
result.
|
|
3979
|
-
result.
|
|
3980
|
-
result.
|
|
4007
|
+
result._x = array[offset];
|
|
4008
|
+
result._y = array[offset + 1];
|
|
4009
|
+
result._z = array[offset + 2];
|
|
4010
|
+
result._w = array[offset + 3];
|
|
4011
|
+
result._isDirty = true;
|
|
3981
4012
|
return result;
|
|
3982
4013
|
}
|
|
3983
4014
|
/**
|
|
@@ -4085,10 +4116,11 @@ export class Quaternion {
|
|
|
4085
4116
|
const cosPitch = Math.cos(halfPitch);
|
|
4086
4117
|
const sinYaw = Math.sin(halfYaw);
|
|
4087
4118
|
const cosYaw = Math.cos(halfYaw);
|
|
4088
|
-
result.
|
|
4089
|
-
result.
|
|
4090
|
-
result.
|
|
4091
|
-
result.
|
|
4119
|
+
result._x = cosYaw * sinPitch * cosRoll + sinYaw * cosPitch * sinRoll;
|
|
4120
|
+
result._y = sinYaw * cosPitch * cosRoll - cosYaw * sinPitch * sinRoll;
|
|
4121
|
+
result._z = cosYaw * cosPitch * sinRoll - sinYaw * sinPitch * cosRoll;
|
|
4122
|
+
result._w = cosYaw * cosPitch * cosRoll + sinYaw * sinPitch * sinRoll;
|
|
4123
|
+
result._isDirty = true;
|
|
4092
4124
|
return result;
|
|
4093
4125
|
}
|
|
4094
4126
|
/**
|
|
@@ -4118,10 +4150,11 @@ export class Quaternion {
|
|
|
4118
4150
|
const halfGammaPlusAlpha = (gamma + alpha) * 0.5;
|
|
4119
4151
|
const halfGammaMinusAlpha = (gamma - alpha) * 0.5;
|
|
4120
4152
|
const halfBeta = beta * 0.5;
|
|
4121
|
-
result.
|
|
4122
|
-
result.
|
|
4123
|
-
result.
|
|
4124
|
-
result.
|
|
4153
|
+
result._x = Math.cos(halfGammaMinusAlpha) * Math.sin(halfBeta);
|
|
4154
|
+
result._y = Math.sin(halfGammaMinusAlpha) * Math.sin(halfBeta);
|
|
4155
|
+
result._z = Math.sin(halfGammaPlusAlpha) * Math.cos(halfBeta);
|
|
4156
|
+
result._w = Math.cos(halfGammaPlusAlpha) * Math.cos(halfBeta);
|
|
4157
|
+
result._isDirty = true;
|
|
4125
4158
|
return result;
|
|
4126
4159
|
}
|
|
4127
4160
|
/**
|
|
@@ -4248,10 +4281,11 @@ export class Quaternion {
|
|
|
4248
4281
|
num3 = Math.sin((1.0 - amount) * num5) * num6;
|
|
4249
4282
|
num2 = flag ? -Math.sin(amount * num5) * num6 : Math.sin(amount * num5) * num6;
|
|
4250
4283
|
}
|
|
4251
|
-
result.
|
|
4252
|
-
result.
|
|
4253
|
-
result.
|
|
4254
|
-
result.
|
|
4284
|
+
result._x = num3 * left._x + num2 * right._x;
|
|
4285
|
+
result._y = num3 * left._y + num2 * right._y;
|
|
4286
|
+
result._z = num3 * left._z + num2 * right._z;
|
|
4287
|
+
result._w = num3 * left._w + num2 * right._w;
|
|
4288
|
+
result._isDirty = true;
|
|
4255
4289
|
return result;
|
|
4256
4290
|
}
|
|
4257
4291
|
/**
|
|
@@ -4306,10 +4340,11 @@ export class Quaternion {
|
|
|
4306
4340
|
*/
|
|
4307
4341
|
static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {
|
|
4308
4342
|
const t2 = time * time;
|
|
4309
|
-
result.
|
|
4310
|
-
result.
|
|
4311
|
-
result.
|
|
4312
|
-
result.
|
|
4343
|
+
result._x = (t2 - time) * 6 * value1._x + (3 * t2 - 4 * time + 1) * tangent1._x + (-t2 + time) * 6 * value2._x + (3 * t2 - 2 * time) * tangent2._x;
|
|
4344
|
+
result._y = (t2 - time) * 6 * value1._y + (3 * t2 - 4 * time + 1) * tangent1._y + (-t2 + time) * 6 * value2._y + (3 * t2 - 2 * time) * tangent2._y;
|
|
4345
|
+
result._z = (t2 - time) * 6 * value1._z + (3 * t2 - 4 * time + 1) * tangent1._z + (-t2 + time) * 6 * value2._z + (3 * t2 - 2 * time) * tangent2._z;
|
|
4346
|
+
result._w = (t2 - time) * 6 * value1._w + (3 * t2 - 4 * time + 1) * tangent1._w + (-t2 + time) * 6 * value2._w + (3 * t2 - 2 * time) * tangent2._w;
|
|
4347
|
+
result._isDirty = true;
|
|
4313
4348
|
return result;
|
|
4314
4349
|
}
|
|
4315
4350
|
}
|