@galacean/engine-math 0.9.21 → 0.9.22

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.
@@ -2,24 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _create_class = require('@swc/helpers/src/_create_class.mjs');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
10
-
5
+ /**
6
+ * Defines how the bounding volumes intersects or contain one another.
7
+ */ exports.ContainmentType = void 0;
11
8
  (function(ContainmentType) {
12
9
  ContainmentType[ContainmentType[/** Indicates that there is no overlap between two bounding volumes. */ "Disjoint"] = 0] = "Disjoint";
13
10
  ContainmentType[ContainmentType[/** Indicates that one bounding volume completely contains another volume. */ "Contains"] = 1] = "Contains";
14
11
  ContainmentType[ContainmentType[/** Indicates that bounding volumes partially overlap one another. */ "Intersects"] = 2] = "Intersects";
15
12
  })(exports.ContainmentType || (exports.ContainmentType = {}));
16
13
 
14
+ /**
15
+ * Defines the intersection between a plane and a bounding volume.
16
+ */ exports.PlaneIntersectionType = void 0;
17
17
  (function(PlaneIntersectionType) {
18
18
  PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the back of the plane. */ "Back"] = 0] = "Back";
19
19
  PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the front of the plane. */ "Front"] = 1] = "Front";
20
20
  PlaneIntersectionType[PlaneIntersectionType[/** The plane is intersected. */ "Intersecting"] = 2] = "Intersecting";
21
21
  })(exports.PlaneIntersectionType || (exports.PlaneIntersectionType = {}));
22
22
 
23
+ /**
24
+ * Frustum face
25
+ */ exports.FrustumFace = void 0;
23
26
  (function(FrustumFace) {
24
27
  FrustumFace[FrustumFace[/** Near face */ "Near"] = 0] = "Near";
25
28
  FrustumFace[FrustumFace[/** Far face */ "Far"] = 1] = "Far";
@@ -29,6 +32,24 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
29
32
  FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
30
33
  })(exports.FrustumFace || (exports.FrustumFace = {}));
31
34
 
35
+ function _defineProperties(target, props) {
36
+ for (var i = 0; i < props.length; i++) {
37
+ var descriptor = props[i];
38
+ descriptor.enumerable = descriptor.enumerable || false;
39
+ descriptor.configurable = true;
40
+
41
+ if ("value" in descriptor) descriptor.writable = true;
42
+
43
+ Object.defineProperty(target, descriptor.key, descriptor);
44
+ }
45
+ }
46
+ function _create_class(Constructor, protoProps, staticProps) {
47
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
48
+ if (staticProps) _defineProperties(Constructor, staticProps);
49
+
50
+ return Constructor;
51
+ }
52
+
32
53
  /**
33
54
  * Common utility methods for math operations.
34
55
  */ var MathUtil = /*#__PURE__*/ function() {
@@ -74,9 +95,15 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
74
95
  };
75
96
  return MathUtil;
76
97
  }();
77
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
78
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
79
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
98
+ (function() {
99
+ /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
100
+ })();
101
+ (function() {
102
+ /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
103
+ })();
104
+ (function() {
105
+ /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
106
+ })();
80
107
 
81
108
  /**
82
109
  * Describes a 3D-vector.
@@ -535,7 +562,7 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
535
562
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
536
563
  out._onValueChanged && out._onValueChanged();
537
564
  };
538
- _create_class__default['default'](Vector3, [
565
+ _create_class(Vector3, [
539
566
  {
540
567
  key: "x",
541
568
  get: /**
@@ -575,8 +602,12 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
575
602
  ]);
576
603
  return Vector3;
577
604
  }();
578
- /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
579
- /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
605
+ (function() {
606
+ /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
607
+ })();
608
+ (function() {
609
+ /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
610
+ })();
580
611
 
581
612
  /**
582
613
  * A bounding sphere.
@@ -645,7 +676,9 @@ var _create_class__default = /*#__PURE__*/_interopDefaultLegacy(_create_class);
645
676
  };
646
677
  return BoundingSphere;
647
678
  }();
