@xort/cga 0.0.78 → 0.0.79

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 (51) hide show
  1. package/dist/IKanimation/Bone.js +1 -3
  2. package/dist/IKanimation/CCDSolver.js +2 -2
  3. package/dist/IKanimation/constaint/hinge.js +1 -3
  4. package/dist/IKanimation/constaint/slider.js +1 -3
  5. package/dist/alg/common.js +2 -2
  6. package/dist/alg/extrude.js +54 -56
  7. package/dist/alg/pointset.js +5 -5
  8. package/dist/alg/trianglution.js +10 -12
  9. package/dist/app.js +10 -14
  10. package/dist/diamondMaterialShader.js +2 -6
  11. package/dist/effect/breath-light.js +1 -3
  12. package/dist/extends/geometryaid.js +7 -7
  13. package/dist/index.js +2 -6
  14. package/dist/math/Color.d.ts +1 -0
  15. package/dist/math/Color.js +40 -5
  16. package/dist/math/Euler.js +10 -12
  17. package/dist/math/HVec3.js +1 -3
  18. package/dist/math/Mat3.js +1 -1
  19. package/dist/math/Mat4.js +6 -6
  20. package/dist/math/Quat.js +2 -4
  21. package/dist/math/Vec.js +1 -3
  22. package/dist/math/Vec2.js +1 -3
  23. package/dist/math/Vec3.js +5 -7
  24. package/dist/math/Vec4.js +1 -3
  25. package/dist/math/vector.js +7 -9
  26. package/dist/render/buffer-attribute.js +28 -12
  27. package/dist/render/eventhandler.d.ts +1 -1
  28. package/dist/render/eventhandler.js +7 -9
  29. package/dist/render/geometry.js +2 -2
  30. package/dist/render/mesh.js +9 -11
  31. package/dist/render/thing.js +8 -10
  32. package/dist/render/types.js +1 -2
  33. package/dist/struct/3d/Box.js +3 -3
  34. package/dist/struct/3d/Capsule.js +1 -3
  35. package/dist/struct/3d/Circle.js +2 -2
  36. package/dist/struct/3d/Disk.js +1 -1
  37. package/dist/struct/3d/Line.js +4 -4
  38. package/dist/struct/3d/Path.js +11 -13
  39. package/dist/struct/3d/Plane.js +10 -12
  40. package/dist/struct/3d/Point.js +1 -3
  41. package/dist/struct/3d/Polygon.js +1 -3
  42. package/dist/struct/3d/Polyline.js +1 -3
  43. package/dist/struct/3d/Rectangle.js +1 -3
  44. package/dist/struct/3d/Segment.js +7 -9
  45. package/dist/struct/3d/Shape.js +1 -3
  46. package/dist/struct/3d/Sphere.js +1 -1
  47. package/dist/struct/3d/Triangle.js +1 -3
  48. package/dist/struct/data/ArrayList.js +9 -11
  49. package/dist/struct/data/ArrayObject.js +1 -3
  50. package/package.json +1 -1
  51. package/src/math/Color.ts +50 -8
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -118,6 +116,42 @@ var Color = /** @class */ (function (_super) {
118
116
  }
119
117
  return this;
120
118
  };
