@xort/cga 0.0.83 → 0.0.84
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/build/@xort_cga.js +639 -314
- package/deploy.sh +13 -1
- package/dist/IKanimation/Bone.d.ts +1 -3
- package/dist/IKanimation/Bone.js +4 -22
- package/dist/alg/extrude.js +4 -4
- package/dist/extends/geometryaid.js +7 -15
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/math/Color.d.ts +1 -2
- package/dist/math/Color.js +14 -31
- package/dist/math/Euler.d.ts +4 -5
- package/dist/math/Euler.js +16 -34
- package/dist/math/HVec3.d.ts +1 -2
- package/dist/math/HVec3.js +13 -30
- package/dist/math/Quat.d.ts +1 -2
- package/dist/math/Quat.js +23 -43
- package/dist/math/Vec2.d.ts +4 -4
- package/dist/math/Vec2.js +7 -24
- package/dist/math/Vec3.d.ts +5 -9
- package/dist/math/Vec3.js +35 -52
- package/dist/math/Vec4.d.ts +4 -4
- package/dist/math/Vec4.js +11 -28
- package/dist/math/vecs.d.ts +19 -6
- package/dist/math/vecs.js +31 -1
- package/dist/render/{buffer-attribute.d.ts → bufferAttribute.d.ts} +8 -4
- package/dist/render/{buffer-attribute.js → bufferAttribute.js} +4 -0
- package/dist/render/geometry.d.ts +7 -9
- package/dist/render/geometry.js +22 -25
- package/dist/render/mesh.d.ts +23 -18
- package/dist/render/mesh.js +62 -57
- package/dist/render/types.d.ts +1 -0
- package/dist/struct/3d/Box.d.ts +1 -1
- package/dist/struct/3d/Plane.js +1 -1
- package/package.json +73 -73
- package/rollup.config.js +1 -1
- package/src/IKanimation/Bone.ts +1 -5
- package/src/alg/extrude.ts +6 -6
- package/src/app.ts +2 -10
- package/src/extends/geometryaid.ts +10 -13
- package/src/index.ts +2 -4
- package/src/math/Color.ts +6 -8
- package/src/math/Euler.ts +11 -12
- package/src/math/HVec3.ts +3 -5
- package/src/math/Quat.ts +18 -23
- package/src/math/Vec2.ts +7 -7
- package/src/math/Vec3.ts +37 -36
- package/src/math/Vec4.ts +9 -9
- package/src/math/vecs.ts +50 -8
- package/src/render/{buffer-attribute.ts → bufferAttribute.ts} +11 -4
- package/src/render/geometry.ts +18 -15
- package/src/render/mesh.ts +56 -54
- package/src/render/types.ts +2 -0
- package/src/struct/3d/Box.ts +1 -1
- package/src/struct/3d/Plane.ts +2 -4
- package/dist/math/Vec.d.ts +0 -7
- package/dist/math/Vec.js +0 -41
- package/dist/math/vector.d.ts +0 -114
- package/dist/math/vector.js +0 -371
- package/dist/render/eventhandler.d.ts +0 -78
- package/dist/render/eventhandler.js +0 -191
- package/dist/render/thing.d.ts +0 -34
- package/dist/render/thing.js +0 -194
- package/src/math/Vec.ts +0 -26
- package/src/render/eventhandler.ts +0 -196
- package/src/render/thing.ts +0 -204
package/build/@xort_cga.js
CHANGED
|
@@ -132,14 +132,12 @@
|
|
|
132
132
|
|
|
133
133
|
var eventhandler = createCommonjsModule(function (module, exports) {
|
|
134
134
|
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
135
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
136
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
137
|
+
|
|
138
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
139
|
+
|
|
140
|
+
return r;
|
|
143
141
|
};
|
|
144
142
|
|
|
145
143
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -183,8 +181,11 @@
|
|
|
183
181
|
|
|
184
182
|
|
|
185
183
|
EventHandler.prototype.on = function (name, callback, scope) {
|
|
186
|
-
|
|
184
|
+
var _this = this;
|
|
187
185
|
|
|
186
|
+
if (Array.isArray(name)) name.forEach(function (v) {
|
|
187
|
+
return _this._addCallback(v, callback, scope, false);
|
|
188
|
+
});else this._addCallback(name, callback, scope, false);
|
|
188
189
|
return this;
|
|
189
190
|
};
|
|
190
191
|
/**
|
|
@@ -281,7 +282,7 @@
|
|
|
281
282
|
for (var i = 0; (callbacks || this._callbackActive[name]) && i < (callbacks || this._callbackActive[name]).length; i++) {
|
|
282
283
|
var evt = (callbacks || this._callbackActive[name])[i];
|
|
283
284
|
|
|
284
|
-
(_a = evt.callback).call.apply(_a,
|
|
285
|
+
(_a = evt.callback).call.apply(_a, __spreadArrays([evt.scope], args));
|
|
285
286
|
|
|
286
287
|
if (evt.once) {
|
|
287
288
|
var ind = this._callbacks[name].indexOf(evt);
|
|
@@ -354,14 +355,13 @@
|
|
|
354
355
|
} instanceof Array && function (d, b) {
|
|
355
356
|
d.__proto__ = b;
|
|
356
357
|
} || function (d, b) {
|
|
357
|
-
for (var p in b) if (
|
|
358
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
358
359
|
};
|
|
359
360
|
|
|
360
361
|
return extendStatics(d, b);
|
|
361
362
|
};
|
|
362
363
|
|
|
363
364
|
return function (d, b) {
|
|
364
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
365
365
|
extendStatics(d, b);
|
|
366
366
|
|
|
367
367
|
function __() {
|
|
@@ -1077,14 +1077,13 @@
|
|
|
1077
1077
|
} instanceof Array && function (d, b) {
|
|
1078
1078
|
d.__proto__ = b;
|
|
1079
1079
|
} || function (d, b) {
|
|
1080
|
-
for (var p in b) if (
|
|
1080
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1081
1081
|
};
|
|
1082
1082
|
|
|
1083
1083
|
return extendStatics(d, b);
|
|
1084
1084
|
};
|
|
1085
1085
|
|
|
1086
1086
|
return function (d, b) {
|
|
1087
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1088
1087
|
extendStatics(d, b);
|
|
1089
1088
|
|
|
1090
1089
|
function __() {
|
|
@@ -1423,7 +1422,7 @@
|
|
|
1423
1422
|
};
|
|
1424
1423
|
|
|
1425
1424
|
Quat.prototype.angleTo = function (q) {
|
|
1426
|
-
return 2 * Math.acos(Math.abs(
|
|
1425
|
+
return 2 * Math.acos(Math.abs(_Math.clamp(this.dot(q), -1, 1)));
|
|
1427
1426
|
};
|
|
1428
1427
|
|
|
1429
1428
|
Quat.prototype.rotateTowards = function (q, step) {
|
|
@@ -1625,14 +1624,13 @@
|
|
|
1625
1624
|
} instanceof Array && function (d, b) {
|
|
1626
1625
|
d.__proto__ = b;
|
|
1627
1626
|
} || function (d, b) {
|
|
1628
|
-
for (var p in b) if (
|
|
1627
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1629
1628
|
};
|
|
1630
1629
|
|
|
1631
1630
|
return extendStatics(d, b);
|
|
1632
1631
|
};
|
|
1633
1632
|
|
|
1634
1633
|
return function (d, b) {
|
|
1635
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1636
1634
|
extendStatics(d, b);
|
|
1637
1635
|
|
|
1638
1636
|
function __() {
|
|
@@ -1663,24 +1661,24 @@
|
|
|
1663
1661
|
|
|
1664
1662
|
function Segment(_p0, _p1) {
|
|
1665
1663
|
if (_p0 === void 0) {
|
|
1666
|
-
_p0 =
|
|
1664
|
+
_p0 = Vec3_1.v3();
|
|
1667
1665
|
}
|
|
1668
1666
|
|
|
1669
1667
|
if (_p1 === void 0) {
|
|
1670
|
-
_p1 =
|
|
1668
|
+
_p1 = Vec3_1.v3();
|
|
1671
1669
|
}
|
|
1672
1670
|
|
|
1673
1671
|
var _this = _super.call(this) || this;
|
|
1674
1672
|
|
|
1675
1673
|
Object.setPrototypeOf(_this, Segment.prototype);
|
|
1676
1674
|
|
|
1677
|
-
_this.push(
|
|
1675
|
+
_this.push(Vec3_1.v3().copy(_p0), Vec3_1.v3().copy(_p1));
|
|
1678
1676
|
|
|
1679
|
-
_this.center =
|
|
1680
|
-
_this.extentDirection =
|
|
1677
|
+
_this.center = Vec3_1.v3().addVecs(_p0, _p1).multiplyScalar(0.5);
|
|
1678
|
+
_this.extentDirection = Vec3_1.v3().subVecs(_p1, _p0);
|
|
1681
1679
|
_this.extentSqr = _this.extentDirection.lengthSq();
|
|
1682
1680
|
_this.extent = Math.sqrt(_this.extentSqr);
|
|
1683
|
-
_this.direction =
|
|
1681
|
+
_this.direction = Vec3_1.v3().copy(_this.extentDirection).normalize();
|
|
1684
1682
|
return _this;
|
|
1685
1683
|
}
|
|
1686
1684
|
|
|
@@ -2002,14 +2000,13 @@
|
|
|
2002
2000
|
} instanceof Array && function (d, b) {
|
|
2003
2001
|
d.__proto__ = b;
|
|
2004
2002
|
} || function (d, b) {
|
|
2005
|
-
for (var p in b) if (
|
|
2003
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
2006
2004
|
};
|
|
2007
2005
|
|
|
2008
2006
|
return extendStatics(d, b);
|
|
2009
2007
|
};
|
|
2010
2008
|
|
|
2011
2009
|
return function (d, b) {
|
|
2012
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2013
2010
|
extendStatics(d, b);
|
|
2014
2011
|
|
|
2015
2012
|
function __() {
|
|
@@ -2675,12 +2672,12 @@
|
|
|
2675
2672
|
Vec3.prototype.angleTo = function (v, normal) {
|
|
2676
2673
|
if (normal) return this.angleToEx(v, normal);
|
|
2677
2674
|
var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
|
|
2678
|
-
return Math.acos(
|
|
2675
|
+
return Math.acos(_Math.clamp(theta, -1, 1));
|
|
2679
2676
|
};
|
|
2680
2677
|
|
|
2681
2678
|
Vec3.prototype.angleToEx = function (v, normal) {
|
|
2682
2679
|
var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
|
|
2683
|
-
if (this.clone().cross(v).dot(normal) > 0) return Math.acos(
|
|
2680
|
+
if (this.clone().cross(v).dot(normal) > 0) return Math.acos(_Math.clamp(theta, -1, 1));else return Math.PI * 2 - Math.acos(_Math.clamp(theta, -1, 1));
|
|
2684
2681
|
};
|
|
2685
2682
|
|
|
2686
2683
|
Vec3.prototype.distanceTo = function (v) {
|
|
@@ -3263,7 +3260,7 @@
|
|
|
3263
3260
|
|
|
3264
3261
|
var _vec = v3();
|
|
3265
3262
|
|
|
3266
|
-
var _quat =
|
|
3263
|
+
var _quat = Quat_1.quat();
|
|
3267
3264
|
|
|
3268
3265
|
function v3(x, y, z) {
|
|
3269
3266
|
return new Vec3(x, y, z);
|
|
@@ -3285,14 +3282,13 @@
|
|
|
3285
3282
|
} instanceof Array && function (d, b) {
|
|
3286
3283
|
d.__proto__ = b;
|
|
3287
3284
|
} || function (d, b) {
|
|
3288
|
-
for (var p in b) if (
|
|
3285
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
3289
3286
|
};
|
|
3290
3287
|
|
|
3291
3288
|
return extendStatics(d, b);
|
|
3292
3289
|
};
|
|
3293
3290
|
|
|
3294
3291
|
return function (d, b) {
|
|
3295
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3296
3292
|
extendStatics(d, b);
|
|
3297
3293
|
|
|
3298
3294
|
function __() {
|
|
@@ -3898,7 +3894,7 @@
|
|
|
3898
3894
|
|
|
3899
3895
|
|
|
3900
3896
|
|
|
3901
|
-
var _Vec =
|
|
3897
|
+
var _Vec = Vec3_1.v3();
|
|
3902
3898
|
|
|
3903
3899
|
var Mat3 =
|
|
3904
3900
|
/** @class */
|
|
@@ -5088,21 +5084,21 @@
|
|
|
5088
5084
|
|
|
5089
5085
|
exports.Mat4 = Mat4;
|
|
5090
5086
|
|
|
5091
|
-
var _v1 =
|
|
5087
|
+
var _v1 = Vec3_1.v3();
|
|
5092
5088
|
|
|
5093
5089
|
var _m1 = m4();
|
|
5094
5090
|
|
|
5095
5091
|
var _m2 = m4();
|
|
5096
5092
|
|
|
5097
|
-
var _zero =
|
|
5093
|
+
var _zero = Vec3_1.v3(0, 0, 0);
|
|
5098
5094
|
|
|
5099
|
-
var _one =
|
|
5095
|
+
var _one = Vec3_1.v3(1, 1, 1);
|
|
5100
5096
|
|
|
5101
|
-
var _x =
|
|
5097
|
+
var _x = Vec3_1.v3();
|
|
5102
5098
|
|
|
5103
|
-
var _y =
|
|
5099
|
+
var _y = Vec3_1.v3();
|
|
5104
5100
|
|
|
5105
|
-
var _z =
|
|
5101
|
+
var _z = Vec3_1.v3();
|
|
5106
5102
|
|
|
5107
5103
|
function m4() {
|
|
5108
5104
|
return new Mat4();
|
|
@@ -5124,14 +5120,13 @@
|
|
|
5124
5120
|
} instanceof Array && function (d, b) {
|
|
5125
5121
|
d.__proto__ = b;
|
|
5126
5122
|
} || function (d, b) {
|
|
5127
|
-
for (var p in b) if (
|
|
5123
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
5128
5124
|
};
|
|
5129
5125
|
|
|
5130
5126
|
return extendStatics(d, b);
|
|
5131
5127
|
};
|
|
5132
5128
|
|
|
5133
5129
|
return function (d, b) {
|
|
5134
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
5135
5130
|
extendStatics(d, b);
|
|
5136
5131
|
|
|
5137
5132
|
function __() {
|
|
@@ -5157,9 +5152,9 @@
|
|
|
5157
5152
|
|
|
5158
5153
|
|
|
5159
5154
|
|
|
5160
|
-
var _matrix =
|
|
5155
|
+
var _matrix = Mat4_1.m4();
|
|
5161
5156
|
|
|
5162
|
-
var _Quat =
|
|
5157
|
+
var _Quat = Quat_1.quat();
|
|
5163
5158
|
var DefaultOrder = "XYZ";
|
|
5164
5159
|
|
|
5165
5160
|
var Euler =
|
|
@@ -5284,7 +5279,7 @@
|
|
|
5284
5279
|
order = order || this._order;
|
|
5285
5280
|
|
|
5286
5281
|
if (order === "XYZ") {
|
|
5287
|
-
this._y = Math.asin(
|
|
5282
|
+
this._y = Math.asin(_Math.clamp(m13, -1, 1));
|
|
5288
5283
|
|
|
5289
5284
|
if (Math.abs(m13) < 0.9999999) {
|
|
5290
5285
|
this._x = Math.atan2(-m23, m33);
|
|
@@ -5294,7 +5289,7 @@
|
|
|
5294
5289
|
this._z = 0;
|
|
5295
5290
|
}
|
|
5296
5291
|
} else if (order === "YXZ") {
|
|
5297
|
-
this._x = Math.asin(-
|
|
5292
|
+
this._x = Math.asin(-_Math.clamp(m23, -1, 1));
|
|
5298
5293
|
|
|
5299
5294
|
if (Math.abs(m23) < 0.9999999) {
|
|
5300
5295
|
this._y = Math.atan2(m13, m33);
|
|
@@ -5304,7 +5299,7 @@
|
|
|
5304
5299
|
this._z = 0;
|
|
5305
5300
|
}
|
|
5306
5301
|
} else if (order === "ZXY") {
|
|
5307
|
-
this._x = Math.asin(
|
|
5302
|
+
this._x = Math.asin(_Math.clamp(m32, -1, 1));
|
|
5308
5303
|
|
|
5309
5304
|
if (Math.abs(m32) < 0.9999999) {
|
|
5310
5305
|
this._y = Math.atan2(-m31, m33);
|
|
@@ -5314,7 +5309,7 @@
|
|
|
5314
5309
|
this._z = Math.atan2(m21, m11);
|
|
5315
5310
|
}
|
|
5316
5311
|
} else if (order === "ZYX") {
|
|
5317
|
-
this._y = Math.asin(-
|
|
5312
|
+
this._y = Math.asin(-_Math.clamp(m31, -1, 1));
|
|
5318
5313
|
|
|
5319
5314
|
if (Math.abs(m31) < 0.9999999) {
|
|
5320
5315
|
this._x = Math.atan2(m32, m33);
|
|
@@ -5324,7 +5319,7 @@
|
|
|
5324
5319
|
this._z = Math.atan2(-m12, m22);
|
|
5325
5320
|
}
|
|
5326
5321
|
} else if (order === "YZX") {
|
|
5327
|
-
this._z = Math.asin(
|
|
5322
|
+
this._z = Math.asin(_Math.clamp(m21, -1, 1));
|
|
5328
5323
|
|
|
5329
5324
|
if (Math.abs(m21) < 0.9999999) {
|
|
5330
5325
|
this._x = Math.atan2(-m23, m22);
|
|
@@ -5334,7 +5329,7 @@
|
|
|
5334
5329
|
this._y = Math.atan2(m13, m33);
|
|
5335
5330
|
}
|
|
5336
5331
|
} else if (order === "XZY") {
|
|
5337
|
-
this._z = Math.asin(-
|
|
5332
|
+
this._z = Math.asin(-_Math.clamp(m12, -1, 1));
|
|
5338
5333
|
|
|
5339
5334
|
if (Math.abs(m12) < 0.9999999) {
|
|
5340
5335
|
this._x = Math.atan2(m32, m22);
|
|
@@ -5402,7 +5397,7 @@
|
|
|
5402
5397
|
if (optionalResult) {
|
|
5403
5398
|
return optionalResult.set(this._x, this._y, this._z);
|
|
5404
5399
|
} else {
|
|
5405
|
-
return
|
|
5400
|
+
return Vec3_1.v3(this._x, this._y, this._z);
|
|
5406
5401
|
}
|
|
5407
5402
|
};
|
|
5408
5403
|
|
|
@@ -5422,6 +5417,288 @@
|
|
|
5422
5417
|
var Euler_2 = Euler_1.euler;
|
|
5423
5418
|
var Euler_3 = Euler_1.Euler;
|
|
5424
5419
|
|
|
5420
|
+
var Color_1 = createCommonjsModule(function (module, exports) {
|
|
5421
|
+
|
|
5422
|
+
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
5423
|
+
var extendStatics = function (d, b) {
|
|
5424
|
+
extendStatics = Object.setPrototypeOf || {
|
|
5425
|
+
__proto__: []
|
|
5426
|
+
} instanceof Array && function (d, b) {
|
|
5427
|
+
d.__proto__ = b;
|
|
5428
|
+
} || function (d, b) {
|
|
5429
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
5430
|
+
};
|
|
5431
|
+
|
|
5432
|
+
return extendStatics(d, b);
|
|
5433
|
+
};
|
|
5434
|
+
|
|
5435
|
+
return function (d, b) {
|
|
5436
|
+
extendStatics(d, b);
|
|
5437
|
+
|
|
5438
|
+
function __() {
|
|
5439
|
+
this.constructor = d;
|
|
5440
|
+
}
|
|
5441
|
+
|
|
5442
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
5443
|
+
};
|
|
5444
|
+
}();
|
|
5445
|
+
|
|
5446
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5447
|
+
value: true
|
|
5448
|
+
});
|
|
5449
|
+
exports.Color = void 0;
|
|
5450
|
+
|
|
5451
|
+
|
|
5452
|
+
|
|
5453
|
+
var Color =
|
|
5454
|
+
/** @class */
|
|
5455
|
+
function (_super) {
|
|
5456
|
+
__extends(Color, _super);
|
|
5457
|
+
|
|
5458
|
+
function Color(r, g, b, a) {
|
|
5459
|
+
if (r === void 0) {
|
|
5460
|
+
r = 0;
|
|
5461
|
+
}
|
|
5462
|
+
|
|
5463
|
+
if (g === void 0) {
|
|
5464
|
+
g = 0;
|
|
5465
|
+
}
|
|
5466
|
+
|
|
5467
|
+
if (b === void 0) {
|
|
5468
|
+
b = 0;
|
|
5469
|
+
}
|
|
5470
|
+
|
|
5471
|
+
if (a === void 0) {
|
|
5472
|
+
a = 1;
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5475
|
+
var _this = _super.call(this) || this;
|
|
5476
|
+
|
|
5477
|
+
_this._r = 0.0;
|
|
5478
|
+
_this._g = 0.0;
|
|
5479
|
+
_this._b = 0.0;
|
|
5480
|
+
_this._a = 1.0;
|
|
5481
|
+
_this._r = r;
|
|
5482
|
+
_this._g = g;
|
|
5483
|
+
_this._b = b;
|
|
5484
|
+
_this._a = a;
|
|
5485
|
+
return _this;
|
|
5486
|
+
}
|
|
5487
|
+
|
|
5488
|
+
Object.defineProperty(Color.prototype, "isColor", {
|
|
5489
|
+
get: function () {
|
|
5490
|
+
return true;
|
|
5491
|
+
},
|
|
5492
|
+
enumerable: false,
|
|
5493
|
+
configurable: true
|
|
5494
|
+
});
|
|
5495
|
+
Object.defineProperty(Color.prototype, "r", {
|
|
5496
|
+
get: function () {
|
|
5497
|
+
return this._r;
|
|
5498
|
+
},
|
|
5499
|
+
set: function (value) {
|
|
5500
|
+
if (this._r !== value) {
|
|
5501
|
+
this._r = value;
|
|
5502
|
+
this.fire('change', 'r', this._r, value);
|
|
5503
|
+
}
|
|
5504
|
+
},
|
|
5505
|
+
enumerable: false,
|
|
5506
|
+
configurable: true
|
|
5507
|
+
});
|
|
5508
|
+
Object.defineProperty(Color.prototype, "g", {
|
|
5509
|
+
get: function () {
|
|
5510
|
+
return this._g;
|
|
5511
|
+
},
|
|
5512
|
+
set: function (value) {
|
|
5513
|
+
if (this._g !== value) {
|
|
5514
|
+
this._g = value;
|
|
5515
|
+
this.fire('change', 'g', this._g, value);
|
|
5516
|
+
}
|
|
5517
|
+
},
|
|
5518
|
+
enumerable: false,
|
|
5519
|
+
configurable: true
|
|
5520
|
+
});
|
|
5521
|
+
Object.defineProperty(Color.prototype, "b", {
|
|
5522
|
+
get: function () {
|
|
5523
|
+
return this._g;
|
|
5524
|
+
},
|
|
5525
|
+
set: function (value) {
|
|
5526
|
+
if (this._b !== value) {
|
|
5527
|
+
this._b = value;
|
|
5528
|
+
this.fire('change', 'b', this._b, value);
|
|
5529
|
+
}
|
|
5530
|
+
},
|
|
5531
|
+
enumerable: false,
|
|
5532
|
+
configurable: true
|
|
5533
|
+
});
|
|
5534
|
+
Object.defineProperty(Color.prototype, "a", {
|
|
5535
|
+
get: function () {
|
|
5536
|
+
return this._a;
|
|
5537
|
+
},
|
|
5538
|
+
set: function (value) {
|
|
5539
|
+
if (this._a !== value) {
|
|
5540
|
+
this._a = value;
|
|
5541
|
+
this.fire('change', 'a', this._a, value);
|
|
5542
|
+
}
|
|
5543
|
+
},
|
|
5544
|
+
enumerable: false,
|
|
5545
|
+
configurable: true
|
|
5546
|
+
});
|
|
5547
|
+
|
|
5548
|
+
Color.prototype.set = function (value) {
|
|
5549
|
+
if (value && value.isColor) {
|
|
5550
|
+
this.copy(value);
|
|
5551
|
+
} else if (typeof value === 'number') {
|
|
5552
|
+
this.setHex(value);
|
|
5553
|
+
}
|
|
5554
|
+
|
|
5555
|
+
if (typeof value === 'string') {
|
|
5556
|
+
if (value.indexOf("#") === 0) this.setHexCssString(value);else console.error("未匹配的颜色数据");
|
|
5557
|
+
}
|
|
5558
|
+
|
|
5559
|
+
return this;
|
|
5560
|
+
};
|
|
5561
|
+
|
|
5562
|
+
Color.prototype.setHex = function (hex) {
|
|
5563
|
+
hex = Math.floor(hex);
|
|
5564
|
+
this._r = (hex >> 16 & 255) / 255;
|
|
5565
|
+
this._g = (hex >> 8 & 255) / 255;
|
|
5566
|
+
this._b = (hex & 255) / 255;
|
|
5567
|
+
return this;
|
|
5568
|
+
};
|
|
5569
|
+
|
|
5570
|
+
Color.prototype.setHexCssString = function (style) {
|
|
5571
|
+
var m = /^\#([A-Fa-f\d]+)$/.exec(style); // hex color
|
|
5572
|
+
|
|
5573
|
+
var hex = m[1];
|
|
5574
|
+
var size = hex.length;
|
|
5575
|
+
|
|
5576
|
+
if (size === 3) {
|
|
5577
|
+
// #ff0
|
|
5578
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
|
|
5579
|
+
this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
|
|
5580
|
+
this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
|
|
5581
|
+
return this;
|
|
5582
|
+
} else if (size === 6) {
|
|
5583
|
+
// #ff0000
|
|
5584
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
|
|
5585
|
+
this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
|
|
5586
|
+
this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
|
|
5587
|
+
return this;
|
|
5588
|
+
} else if (size === 4) {
|
|
5589
|
+
// #ff0000
|
|
5590
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
|
|
5591
|
+
this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
|
|
5592
|
+
this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
|
|
5593
|
+
this.a = parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255;
|
|
5594
|
+
return this;
|
|
5595
|
+
} else if (size === 8) {
|
|
5596
|
+
// #ff0000
|
|
5597
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
|
|
5598
|
+
this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
|
|
5599
|
+
this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
|
|
5600
|
+
this.a = parseInt(hex.charAt(6) + hex.charAt(7), 16) / 255;
|
|
5601
|
+
return this;
|
|
5602
|
+
}
|
|
5603
|
+
};
|
|
5604
|
+
|
|
5605
|
+
Color.prototype.setRGB = function (r, g, b, a) {
|
|
5606
|
+
if (a === void 0) {
|
|
5607
|
+
a = 1.0;
|
|
5608
|
+
}
|
|
5609
|
+
|
|
5610
|
+
this._r = r;
|
|
5611
|
+
this._g = g;
|
|
5612
|
+
this._b = b;
|
|
5613
|
+
this._a = a;
|
|
5614
|
+
return this;
|
|
5615
|
+
};
|
|
5616
|
+
|
|
5617
|
+
Color.prototype.clone = function () {
|
|
5618
|
+
return new this.constructor(this.r, this.g, this.b, this.a);
|
|
5619
|
+
};
|
|
5620
|
+
|
|
5621
|
+
Color.prototype.copy = function (color) {
|
|
5622
|
+
this._r = color.r;
|
|
5623
|
+
this._g = color.g;
|
|
5624
|
+
this._b = color.b;
|
|
5625
|
+
this._a = color.a;
|
|
5626
|
+
return this;
|
|
5627
|
+
};
|
|
5628
|
+
|
|
5629
|
+
Color.prototype.equals = function (c) {
|
|
5630
|
+
return c.r === this.r && c.g === this.g && c.b === this.b && c.a === this.a;
|
|
5631
|
+
};
|
|
5632
|
+
|
|
5633
|
+
Color.prototype.toArray = function (array, offset) {
|
|
5634
|
+
if (array === void 0) {
|
|
5635
|
+
array = [];
|
|
5636
|
+
}
|
|
5637
|
+
|
|
5638
|
+
if (offset === void 0) {
|
|
5639
|
+
offset = 0;
|
|
5640
|
+
}
|
|
5641
|
+
|
|
5642
|
+
array[offset] = this.r;
|
|
5643
|
+
array[offset + 1] = this.g;
|
|
5644
|
+
array[offset + 2] = this.b;
|
|
5645
|
+
array[offset + 3] = this.a;
|
|
5646
|
+
return array;
|
|
5647
|
+
};
|
|
5648
|
+
|
|
5649
|
+
Color.prototype.byteToFloat = function (val) {
|
|
5650
|
+
return val / 255.0;
|
|
5651
|
+
};
|
|
5652
|
+
|
|
5653
|
+
Color.prototype.floatToByte = function (val) {
|
|
5654
|
+
return val === 1.0 ? 255.0 : val * 256.0 | 0;
|
|
5655
|
+
};
|
|
5656
|
+
|
|
5657
|
+
Color.prototype.getHexCssString = function () {
|
|
5658
|
+
var r = this.floatToByte(this._r).toString(16);
|
|
5659
|
+
|
|
5660
|
+
if (r.length < 2) {
|
|
5661
|
+
r = "0" + r;
|
|
5662
|
+
}
|
|
5663
|
+
|
|
5664
|
+
var g = this.floatToByte(this._g).toString(16);
|
|
5665
|
+
|
|
5666
|
+
if (g.length < 2) {
|
|
5667
|
+
g = "0" + g;
|
|
5668
|
+
}
|
|
5669
|
+
|
|
5670
|
+
var b = this.floatToByte(this._b).toString(16);
|
|
5671
|
+
|
|
5672
|
+
if (b.length < 2) {
|
|
5673
|
+
b = "0" + b;
|
|
5674
|
+
}
|
|
5675
|
+
|
|
5676
|
+
if (this._a < 1) {
|
|
5677
|
+
var hexAlpha = this.floatToByte(this._a).toString(16);
|
|
5678
|
+
|
|
5679
|
+
if (hexAlpha.length < 2) {
|
|
5680
|
+
hexAlpha = "0" + hexAlpha;
|
|
5681
|
+
}
|
|
5682
|
+
|
|
5683
|
+
return "#" + r + g + b + hexAlpha;
|
|
5684
|
+
}
|
|
5685
|
+
|
|
5686
|
+
return "#" + r + g + b;
|
|
5687
|
+
};
|
|
5688
|
+
|
|
5689
|
+
Color.prototype.toJSON = function () {
|
|
5690
|
+
return this.getHexCssString();
|
|
5691
|
+
};
|
|
5692
|
+
|
|
5693
|
+
return Color;
|
|
5694
|
+
}(eventhandler.EventHandler);
|
|
5695
|
+
|
|
5696
|
+
exports.Color = Color;
|
|
5697
|
+
});
|
|
5698
|
+
|
|
5699
|
+
unwrapExports(Color_1);
|
|
5700
|
+
var Color_2 = Color_1.Color;
|
|
5701
|
+
|
|
5425
5702
|
var types = createCommonjsModule(function (module, exports) {
|
|
5426
5703
|
|
|
5427
5704
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5480,11 +5757,11 @@
|
|
|
5480
5757
|
function () {
|
|
5481
5758
|
function Line(origin, end) {
|
|
5482
5759
|
if (origin === void 0) {
|
|
5483
|
-
origin =
|
|
5760
|
+
origin = Vec3_1.v3();
|
|
5484
5761
|
}
|
|
5485
5762
|
|
|
5486
5763
|
if (end === void 0) {
|
|
5487
|
-
end =
|
|
5764
|
+
end = Vec3_1.v3();
|
|
5488
5765
|
}
|
|
5489
5766
|
|
|
5490
5767
|
this.origin = origin;
|
|
@@ -5677,9 +5954,9 @@
|
|
|
5677
5954
|
|
|
5678
5955
|
if (numInputs === 1) {
|
|
5679
5956
|
if (Math.abs(v[0][0]) > Math.abs(v[0][1])) {
|
|
5680
|
-
v[1] =
|
|
5957
|
+
v[1] = Vec3_1.v3(-v[0].z, 0, +v[0].x);
|
|
5681
5958
|
} else {
|
|
5682
|
-
v[1] =
|
|
5959
|
+
v[1] = Vec3_1.v3(0, +v[0].z, -v[0].y);
|
|
5683
5960
|
}
|
|
5684
5961
|
numInputs = 2;
|
|
5685
5962
|
}
|
|
@@ -5908,7 +6185,7 @@
|
|
|
5908
6185
|
Circle.prototype.arc1 = function (fixp0, fixp1, movep, normal) {
|
|
5909
6186
|
this.setFrom3Points(fixp0, fixp1, movep);
|
|
5910
6187
|
this.startAngle = 0;
|
|
5911
|
-
this.endAngle =
|
|
6188
|
+
this.endAngle = common.angle(fixp0.clone().sub(this.center).normalize(), fixp1.clone().sub(this.center).normalize(), this.normal || normal);
|
|
5912
6189
|
};
|
|
5913
6190
|
/**
|
|
5914
6191
|
* 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
|
|
@@ -5924,7 +6201,7 @@
|
|
|
5924
6201
|
this.center.copy(center);
|
|
5925
6202
|
var v2 = movep.clone().sub(center);
|
|
5926
6203
|
var v1 = fixp1.clone().sub(center);
|
|
5927
|
-
var jd =
|
|
6204
|
+
var jd = common.angle(v1, v2);
|
|
5928
6205
|
};
|
|
5929
6206
|
|
|
5930
6207
|
Circle.prototype.setFrom3Points = function (p0, p1, p2, normal) {
|
|
@@ -6003,14 +6280,13 @@
|
|
|
6003
6280
|
} instanceof Array && function (d, b) {
|
|
6004
6281
|
d.__proto__ = b;
|
|
6005
6282
|
} || function (d, b) {
|
|
6006
|
-
for (var p in b) if (
|
|
6283
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
6007
6284
|
};
|
|
6008
6285
|
|
|
6009
6286
|
return extendStatics(d, b);
|
|
6010
6287
|
};
|
|
6011
6288
|
|
|
6012
6289
|
return function (d, b) {
|
|
6013
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
6014
6290
|
extendStatics(d, b);
|
|
6015
6291
|
|
|
6016
6292
|
function __() {
|
|
@@ -6080,14 +6356,14 @@
|
|
|
6080
6356
|
function () {
|
|
6081
6357
|
function Box(min, max) {
|
|
6082
6358
|
if (min === void 0) {
|
|
6083
|
-
min =
|
|
6359
|
+
min = Vec3_1.v3(Infinity, Infinity, Infinity);
|
|
6084
6360
|
}
|
|
6085
6361
|
|
|
6086
6362
|
if (max === void 0) {
|
|
6087
|
-
max =
|
|
6363
|
+
max = Vec3_1.v3(-Infinity, -Infinity, -Infinity);
|
|
6088
6364
|
}
|
|
6089
6365
|
|
|
6090
|
-
this._center =
|
|
6366
|
+
this._center = Vec3_1.v3();
|
|
6091
6367
|
this.min = min;
|
|
6092
6368
|
this.max = max; // if (points) {
|
|
6093
6369
|
// this.setFromPoints(points);
|
|
@@ -6219,7 +6495,7 @@
|
|
|
6219
6495
|
function () {
|
|
6220
6496
|
function Sphere(center, radius) {
|
|
6221
6497
|
if (center === void 0) {
|
|
6222
|
-
center =
|
|
6498
|
+
center = Vec3_1.v3();
|
|
6223
6499
|
}
|
|
6224
6500
|
|
|
6225
6501
|
if (radius === void 0) {
|
|
@@ -6268,14 +6544,13 @@
|
|
|
6268
6544
|
} instanceof Array && function (d, b) {
|
|
6269
6545
|
d.__proto__ = b;
|
|
6270
6546
|
} || function (d, b) {
|
|
6271
|
-
for (var p in b) if (
|
|
6547
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
6272
6548
|
};
|
|
6273
6549
|
|
|
6274
6550
|
return extendStatics(d, b);
|
|
6275
6551
|
};
|
|
6276
6552
|
|
|
6277
6553
|
return function (d, b) {
|
|
6278
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
6279
6554
|
extendStatics(d, b);
|
|
6280
6555
|
|
|
6281
6556
|
function __() {
|
|
@@ -6592,8 +6867,11 @@
|
|
|
6592
6867
|
normalized = false;
|
|
6593
6868
|
}
|
|
6594
6869
|
|
|
6870
|
+
var _this = this;
|
|
6871
|
+
|
|
6595
6872
|
if (Array.isArray(array)) array = new Int8Array(array);
|
|
6596
|
-
|
|
6873
|
+
_this = _super.call(this, new Int8Array(array), itemSize, normalized) || this;
|
|
6874
|
+
return _this;
|
|
6597
6875
|
}
|
|
6598
6876
|
|
|
6599
6877
|
return Int8BufferAttribute;
|
|
@@ -6611,8 +6889,11 @@
|
|
|
6611
6889
|
normalized = false;
|
|
6612
6890
|
}
|
|
6613
6891
|
|
|
6892
|
+
var _this = this;
|
|
6893
|
+
|
|
6614
6894
|
if (Array.isArray(array)) array = new Uint8Array(array);
|
|
6615
|
-
|
|
6895
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6896
|
+
return _this;
|
|
6616
6897
|
}
|
|
6617
6898
|
|
|
6618
6899
|
return Uint8BufferAttribute;
|
|
@@ -6630,8 +6911,11 @@
|
|
|
6630
6911
|
normalized = false;
|
|
6631
6912
|
}
|
|
6632
6913
|
|
|
6914
|
+
var _this = this;
|
|
6915
|
+
|
|
6633
6916
|
if (Array.isArray(array)) array = new Uint8ClampedArray(array);
|
|
6634
|
-
|
|
6917
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6918
|
+
return _this;
|
|
6635
6919
|
}
|
|
6636
6920
|
|
|
6637
6921
|
return Uint8ClampedBufferAttribute;
|
|
@@ -6649,8 +6933,11 @@
|
|
|
6649
6933
|
normalized = false;
|
|
6650
6934
|
}
|
|
6651
6935
|
|
|
6936
|
+
var _this = this;
|
|
6937
|
+
|
|
6652
6938
|
if (Array.isArray(array)) array = new Int16Array(array);
|
|
6653
|
-
|
|
6939
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6940
|
+
return _this;
|
|
6654
6941
|
}
|
|
6655
6942
|
|
|
6656
6943
|
return Int16BufferAttribute;
|
|
@@ -6665,8 +6952,11 @@
|
|
|
6665
6952
|
|
|
6666
6953
|
function Uint16BufferAttribute(array, itemSize, normalized) {
|
|
6667
6954
|
|
|
6955
|
+
var _this = this;
|
|
6956
|
+
|
|
6668
6957
|
if (Array.isArray(array)) array = new Uint16Array(array);
|
|
6669
|
-
|
|
6958
|
+
_this = _super.call(this, array, itemSize) || this;
|
|
6959
|
+
return _this;
|
|
6670
6960
|
}
|
|
6671
6961
|
|
|
6672
6962
|
return Uint16BufferAttribute;
|
|
@@ -6684,8 +6974,11 @@
|
|
|
6684
6974
|
normalized = false;
|
|
6685
6975
|
}
|
|
6686
6976
|
|
|
6977
|
+
var _this = this;
|
|
6978
|
+
|
|
6687
6979
|
if (Array.isArray(array)) array = new Int32Array(array);
|
|
6688
|
-
|
|
6980
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6981
|
+
return _this;
|
|
6689
6982
|
}
|
|
6690
6983
|
|
|
6691
6984
|
return Int32BufferAttribute;
|
|
@@ -6703,8 +6996,11 @@
|
|
|
6703
6996
|
normalized = false;
|
|
6704
6997
|
}
|
|
6705
6998
|
|
|
6999
|
+
var _this = this;
|
|
7000
|
+
|
|
6706
7001
|
if (Array.isArray(array)) array = new Uint32Array(array);
|
|
6707
|
-
|
|
7002
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
7003
|
+
return _this;
|
|
6708
7004
|
}
|
|
6709
7005
|
|
|
6710
7006
|
return Uint32BufferAttribute;
|
|
@@ -6722,8 +7018,11 @@
|
|
|
6722
7018
|
normalized = false;
|
|
6723
7019
|
}
|
|
6724
7020
|
|
|
7021
|
+
var _this = this;
|
|
7022
|
+
|
|
6725
7023
|
if (Array.isArray(array)) array = new Float32Array(array);
|
|
6726
|
-
|
|
7024
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
7025
|
+
return _this;
|
|
6727
7026
|
}
|
|
6728
7027
|
|
|
6729
7028
|
return Float32BufferAttribute;
|
|
@@ -6741,8 +7040,11 @@
|
|
|
6741
7040
|
normalized = false;
|
|
6742
7041
|
}
|
|
6743
7042
|
|
|
7043
|
+
var _this = this;
|
|
7044
|
+
|
|
6744
7045
|
if (Array.isArray(array)) array = new Float64Array(array);
|
|
6745
|
-
|
|
7046
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
7047
|
+
return _this;
|
|
6746
7048
|
}
|
|
6747
7049
|
|
|
6748
7050
|
return Float64BufferAttribute;
|
|
@@ -6770,12 +7072,10 @@
|
|
|
6770
7072
|
});
|
|
6771
7073
|
exports.isBufferArray = void 0;
|
|
6772
7074
|
|
|
6773
|
-
|
|
7075
|
+
exports.isBufferArray = function (obj) {
|
|
6774
7076
|
var types = ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'];
|
|
6775
7077
|
return types.indexOf(obj.constructor.name) > -1;
|
|
6776
7078
|
};
|
|
6777
|
-
|
|
6778
|
-
exports.isBufferArray = isBufferArray;
|
|
6779
7079
|
});
|
|
6780
7080
|
|
|
6781
7081
|
unwrapExports(types$1);
|
|
@@ -6783,12 +7083,6 @@
|
|
|
6783
7083
|
|
|
6784
7084
|
var geometry = createCommonjsModule(function (module, exports) {
|
|
6785
7085
|
|
|
6786
|
-
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
|
|
6787
|
-
return mod && mod.__esModule ? mod : {
|
|
6788
|
-
"default": mod
|
|
6789
|
-
};
|
|
6790
|
-
};
|
|
6791
|
-
|
|
6792
7086
|
Object.defineProperty(exports, "__esModule", {
|
|
6793
7087
|
value: true
|
|
6794
7088
|
});
|
|
@@ -6814,7 +7108,7 @@
|
|
|
6814
7108
|
|
|
6815
7109
|
|
|
6816
7110
|
|
|
6817
|
-
|
|
7111
|
+
|
|
6818
7112
|
|
|
6819
7113
|
var _bufferGeometryId = 1; // BufferGeometry uses odd numbers as Id
|
|
6820
7114
|
|
|
@@ -6895,13 +7189,13 @@
|
|
|
6895
7189
|
|
|
6896
7190
|
if (Array.isArray(attribute)) {
|
|
6897
7191
|
if (attribute[0] instanceof Vec2_1.Vec2) {
|
|
6898
|
-
var nums =
|
|
7192
|
+
var nums = vecs_1.vecs.verctorToNumbers(attribute);
|
|
6899
7193
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(nums, 2));
|
|
6900
7194
|
} else if (attribute[0] instanceof Vec3_1.Vec3) {
|
|
6901
|
-
var nums =
|
|
7195
|
+
var nums = vecs_1.vecs.verctorToNumbers(attribute);
|
|
6902
7196
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(nums, 3));
|
|
6903
7197
|
} else if (attribute[0] instanceof Vec4_1.Vec4) {
|
|
6904
|
-
var nums =
|
|
7198
|
+
var nums = vecs_1.vecs.verctorToNumbers(attribute);
|
|
6905
7199
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(nums, 4));
|
|
6906
7200
|
} else if (!isNaN(attribute[0])) {
|
|
6907
7201
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(attribute, itemSize));
|
|
@@ -6910,7 +7204,7 @@
|
|
|
6910
7204
|
}
|
|
6911
7205
|
} else if (attribute instanceof bufferAttribute.BufferAttribute) {
|
|
6912
7206
|
this.attributes[name] = attribute;
|
|
6913
|
-
} else if (
|
|
7207
|
+
} else if (types$1.isBufferArray(attribute)) {
|
|
6914
7208
|
this.setAttribute(name, new bufferAttribute.BufferAttribute(attribute, itemSize));
|
|
6915
7209
|
}
|
|
6916
7210
|
|
|
@@ -7014,7 +7308,7 @@
|
|
|
7014
7308
|
};
|
|
7015
7309
|
|
|
7016
7310
|
BufferGeometry.prototype.lookAt = function (vector) {
|
|
7017
|
-
_m1.lookAt(
|
|
7311
|
+
_m1.lookAt(Vec3_1.v3(), vector, Vec3_1.Vec3.UnitY);
|
|
7018
7312
|
|
|
7019
7313
|
this.applyMat4(_m1);
|
|
7020
7314
|
return this;
|
|
@@ -8436,14 +8730,12 @@
|
|
|
8436
8730
|
return __assign.apply(this, arguments);
|
|
8437
8731
|
};
|
|
8438
8732
|
|
|
8439
|
-
var
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
}
|
|
8446
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
8733
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
8734
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
8735
|
+
|
|
8736
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
8737
|
+
|
|
8738
|
+
return r;
|
|
8447
8739
|
};
|
|
8448
8740
|
|
|
8449
8741
|
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
|
|
@@ -8467,7 +8759,7 @@
|
|
|
8467
8759
|
|
|
8468
8760
|
|
|
8469
8761
|
|
|
8470
|
-
|
|
8762
|
+
|
|
8471
8763
|
|
|
8472
8764
|
var AxisPlane;
|
|
8473
8765
|
|
|
@@ -8508,15 +8800,15 @@
|
|
|
8508
8800
|
var normal = options.normal;
|
|
8509
8801
|
|
|
8510
8802
|
if (normal && normal.dot(Vec3_1.Vec3.UnitZ) < 1 - _Math.delta4) {
|
|
8511
|
-
boundary =
|
|
8512
|
-
|
|
8803
|
+
boundary = common.clone(inboundary);
|
|
8804
|
+
common.rotateByUnitVectors(boundary, normal, Vec3_1.Vec3.UnitZ);
|
|
8513
8805
|
} else {
|
|
8514
8806
|
boundary = inboundary;
|
|
8515
8807
|
}
|
|
8516
8808
|
|
|
8517
|
-
var allV =
|
|
8809
|
+
var allV = __spreadArrays(boundary, array.flat(holes));
|
|
8518
8810
|
|
|
8519
|
-
var vertextNumbers =
|
|
8811
|
+
var vertextNumbers = vecs_1.vecs.verctorToNumbers(allV, feature);
|
|
8520
8812
|
var holesIndex = [];
|
|
8521
8813
|
var baseIndex = boundary.length;
|
|
8522
8814
|
|
|
@@ -8527,7 +8819,7 @@
|
|
|
8527
8819
|
baseIndex += hole.length;
|
|
8528
8820
|
}
|
|
8529
8821
|
|
|
8530
|
-
var result =
|
|
8822
|
+
var result = earcut_1$1.default(vertextNumbers, holesIndex, dim);
|
|
8531
8823
|
return result;
|
|
8532
8824
|
}
|
|
8533
8825
|
|
|
@@ -8540,14 +8832,12 @@
|
|
|
8540
8832
|
|
|
8541
8833
|
var mesh = createCommonjsModule(function (module, exports) {
|
|
8542
8834
|
|
|
8543
|
-
var
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
}
|
|
8550
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
8835
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
8836
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
8837
|
+
|
|
8838
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
8839
|
+
|
|
8840
|
+
return r;
|
|
8551
8841
|
};
|
|
8552
8842
|
|
|
8553
8843
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -8594,7 +8884,7 @@
|
|
|
8594
8884
|
function triangListToBuffer(vertices, triangleList) {
|
|
8595
8885
|
indexable(triangleList);
|
|
8596
8886
|
var indices = [];
|
|
8597
|
-
|
|
8887
|
+
array.forall(triangleList, function (v) {
|
|
8598
8888
|
indices.push(v.index);
|
|
8599
8889
|
});
|
|
8600
8890
|
return toGeoBuffer(vertices, indices);
|
|
@@ -8636,9 +8926,9 @@
|
|
|
8636
8926
|
};
|
|
8637
8927
|
}
|
|
8638
8928
|
|
|
8639
|
-
var triangles =
|
|
8929
|
+
var triangles = trianglution.triangulation(boundary, holes, options);
|
|
8640
8930
|
|
|
8641
|
-
var vertices =
|
|
8931
|
+
var vertices = __spreadArrays(boundary, array.flat(holes));
|
|
8642
8932
|
|
|
8643
8933
|
var uvs = [];
|
|
8644
8934
|
vertices.forEach(function (v) {
|
|
@@ -8659,14 +8949,12 @@
|
|
|
8659
8949
|
|
|
8660
8950
|
var Plane_1 = createCommonjsModule(function (module, exports) {
|
|
8661
8951
|
|
|
8662
|
-
var
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
}
|
|
8669
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
8952
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
8953
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
8954
|
+
|
|
8955
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
8956
|
+
|
|
8957
|
+
return r;
|
|
8670
8958
|
};
|
|
8671
8959
|
|
|
8672
8960
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -8754,8 +9042,8 @@
|
|
|
8754
9042
|
|
|
8755
9043
|
Plane.prototype.frontback = function (point) {
|
|
8756
9044
|
var value = this.normal.dot(point);
|
|
8757
|
-
if (
|
|
8758
|
-
return
|
|
9045
|
+
if (_Math.approximateEqual(value, 0)) return 0;
|
|
9046
|
+
return _Math.sign(this.normal.dot(point));
|
|
8759
9047
|
}; //---Distance-------------------------------------------------------------------------------
|
|
8760
9048
|
|
|
8761
9049
|
|
|
@@ -8912,8 +9200,8 @@
|
|
|
8912
9200
|
|
|
8913
9201
|
|
|
8914
9202
|
Plane.prototype.splitPolyVS = function (polyVS) {
|
|
8915
|
-
polyVS =
|
|
8916
|
-
|
|
9203
|
+
polyVS = __spreadArrays(polyVS);
|
|
9204
|
+
mesh.indexable(polyVS);
|
|
8917
9205
|
|
|
8918
9206
|
var jdp0; //找出第一个交点
|
|
8919
9207
|
|
|
@@ -9023,7 +9311,7 @@
|
|
|
9023
9311
|
if (e1.x !== e2.x) return e1.x - e2.x;else if (e1.y !== e2.y) return e1.y - e2.y;else return e1.z - e2.z;
|
|
9024
9312
|
};
|
|
9025
9313
|
|
|
9026
|
-
var _vector =
|
|
9314
|
+
var _vector = Vec3_1.v3();
|
|
9027
9315
|
/**
|
|
9028
9316
|
* 数组深度复制
|
|
9029
9317
|
* @param {Array} array
|
|
@@ -9031,7 +9319,7 @@
|
|
|
9031
9319
|
|
|
9032
9320
|
|
|
9033
9321
|
function clone(array) {
|
|
9034
|
-
if (!
|
|
9322
|
+
if (!types.isDefined(array)) return array;
|
|
9035
9323
|
|
|
9036
9324
|
if (Array.isArray(array)) {
|
|
9037
9325
|
var result = new Array();
|
|
@@ -9082,23 +9370,23 @@
|
|
|
9082
9370
|
/**
|
|
9083
9371
|
*
|
|
9084
9372
|
* @param {*} points
|
|
9085
|
-
* @param {*}
|
|
9373
|
+
* @param {*} quat
|
|
9086
9374
|
* @param {Boolean} ref 是否是引用
|
|
9087
9375
|
*/
|
|
9088
9376
|
|
|
9089
|
-
function applyQuat(points,
|
|
9377
|
+
function applyQuat(points, quat, ref) {
|
|
9090
9378
|
if (ref === void 0) {
|
|
9091
9379
|
ref = true;
|
|
9092
9380
|
}
|
|
9093
9381
|
|
|
9094
9382
|
if (ref) {
|
|
9095
9383
|
points.flat(Infinity).forEach(function (point) {
|
|
9096
|
-
point.applyQuat(
|
|
9384
|
+
point.applyQuat(quat);
|
|
9097
9385
|
});
|
|
9098
9386
|
return points;
|
|
9099
9387
|
}
|
|
9100
9388
|
|
|
9101
|
-
return applyQuat(clone(points),
|
|
9389
|
+
return applyQuat(clone(points), quat);
|
|
9102
9390
|
}
|
|
9103
9391
|
|
|
9104
9392
|
exports.applyQuat = applyQuat;
|
|
@@ -9396,14 +9684,12 @@
|
|
|
9396
9684
|
|
|
9397
9685
|
var ArrayList_1 = createCommonjsModule(function (module, exports) {
|
|
9398
9686
|
|
|
9399
|
-
var
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
}
|
|
9406
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9687
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
9688
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
9689
|
+
|
|
9690
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
9691
|
+
|
|
9692
|
+
return r;
|
|
9407
9693
|
};
|
|
9408
9694
|
|
|
9409
9695
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -9512,7 +9798,7 @@
|
|
|
9512
9798
|
value[_i - 1] = arguments[_i];
|
|
9513
9799
|
}
|
|
9514
9800
|
|
|
9515
|
-
(_a = this._array).splice.apply(_a,
|
|
9801
|
+
(_a = this._array).splice.apply(_a, __spreadArrays([i, 0], value));
|
|
9516
9802
|
};
|
|
9517
9803
|
|
|
9518
9804
|
ArrayList.prototype.splice = function (start, deleteCount) {
|
|
@@ -9524,7 +9810,7 @@
|
|
|
9524
9810
|
items[_i - 2] = arguments[_i];
|
|
9525
9811
|
}
|
|
9526
9812
|
|
|
9527
|
-
(_a = this._array).splice.apply(_a,
|
|
9813
|
+
(_a = this._array).splice.apply(_a, __spreadArrays([start, deleteCount], items));
|
|
9528
9814
|
};
|
|
9529
9815
|
|
|
9530
9816
|
ArrayList.prototype.get = function (index) {
|
|
@@ -9548,7 +9834,7 @@
|
|
|
9548
9834
|
|
|
9549
9835
|
|
|
9550
9836
|
ArrayList.prototype.clone = function () {
|
|
9551
|
-
return new this.constructor(
|
|
9837
|
+
return new this.constructor(common.clone(this._array));
|
|
9552
9838
|
};
|
|
9553
9839
|
/**
|
|
9554
9840
|
* 分类
|
|
@@ -9640,7 +9926,7 @@
|
|
|
9640
9926
|
|
|
9641
9927
|
|
|
9642
9928
|
|
|
9643
|
-
var _Vec =
|
|
9929
|
+
var _Vec = Vec3_1.v3();
|
|
9644
9930
|
/**
|
|
9645
9931
|
* 点排序函数
|
|
9646
9932
|
* @param {Vec*} a
|
|
@@ -9693,7 +9979,7 @@
|
|
|
9693
9979
|
return points;
|
|
9694
9980
|
}
|
|
9695
9981
|
|
|
9696
|
-
return applyQuat(
|
|
9982
|
+
return applyQuat(common.clone(points), quat);
|
|
9697
9983
|
}
|
|
9698
9984
|
|
|
9699
9985
|
exports.applyQuat = applyQuat;
|
|
@@ -9716,7 +10002,7 @@
|
|
|
9716
10002
|
return points;
|
|
9717
10003
|
}
|
|
9718
10004
|
|
|
9719
|
-
return translate(
|
|
10005
|
+
return translate(common.clone(points));
|
|
9720
10006
|
}
|
|
9721
10007
|
|
|
9722
10008
|
exports.translate = translate;
|
|
@@ -9774,7 +10060,7 @@
|
|
|
9774
10060
|
return points;
|
|
9775
10061
|
}
|
|
9776
10062
|
|
|
9777
|
-
return applyMat4(
|
|
10063
|
+
return applyMat4(common.clone(points), mat4);
|
|
9778
10064
|
}
|
|
9779
10065
|
|
|
9780
10066
|
exports.applyMat4 = applyMat4;
|
|
@@ -9856,7 +10142,7 @@
|
|
|
9856
10142
|
|
|
9857
10143
|
return points;
|
|
9858
10144
|
} else {
|
|
9859
|
-
return projectOnPlane(
|
|
10145
|
+
return projectOnPlane(common.clone(points), plane, projectDirect);
|
|
9860
10146
|
}
|
|
9861
10147
|
}
|
|
9862
10148
|
|
|
@@ -9943,14 +10229,13 @@
|
|
|
9943
10229
|
} instanceof Array && function (d, b) {
|
|
9944
10230
|
d.__proto__ = b;
|
|
9945
10231
|
} || function (d, b) {
|
|
9946
|
-
for (var p in b) if (
|
|
10232
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
9947
10233
|
};
|
|
9948
10234
|
|
|
9949
10235
|
return extendStatics(d, b);
|
|
9950
10236
|
};
|
|
9951
10237
|
|
|
9952
10238
|
return function (d, b) {
|
|
9953
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
9954
10239
|
extendStatics(d, b);
|
|
9955
10240
|
|
|
9956
10241
|
function __() {
|
|
@@ -10042,16 +10327,16 @@
|
|
|
10042
10327
|
var normal = new Vec3_1.Vec3();
|
|
10043
10328
|
normal.crossVecs(d1, d2).normalize();
|
|
10044
10329
|
this.get(i).normal = normal;
|
|
10045
|
-
var bdir =
|
|
10330
|
+
var bdir = Vec3_1.v3().addVecs(d1, d2).normalize();
|
|
10046
10331
|
this.get(i).bdirection = bdir;
|
|
10047
|
-
this.get(i).bnormal =
|
|
10332
|
+
this.get(i).bnormal = Vec3_1.v3().crossVecs(bdir, normal).normalize(); // }
|
|
10048
10333
|
}
|
|
10049
10334
|
|
|
10050
10335
|
if (!this._closed) {
|
|
10051
10336
|
//不闭合路径 最后一个点没有
|
|
10052
|
-
this.get(-1).bdirection =
|
|
10053
|
-
this.get(-1).normal =
|
|
10054
|
-
this.get(-1).bnormal =
|
|
10337
|
+
this.get(-1).bdirection = Vec3_1.v3();
|
|
10338
|
+
this.get(-1).normal = Vec3_1.v3();
|
|
10339
|
+
this.get(-1).bnormal = Vec3_1.v3();
|
|
10055
10340
|
}
|
|
10056
10341
|
|
|
10057
10342
|
if (!this._closed) {
|
|
@@ -10088,11 +10373,11 @@
|
|
|
10088
10373
|
});
|
|
10089
10374
|
|
|
10090
10375
|
Path.prototype.applyMat4 = function (mat4) {
|
|
10091
|
-
|
|
10376
|
+
pointset.applyMat4(this._array, mat4);
|
|
10092
10377
|
};
|
|
10093
10378
|
|
|
10094
10379
|
Path.prototype.scale = function (x, y, z) {
|
|
10095
|
-
|
|
10380
|
+
common.scale(this._array, Vec3_1.v3(x, y, z), true);
|
|
10096
10381
|
};
|
|
10097
10382
|
/**
|
|
10098
10383
|
* 截取一段从from到to的path
|
|
@@ -10150,7 +10435,7 @@
|
|
|
10150
10435
|
right = this.length - 1;
|
|
10151
10436
|
}
|
|
10152
10437
|
|
|
10153
|
-
var distance =
|
|
10438
|
+
var distance = _Math.clamp(arg_distance, 0, this.get(-1).tlen);
|
|
10154
10439
|
if (distance !== arg_distance) return null;
|
|
10155
10440
|
|
|
10156
10441
|
if (right - left === 1) {
|
|
@@ -10183,7 +10468,7 @@
|
|
|
10183
10468
|
right = this.length - 1;
|
|
10184
10469
|
}
|
|
10185
10470
|
|
|
10186
|
-
var distance =
|
|
10471
|
+
var distance = _Math.clamp(arg_distance, 0, this.get(-1).tlen);
|
|
10187
10472
|
if (distance !== arg_distance) return null;
|
|
10188
10473
|
|
|
10189
10474
|
if (right - left === 1) {
|
|
@@ -10309,7 +10594,7 @@
|
|
|
10309
10594
|
}
|
|
10310
10595
|
|
|
10311
10596
|
if (normalize) {
|
|
10312
|
-
var tl =
|
|
10597
|
+
var tl = types.isDefined(totalMileage) ? totalMileage : this.totalMileages(ps);
|
|
10313
10598
|
|
|
10314
10599
|
for (var i = 0, len = ps.length; i < len; i++) {
|
|
10315
10600
|
res[i] /= tl;
|
|
@@ -10330,12 +10615,6 @@
|
|
|
10330
10615
|
|
|
10331
10616
|
var distance = createCommonjsModule(function (module, exports) {
|
|
10332
10617
|
|
|
10333
|
-
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
|
|
10334
|
-
return mod && mod.__esModule ? mod : {
|
|
10335
|
-
"default": mod
|
|
10336
|
-
};
|
|
10337
|
-
};
|
|
10338
|
-
|
|
10339
10618
|
Object.defineProperty(exports, "__esModule", {
|
|
10340
10619
|
value: true
|
|
10341
10620
|
});
|
|
@@ -10343,7 +10622,7 @@
|
|
|
10343
10622
|
|
|
10344
10623
|
|
|
10345
10624
|
|
|
10346
|
-
|
|
10625
|
+
|
|
10347
10626
|
/*
|
|
10348
10627
|
* @Description : 如无必要,勿增实体
|
|
10349
10628
|
* @Author : 赵耀圣
|
|
@@ -10362,7 +10641,7 @@
|
|
|
10362
10641
|
function Distance() {}
|
|
10363
10642
|
|
|
10364
10643
|
Distance.Point2Point_Number = function (x0, y0, z0, x1, y1, z1) {
|
|
10365
|
-
return
|
|
10644
|
+
return vecs_1.vecs.distance(x0, y0, z0, x1, y1, z1);
|
|
10366
10645
|
};
|
|
10367
10646
|
|
|
10368
10647
|
Distance.Point2Line_Number = function (x0, y0, z0, sox, soy, soz, sdx, sdy, sdz) {};
|
|
@@ -10419,20 +10698,12 @@
|
|
|
10419
10698
|
return __assign.apply(this, arguments);
|
|
10420
10699
|
};
|
|
10421
10700
|
|
|
10422
|
-
var
|
|
10423
|
-
|
|
10424
|
-
if (ar || !(i in from)) {
|
|
10425
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
10426
|
-
ar[i] = from[i];
|
|
10427
|
-
}
|
|
10428
|
-
}
|
|
10429
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10430
|
-
};
|
|
10701
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
10702
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
10431
10703
|
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
};
|
|
10704
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
10705
|
+
|
|
10706
|
+
return r;
|
|
10436
10707
|
};
|
|
10437
10708
|
|
|
10438
10709
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10464,7 +10735,7 @@
|
|
|
10464
10735
|
|
|
10465
10736
|
|
|
10466
10737
|
|
|
10467
|
-
|
|
10738
|
+
|
|
10468
10739
|
|
|
10469
10740
|
|
|
10470
10741
|
/**
|
|
@@ -10508,7 +10779,7 @@
|
|
|
10508
10779
|
triangles.push(v10);
|
|
10509
10780
|
}
|
|
10510
10781
|
} else {
|
|
10511
|
-
if (
|
|
10782
|
+
if (types.isDefined(side0[0].index)) {
|
|
10512
10783
|
//含索引的顶点
|
|
10513
10784
|
for (var i = 0; i < length; i++) {
|
|
10514
10785
|
var v00 = side0[i];
|
|
@@ -10597,7 +10868,7 @@
|
|
|
10597
10868
|
if (hasHole) allVertics.push(holess);
|
|
10598
10869
|
var orgShape = options.orgShape || shapes[0];
|
|
10599
10870
|
var orgHoles = options.orgHoles || holess && holess[0];
|
|
10600
|
-
if (index)
|
|
10871
|
+
if (index) mesh.indexable(allVertics, index);
|
|
10601
10872
|
|
|
10602
10873
|
for (var i = 0; i < length; i++) {
|
|
10603
10874
|
if (holess) triangles.push.apply(triangles, linkSide({
|
|
@@ -10614,15 +10885,15 @@
|
|
|
10614
10885
|
}
|
|
10615
10886
|
|
|
10616
10887
|
if (options.sealStart) {
|
|
10617
|
-
var startShape =
|
|
10888
|
+
var startShape = common.clone(shapes[0]);
|
|
10618
10889
|
allVertics.push(startShape);
|
|
10619
10890
|
|
|
10620
10891
|
if (holess && holess[0]) {
|
|
10621
|
-
var startHoles =
|
|
10892
|
+
var startHoles = common.clone(holess[0]);
|
|
10622
10893
|
allVertics.push(startHoles);
|
|
10623
10894
|
}
|
|
10624
10895
|
|
|
10625
|
-
var startTris =
|
|
10896
|
+
var startTris = trianglution.triangulation(orgShape, orgHoles, {
|
|
10626
10897
|
feature: trianglution.AxisPlane.XYZ
|
|
10627
10898
|
});
|
|
10628
10899
|
|
|
@@ -10640,15 +10911,15 @@
|
|
|
10640
10911
|
}
|
|
10641
10912
|
|
|
10642
10913
|
if (options.sealEnd) {
|
|
10643
|
-
var endShape =
|
|
10914
|
+
var endShape = common.clone(shapes[shapes.length - 1]);
|
|
10644
10915
|
allVertics.push(endShape);
|
|
10645
10916
|
|
|
10646
10917
|
if (holess && holess[0]) {
|
|
10647
|
-
var endHoles =
|
|
10918
|
+
var endHoles = common.clone(common.clone(holess[holess.length - 1]));
|
|
10648
10919
|
allVertics.push(endHoles);
|
|
10649
10920
|
}
|
|
10650
10921
|
|
|
10651
|
-
var endTris =
|
|
10922
|
+
var endTris = trianglution.triangulation(orgShape, orgHoles, {
|
|
10652
10923
|
feature: trianglution.AxisPlane.XYZ
|
|
10653
10924
|
});
|
|
10654
10925
|
|
|
@@ -10757,7 +11028,7 @@
|
|
|
10757
11028
|
break;
|
|
10758
11029
|
}
|
|
10759
11030
|
|
|
10760
|
-
uvs.push.apply(uvs,
|
|
11031
|
+
uvs.push.apply(uvs, __spreadArrays(sealUvs, sealUvs));
|
|
10761
11032
|
}
|
|
10762
11033
|
|
|
10763
11034
|
var indices = triangles || []; // if (isDefined(shapes[0][0].index)) {
|
|
@@ -10771,7 +11042,7 @@
|
|
|
10771
11042
|
// }
|
|
10772
11043
|
// }
|
|
10773
11044
|
|
|
10774
|
-
var positions =
|
|
11045
|
+
var positions = vecs_1.vecs.verctorToNumbers(allVertics);
|
|
10775
11046
|
shapes.pop();
|
|
10776
11047
|
shapes.pop();
|
|
10777
11048
|
return {
|
|
@@ -10791,17 +11062,17 @@
|
|
|
10791
11062
|
normal: Vec3_1.Vec3.UnitZ
|
|
10792
11063
|
};
|
|
10793
11064
|
|
|
10794
|
-
var _matrix =
|
|
11065
|
+
var _matrix = Mat4_1.m4();
|
|
10795
11066
|
|
|
10796
|
-
var _matrix1 =
|
|
11067
|
+
var _matrix1 = Mat4_1.m4();
|
|
10797
11068
|
|
|
10798
|
-
var _quat =
|
|
11069
|
+
var _quat = Quat_1.quat();
|
|
10799
11070
|
|
|
10800
|
-
var _quat1 =
|
|
11071
|
+
var _quat1 = Quat_1.quat();
|
|
10801
11072
|
|
|
10802
|
-
var _vec1 =
|
|
11073
|
+
var _vec1 = Vec3_1.v3();
|
|
10803
11074
|
|
|
10804
|
-
var _vec2 =
|
|
11075
|
+
var _vec2 = Vec3_1.v3();
|
|
10805
11076
|
/**
|
|
10806
11077
|
* @description : 挤压形状生成几何体
|
|
10807
11078
|
* @param {IExtrudeOptionsEx} options
|
|
@@ -10840,9 +11111,9 @@
|
|
|
10840
11111
|
smoothAngle: 30 * _Math.RADIANS_PER_DEGREE,
|
|
10841
11112
|
enableSmooth: false
|
|
10842
11113
|
}, options);
|
|
10843
|
-
if (!
|
|
11114
|
+
if (!vecs_1.vecs.isCCW(options.shape)) options.shape.reverse();
|
|
10844
11115
|
if (options.holes) options.holes.forEach(function (hole) {
|
|
10845
|
-
if (!
|
|
11116
|
+
if (!vecs_1.vecs.isCCW(hole)) hole.reverse();
|
|
10846
11117
|
});
|
|
10847
11118
|
var path = new Path_1.Path(options.path);
|
|
10848
11119
|
var shapes = [];
|
|
@@ -10858,9 +11129,9 @@
|
|
|
10858
11129
|
}
|
|
10859
11130
|
var ups = options.ups || [];
|
|
10860
11131
|
|
|
10861
|
-
if (
|
|
11132
|
+
if (types.isUndefined(shapePath.first.z)) {
|
|
10862
11133
|
shapePath.array = shapePath.array.map(function (e) {
|
|
10863
|
-
return
|
|
11134
|
+
return Vec3_1.v3(e.x, e.y, 0);
|
|
10864
11135
|
});
|
|
10865
11136
|
options.normal = options.normal || Vec3_1.Vec3.UnitZ;
|
|
10866
11137
|
}
|
|
@@ -10873,9 +11144,9 @@
|
|
|
10873
11144
|
var point = path.get(i);
|
|
10874
11145
|
var direction = point.direction;
|
|
10875
11146
|
var upi = void 0;
|
|
10876
|
-
upi = ups[i] || up ||
|
|
11147
|
+
upi = ups[i] || up || Vec3_1.v3().crossVecs(right, direction);
|
|
10877
11148
|
var righti = right;
|
|
10878
|
-
if (!right) righti =
|
|
11149
|
+
if (!right) righti = Vec3_1.v3().crossVecs(upi, direction).normalize();
|
|
10879
11150
|
|
|
10880
11151
|
_matrix.makeBasis(righti, upi, direction);
|
|
10881
11152
|
|
|
@@ -10886,7 +11157,7 @@
|
|
|
10886
11157
|
shapes.push(new_shape);
|
|
10887
11158
|
|
|
10888
11159
|
if (options.holes) {
|
|
10889
|
-
var mholes =
|
|
11160
|
+
var mholes = pointset.applyMat4(options.holes, _matrix, false);
|
|
10890
11161
|
newholes.push(mholes);
|
|
10891
11162
|
}
|
|
10892
11163
|
}
|
|
@@ -10937,10 +11208,10 @@
|
|
|
10937
11208
|
throw "路径节点数必须大于2";
|
|
10938
11209
|
}
|
|
10939
11210
|
|
|
10940
|
-
var isCCW =
|
|
11211
|
+
var isCCW = vecs_1.vecs.isCCW(shape);
|
|
10941
11212
|
if (!isCCW) shape.reverse();
|
|
10942
11213
|
var normal = options.normal;
|
|
10943
|
-
var startSeal =
|
|
11214
|
+
var startSeal = common.clone(shape);
|
|
10944
11215
|
var shapepath = new Path_1.Path(shape);
|
|
10945
11216
|
var insertNum = 0;
|
|
10946
11217
|
|
|
@@ -10964,26 +11235,26 @@
|
|
|
10964
11235
|
for (var i = 0; i < path.length; i++) {
|
|
10965
11236
|
var node = path[i];
|
|
10966
11237
|
var dir = node.tangent;
|
|
10967
|
-
var newShape =
|
|
10968
|
-
|
|
11238
|
+
var newShape = common.clone(shape);
|
|
11239
|
+
common.rotateByUnitVectors(newShape, normal, dir);
|
|
10969
11240
|
|
|
10970
11241
|
if (options.fixedY) {
|
|
10971
11242
|
var v = Vec3_1.Vec3.UnitX;
|
|
10972
|
-
|
|
11243
|
+
common.rotateByUnitVectors([v], normal, dir);
|
|
10973
11244
|
var v1 = v.clone();
|
|
10974
11245
|
v1.y = 0;
|
|
10975
|
-
|
|
11246
|
+
common.rotateByUnitVectors(newShape, v, v1);
|
|
10976
11247
|
}
|
|
10977
11248
|
|
|
10978
|
-
|
|
11249
|
+
pointset.translate(newShape, node);
|
|
10979
11250
|
shapeArray.push(newShape);
|
|
10980
11251
|
}
|
|
10981
11252
|
|
|
10982
11253
|
var gindex = {
|
|
10983
11254
|
index: 0
|
|
10984
11255
|
};
|
|
10985
|
-
var vertices =
|
|
10986
|
-
|
|
11256
|
+
var vertices = array.flat(shapeArray);
|
|
11257
|
+
mesh.indexable(vertices, gindex);
|
|
10987
11258
|
var index = linkSides({
|
|
10988
11259
|
shapes: shapeArray,
|
|
10989
11260
|
shapeClosed: options.shapeClosed,
|
|
@@ -10999,37 +11270,37 @@
|
|
|
10999
11270
|
}
|
|
11000
11271
|
}
|
|
11001
11272
|
|
|
11002
|
-
var sealUv =
|
|
11003
|
-
if (normal.dot(Vec3_1.Vec3.UnitZ) < 1 - 1e-4)
|
|
11004
|
-
var endSeal =
|
|
11005
|
-
|
|
11273
|
+
var sealUv = common.clone(startSeal);
|
|
11274
|
+
if (normal.dot(Vec3_1.Vec3.UnitZ) < 1 - 1e-4) common.rotateByUnitVectors(sealUv, normal, Vec3_1.Vec3.UnitZ);
|
|
11275
|
+
var endSeal = common.clone(startSeal);
|
|
11276
|
+
common.rotateByUnitVectors(startSeal, normal, path[0].tangent);
|
|
11006
11277
|
|
|
11007
11278
|
if (options.fixedY) {
|
|
11008
11279
|
var v = Vec3_1.Vec3.UnitX;
|
|
11009
|
-
|
|
11280
|
+
common.rotateByUnitVectors([v], normal, path[0].tangent);
|
|
11010
11281
|
var v1 = v.clone();
|
|
11011
11282
|
v1.y = 0;
|
|
11012
|
-
|
|
11283
|
+
common.rotateByUnitVectors(startSeal, v, v1);
|
|
11013
11284
|
}
|
|
11014
11285
|
|
|
11015
|
-
|
|
11016
|
-
|
|
11286
|
+
pointset.translate(startSeal, path[0]);
|
|
11287
|
+
common.rotateByUnitVectors(endSeal, normal, path.get(-1).tangent);
|
|
11017
11288
|
|
|
11018
11289
|
if (options.fixedY) {
|
|
11019
11290
|
var v = Vec3_1.Vec3.UnitX;
|
|
11020
|
-
|
|
11291
|
+
common.rotateByUnitVectors([v], normal, path.get(-1).tangent);
|
|
11021
11292
|
var v1 = v.clone();
|
|
11022
11293
|
v1.y = 0;
|
|
11023
|
-
|
|
11294
|
+
common.rotateByUnitVectors(endSeal, v, v1);
|
|
11024
11295
|
}
|
|
11025
11296
|
|
|
11026
|
-
|
|
11027
|
-
var sealStartTris =
|
|
11297
|
+
pointset.translate(endSeal, path.get(-1));
|
|
11298
|
+
var sealStartTris = trianglution.triangulation(sealUv, [], {
|
|
11028
11299
|
normal: normal
|
|
11029
11300
|
});
|
|
11030
11301
|
sealStartTris.reverse();
|
|
11031
|
-
if (options.sealStart)
|
|
11032
|
-
if (options.sealEnd)
|
|
11302
|
+
if (options.sealStart) mesh.indexable(startSeal, gindex);
|
|
11303
|
+
if (options.sealEnd) mesh.indexable(endSeal, gindex);
|
|
11033
11304
|
var sealEndTris = [];
|
|
11034
11305
|
var hasVLen = vertices.length;
|
|
11035
11306
|
if (options.sealStart) for (var i = 0; i < sealStartTris.length; i++) {
|
|
@@ -11111,12 +11382,12 @@
|
|
|
11111
11382
|
smoothAngle: 30 * _Math.RADIANS_PER_DEGREE,
|
|
11112
11383
|
enableSmooth: false
|
|
11113
11384
|
}, options);
|
|
11114
|
-
var path = options.shapeCenter ?
|
|
11385
|
+
var path = options.shapeCenter ? pointset.translate(options.path, options.shapeCenter, false) : options.path;
|
|
11115
11386
|
var shape = options.shape;
|
|
11116
|
-
|
|
11387
|
+
array.unique(path, function (a, b) {
|
|
11117
11388
|
return a.equals(b);
|
|
11118
11389
|
});
|
|
11119
|
-
|
|
11390
|
+
array.unique(shape, function (a, b) {
|
|
11120
11391
|
return a.equals(b);
|
|
11121
11392
|
});
|
|
11122
11393
|
var pathPath = new Path_1.Path(path, options.pathClosed, true);
|
|
@@ -11131,9 +11402,9 @@
|
|
|
11131
11402
|
}
|
|
11132
11403
|
options.normal = options.normal || Vec3_1.Vec3.UnitZ;
|
|
11133
11404
|
|
|
11134
|
-
if (
|
|
11405
|
+
if (types.isUndefined(shapePath.first.z)) {
|
|
11135
11406
|
shapePath.array = shapePath.array.map(function (e) {
|
|
11136
|
-
return
|
|
11407
|
+
return Vec3_1.v3(e.x, e.y, 0);
|
|
11137
11408
|
});
|
|
11138
11409
|
}
|
|
11139
11410
|
|
|
@@ -11141,7 +11412,7 @@
|
|
|
11141
11412
|
var right = options.right;
|
|
11142
11413
|
var shapes = [],
|
|
11143
11414
|
newholes = [];
|
|
11144
|
-
var accMat =
|
|
11415
|
+
var accMat = Mat4_1.m4();
|
|
11145
11416
|
/**
|
|
11146
11417
|
* 如果路径闭合 要考虑首尾shape矩阵变化后还能一致吻合
|
|
11147
11418
|
*/
|
|
@@ -11338,14 +11609,13 @@
|
|
|
11338
11609
|
} instanceof Array && function (d, b) {
|
|
11339
11610
|
d.__proto__ = b;
|
|
11340
11611
|
} || function (d, b) {
|
|
11341
|
-
for (var p in b) if (
|
|
11612
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
11342
11613
|
};
|
|
11343
11614
|
|
|
11344
11615
|
return extendStatics(d, b);
|
|
11345
11616
|
};
|
|
11346
11617
|
|
|
11347
11618
|
return function (d, b) {
|
|
11348
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11349
11619
|
extendStatics(d, b);
|
|
11350
11620
|
|
|
11351
11621
|
function __() {
|
|
@@ -11507,14 +11777,13 @@
|
|
|
11507
11777
|
} instanceof Array && function (d, b) {
|
|
11508
11778
|
d.__proto__ = b;
|
|
11509
11779
|
} || function (d, b) {
|
|
11510
|
-
for (var p in b) if (
|
|
11780
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
11511
11781
|
};
|
|
11512
11782
|
|
|
11513
11783
|
return extendStatics(d, b);
|
|
11514
11784
|
};
|
|
11515
11785
|
|
|
11516
11786
|
return function (d, b) {
|
|
11517
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11518
11787
|
extendStatics(d, b);
|
|
11519
11788
|
|
|
11520
11789
|
function __() {
|
|
@@ -11589,7 +11858,7 @@
|
|
|
11589
11858
|
unwrapExports(Polygon_1);
|
|
11590
11859
|
var Polygon_2 = Polygon_1.Polygon;
|
|
11591
11860
|
|
|
11592
|
-
var
|
|
11861
|
+
var vecs_1 = createCommonjsModule(function (module, exports) {
|
|
11593
11862
|
/**
|
|
11594
11863
|
* 当向量以数组的方式出现,一个计算单元库
|
|
11595
11864
|
* @Description : 向量数组
|
|
@@ -11600,19 +11869,20 @@
|
|
|
11600
11869
|
* @FilePath : \cga.js\src\math\VecArray.ts
|
|
11601
11870
|
*/
|
|
11602
11871
|
|
|
11603
|
-
var
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
}
|
|
11610
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
11872
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
11873
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
11874
|
+
|
|
11875
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
11876
|
+
|
|
11877
|
+
return r;
|
|
11611
11878
|
};
|
|
11612
11879
|
|
|
11613
11880
|
Object.defineProperty(exports, "__esModule", {
|
|
11614
11881
|
value: true
|
|
11615
11882
|
});
|
|
11883
|
+
exports.vecs = void 0;
|
|
11884
|
+
|
|
11885
|
+
|
|
11616
11886
|
|
|
11617
11887
|
|
|
11618
11888
|
|
|
@@ -11626,6 +11896,12 @@
|
|
|
11626
11896
|
|
|
11627
11897
|
|
|
11628
11898
|
|
|
11899
|
+
var _vec21 = new Vec2_1.Vec2();
|
|
11900
|
+
|
|
11901
|
+
var _vec31 = new Vec3_1.Vec3();
|
|
11902
|
+
|
|
11903
|
+
var _vec41 = new Vec4_1.Vec4();
|
|
11904
|
+
|
|
11629
11905
|
var ckeckVec = function (vs, component) {
|
|
11630
11906
|
if (vs.length % component !== 0) throw "向量组件数量不一样";
|
|
11631
11907
|
};
|
|
@@ -11634,10 +11910,10 @@
|
|
|
11634
11910
|
*/
|
|
11635
11911
|
|
|
11636
11912
|
|
|
11637
|
-
var
|
|
11913
|
+
var vecs =
|
|
11638
11914
|
/** @class */
|
|
11639
11915
|
function () {
|
|
11640
|
-
function
|
|
11916
|
+
function vecs() {}
|
|
11641
11917
|
/**
|
|
11642
11918
|
* 去除相邻的重复向量
|
|
11643
11919
|
* @param vs 矢量集合
|
|
@@ -11646,7 +11922,7 @@
|
|
|
11646
11922
|
*/
|
|
11647
11923
|
|
|
11648
11924
|
|
|
11649
|
-
|
|
11925
|
+
vecs.uniqueNeighborVecs = function (vs, delta) {
|
|
11650
11926
|
if (delta === void 0) {
|
|
11651
11927
|
delta = _Math.delta4;
|
|
11652
11928
|
}
|
|
@@ -11663,7 +11939,7 @@
|
|
|
11663
11939
|
*/
|
|
11664
11940
|
|
|
11665
11941
|
|
|
11666
|
-
|
|
11942
|
+
vecs.uniqueNeighbor = function (vs, component, delta) {
|
|
11667
11943
|
if (component === void 0) {
|
|
11668
11944
|
component = 3;
|
|
11669
11945
|
}
|
|
@@ -11694,7 +11970,7 @@
|
|
|
11694
11970
|
*/
|
|
11695
11971
|
|
|
11696
11972
|
|
|
11697
|
-
|
|
11973
|
+
vecs.unique = function (vs, component) {
|
|
11698
11974
|
if (component === void 0) {
|
|
11699
11975
|
component = 3;
|
|
11700
11976
|
}
|
|
@@ -11721,7 +11997,7 @@
|
|
|
11721
11997
|
*/
|
|
11722
11998
|
|
|
11723
11999
|
|
|
11724
|
-
|
|
12000
|
+
vecs.reverse = function (vecs, component) {
|
|
11725
12001
|
if (component === void 0) {
|
|
11726
12002
|
component = 3;
|
|
11727
12003
|
}
|
|
@@ -11742,7 +12018,7 @@
|
|
|
11742
12018
|
*/
|
|
11743
12019
|
|
|
11744
12020
|
|
|
11745
|
-
|
|
12021
|
+
vecs.dot = function () {
|
|
11746
12022
|
var vecs = [];
|
|
11747
12023
|
|
|
11748
12024
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11766,7 +12042,7 @@
|
|
|
11766
12042
|
*/
|
|
11767
12043
|
|
|
11768
12044
|
|
|
11769
|
-
|
|
12045
|
+
vecs.distanceSq = function () {
|
|
11770
12046
|
var vecs = [];
|
|
11771
12047
|
|
|
11772
12048
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11791,7 +12067,7 @@
|
|
|
11791
12067
|
*/
|
|
11792
12068
|
|
|
11793
12069
|
|
|
11794
|
-
|
|
12070
|
+
vecs.distance = function () {
|
|
11795
12071
|
var vecs = [];
|
|
11796
12072
|
|
|
11797
12073
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11807,7 +12083,7 @@
|
|
|
11807
12083
|
*/
|
|
11808
12084
|
|
|
11809
12085
|
|
|
11810
|
-
|
|
12086
|
+
vecs.add = function () {
|
|
11811
12087
|
var vecs = [];
|
|
11812
12088
|
|
|
11813
12089
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11841,7 +12117,7 @@
|
|
|
11841
12117
|
*/
|
|
11842
12118
|
|
|
11843
12119
|
|
|
11844
|
-
|
|
12120
|
+
vecs.sub = function () {
|
|
11845
12121
|
var vecs = [];
|
|
11846
12122
|
|
|
11847
12123
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11875,7 +12151,7 @@
|
|
|
11875
12151
|
*/
|
|
11876
12152
|
|
|
11877
12153
|
|
|
11878
|
-
|
|
12154
|
+
vecs.mul = function () {
|
|
11879
12155
|
var vecs = [];
|
|
11880
12156
|
|
|
11881
12157
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11911,7 +12187,7 @@
|
|
|
11911
12187
|
*/
|
|
11912
12188
|
|
|
11913
12189
|
|
|
11914
|
-
|
|
12190
|
+
vecs.getVecAt = function (vecs, i, component) {
|
|
11915
12191
|
|
|
11916
12192
|
return [vecs[3 * i], vecs[3 * i + 1], vecs[3 * i + 2]];
|
|
11917
12193
|
};
|
|
@@ -11923,14 +12199,14 @@
|
|
|
11923
12199
|
*/
|
|
11924
12200
|
|
|
11925
12201
|
|
|
11926
|
-
|
|
12202
|
+
vecs.insertAt = function (vecs, i) {
|
|
11927
12203
|
var vec = [];
|
|
11928
12204
|
|
|
11929
12205
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
11930
12206
|
vec[_i - 2] = arguments[_i];
|
|
11931
12207
|
}
|
|
11932
12208
|
|
|
11933
|
-
vecs.splice.apply(vecs,
|
|
12209
|
+
vecs.splice.apply(vecs, __spreadArrays([i * vecs.length, 0], vecs));
|
|
11934
12210
|
}; //
|
|
11935
12211
|
|
|
11936
12212
|
/**
|
|
@@ -11939,7 +12215,7 @@
|
|
|
11939
12215
|
*/
|
|
11940
12216
|
|
|
11941
12217
|
|
|
11942
|
-
|
|
12218
|
+
vecs.isCCW = function (shape, component) {
|
|
11943
12219
|
if (component === void 0) {
|
|
11944
12220
|
component = 3;
|
|
11945
12221
|
}
|
|
@@ -11976,47 +12252,47 @@
|
|
|
11976
12252
|
*/
|
|
11977
12253
|
|
|
11978
12254
|
|
|
11979
|
-
|
|
12255
|
+
vecs.verctorToNumbers = function (vectors, comSort) {
|
|
11980
12256
|
if (comSort === void 0) {
|
|
11981
12257
|
comSort = "xyz";
|
|
11982
12258
|
}
|
|
11983
12259
|
|
|
11984
|
-
if (!(
|
|
12260
|
+
if (!(vectors instanceof Array)) {
|
|
11985
12261
|
console.error("传入参数必须是数组");
|
|
11986
12262
|
return [];
|
|
11987
12263
|
}
|
|
11988
12264
|
|
|
11989
12265
|
var numbers = [];
|
|
11990
12266
|
|
|
11991
|
-
if (
|
|
12267
|
+
if (vectors[0].x !== undefined && vectors[0].y !== undefined && vectors[0].z !== undefined && vectors[0].w !== undefined) {
|
|
11992
12268
|
comSort = comSort.length !== 4 ? 'xyzw' : comSort;
|
|
11993
12269
|
|
|
11994
|
-
for (var i = 0; i <
|
|
12270
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
11995
12271
|
for (var j = 0; j < comSort.length; j++) {
|
|
11996
|
-
numbers.push(
|
|
12272
|
+
numbers.push(vectors[i][comSort[j]]);
|
|
11997
12273
|
}
|
|
11998
12274
|
}
|
|
11999
12275
|
}
|
|
12000
12276
|
|
|
12001
|
-
if (
|
|
12277
|
+
if (vectors[0].x !== undefined && vectors[0].y !== undefined && vectors[0].z !== undefined) {
|
|
12002
12278
|
comSort = comSort.length !== 3 ? 'xyz' : comSort;
|
|
12003
12279
|
|
|
12004
|
-
for (var i = 0; i <
|
|
12280
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
12005
12281
|
for (var j = 0; j < comSort.length; j++) {
|
|
12006
|
-
numbers.push(
|
|
12282
|
+
numbers.push(vectors[i][comSort[j]]);
|
|
12007
12283
|
}
|
|
12008
12284
|
}
|
|
12009
|
-
} else if (
|
|
12285
|
+
} else if (vectors[0].x !== undefined && vectors[0].y !== undefined) {
|
|
12010
12286
|
comSort = comSort.length !== 2 ? 'xy' : comSort;
|
|
12011
12287
|
|
|
12012
|
-
for (var i = 0; i <
|
|
12288
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
12013
12289
|
for (var j = 0; j < comSort.length; j++) {
|
|
12014
|
-
numbers.push(
|
|
12290
|
+
numbers.push(vectors[i][comSort[j]]);
|
|
12015
12291
|
}
|
|
12016
12292
|
}
|
|
12017
|
-
} else if (
|
|
12018
|
-
for (var i = 0; i <
|
|
12019
|
-
numbers = numbers.concat(
|
|
12293
|
+
} else if (vectors[0] instanceof Array) {
|
|
12294
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
12295
|
+
numbers = numbers.concat(vecs.verctorToNumbers(vectors[i]));
|
|
12020
12296
|
}
|
|
12021
12297
|
} else {
|
|
12022
12298
|
console.error("数组内部的元素不是向量");
|
|
@@ -12025,7 +12301,7 @@
|
|
|
12025
12301
|
return numbers;
|
|
12026
12302
|
};
|
|
12027
12303
|
|
|
12028
|
-
|
|
12304
|
+
vecs.vec = function (component) {
|
|
12029
12305
|
if (component === void 0) {
|
|
12030
12306
|
component = 3;
|
|
12031
12307
|
}
|
|
@@ -12043,30 +12319,84 @@
|
|
|
12043
12319
|
*/
|
|
12044
12320
|
|
|
12045
12321
|
|
|
12046
|
-
|
|
12322
|
+
vecs.numbersToVecs = function (vss, component) {
|
|
12047
12323
|
if (component === void 0) {
|
|
12048
12324
|
component = 3;
|
|
12049
12325
|
}
|
|
12050
12326
|
|
|
12051
12327
|
var result = [];
|
|
12052
|
-
var length = vss.length;
|
|
12053
12328
|
|
|
12054
|
-
for (var i = 0; i <
|
|
12055
|
-
var vec =
|
|
12056
|
-
vec.fromArray(vss
|
|
12329
|
+
for (var i = 0, length_1 = vss.length; i < length_1; i += component) {
|
|
12330
|
+
var vec = vecs.vec(component);
|
|
12331
|
+
vec.fromArray(vss, i);
|
|
12057
12332
|
result.push(vec);
|
|
12058
12333
|
}
|
|
12059
12334
|
|
|
12060
12335
|
return result;
|
|
12061
12336
|
};
|
|
12062
12337
|
|
|
12063
|
-
|
|
12338
|
+
vecs.applyQuat = function (vss, quat, component) {
|
|
12339
|
+
if (component === void 0) {
|
|
12340
|
+
component = 3;
|
|
12341
|
+
}
|
|
12342
|
+
|
|
12343
|
+
var vec;
|
|
12344
|
+
if (component === 3) vec = _vec31;else if (component === 2) vec = _vec21;else if (component === 4) vec = _vec41;
|
|
12345
|
+
|
|
12346
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
12347
|
+
vec.fromArray(vss, i).applyQuat(quat).toArray(vss, i);
|
|
12348
|
+
}
|
|
12349
|
+
};
|
|
12350
|
+
|
|
12351
|
+
vecs.applyMat4 = function (vss, mat, component) {
|
|
12352
|
+
if (component === void 0) {
|
|
12353
|
+
component = 3;
|
|
12354
|
+
}
|
|
12355
|
+
|
|
12356
|
+
var vec;
|
|
12357
|
+
if (component === 3) vec = _vec31;else if (component === 2) vec = _vec21;else if (component === 4) vec = _vec41;
|
|
12358
|
+
|
|
12359
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
12360
|
+
vec.fromArray(vss, i).applyMat4(mat).toArray(vss, i);
|
|
12361
|
+
}
|
|
12362
|
+
};
|
|
12363
|
+
|
|
12364
|
+
vecs.translate = function (vss, distance, component) {
|
|
12365
|
+
if (component === void 0) {
|
|
12366
|
+
component = 3;
|
|
12367
|
+
}
|
|
12368
|
+
|
|
12369
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
12370
|
+
for (var j = 0; j < component; j++) {
|
|
12371
|
+
vss[i + j] += distance[j];
|
|
12372
|
+
}
|
|
12373
|
+
}
|
|
12374
|
+
};
|
|
12375
|
+
|
|
12376
|
+
vecs.rotate = function (vss, axis, angle) {
|
|
12377
|
+
vecs.applyQuat(vss, new Quat_1.Quat().setFromAxisAngle(axis, angle));
|
|
12378
|
+
};
|
|
12379
|
+
|
|
12380
|
+
vecs.scale = function (vss, _scale, component) {
|
|
12381
|
+
if (component === void 0) {
|
|
12382
|
+
component = 3;
|
|
12383
|
+
}
|
|
12384
|
+
|
|
12385
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
12386
|
+
for (var j = 0; j < component; j++) {
|
|
12387
|
+
vss[i + j] *= _scale[j];
|
|
12388
|
+
}
|
|
12389
|
+
}
|
|
12390
|
+
};
|
|
12391
|
+
|
|
12392
|
+
return vecs;
|
|
12064
12393
|
}();
|
|
12065
12394
|
|
|
12066
|
-
exports.
|
|
12395
|
+
exports.vecs = vecs;
|
|
12067
12396
|
});
|
|
12068
12397
|
|
|
12069
|
-
unwrapExports(
|
|
12398
|
+
unwrapExports(vecs_1);
|
|
12399
|
+
var vecs_2 = vecs_1.vecs;
|
|
12070
12400
|
|
|
12071
12401
|
var result = createCommonjsModule(function (module, exports) {
|
|
12072
12402
|
|
|
@@ -13606,14 +13936,13 @@
|
|
|
13606
13936
|
} instanceof Array && function (d, b) {
|
|
13607
13937
|
d.__proto__ = b;
|
|
13608
13938
|
} || function (d, b) {
|
|
13609
|
-
for (var p in b) if (
|
|
13939
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
13610
13940
|
};
|
|
13611
13941
|
|
|
13612
13942
|
return extendStatics(d, b);
|
|
13613
13943
|
};
|
|
13614
13944
|
|
|
13615
13945
|
return function (d, b) {
|
|
13616
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13617
13946
|
extendStatics(d, b);
|
|
13618
13947
|
|
|
13619
13948
|
function __() {
|
|
@@ -13680,7 +14009,7 @@
|
|
|
13680
14009
|
normal = Vec3_1.Vec3.UnitY;
|
|
13681
14010
|
}
|
|
13682
14011
|
|
|
13683
|
-
this.center = center ||
|
|
14012
|
+
this.center = center || Vec3_1.v3();
|
|
13684
14013
|
this.normal = normal;
|
|
13685
14014
|
this.radius = radius || 0;
|
|
13686
14015
|
this.w = this.normal.dot(center);
|
|
@@ -13715,14 +14044,13 @@
|
|
|
13715
14044
|
} instanceof Array && function (d, b) {
|
|
13716
14045
|
d.__proto__ = b;
|
|
13717
14046
|
} || function (d, b) {
|
|
13718
|
-
for (var p in b) if (
|
|
14047
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
13719
14048
|
};
|
|
13720
14049
|
|
|
13721
14050
|
return extendStatics(d, b);
|
|
13722
14051
|
};
|
|
13723
14052
|
|
|
13724
14053
|
return function (d, b) {
|
|
13725
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13726
14054
|
extendStatics(d, b);
|
|
13727
14055
|
|
|
13728
14056
|
function __() {
|
|
@@ -14056,14 +14384,13 @@
|
|
|
14056
14384
|
} instanceof Array && function (d, b) {
|
|
14057
14385
|
d.__proto__ = b;
|
|
14058
14386
|
} || function (d, b) {
|
|
14059
|
-
for (var p in b) if (
|
|
14387
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
14060
14388
|
};
|
|
14061
14389
|
|
|
14062
14390
|
return extendStatics(d, b);
|
|
14063
14391
|
};
|
|
14064
14392
|
|
|
14065
14393
|
return function (d, b) {
|
|
14066
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14067
14394
|
extendStatics(d, b);
|
|
14068
14395
|
|
|
14069
14396
|
function __() {
|
|
@@ -14364,7 +14691,7 @@
|
|
|
14364
14691
|
|
|
14365
14692
|
|
|
14366
14693
|
function toGeometryBuffer(geo) {
|
|
14367
|
-
var buffer =
|
|
14694
|
+
var buffer = mesh.toGeoBuffer(geo.position, geo.index, geo.uv);
|
|
14368
14695
|
return buffer;
|
|
14369
14696
|
}
|
|
14370
14697
|
|
|
@@ -14377,8 +14704,8 @@
|
|
|
14377
14704
|
*/
|
|
14378
14705
|
|
|
14379
14706
|
function extrudeToGeometryBuffer(shape, arg_path, options) {
|
|
14380
|
-
var extrudeRes =
|
|
14381
|
-
return
|
|
14707
|
+
var extrudeRes = extrude_1.extrude_obsolete(shape, arg_path, options);
|
|
14708
|
+
return mesh.toGeoBuffer(extrudeRes.vertices, extrudeRes.index, extrudeRes.uvs);
|
|
14382
14709
|
}
|
|
14383
14710
|
|
|
14384
14711
|
exports.extrudeToGeometryBuffer = extrudeToGeometryBuffer;
|
|
@@ -14399,7 +14726,7 @@
|
|
|
14399
14726
|
shapeClose = false;
|
|
14400
14727
|
}
|
|
14401
14728
|
|
|
14402
|
-
var geo =
|
|
14729
|
+
var geo = extrude_1.linkSides({
|
|
14403
14730
|
shapes: [shape, shape1],
|
|
14404
14731
|
shapeClosed: shapeClose,
|
|
14405
14732
|
orgShape: shape,
|
|
@@ -14422,9 +14749,9 @@
|
|
|
14422
14749
|
pathClosed = true;
|
|
14423
14750
|
}
|
|
14424
14751
|
|
|
14425
|
-
var vertices =
|
|
14426
|
-
|
|
14427
|
-
var geo =
|
|
14752
|
+
var vertices = array.flat(shapes);
|
|
14753
|
+
mesh.indexable(vertices);
|
|
14754
|
+
var geo = extrude_1.linkSides({
|
|
14428
14755
|
shapes: shapes,
|
|
14429
14756
|
shapeClosed: pathClosed,
|
|
14430
14757
|
orgShape: shapes[0]
|
|
@@ -14459,29 +14786,23 @@
|
|
|
14459
14786
|
var geometryaid_3 = geometryaid.extrudeToGeometryBuffer;
|
|
14460
14787
|
var geometryaid_4 = geometryaid.toGeometryBuffer;
|
|
14461
14788
|
|
|
14462
|
-
var
|
|
14789
|
+
var dist = createCommonjsModule(function (module, exports) {
|
|
14463
14790
|
|
|
14464
14791
|
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
14465
14792
|
if (k2 === undefined) k2 = k;
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
return m[k];
|
|
14473
|
-
}
|
|
14474
|
-
};
|
|
14475
|
-
}
|
|
14476
|
-
|
|
14477
|
-
Object.defineProperty(o, k2, desc);
|
|
14793
|
+
Object.defineProperty(o, k2, {
|
|
14794
|
+
enumerable: true,
|
|
14795
|
+
get: function () {
|
|
14796
|
+
return m[k];
|
|
14797
|
+
}
|
|
14798
|
+
});
|
|
14478
14799
|
} : function (o, m, k, k2) {
|
|
14479
14800
|
if (k2 === undefined) k2 = k;
|
|
14480
14801
|
o[k2] = m[k];
|
|
14481
14802
|
});
|
|
14482
14803
|
|
|
14483
14804
|
var __exportStar = commonjsGlobal && commonjsGlobal.__exportStar || function (m, exports) {
|
|
14484
|
-
for (var p in m) if (p !== "default" && !
|
|
14805
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
14485
14806
|
};
|
|
14486
14807
|
|
|
14487
14808
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -14504,10 +14825,12 @@
|
|
|
14504
14825
|
|
|
14505
14826
|
__exportStar(_Math, exports);
|
|
14506
14827
|
|
|
14507
|
-
__exportStar(Euler_1, exports);
|
|
14828
|
+
__exportStar(Euler_1, exports);
|
|
14508
14829
|
|
|
14830
|
+
__exportStar(Color_1, exports); //common
|
|
14509
14831
|
|
|
14510
|
-
|
|
14832
|
+
|
|
14833
|
+
__exportStar(vecs_1, exports);
|
|
14511
14834
|
|
|
14512
14835
|
__exportStar(common, exports);
|
|
14513
14836
|
|
|
@@ -14553,6 +14876,8 @@
|
|
|
14553
14876
|
|
|
14554
14877
|
__exportStar(voronoi, exports);
|
|
14555
14878
|
|
|
14879
|
+
__exportStar(eventhandler, exports);
|
|
14880
|
+
|
|
14556
14881
|
__exportStar(geometryaid, exports); //Geometry
|
|
14557
14882
|
|
|
14558
14883
|
|
|
@@ -14563,7 +14888,7 @@
|
|
|
14563
14888
|
__exportStar(mesh, exports);
|
|
14564
14889
|
});
|
|
14565
14890
|
|
|
14566
|
-
var index = unwrapExports(
|
|
14891
|
+
var index = unwrapExports(dist);
|
|
14567
14892
|
|
|
14568
14893
|
return index;
|
|
14569
14894
|
|