@xort/cga 0.0.71 → 0.0.72

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.
Files changed (58) hide show
  1. package/build/{cga.js → @xort_cga.js} +13798 -13792
  2. package/dist/IKanimation/Bone.js +3 -1
  3. package/dist/IKanimation/CCDSolver.js +2 -2
  4. package/dist/IKanimation/constaint/hinge.js +3 -1
  5. package/dist/IKanimation/constaint/slider.js +3 -1
  6. package/dist/alg/common.js +2 -2
  7. package/dist/alg/extrude.js +56 -54
  8. package/dist/alg/pointset.js +5 -5
  9. package/dist/alg/trianglution.js +12 -10
  10. package/dist/app.js +14 -10
  11. package/dist/diamondMaterialShader.js +6 -2
  12. package/dist/effect/breath-light.js +3 -1
  13. package/dist/extends/geometryaid.js +7 -7
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +7 -2
  16. package/dist/math/Euler.js +12 -10
  17. package/dist/math/HVec3.js +3 -1
  18. package/dist/math/Mat3.js +1 -1
  19. package/dist/math/Mat4.js +6 -6
  20. package/dist/math/Quat.js +4 -2
  21. package/dist/math/Vec.js +3 -1
  22. package/dist/math/Vec2.js +3 -1
  23. package/dist/math/Vec3.js +7 -5
  24. package/dist/math/Vec4.js +3 -1
  25. package/dist/math/vector.js +9 -7
  26. package/dist/render/buffer-attribute.js +12 -28
  27. package/dist/render/eventhandler.d.ts +2 -2
  28. package/dist/render/eventhandler.js +14 -8
  29. package/dist/render/geometry.d.ts +1 -1
  30. package/dist/render/geometry.js +2 -2
  31. package/dist/render/mesh.js +11 -9
  32. package/dist/render/thing.js +10 -8
  33. package/dist/render/types.js +2 -1
  34. package/dist/struct/3d/Box.js +3 -3
  35. package/dist/struct/3d/Capsule.js +3 -1
  36. package/dist/struct/3d/Circle.js +2 -2
  37. package/dist/struct/3d/Disk.js +1 -1
  38. package/dist/struct/3d/Line.js +4 -4
  39. package/dist/struct/3d/Path.js +13 -11
  40. package/dist/struct/3d/Plane.js +12 -10
  41. package/dist/struct/3d/Point.js +3 -1
  42. package/dist/struct/3d/Polygon.js +3 -1
  43. package/dist/struct/3d/Polyline.js +3 -1
  44. package/dist/struct/3d/Rectangle.js +3 -1
  45. package/dist/struct/3d/Segment.js +9 -7
  46. package/dist/struct/3d/Shape.js +3 -1
  47. package/dist/struct/3d/Sphere.js +1 -1
  48. package/dist/struct/3d/Triangle.js +3 -1
  49. package/dist/struct/data/ArrayList.js +11 -9
  50. package/dist/struct/data/ArrayObject.js +3 -1
  51. package/docs/guide/README.md +6 -6
  52. package/git.sh +2 -2
  53. package/package.json +2 -2
  54. package/readme.md +8 -8
  55. package/rollup.config.js +1 -1
  56. package/src/index.ts +2 -0
  57. package/src/render/eventhandler.ts +5 -2
  58. package/src/render/geometry.ts +2 -2
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -19,8 +21,8 @@ var Math_1 = require("./Math");
19
21
  var Mat4_1 = require("./Mat4");
20
22
  var Quat_1 = require("./Quat");
21
23
  var eventhandler_1 = require("../render/eventhandler");
22
- var _matrix = Mat4_1.m4();
23
- var _Quat = Quat_1.quat();
24
+ var _matrix = (0, Mat4_1.m4)();
25
+ var _Quat = (0, Quat_1.quat)();
24
26
  var RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"];
25
27
  var DefaultOrder = "XYZ";