119
+ Color.prototype.setStyle = function (style) {
120
+ var m = /^\#([A-Fa-f\d]+)$/.exec(style);
121
+ // hex color
122
+ var hex = m[1];
123
+ var size = hex.length;
124
+ if (size === 3) {
125
+ // #ff0
126
+ this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
127
+ this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
128
+ this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
129
+ return this;
130
+ }
131
+ else if (size === 6) {
132
+ // #ff0000
133
+ this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
134
+ this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
135
+ this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
136
+ return this;
137
+ }
138
+ else if (size === 4) {
139
+ // #ff0000
140
+ this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
141
+ this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
142
+ this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
143
+ this.a = parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255;
144
+ return this;
145
+ }
146
+ else if (size === 8) {
147
+ // #ff0000
148
+ this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
149
+ this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
150
+ this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
151
+ this.a = parseInt(hex.charAt(6) + hex.charAt(7), 16) / 255;
152
+ return this;
153
+ }
154
+ };
121
155
  Color.prototype.setRGB = function (r, g, b, a) {
122
156
  if (a === void 0) { a = 1.0; }
123
157
  this._r = r;
@@ -133,10 +167,11 @@ var Color = /** @class */ (function (_super) {
133
167
  this._r = color.r;
134
168
  this._g = color.g;
135
169
  this._b = color.b;
170
+ this._a = color.a;
136
171
  return this;
137
172
  };
138
173
  Color.prototype.equals = function (c) {
139
- return (c.r === this.r) && (c.g === this.g) && (c.b === this.b);
174
+ return (c.r === this.r) && (c.g === this.g) && (c.b === this.b) && (c.a === this.a);
140
175
  };
141
176
  Color.prototype.toArray = function (array, offset) {
142
177
  if (array === void 0) { array = []; }
@@ -148,7 +183,7 @@ var Color = /** @class */ (function (_super) {
148
183
  return array;
149
184
  };
150
185
  Color.prototype.getHex = function () {
151
- return (this.r * 255) << 32 ^ (this.g * 255) << 16 ^ (this.b * 255) << 8 ^ (this.a * 255) << 0;
186
+ return (this.r * 255) << 24 ^ (this.g * 255) << 16 ^ (this.b * 255) << 8 ^ (this.a * 255) << 0;
152
187
  };
153
188
  Color.prototype.toJSON = function () {
154
189
  return this.getHex();
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -21,8 +19,8 @@ var Math_1 = require("./Math");
21
19
  var Mat4_1 = require("./Mat4");
22
20
  var Quat_1 = require("./Quat");
23
21
  var eventhandler_1 = require("../render/eventhandler");
24
- var _matrix = (0, Mat4_1.m4)();
25
- var _Quat = (0, Quat_1.quat)();
22
+ var _matrix = Mat4_1.m4();
23
+ var _Quat = Quat_1.quat();
26
24
  var RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"];
27
25
  var DefaultOrder = "XYZ";
28
26
  var Euler = /** @class */ (function (_super) {
@@ -119,7 +117,7 @@ var Euler = /** @class */ (function (_super) {
119
117
  var m31 = te[2], m32 = te[6], m33 = te[10];
120
118
  order = order || this._order;
121
119
  if (order === "XYZ") {
122
- this._y = Math.asin((0, Math_1.clamp)(m13, -1, 1));
120
+ this._y = Math.asin(Math_1.clamp(m13, -1, 1));
123
121
  if (Math.abs(m13) < 0.9999999) {
124
122
  this._x = Math.atan2(-m23, m33);
125
123
  this._z = Math.atan2(-m12, m11);
@@ -130,7 +128,7 @@ var Euler = /** @class */ (function (_super) {
130
128
  }
131
129
  }
132
130
  else if (order === "YXZ") {
133
- this._x = Math.asin(-(0, Math_1.clamp)(m23, -1, 1));
131
+ this._x = Math.asin(-Math_1.clamp(m23, -1, 1));
134
132
  if (Math.abs(m23) < 0.9999999) {
135
133
  this._y = Math.atan2(m13, m33);
136
134
  this._z = Math.atan2(m21, m22);
@@ -141,7 +139,7 @@ var Euler = /** @class */ (function (_super) {
141
139
  }
142
140
  }
143
141
  else if (order === "ZXY") {
144
- this._x = Math.asin((0, Math_1.clamp)(m32, -1, 1));
142
+ this._x = Math.asin(Math_1.clamp(m32, -1, 1));
145
143
  if (Math.abs(m32) < 0.9999999) {
146
144
  this._y = Math.atan2(-m31, m33);
147
145
  this._z = Math.atan2(-m12, m22);
@@ -152,7 +150,7 @@ var Euler = /** @class */ (function (_super) {
152
150
  }
153
151
  }
154
152
  else if (order === "ZYX") {
155
- this._y = Math.asin(-(0, Math_1.clamp)(m31, -1, 1));
153
+ this._y = Math.asin(-Math_1.clamp(m31, -1, 1));
156
154
  if (Math.abs(m31) < 0.9999999) {
157
155
  this._x = Math.atan2(m32, m33);
158
156
  this._z = Math.atan2(m21, m11);
@@ -163,7 +161,7 @@ var Euler = /** @class */ (function (_super) {
163
161
  }
164
162
  }
165
163
  else if (order === "YZX") {
166
- this._z = Math.asin((0, Math_1.clamp)(m21, -1, 1));
164
+ this._z = Math.asin(Math_1.clamp(m21, -1, 1));
167
165
  if (Math.abs(m21) < 0.9999999) {
168
166
  this._x = Math.atan2(-m23, m22);
169
167
  this._y = Math.atan2(-m31, m11);
@@ -174,7 +172,7 @@ var Euler = /** @class */ (function (_super) {
174
172
  }
175
173
  }
176
174
  else if (order === "XZY") {
177
- this._z = Math.asin(-(0, Math_1.clamp)(m12, -1, 1));
175
+ this._z = Math.asin(-Math_1.clamp(m12, -1, 1));
178
176
  if (Math.abs(m12) < 0.9999999) {
179
177
  this._x = Math.atan2(m32, m22);
180
178
  this._y = Math.atan2(m13, m11);
@@ -233,7 +231,7 @@ var Euler = /** @class */ (function (_super) {
233
231
  return optionalResult.set(this._x, this._y, this._z);
234
232
  }
235
233
  else {
236
- return (0, Vec3_1.v3)(this._x, this._y, this._z);
234
+ return Vec3_1.v3(this._x, this._y, this._z);
237
235
  }
238
236
  };
239
237
  return Euler;
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  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 = (0, Vec3_1.v3)();
5
+ var _Vec = 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 = (0, Vec3_1.v3)();
780
+ var _v1 = Vec3_1.v3();
781
781
  var _m1 = m4();
782
782
  var _m2 = m4();
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)();
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();
788
788
  function m4() {
789
789
  return new Mat4();
790
790
  }
package/dist/math/Quat.js CHANGED
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -283,7 +281,7 @@ var Quat = /** @class */ (function (_super) {
283
281
  return this.normalize();
284
282
  };
285
283
  Quat.prototype.angleTo = function (q) {
286
- return 2 * Math.acos(Math.abs((0, Math_1.clamp)(this.dot(q), -1, 1)));
284
+ return 2 * Math.acos(Math.abs(Math_1.clamp(this.dot(q), -1, 1)));
287
285
  };
288
286
  Quat.prototype.rotateTowards = function (q, step) {
289
287
  var angle = this.angleTo(q);
package/dist/math/Vec.js CHANGED
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/dist/math/Vec2.js CHANGED
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/dist/math/Vec3.js CHANGED
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -550,14 +548,14 @@ var Vec3 = /** @class */ (function (_super) {
550
548
  if (normal)
551
549
  return this.angleToEx(v, normal);
552
550
  var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
553
- return Math.acos((0, Math_1.clamp)(theta, -1, 1));
551
+ return Math.acos(Math_1.clamp(theta, -1, 1));
554
552
  };
555
553
  Vec3.prototype.angleToEx = function (v, normal) {
556
554
  var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
557
555
  if (this.clone().cross(v).dot(normal) > 0)
558
- return Math.acos((0, Math_1.clamp)(theta, -1, 1));
556
+ return Math.acos(Math_1.clamp(theta, -1, 1));
559
557
  else
560
- return Math.PI * 2 - Math.acos((0, Math_1.clamp)(theta, -1, 1));
558
+ return Math.PI * 2 - Math.acos(Math_1.clamp(theta, -1, 1));
561
559
  };
562
560
  Vec3.prototype.distanceTo = function (v) {
563
561
  return Math.sqrt(this.distanceToSquared(v));
@@ -1082,7 +1080,7 @@ var Vec3 = /** @class */ (function (_super) {
1082
1080
  }(eventhandler_1.EventHandler));
1083
1081
  exports.Vec3 = Vec3;
1084
1082
  var _vec = v3();
1085
- var _quat = (0, Quat_1.quat)();
1083
+ var _quat = Quat_1.quat();
1086
1084
  function v3(x, y, z) {
1087
1085
  return new Vec3(x, y, z);
1088
1086
  }
package/dist/math/Vec4.js CHANGED
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -8,14 +8,12 @@
8
8
  * @LastEditTime : 2021-08-02 15:50:16
9
9
  * @FilePath : \cga.js\src\math\VecArray.ts
10
10
  */
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));
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;
19
17
  };
20
18
  Object.defineProperty(exports, "__esModule", { value: true });
21
19
  var Polygon_1 = require("../struct/3d/Polygon");
@@ -258,7 +256,7 @@ var vector = /** @class */ (function () {
258
256
  for (var _i = 2; _i < arguments.length; _i++) {
259
257
  vec[_i - 2] = arguments[_i];
260
258
  }
261
- vecs.splice.apply(vecs, __spreadArray([i * vecs.length, 0], vecs, false));
259
+ vecs.splice.apply(vecs, __spreadArrays([i * vecs.length, 0], vecs));
262
260
  };
263
261
  //
264
262
  /**
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -243,9 +241,11 @@ var Int8BufferAttribute = /** @class */ (function (_super) {
243
241
  __extends(Int8BufferAttribute, _super);
244
242
  function Int8BufferAttribute(array, itemSize, normalized) {
245
243
  if (normalized === void 0) { normalized = false; }
244
+ var _this = this;
246
245
  if (Array.isArray(array))
247
246
  array = new Int8Array(array);
248
- return _super.call(this, new Int8Array(array), itemSize, normalized) || this;
247
+ _this = _super.call(this, new Int8Array(array), itemSize, normalized) || this;
248
+ return _this;
249
249
  }
250
250
  return Int8BufferAttribute;
251
251
  }(BufferAttribute));
@@ -254,9 +254,11 @@ 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;
257
258
  if (Array.isArray(array))
258
259
  array = new Uint8Array(array);
259
- return _super.call(this, array, itemSize, normalized) || this;
260
+ _this = _super.call(this, array, itemSize, normalized) || this;
261
+ return _this;
260
262
  }
261
263
  return Uint8BufferAttribute;
262
264
  }(BufferAttribute));
@@ -265,9 +267,11 @@ var Uint8ClampedBufferAttribute = /** @class */ (function (_super) {
265
267
  __extends(Uint8ClampedBufferAttribute, _super);
266
268
  function Uint8ClampedBufferAttribute(array, itemSize, normalized) {
267
269
  if (normalized === void 0) { normalized = false; }
270
+ var _this = this;
268
271
  if (Array.isArray(array))
269
272
  array = new Uint8ClampedArray(array);
270
- return _super.call(this, array, itemSize, normalized) || this;
273
+ _this = _super.call(this, array, itemSize, normalized) || this;
274
+ return _this;
271
275
  }
272
276
  return Uint8ClampedBufferAttribute;
273
277
  }(BufferAttribute));
@@ -276,9 +280,11 @@ var Int16BufferAttribute = /** @class */ (function (_super) {
276
280
  __extends(Int16BufferAttribute, _super);
277
281
  function Int16BufferAttribute(array, itemSize, normalized) {
278
282
  if (normalized === void 0) { normalized = false; }
283
+ var _this = this;
279
284
  if (Array.isArray(array))
280
285
  array = new Int16Array(array);
281
- return _super.call(this, array, itemSize, normalized) || this;
286
+ _this = _super.call(this, array, itemSize, normalized) || this;
287
+ return _this;
282
288
  }
283
289
  return Int16BufferAttribute;
284
290
  }(BufferAttribute));
@@ -287,9 +293,11 @@ var Uint16BufferAttribute = /** @class */ (function (_super) {
287
293
  __extends(Uint16BufferAttribute, _super);
288
294
  function Uint16BufferAttribute(array, itemSize, normalized) {
289
295
  if (normalized === void 0) { normalized = false; }
296
+ var _this = this;
290
297
  if (Array.isArray(array))
291
298
  array = new Uint16Array(array);
292
- return _super.call(this, array, itemSize) || this;
299
+ _this = _super.call(this, array, itemSize) || this;
300
+ return _this;
293
301
  }
294
302
  return Uint16BufferAttribute;
295
303
  }(BufferAttribute));
@@ -298,9 +306,11 @@ var Int32BufferAttribute = /** @class */ (function (_super) {
298
306
  __extends(Int32BufferAttribute, _super);
299
307
  function Int32BufferAttribute(array, itemSize, normalized) {
300
308
  if (normalized === void 0) { normalized = false; }
309
+ var _this = this;
301
310
  if (Array.isArray(array))
302
311
  array = new Int32Array(array);
303
- return _super.call(this, array, itemSize, normalized) || this;
312
+ _this = _super.call(this, array, itemSize, normalized) || this;
313
+ return _this;
304
314
  }
305
315
  return Int32BufferAttribute;
306
316
  }(BufferAttribute));
@@ -309,9 +319,11 @@ var Uint32BufferAttribute = /** @class */ (function (_super) {
309
319
  __extends(Uint32BufferAttribute, _super);
310
320
  function Uint32BufferAttribute(array, itemSize, normalized) {
311
321
  if (normalized === void 0) { normalized = false; }
322
+ var _this = this;
312
323
  if (Array.isArray(array))
313
324
  array = new Uint32Array(array);
314
- return _super.call(this, array, itemSize, normalized) || this;
325
+ _this = _super.call(this, array, itemSize, normalized) || this;
326
+ return _this;
315
327
  }
316
328
  return Uint32BufferAttribute;
317
329
  }(BufferAttribute));
@@ -320,9 +332,11 @@ var Float32BufferAttribute = /** @class */ (function (_super) {
320
332
  __extends(Float32BufferAttribute, _super);
321
333
  function Float32BufferAttribute(array, itemSize, normalized) {
322
334
  if (normalized === void 0) { normalized = false; }
335
+ var _this = this;
323
336
  if (Array.isArray(array))
324
337
  array = new Float32Array(array);
325
- return _super.call(this, array, itemSize, normalized) || this;
338
+ _this = _super.call(this, array, itemSize, normalized) || this;
339
+ return _this;
326
340
  }
327
341
  return Float32BufferAttribute;
328
342
  }(BufferAttribute));
@@ -331,9 +345,11 @@ var Float64BufferAttribute = /** @class */ (function (_super) {
331
345
  __extends(Float64BufferAttribute, _super);
332
346
  function Float64BufferAttribute(array, itemSize, normalized) {
333
347
  if (normalized === void 0) { normalized = false; }
348
+ var _this = this;
334
349
  if (Array.isArray(array))
335
350
  array = new Float64Array(array);
336
- return _super.call(this, array, itemSize, normalized) || this;
351
+ _this = _super.call(this, array, itemSize, normalized) || this;
352
+ return _this;
337
353
  }
338
354
  return Float64BufferAttribute;
339
355
  }(BufferAttribute));
@@ -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): any;
77
+ hasEvent(name: string | number): boolean;
78
78
  }
@@ -1,12 +1,10 @@
1
1
  "use strict";
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));
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;
10
8
  };
11
9
  Object.defineProperty(exports, "__esModule", { value: true });
12
10
  exports.EventHandler = void 0;
@@ -141,7 +139,7 @@ var EventHandler = /** @class */ (function () {
141
139
  // eslint-disable-next-line no-unmodified-loop-condition
142
140
  for (var i = 0; (callbacks || this._callbackActive[name]) && (i < (callbacks || this._callbackActive[name]).length); i++) {
143
141
  var evt = (callbacks || this._callbackActive[name])[i];
144
- (_a = evt.callback).call.apply(_a, __spreadArray([evt.scope], args, false));
142
+ (_a = evt.callback).call.apply(_a, __spreadArrays([evt.scope], args));
145
143
  if (evt.once) {
146
144
  var ind = this._callbacks[name].indexOf(evt);
147
145
  if (ind !== -1) {
@@ -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 ((0, types_1.isBufferArray)(attribute)) {
98
+ else if (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((0, Vec3_1.v3)(), vector, Vec3_1.Vec3.UnitY);
177
+ _m1.lookAt(Vec3_1.v3(), vector, Vec3_1.Vec3.UnitY);
178
178
  this.applyMat4(_m1);
179
179
  return this;
180
180
  };
@@ -1,12 +1,10 @@
1
1
  "use strict";
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));
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;
10
8
  };
11
9
  Object.defineProperty(exports, "__esModule", { value: true });
12
10
  exports.trianglutionToGeometryBuffer = exports.toGeoBuffer = exports.triangListToBuffer = exports.indexable = void 0;
@@ -40,7 +38,7 @@ exports.indexable = indexable;
40
38
  function triangListToBuffer(vertices, triangleList) {
41
39
  indexable(triangleList);
42
40
  var indices = [];
43
- (0, array_1.forall)(triangleList, function (v) {
41
+ array_1.forall(triangleList, function (v) {
44
42
  indices.push(v.index);
45
43
  });
46
44
  return toGeoBuffer(vertices, indices);
@@ -70,8 +68,8 @@ exports.toGeoBuffer = toGeoBuffer;
70
68
  function trianglutionToGeometryBuffer(boundary, holes, options) {
71
69
  if (holes === void 0) { holes = []; }
72
70
  if (options === void 0) { options = { normal: Vec3_1.Vec3.UnitZ }; }
73
- var triangles = (0, trianglution_1.triangulation)(boundary, holes, options);
74
- var vertices = __spreadArray(__spreadArray([], boundary, true), (0, array_1.flat)(holes), true);
71
+ var triangles = trianglution_1.triangulation(boundary, holes, options);
72
+ var vertices = __spreadArrays(boundary, array_1.flat(holes));
75
73
  var uvs = [];
76
74
  vertices.forEach(function (v) {
77
75
  uvs.push(v.x, v.z);
@@ -3,12 +3,10 @@ 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(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");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -25,7 +23,7 @@ var Thing = /** @class */ (function (_super) {
25
23
  _this.cache = {};
26
24
  _this._useData = {};
27
25
  opts = opts || {};
28
- _this.uuid = (0, uuid_1.v4)();
26
+ _this.uuid = uuid_1.v4();
29
27
  _this.id = _this.uuid;
30
28
  _this.name = opts.name || "未命名";
31
29
  _this.alias = opts.alias;
@@ -153,11 +151,11 @@ var Thing = /** @class */ (function (_super) {
153
151
  return;
154
152
  Object.defineProperty(bindObject, name, {
155
153
  get: function () {
156
- return bindObject["_".concat(name)];
154
+ return bindObject["_" + name];
157
155
  },
158
156
  set: function (value) {
159
- var oldValue = bindObject["_".concat(name)];
160
- bindObject["_".concat(name)] = value;
157
+ var oldValue = bindObject["_" + name];
158
+ bindObject["_" + name] = value;
161
159
  bindObject.fire('set', name, oldValue, value);
162
160
  },
163
161
  configurable: true
@@ -177,11 +175,11 @@ function buildAccessor(name, bindObject) {
177
175
  return;
178
176
  Object.defineProperty(bindObject, name, {
179
177
  get: function () {
180
- return bindObject["_".concat(name)];
178
+ return bindObject["_" + name];
181
179
  },
182
180
  set: function (value) {
183
- var oldValue = bindObject["_".concat(name)];
184
- bindObject["_".concat(name)] = value;
181
+ var oldValue = bindObject["_" + name];
182
+ bindObject["_" + name] = value;
185
183
  bindObject.fire('set', name, oldValue, value);
186
184
  },
187
185
  configurable: true
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isBufferArray = void 0;
4
- var isBufferArray = function (obj) {
4
+ exports.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;