648
- BoundingSphere._tempVec30 = new Vector3();
679
+ (function() {
680
+ BoundingSphere._tempVec30 = new Vector3();
681
+ })();
649
682
 
650
683
  /**
651
684
  * Axis Aligned Bound Box (AABB).
@@ -804,8 +837,12 @@ BoundingSphere._tempVec30 = new Vector3();
804
837
  };
805
838
  return BoundingBox;
806
839
  }();
807
- BoundingBox._tempVec30 = new Vector3();
808
- BoundingBox._tempVec31 = new Vector3();
840
+ (function() {
841
+ BoundingBox._tempVec30 = new Vector3();
842
+ })();
843
+ (function() {
844
+ BoundingBox._tempVec31 = new Vector3();
845
+ })();
809
846
 
810
847
  /**
811
848
  * Contains static methods to help in determining intersections, containment, etc.
@@ -1154,9 +1191,15 @@ BoundingBox._tempVec31 = new Vector3();
1154
1191
  };
1155
1192
  return CollisionUtil;
1156
1193
  }();
1157
- CollisionUtil._tempVec30 = new Vector3();
1158
- CollisionUtil._tempVec31 = new Vector3();
1159
- CollisionUtil._tempVec32 = new Vector3();
1194
+ (function() {
1195
+ CollisionUtil._tempVec30 = new Vector3();
1196
+ })();
1197
+ (function() {
1198
+ CollisionUtil._tempVec31 = new Vector3();
1199
+ })();
1200
+ (function() {
1201
+ CollisionUtil._tempVec32 = new Vector3();
1202
+ })();
1160
1203
 
1161
1204
  /**
1162
1205
  * Represents a plane in three-dimensional space.
@@ -2480,7 +2523,7 @@ CollisionUtil._tempVec32 = new Vector3();
2480
2523
  out._w = a._w * s;
2481
2524
  out._onValueChanged && out._onValueChanged();
2482
2525
  };
2483
- _create_class__default['default'](Quaternion, [
2526
+ _create_class(Quaternion, [
2484
2527
  {
2485
2528
  key: "x",
2486
2529
  get: /**
@@ -2540,8 +2583,12 @@ CollisionUtil._tempVec32 = new Vector3();
2540
2583
  ]);
2541
2584
  return Quaternion;
2542
2585
  }();
2543
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2544
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2586
+ (function() {
2587
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2588
+ })();
2589
+ (function() {
2590
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2591
+ })();
2545
2592
 
2546
2593
  /**
2547
2594
  * Represents a 4x4 mathematical matrix.
@@ -3487,11 +3534,21 @@ CollisionUtil._tempVec32 = new Vector3();
3487
3534
  };
3488
3535
  return Matrix;
3489
3536
  }();
3490
- Matrix._tempVec30 = new Vector3();
3491
- Matrix._tempVec31 = new Vector3();
3492
- Matrix._tempVec32 = new Vector3();
3493
- Matrix._tempMat30 = new Matrix3x3();
3494
- /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
3537
+ (function() {
3538
+ Matrix._tempVec30 = new Vector3();
3539
+ })();
3540
+ (function() {
3541
+ Matrix._tempVec31 = new Vector3();
3542
+ })();
3543
+ (function() {
3544
+ Matrix._tempVec32 = new Vector3();
3545
+ })();
3546
+ (function() {
3547
+ Matrix._tempMat30 = new Matrix3x3();
3548
+ })();
3549
+ (function() {
3550
+ /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
3551
+ })();
3495
3552
 
3496
3553
  /**
3497
3554
  * Represents a ray with an origin and a direction in 3D space.
@@ -3827,7 +3884,7 @@ Matrix._tempMat30 = new Matrix3x3();
3827
3884
  out._y = left._y * s;
3828
3885
  out._onValueChanged && out._onValueChanged();
3829
3886
  };
3830
- _create_class__default['default'](Vector2, [
3887
+ _create_class(Vector2, [
3831
3888
  {
3832
3889
  key: "x",
3833
3890
  get: /**
@@ -3855,8 +3912,12 @@ Matrix._tempMat30 = new Matrix3x3();
3855
3912
  ]);
3856
3913
  return Vector2;
3857
3914
  }();
3858
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3859
- /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3915
+ (function() {
3916
+ /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3917
+ })();
3918
+ (function() {
3919
+ /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3920
+ })();
3860
3921
 
3861
3922
  /**
3862
3923
  * Describes a 4D-vector.
@@ -4237,7 +4298,7 @@ Matrix._tempMat30 = new Matrix3x3();
4237
4298
  out._w = w;
4238
4299
  out._onValueChanged && out._onValueChanged();
4239
4300
  };
4240
- _create_class__default['default'](Vector4, [
4301
+ _create_class(Vector4, [
4241
4302
  {
4242
4303
  key: "x",
4243
4304
  get: /**
@@ -4289,8 +4350,12 @@ Matrix._tempMat30 = new Matrix3x3();
4289
4350
  ]);
4290
4351
  return Vector4;
4291
4352
  }();
4292
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4293
- /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4353
+ (function() {
4354
+ /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4355
+ })();
4356
+ (function() {
4357
+ /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4358
+ })();
4294
4359
 
4295
4360
  /**
4296
4361
  * Describes a color in the from of RGBA (in order: R, G, B, A).
@@ -4500,7 +4565,7 @@ Matrix._tempMat30 = new Matrix3x3();
4500
4565
  out._onValueChanged && out._onValueChanged();
4501
4566
  return out;
4502
4567
  };
4503
- _create_class__default['default'](Color, [
4568
+ _create_class(Color, [
4504
4569
  {
4505
4570
  key: "r",
4506
4571
  get: /**
package/dist/module.js CHANGED
@@ -1,5 +1,3 @@
1
- import _create_class from '@swc/helpers/src/_create_class.mjs';
2
-
3
1
  /**
4
2
  * Defines how the bounding volumes intersects or contain one another.
5
3
  */ var ContainmentType;
