@galacean/engine-math 0.9.19 → 0.9.21

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/dist/main.js CHANGED
@@ -2,27 +2,24 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /**
6
- * Defines how the bounding volumes intersects or contain one another.
7
- */ exports.ContainmentType = void 0;
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
+
8
11
  (function(ContainmentType) {
9
12
  ContainmentType[ContainmentType[/** Indicates that there is no overlap between two bounding volumes. */ "Disjoint"] = 0] = "Disjoint";
10
13
  ContainmentType[ContainmentType[/** Indicates that one bounding volume completely contains another volume. */ "Contains"] = 1] = "Contains";
11
14
  ContainmentType[ContainmentType[/** Indicates that bounding volumes partially overlap one another. */ "Intersects"] = 2] = "Intersects";
12
15
  })(exports.ContainmentType || (exports.ContainmentType = {}));
13
16
 
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;
26
23
  (function(FrustumFace) {
27
24
  FrustumFace[FrustumFace[/** Near face */ "Near"] = 0] = "Near";
28
25
  FrustumFace[FrustumFace[/** Far face */ "Far"] = 1] = "Far";
@@ -32,24 +29,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
32
29
  FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
33
30
  })(exports.FrustumFace || (exports.FrustumFace = {}));
34
31
 
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
-
53
32
  /**
54
33
  * Common utility methods for math operations.
55
34
  */ var MathUtil = /*#__PURE__*/ function() {
@@ -95,15 +74,9 @@ function _create_class(Constructor, protoProps, staticProps) {
95
74
  };
96
75
  return MathUtil;
97
76
  }();
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
- })();
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;
107
80
 
108
81
  /**
109
82
  * Describes a 3D-vector.
@@ -562,7 +535,7 @@ function _create_class(Constructor, protoProps, staticProps) {
562
535
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
563
536
  out._onValueChanged && out._onValueChanged();
564
537
  };
565
- _create_class(Vector3, [
538
+ _create_class__default['default'](Vector3, [
566
539
  {
567
540
  key: "x",
568
541
  get: /**
@@ -602,12 +575,8 @@ function _create_class(Constructor, protoProps, staticProps) {
602
575
  ]);
603
576
  return Vector3;
604
577
  }();
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
- })();
578
+ /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
579
+ /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
611
580
 
612
581
  /**
613
582
  * A bounding sphere.
@@ -676,9 +645,7 @@ function _create_class(Constructor, protoProps, staticProps) {
676
645
  };
677
646
  return BoundingSphere;
678
647
  }();
679
- (function() {
680
- BoundingSphere._tempVec30 = new Vector3();
681
- })();
648
+ BoundingSphere._tempVec30 = new Vector3();
682
649
 
683
650
  /**
684
651
  * Axis Aligned Bound Box (AABB).
@@ -837,12 +804,8 @@ function _create_class(Constructor, protoProps, staticProps) {
837
804
  };
838
805
  return BoundingBox;
839
806
  }();
840
- (function() {
841
- BoundingBox._tempVec30 = new Vector3();
842
- })();
843
- (function() {
844
- BoundingBox._tempVec31 = new Vector3();
845
- })();
807
+ BoundingBox._tempVec30 = new Vector3();
808
+ BoundingBox._tempVec31 = new Vector3();
846
809
 
847
810
  /**
848
811
  * Contains static methods to help in determining intersections, containment, etc.
@@ -1191,15 +1154,9 @@ function _create_class(Constructor, protoProps, staticProps) {
1191
1154
  };
1192
1155
  return CollisionUtil;
1193
1156
  }();
1194
- (function() {
1195
- CollisionUtil._tempVec30 = new Vector3();
1196
- })();
1197
- (function() {
1198
- CollisionUtil._tempVec31 = new Vector3();
1199
- })();
1200
- (function() {
1201
- CollisionUtil._tempVec32 = new Vector3();
1202
- })();
1157
+ CollisionUtil._tempVec30 = new Vector3();
1158
+ CollisionUtil._tempVec31 = new Vector3();
1159
+ CollisionUtil._tempVec32 = new Vector3();
1203
1160
 
1204
1161
  /**
1205
1162
  * Represents a plane in three-dimensional space.
@@ -2523,7 +2480,7 @@ function _create_class(Constructor, protoProps, staticProps) {
2523
2480
  out._w = a._w * s;
2524
2481
  out._onValueChanged && out._onValueChanged();
2525
2482
  };
2526
- _create_class(Quaternion, [
2483
+ _create_class__default['default'](Quaternion, [
2527
2484
  {
2528
2485
  key: "x",
2529
2486
  get: /**
@@ -2583,12 +2540,8 @@ function _create_class(Constructor, protoProps, staticProps) {
2583
2540
  ]);
2584
2541
  return Quaternion;
2585
2542
  }();
2586
- (function() {
2587
- /** @internal */ Quaternion._tempVector3 = new Vector3();
2588
- })();
2589
- (function() {
2590
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2591
- })();
2543
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
2544
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
2592
2545
 
2593
2546
  /**
2594
2547
  * Represents a 4x4 mathematical matrix.
@@ -3534,21 +3487,11 @@ function _create_class(Constructor, protoProps, staticProps) {
3534
3487
  };
3535
3488
  return Matrix;
3536
3489
  }();
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
- })();
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);
3552
3495
 
3553
3496
  /**
3554
3497
  * Represents a ray with an origin and a direction in 3D space.
@@ -3884,7 +3827,7 @@ function _create_class(Constructor, protoProps, staticProps) {
3884
3827
  out._y = left._y * s;
3885
3828
  out._onValueChanged && out._onValueChanged();
3886
3829
  };
3887
- _create_class(Vector2, [
3830
+ _create_class__default['default'](Vector2, [
3888
3831
  {
3889
3832
  key: "x",
3890
3833
  get: /**
@@ -3912,12 +3855,8 @@ function _create_class(Constructor, protoProps, staticProps) {
3912
3855
  ]);
3913
3856
  return Vector2;
3914
3857
  }();
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
- })();
3858
+ /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
3859
+ /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
3921
3860
 
3922
3861
  /**
3923
3862
  * Describes a 4D-vector.
@@ -4298,7 +4237,7 @@ function _create_class(Constructor, protoProps, staticProps) {
4298
4237
  out._w = w;
4299
4238
  out._onValueChanged && out._onValueChanged();
4300
4239
  };
4301
- _create_class(Vector4, [
4240
+ _create_class__default['default'](Vector4, [
4302
4241
  {
4303
4242
  key: "x",
4304
4243
  get: /**
@@ -4350,12 +4289,8 @@ function _create_class(Constructor, protoProps, staticProps) {
4350
4289
  ]);
4351
4290
  return Vector4;
4352
4291
  }();
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
- })();
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);
4359
4294
 
4360
4295
  /**
4361
4296
  * Describes a color in the from of RGBA (in order: R, G, B, A).
@@ -4565,7 +4500,7 @@ function _create_class(Constructor, protoProps, staticProps) {
4565
4500
  out._onValueChanged && out._onValueChanged();
4566
4501
  return out;
4567
4502
  };
4568
- _create_class(Color, [
4503
+ _create_class__default['default'](Color, [
4569
4504
  {
4570
4505
  key: "r",
4571
4506
  get: /**