26
28
  var Euler = /** @class */ (function (_super) {
@@ -117,7 +119,7 @@ var Euler = /** @class */ (function (_super) {
117
119
  var m31 = te[2], m32 = te[6], m33 = te[10];
118
120
  order = order || this._order;
119
121
  if (order === "XYZ") {
120
- this._y = Math.asin(Math_1.clamp(m13, -1, 1));
122
+ this._y = Math.asin((0, Math_1.clamp)(m13, -1, 1));
121
123
  if (Math.abs(m13) < 0.9999999) {
122
124
  this._x = Math.atan2(-m23, m33);
123
125
  this._z = Math.atan2(-m12, m11);
@@ -128,7 +130,7 @@ var Euler = /** @class */ (function (_super) {
128
130
  }
129
131
  }
130
132
  else if (order === "YXZ") {
131
- this._x = Math.asin(-Math_1.clamp(m23, -1, 1));
133
+ this._x = Math.asin(-(0, Math_1.clamp)(m23, -1, 1));
132
134
  if (Math.abs(m23) < 0.9999999) {
133
135
  this._y = Math.atan2(m13, m33);
134
136
  this._z = Math.atan2(m21, m22);
@@ -139,7 +141,7 @@ var Euler = /** @class */ (function (_super) {
139
141
  }
140
142
  }
141
143
  else if (order === "ZXY") {
142
- this._x = Math.asin(Math_1.clamp(m32, -1, 1));
144
+ this._x = Math.asin((0, Math_1.clamp)(m32, -1, 1));
143
145
  if (Math.abs(m32) < 0.9999999) {
144
146
  this._y = Math.atan2(-m31, m33);
145
147
  this._z = Math.atan2(-m12, m22);
@@ -150,7 +152,7 @@ var Euler = /** @class */ (function (_super) {
150
152
  }
151
153
  }
152
154
  else if (order === "ZYX") {
153
- this._y = Math.asin(-Math_1.clamp(m31, -1, 1));
155
+ this._y = Math.asin(-(0, Math_1.clamp)(m31, -1, 1));
154
156
  if (Math.abs(m31) < 0.9999999) {
155
157
  this._x = Math.atan2(m32, m33);
156
158
  this._z = Math.atan2(m21, m11);
@@ -161,7 +163,7 @@ var Euler = /** @class */ (function (_super) {
161
163
  }
162
164
  }
163
165
  else if (order === "YZX") {
164
- this._z = Math.asin(Math_1.clamp(m21, -1, 1));
166
+ this._z = Math.asin((0, Math_1.clamp)(m21, -1, 1));
165
167
  if (Math.abs(m21) < 0.9999999) {
166
168
  this._x = Math.atan2(-m23, m22);
167
169
  this._y = Math.atan2(-m31, m11);
@@ -172,7 +174,7 @@ var Euler = /** @class */ (function (_super) {
172
174
  }
173
175
  }
174
176
  else if (order === "XZY") {
175
- this._z = Math.asin(-Math_1.clamp(m12, -1, 1));
177
+ this._z = Math.asin(-(0, Math_1.clamp)(m12, -1, 1));
176
178
  if (Math.abs(m12) < 0.9999999) {
177
179
  this._x = Math.atan2(m32, m22);
178
180
  this._y = Math.atan2(m13, m11);
@@ -231,7 +233,7 @@ var Euler = /** @class */ (function (_super) {
231
233
  return optionalResult.set(this._x, this._y, this._z);
232
234
  }
233
235
  else {
234
- return Vec3_1.v3(this._x, this._y, this._z);
236
+ return (0, Vec3_1.v3)(this._x, this._y, this._z);
235
237
  }
236
238
  };
237
239
  return Euler;
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/dist/math/Mat3.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.m3 = exports.Mat3 = void 0;
4
4
  var Vec3_1 = require("./Vec3");
5
- var _Vec = Vec3_1.v3();
5
+ var _Vec = (0, Vec3_1.v3)();
6
6
  var Mat3 = /** @class */ (function () {
7
7
  function Mat3() {
8
8
  this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
package/dist/math/Mat4.js CHANGED
@@ -777,14 +777,14 @@ var Mat4 = /** @class */ (function () {
777
777
  return Mat4;
778
778
  }());
779
779
  exports.Mat4 = Mat4;
780
- var _v1 = Vec3_1.v3();
780
+ var _v1 = (0, Vec3_1.v3)();
781
781
  var _m1 = m4();
782
782
  var _m2 = m4();
783
- var _zero = Vec3_1.v3(0, 0, 0);
784
- var _one = Vec3_1.v3(1, 1, 1);
785
- var _x = Vec3_1.v3();
786
- var _y = Vec3_1.v3();
787
- var _z = Vec3_1.v3();
783
+ var _zero = (0, Vec3_1.v3)(0, 0, 0);
784
+ var _one = (0, Vec3_1.v3)(1, 1, 1);
785
+ var _x = (0, Vec3_1.v3)();
786
+ var _y = (0, Vec3_1.v3)();
787
+ var _z = (0, Vec3_1.v3)();
788
788
  function m4() {
789
789
  return new Mat4();
790
790
  }
package/dist/math/Quat.js CHANGED
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -281,7 +283,7 @@ var Quat = /** @class */ (function (_super) {
281
283
  return this.normalize();
282
284
  };
283
285
  Quat.prototype.angleTo = function (q) {
284
- return 2 * Math.acos(Math.abs(Math_1.clamp(this.dot(q), -1, 1)));
286
+ return 2 * Math.acos(Math.abs((0, Math_1.clamp)(this.dot(q), -1, 1)));
285
287
  };
286
288
  Quat.prototype.rotateTowards = function (q, step) {
287
289
  var angle = this.angleTo(q);
package/dist/math/Vec.js CHANGED
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/dist/math/Vec2.js CHANGED
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/dist/math/Vec3.js CHANGED
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -548,14 +550,14 @@ var Vec3 = /** @class */ (function (_super) {
548
550
  if (normal)
549
551
  return this.angleToEx(v, normal);
550
552
  var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
551
- return Math.acos(Math_1.clamp(theta, -1, 1));
553
+ return Math.acos((0, Math_1.clamp)(theta, -1, 1));
552
554
  };
553
555
  Vec3.prototype.angleToEx = function (v, normal) {
554
556
  var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
555
557
  if (this.clone().cross(v).dot(normal) > 0)
556
- return Math.acos(Math_1.clamp(theta, -1, 1));
558
+ return Math.acos((0, Math_1.clamp)(theta, -1, 1));
557
559
  else
558
- return Math.PI * 2 - Math.acos(Math_1.clamp(theta, -1, 1));
560
+ return Math.PI * 2 - Math.acos((0, Math_1.clamp)(theta, -1, 1));
559
561
  };
560
562
  Vec3.prototype.distanceTo = function (v) {
561
563
  return Math.sqrt(this.distanceToSquared(v));
@@ -1080,7 +1082,7 @@ var Vec3 = /** @class */ (function (_super) {
1080
1082
  }(eventhandler_1.EventHandler));
1081
1083
  exports.Vec3 = Vec3;
1082
1084
  var _vec = v3();
1083
- var _quat = Quat_1.quat();
1085
+ var _quat = (0, Quat_1.quat)();
1084
1086
  function v3(x, y, z) {
1085
1087
  return new Vec3(x, y, z);
1086
1088
  }
package/dist/math/Vec4.js CHANGED
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -8,12 +8,14 @@
8
8
  * @LastEditTime : 2021-08-02 15:50:16
9
9
  * @FilePath : \cga.js\src\math\VecArray.ts
10
10
  */
11
- var __spreadArrays = (this && this.__spreadArrays) || function () {
12
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
13
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
14
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
15
- r[k] = a[j];
16
- return r;
11
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
12
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
13
+ if (ar || !(i in from)) {
14
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
15
+ ar[i] = from[i];
16
+ }
17
+ }
18
+ return to.concat(ar || Array.prototype.slice.call(from));
17
19
  };
18
20
  Object.defineProperty(exports, "__esModule", { value: true });
19
21
  var Polygon_1 = require("../struct/3d/Polygon");
@@ -256,7 +258,7 @@ var vector = /** @class */ (function () {
256
258
  for (var _i = 2; _i < arguments.length; _i++) {
257
259
  vec[_i - 2] = arguments[_i];
258
260
  }
259
- vecs.splice.apply(vecs, __spreadArrays([i * vecs.length, 0], vecs));
261
+ vecs.splice.apply(vecs, __spreadArray([i * vecs.length, 0], vecs, false));
260
262
  };
261
263
  //
262
264
  /**
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -241,11 +243,9 @@ var Int8BufferAttribute = /** @class */ (function (_super) {
241
243
  __extends(Int8BufferAttribute, _super);
242
244
  function Int8BufferAttribute(array, itemSize, normalized) {
243
245
  if (normalized === void 0) { normalized = false; }
244
- var _this = this;
245
246
  if (Array.isArray(array))
246
247
  array = new Int8Array(array);
247
- _this = _super.call(this, new Int8Array(array), itemSize, normalized) || this;
248
- return _this;
248
+ return _super.call(this, new Int8Array(array), itemSize, normalized) || this;
249
249
  }
250
250
  return Int8BufferAttribute;
251
251
  }(BufferAttribute));
@@ -254,11 +254,9 @@ var Uint8BufferAttribute = /** @class */ (function (_super) {
254
254
  __extends(Uint8BufferAttribute, _super);
255
255
  function Uint8BufferAttribute(array, itemSize, normalized) {
256
256
  if (normalized === void 0) { normalized = false; }
257
- var _this = this;
258
257
  if (Array.isArray(array))
259
258
  array = new Uint8Array(array);
260
- _this = _super.call(this, array, itemSize, normalized) || this;
261
- return _this;
259
+ return _super.call(this, array, itemSize, normalized) || this;
262
260
  }
263
261
  return Uint8BufferAttribute;
264
262
  }(BufferAttribute));
@@ -267,11 +265,9 @@ var Uint8ClampedBufferAttribute = /** @class */ (function (_super) {
267
265
  __extends(Uint8ClampedBufferAttribute, _super);
268
266
  function Uint8ClampedBufferAttribute(array, itemSize, normalized) {
269
267
  if (normalized === void 0) { normalized = false; }
270
- var _this = this;
271
268
  if (Array.isArray(array))
272
269
  array = new Uint8ClampedArray(array);
273
- _this = _super.call(this, array, itemSize, normalized) || this;
274
- return _this;
270
+ return _super.call(this, array, itemSize, normalized) || this;
275
271
  }
276
272
  return Uint8ClampedBufferAttribute;
277
273
  }(BufferAttribute));
@@ -280,11 +276,9 @@ var Int16BufferAttribute = /** @class */ (function (_super) {
280
276
  __extends(Int16BufferAttribute, _super);
281
277
  function Int16BufferAttribute(array, itemSize, normalized) {
282
278
  if (normalized === void 0) { normalized = false; }
283
- var _this = this;
284
279
  if (Array.isArray(array))
285
280
  array = new Int16Array(array);
286
- _this = _super.call(this, array, itemSize, normalized) || this;
287
- return _this;
281
+ return _super.call(this, array, itemSize, normalized) || this;
288
282
  }
289
283
  return Int16BufferAttribute;
290
284
  }(BufferAttribute));
@@ -293,11 +287,9 @@ var Uint16BufferAttribute = /** @class */ (function (_super) {
293
287
  __extends(Uint16BufferAttribute, _super);
294
288
  function Uint16BufferAttribute(array, itemSize, normalized) {
295
289
  if (normalized === void 0) { normalized = false; }
296
- var _this = this;
297
290
  if (Array.isArray(array))
298
291
  array = new Uint16Array(array);
299
- _this = _super.call(this, array, itemSize) || this;
300
- return _this;
292
+ return _super.call(this, array, itemSize) || this;
301
293
  }
302
294
  return Uint16BufferAttribute;
303
295
  }(BufferAttribute));
@@ -306,11 +298,9 @@ var Int32BufferAttribute = /** @class */ (function (_super) {
306
298
  __extends(Int32BufferAttribute, _super);
307
299
  function Int32BufferAttribute(array, itemSize, normalized) {
308
300
  if (normalized === void 0) { normalized = false; }
309
- var _this = this;
310
301
  if (Array.isArray(array))
311
302
  array = new Int32Array(array);
312
- _this = _super.call(this, array, itemSize, normalized) || this;
313
- return _this;
303
+ return _super.call(this, array, itemSize, normalized) || this;
314
304
  }
315
305
  return Int32BufferAttribute;
316
306
  }(BufferAttribute));
@@ -319,11 +309,9 @@ var Uint32BufferAttribute = /** @class */ (function (_super) {
319
309
  __extends(Uint32BufferAttribute, _super);
320
310
  function Uint32BufferAttribute(array, itemSize, normalized) {
321
311
  if (normalized === void 0) { normalized = false; }
322
- var _this = this;
323
312
  if (Array.isArray(array))
324
313
  array = new Uint32Array(array);
325
- _this = _super.call(this, array, itemSize, normalized) || this;
326
- return _this;
314
+ return _super.call(this, array, itemSize, normalized) || this;
327
315
  }
328
316
  return Uint32BufferAttribute;
329
317
  }(BufferAttribute));
@@ -332,11 +320,9 @@ var Float32BufferAttribute = /** @class */ (function (_super) {
332
320
  __extends(Float32BufferAttribute, _super);
333
321
  function Float32BufferAttribute(array, itemSize, normalized) {
334
322
  if (normalized === void 0) { normalized = false; }
335
- var _this = this;
336
323
  if (Array.isArray(array))
337
324
  array = new Float32Array(array);
338
- _this = _super.call(this, array, itemSize, normalized) || this;
339
- return _this;
325
+ return _super.call(this, array, itemSize, normalized) || this;
340
326
  }
341
327
  return Float32BufferAttribute;
342
328
  }(BufferAttribute));
@@ -345,11 +331,9 @@ var Float64BufferAttribute = /** @class */ (function (_super) {
345
331
  __extends(Float64BufferAttribute, _super);
346
332
  function Float64BufferAttribute(array, itemSize, normalized) {
347
333
  if (normalized === void 0) { normalized = false; }
348
- var _this = this;
349
334
  if (Array.isArray(array))
350
335
  array = new Float64Array(array);
351
- _this = _super.call(this, array, itemSize, normalized) || this;
352
- return _this;
336
+ return _super.call(this, array, itemSize, normalized) || this;
353
337
  }
354
338
  return Float64BufferAttribute;
355
339
  }(BufferAttribute));
@@ -17,7 +17,7 @@ export declare class EventHandler {
17
17
  * });
18
18
  * obj.fire('test', 1, 2); // prints 3 to the console
19
19
  */
20
- on(name: string, callback: any, scope?: any): this;
20
+ on(name: string | string[], callback: any, scope?: any): this;
21
21
  /**
22
22
  * @function
23
23
  * @name EventHandler#off
@@ -74,5 +74,5 @@ export declare class EventHandler {
74
74
  * obj.hasEvent('test'); // returns true
75
75
  * obj.hasEvent('hello'); // returns false
76
76
  */
77
- hasEvent(name: string | number): boolean;
77
+ hasEvent(name: string | number): any;
78
78
  }
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
8
10
  };
9
11
  Object.defineProperty(exports, "__esModule", { value: true });
10
12
  exports.EventHandler = void 0;
@@ -41,7 +43,11 @@ var EventHandler = /** @class */ (function () {
41
43
  * obj.fire('test', 1, 2); // prints 3 to the console
42
44
  */
43
45
  EventHandler.prototype.on = function (name, callback, scope) {
44
- this._addCallback(name, callback, scope, false);
46
+ var _this = this;
47
+ if (Array.isArray(name))
48
+ name.forEach(function (v) { return _this._addCallback(v, callback, scope, false); });
49
+ else
50
+ this._addCallback(name, callback, scope, false);
45
51
  return this;
46
52
  };
47
53
  /**
@@ -135,7 +141,7 @@ var EventHandler = /** @class */ (function () {
135
141
  // eslint-disable-next-line no-unmodified-loop-condition
136
142
  for (var i = 0; (callbacks || this._callbackActive[name]) && (i < (callbacks || this._callbackActive[name]).length); i++) {
137
143
  var evt = (callbacks || this._callbackActive[name])[i];
138
- (_a = evt.callback).call.apply(_a, __spreadArrays([evt.scope], args));
144
+ (_a = evt.callback).call.apply(_a, __spreadArray([evt.scope], args, false));
139
145
  if (evt.once) {
140
146
  var ind = this._callbacks[name].indexOf(evt);
141
147
  if (ind !== -1) {
@@ -53,7 +53,7 @@ export declare class BufferGeometry {
53
53
  * 转化成BufferArray来计算
54
54
  * @param geo
55
55
  */
56
- setFromGeometry(geo: IGeometry): this;
56
+ setFromGeometry(geo: IGeometry | IBufferGeometry): this;
57
57
  getIndex(): BufferAttribute | undefined;
58
58
  setIndex(index: BufferAttribute | TypedArray | number[]): void;
59
59
  getAttribute(name: string): BufferAttribute;
@@ -95,7 +95,7 @@ var BufferGeometry = /** @class */ (function () {
95
95
  else if (attribute instanceof buffer_attribute_1.BufferAttribute) {
96
96
  this.attributes[name] = attribute;
97
97
  }
98
- else if (types_1.isBufferArray(attribute)) {
98
+ else if ((0, types_1.isBufferArray)(attribute)) {
99
99
  this.setAttribute(name, new buffer_attribute_1.BufferAttribute(attribute, itemSize));
100
100
  }
101
101
  return this;
@@ -174,7 +174,7 @@ var BufferGeometry = /** @class */ (function () {
174
174
  return this;
175
175
  };
176
176
  BufferGeometry.prototype.lookAt = function (vector) {
177
- _m1.lookAt(Vec3_1.v3(), vector, Vec3_1.Vec3.UnitY);
177
+ _m1.lookAt((0, Vec3_1.v3)(), vector, Vec3_1.Vec3.UnitY);
178
178
  this.applyMat4(_m1);
179
179
  return this;
180
180
  };
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
8
10
  };
9
11
  Object.defineProperty(exports, "__esModule", { value: true });
10
12
  exports.trianglutionToGeometryBuffer = exports.toGeoBuffer = exports.triangListToBuffer = exports.indexable = void 0;
@@ -38,7 +40,7 @@ exports.indexable = indexable;
38
40
  function triangListToBuffer(vertices, triangleList) {
39
41
  indexable(triangleList);
40
42
  var indices = [];
41
- array_1.forall(triangleList, function (v) {
43
+ (0, array_1.forall)(triangleList, function (v) {
42
44
  indices.push(v.index);
43
45
  });
44
46
  return toGeoBuffer(vertices, indices);
@@ -68,8 +70,8 @@ exports.toGeoBuffer = toGeoBuffer;
68
70
  function trianglutionToGeometryBuffer(boundary, holes, options) {
69
71
  if (holes === void 0) { holes = []; }
70
72
  if (options === void 0) { options = { normal: Vec3_1.Vec3.UnitZ }; }
71
- var triangles = trianglution_1.triangulation(boundary, holes, options);
72
- var vertices = __spreadArrays(boundary, array_1.flat(holes));
73
+ var triangles = (0, trianglution_1.triangulation)(boundary, holes, options);
74
+ var vertices = __spreadArray(__spreadArray([], boundary, true), (0, array_1.flat)(holes), true);
73
75
  var uvs = [];
74
76
  vertices.forEach(function (v) {
75
77
  uvs.push(v.x, v.z);
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -23,7 +25,7 @@ var Thing = /** @class */ (function (_super) {
23
25
  _this.cache = {};
24
26
  _this._useData = {};
25
27
  opts = opts || {};
26
- _this.uuid = uuid_1.v4();
28
+ _this.uuid = (0, uuid_1.v4)();
27
29
  _this.id = _this.uuid;
28
30
  _this.name = opts.name || "未命名";
29
31
  _this.alias = opts.alias;
@@ -151,11 +153,11 @@ var Thing = /** @class */ (function (_super) {
151
153
  return;
152
154
  Object.defineProperty(bindObject, name, {
153
155
  get: function () {
154
- return bindObject["_" + name];
156
+ return bindObject["_".concat(name)];
155
157
  },
156
158
  set: function (value) {
157
- var oldValue = bindObject["_" + name];
158
- bindObject["_" + name] = value;
159
+ var oldValue = bindObject["_".concat(name)];
160
+ bindObject["_".concat(name)] = value;
159
161
  bindObject.fire('set', name, oldValue, value);
160
162
  },
161
163
  configurable: true
@@ -175,11 +177,11 @@ function buildAccessor(name, bindObject) {
175
177
  return;
176
178
  Object.defineProperty(bindObject, name, {
177
179
  get: function () {
178
- return bindObject["_" + name];
180
+ return bindObject["_".concat(name)];
179
181
  },
180
182
  set: function (value) {
181
- var oldValue = bindObject["_" + name];
182
- bindObject["_" + name] = value;
183
+ var oldValue = bindObject["_".concat(name)];
184
+ bindObject["_".concat(name)] = value;
183
185
  bindObject.fire('set', name, oldValue, value);
184
186
  },
185
187
  configurable: true
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBufferArray = void 0;
4
- exports.isBufferArray = function (obj) {
4
+ var isBufferArray = function (obj) {
5
5
  var types = ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'];
6
6
  return types.indexOf(obj.constructor.name) > -1;
7
7
  };
8
+ exports.isBufferArray = isBufferArray;
@@ -5,9 +5,9 @@ var Vec3_1 = require("../../math/Vec3");
5
5
  var _vector = new Vec3_1.Vec3();
6
6
  var Box = /** @class */ (function () {
7
7
  function Box(min, max) {
8
- if (min === void 0) { min = Vec3_1.v3(Infinity, Infinity, Infinity); }
9
- if (max === void 0) { max = Vec3_1.v3(-Infinity, -Infinity, -Infinity); }
10
- this._center = Vec3_1.v3();
8
+ if (min === void 0) { min = (0, Vec3_1.v3)(Infinity, Infinity, Infinity); }
9
+ if (max === void 0) { max = (0, Vec3_1.v3)(-Infinity, -Infinity, -Infinity); }
10
+ this._center = (0, Vec3_1.v3)();
11
11
  this.min = min;
12
12
  this.max = max;
13
13
  // if (points) {
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -35,7 +35,7 @@ var Circle = /** @class */ (function () {
35
35
  Circle.prototype.arc1 = function (fixp0, fixp1, movep, normal) {
36
36
  this.setFrom3Points(fixp0, fixp1, movep);
37
37
  this.startAngle = 0;
38
- this.endAngle = common_1.angle(fixp0.clone().sub(this.center).normalize(), fixp1.clone().sub(this.center).normalize(), this.normal || normal);
38
+ this.endAngle = (0, common_1.angle)(fixp0.clone().sub(this.center).normalize(), fixp1.clone().sub(this.center).normalize(), this.normal || normal);
39
39
  };
40
40
  /**
41
41
  * 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
@@ -49,7 +49,7 @@ var Circle = /** @class */ (function () {
49
49
  this.center.copy(center);
50
50
  var v2 = movep.clone().sub(center);
51
51
  var v1 = fixp1.clone().sub(center);
52
- var jd = common_1.angle(v1, v2);
52
+ var jd = (0, common_1.angle)(v1, v2);
53
53
  };
54
54
  Circle.prototype.setFrom3Points = function (p0, p1, p2, normal) {
55
55
  // if (pointsCollinear(p0, p1, p2))