@@ -30,6 +28,24 @@ import _create_class from '@swc/helpers/src/_create_class.mjs';
30
28
  FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
31
29
  })(FrustumFace || (FrustumFace = {}));
32
30
 
31
+ function _defineProperties(target, props) {
32
+ for (var i = 0; i < props.length; i++) {
33
+ var descriptor = props[i];
34
+ descriptor.enumerable = descriptor.enumerable || false;
35
+ descriptor.configurable = true;
36
+
37
+ if ("value" in descriptor) descriptor.writable = true;
38
+
39
+ Object.defineProperty(target, descriptor.key, descriptor);
40
+ }
41
+ }
42
+ function _create_class(Constructor, protoProps, staticProps) {
43
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
44
+ if (staticProps) _defineProperties(Constructor, staticProps);
45
+
46
+ return Constructor;
47
+ }
48
+
33
49
  /**
34
50
  * Common utility methods for math operations.
35
51
  */ var MathUtil = /*#__PURE__*/ function() {
@@ -75,9 +91,15 @@ import _create_class from '@swc/helpers/src/_create_class.mjs';
75
91
  };
76
92
  return MathUtil;
77
93
  }();
78
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
79
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
80
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
94
+ (function() {
95
+ /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
96
+ })();
97
+ (function() {
98
+ /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
99
+ })();
100
+ (function() {
101
+ /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
102
+ })();
81
103
 
82
104
  /**
83
105
  * Describes a 3D-vector.
@@ -576,8 +598,12 @@ import _create_class from '@swc/helpers/src/_create_class.mjs';
576
598
  ]);
577
599
  return Vector3;
578
600
  }();
579
- /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
580
- /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
601
+ (function() {
602
+ /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
603
+ })();
604
+ (function() {
605
+ /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
606
+ })();
581
607
 
582
608
  /**
583
609
  * A bounding sphere.
@@ -646,7 +672,9 @@ import _create_class from '@swc/helpers/src/_create_class.mjs';
646
672
  };
647
673
  return BoundingSphere;
648
674
  }();
649
- BoundingSphere._tempVec30 = new Vector3();
675
+ (function() {
676
+ BoundingSphere._tempVec30 = new Vector3();
677
+ })();
650
678
 
651
679
  /**
652
680
  * Axis Aligned Bound Box (AABB).
@@ -805,8 +833,12 @@ BoundingSphere._tempVec30 = new Vector3();
805
833
  };
806
834
  return BoundingBox;
807
835
  }();
808
- BoundingBox._tempVec30 = new Vector3();
809
- BoundingBox._tempVec31 = new Vector3();
836
+ (function() {
837
+ BoundingBox._tempVec30 = new Vector3();
838
+ })();
839
+ (function() {
840
+ BoundingBox._tempVec31 = new Vector3();
841
+ })();
810
842
 
811
843
  /**
812
844
  * Contains static methods to help in determining intersections, containment, etc.
@@ -1155,9 +1187,15 @@ BoundingBox._tempVec31 = new Vector3();
1155
1187
  };
1156
1188
  return CollisionUtil;
1157
1189
  }();
1158
- CollisionUtil._tempVec30 = new Vector3();
1159
- CollisionUtil._tempVec31 = new Vector3();
1160
- CollisionUtil._tempVec32 = new Vector3();
1190
+ (function() {
1191
+ CollisionUtil._tempVec30 = new Vector3();
1192
+ })();
1193
+ (function() {
1194
+ CollisionUtil._tempVec31 = new Vector3();
1195
+ })();
1196
+ (function() {
1197
+ CollisionUtil._tempVec32 = new Vector3();
1198
+ })();
1161
1199
 
1162
1200
  /**
1163
1201
  * Represents a plane in three-dimensional space.
@@ -2541,8 +2579,12 @@ CollisionUtil._tempVec32 = new Vector3();
2541
2579
  ]);
2542
2580
  return Quaternion;
2543
2581
  }();
2544
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2545
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2582
+ (function() {
2583
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2584
+ })();
2585
+ (function() {
2586
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2587
+ })();
2546
2588
 
2547
2589
  /**
2548
2590
  * Represents a 4x4 mathematical matrix.
@@ -3488,11 +3530,21 @@ CollisionUtil._tempVec32 = new Vector3();
3488
3530
  };
3489
3531
  return Matrix;
3490
3532
  }();
3491
- Matrix._tempVec30 = new Vector3();
3492
- Matrix._tempVec31 = new Vector3();
3493
- Matrix._tempVec32 = new Vector3();
3494
- Matrix._tempMat30 = new Matrix3x3();
3495
- /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
3533
+ (function() {
3534
+ Matrix._tempVec30 = new Vector3();
3535
+ })();
3536
+ (function() {
3537
+ Matrix._tempVec31 = new Vector3();
3538
+ })();
3539
+ (function() {
3540
+ Matrix._tempVec32 = new Vector3();
3541
+ })();
3542
+ (function() {
3543
+ Matrix._tempMat30 = new Matrix3x3();
3544
+ })();
3545
+ (function() {
3546
+ /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
3547
+ })();
3496
3548
 
3497
3549
  /**
3498
3550
  * Represents a ray with an origin and a direction in 3D space.
@@ -3856,8 +3908,12 @@ Matrix._tempMat30 = new Matrix3x3();
3856
3908
  ]);
3857
3909
  return Vector2;
3858
3910
  }();
3859
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3860
- /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3911
+ (function() {
3912
+ /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3913
+ })();
3914
+ (function() {
3915
+ /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3916
+ })();
3861
3917
 
3862
3918
  /**
3863
3919
  * Describes a 4D-vector.
@@ -4290,8 +4346,12 @@ Matrix._tempMat30 = new Matrix3x3();
4290
4346
  ]);
4291
4347
  return Vector4;
4292
4348
  }();
4293
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4294
- /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4349
+ (function() {
4350
+ /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
4351
+ })();
4352
+ (function() {
4353
+ /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
4354
+ })();
4295
4355
 
4296
4356
  /**
4297
4357
  * Describes a color in the from of RGBA (in order: R, G, B, A).