@xort/cga 0.0.83 → 0.0.85
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 +871 -1010
- 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 +2 -2
- package/dist/math/Color.js +24 -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 +18 -7
- 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
|
@@ -130,260 +130,16 @@
|
|
|
130
130
|
var array_3 = array.flat;
|
|
131
131
|
var array_4 = array.forall;
|
|
132
132
|
|
|
133
|
-
var eventhandler = createCommonjsModule(function (module, exports) {
|
|
134
|
-
|
|
135
|
-
var __spreadArray = commonjsGlobal && commonjsGlobal.__spreadArray || function (to, from, pack) {
|
|
136
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
137
|
-
if (ar || !(i in from)) {
|
|
138
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
139
|
-
ar[i] = from[i];
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
Object.defineProperty(exports, "__esModule", {
|
|
146
|
-
value: true
|
|
147
|
-
});
|
|
148
|
-
exports.EventHandler = void 0;
|
|
149
|
-
|
|
150
|
-
var EventHandler =
|
|
151
|
-
/** @class */
|
|
152
|
-
function () {
|
|
153
|
-
function EventHandler() {
|
|
154
|
-
this._callbacks = {};
|
|
155
|
-
this._callbackActive = {};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
EventHandler.prototype._addCallback = function (name, callback, scope, once) {
|
|
159
|
-
if (!name || typeof name !== 'string' || !callback) return;
|
|
160
|
-
if (!this._callbacks[name]) this._callbacks[name] = [];
|
|
161
|
-
if (this._callbackActive[name] && this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
162
|
-
|
|
163
|
-
this._callbacks[name].push({
|
|
164
|
-
callback: callback,
|
|
165
|
-
scope: scope || this,
|
|
166
|
-
once: once || false
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* @function
|
|
171
|
-
* @name EventHandler#on
|
|
172
|
-
* @description Attach an event handler to an event.
|
|
173
|
-
* @param {string} name - Name of the event to bind the callback to.
|
|
174
|
-
* @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
|
|
175
|
-
* @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
|
|
176
|
-
* @returns {EventHandler} Self for chaining.
|
|
177
|
-
* @example
|
|
178
|
-
* obj.on('test', function (a, b) {
|
|
179
|
-
* console.log(a + b);
|
|
180
|
-
* });
|
|
181
|
-
* obj.fire('test', 1, 2); // prints 3 to the console
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
EventHandler.prototype.on = function (name, callback, scope) {
|
|
186
|
-
this._addCallback(name, callback, scope, false);
|
|
187
|
-
|
|
188
|
-
return this;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* @function
|
|
192
|
-
* @name EventHandler#off
|
|
193
|
-
* @description Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event,
|
|
194
|
-
* if scope is not provided then all events with the callback will be unbound.
|
|
195
|
-
* @param {string} [name] - Name of the event to unbind.
|
|
196
|
-
* @param {callbacks.HandleEvent} [callback] - Function to be unbound.
|
|
197
|
-
* @param {object} [scope] - Scope that was used as the this when the event is fired.
|
|
198
|
-
* @returns {EventHandler} Self for chaining.
|
|
199
|
-
* @example
|
|
200
|
-
* var handler = function () {
|
|
201
|
-
* };
|
|
202
|
-
* obj.on('test', handler);
|
|
203
|
-
*
|
|
204
|
-
* obj.off(); // Removes all events
|
|
205
|
-
* obj.off('test'); // Removes all events called 'test'
|
|
206
|
-
* obj.off('test', handler); // Removes all handler functions, called 'test'
|
|
207
|
-
* obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this
|
|
208
|
-
*/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
EventHandler.prototype.off = function (name, callback, scope) {
|
|
212
|
-
if (name) {
|
|
213
|
-
if (this._callbackActive[name] && this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
214
|
-
} else {
|
|
215
|
-
for (var key in this._callbackActive) {
|
|
216
|
-
if (!this._callbacks[key]) continue;
|
|
217
|
-
if (this._callbacks[key] !== this._callbackActive[key]) continue;
|
|
218
|
-
this._callbackActive[key] = this._callbackActive[key].slice();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (!name) {
|
|
223
|
-
this._callbacks = {};
|
|
224
|
-
} else if (!callback) {
|
|
225
|
-
if (this._callbacks[name]) this._callbacks[name] = [];
|
|
226
|
-
} else {
|
|
227
|
-
var events = this._callbacks[name];
|
|
228
|
-
if (!events) return this;
|
|
229
|
-
var count = events.length;
|
|
230
|
-
|
|
231
|
-
for (var i = 0; i < count; i++) {
|
|
232
|
-
if (events[i].callback !== callback) continue;
|
|
233
|
-
if (scope && events[i].scope !== scope) continue;
|
|
234
|
-
events[i--] = events[--count];
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
events.length = count;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return this;
|
|
241
|
-
}; // ESLint rule disabled here as documenting arg1, arg2...argN as [...] rest
|
|
242
|
-
// arguments is preferable to documenting each one individually.
|
|
243
|
-
|
|
244
|
-
/* eslint-disable valid-jsdoc */
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* @function
|
|
248
|
-
* @name EventHandler#fire
|
|
249
|
-
* @description Fire an event, all additional arguments are passed on to the event listener.
|
|
250
|
-
* @param {object} name - Name of event to fire.
|
|
251
|
-
* @param {*} [args] - arguments that is passed to the event handler.
|
|
252
|
-
* obj.fire('test', 'This is the message');
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
/* eslint-enable valid-jsdoc */
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
EventHandler.prototype.fire = function (name) {
|
|
259
|
-
var _a;
|
|
260
|
-
|
|
261
|
-
var args = [];
|
|
262
|
-
|
|
263
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
264
|
-
args[_i - 1] = arguments[_i];
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (!name || !this._callbacks[name]) return this;
|
|
268
|
-
var callbacks;
|
|
269
|
-
|
|
270
|
-
if (!this._callbackActive[name]) {
|
|
271
|
-
this._callbackActive[name] = this._callbacks[name];
|
|
272
|
-
} else {
|
|
273
|
-
if (this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
274
|
-
callbacks = this._callbacks[name].slice();
|
|
275
|
-
} // TODO: What does callbacks do here?
|
|
276
|
-
// In particular this condition check looks wrong: (i < (callbacks || this._callbackActive[name]).length)
|
|
277
|
-
// Because callbacks is not an integer
|
|
278
|
-
// eslint-disable-next-line no-unmodified-loop-condition
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
for (var i = 0; (callbacks || this._callbackActive[name]) && i < (callbacks || this._callbackActive[name]).length; i++) {
|
|
282
|
-
var evt = (callbacks || this._callbackActive[name])[i];
|
|
283
|
-
|
|
284
|
-
(_a = evt.callback).call.apply(_a, __spreadArray([evt.scope], args, false));
|
|
285
|
-
|
|
286
|
-
if (evt.once) {
|
|
287
|
-
var ind = this._callbacks[name].indexOf(evt);
|
|
288
|
-
|
|
289
|
-
if (ind !== -1) {
|
|
290
|
-
if (this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
291
|
-
|
|
292
|
-
this._callbacks[name].splice(ind, 1);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (!callbacks) this._callbackActive[name] = null;
|
|
298
|
-
return this;
|
|
299
|
-
};
|
|
300
|
-
/**
|
|
301
|
-
* @function
|
|
302
|
-
* @name EventHandler#once
|
|
303
|
-
* @description Attach an event handler to an event. This handler will be removed after being fired once.
|
|
304
|
-
* @param {string} name - Name of the event to bind the callback to.
|
|
305
|
-
* @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
|
|
306
|
-
* @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
|
|
307
|
-
* @returns {EventHandler} Self for chaining.
|
|
308
|
-
* @example
|
|
309
|
-
* obj.once('test', function (a, b) {
|
|
310
|
-
* console.log(a + b);
|
|
311
|
-
* });
|
|
312
|
-
* obj.fire('test', 1, 2); // prints 3 to the console
|
|
313
|
-
* obj.fire('test', 1, 2); // not going to get handled
|
|
314
|
-
*/
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
EventHandler.prototype.once = function (name, callback, scope) {
|
|
318
|
-
this._addCallback(name, callback, scope, true);
|
|
319
|
-
|
|
320
|
-
return this;
|
|
321
|
-
};
|
|
322
|
-
/**
|
|
323
|
-
* @function
|
|
324
|
-
* @name EventHandler#hasEvent
|
|
325
|
-
* @description Test if there are any handlers bound to an event name.
|
|
326
|
-
* @param {string} name - The name of the event to test.
|
|
327
|
-
* @returns {boolean} True if the object has handlers bound to the specified event name.
|
|
328
|
-
* @example
|
|
329
|
-
* obj.on('test', function () { }); // bind an event to 'test'
|
|
330
|
-
* obj.hasEvent('test'); // returns true
|
|
331
|
-
* obj.hasEvent('hello'); // returns false
|
|
332
|
-
*/
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
EventHandler.prototype.hasEvent = function (name) {
|
|
336
|
-
return this._callbacks[name] && this._callbacks[name].length !== 0 || false;
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
return EventHandler;
|
|
340
|
-
}();
|
|
341
|
-
|
|
342
|
-
exports.EventHandler = EventHandler;
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
unwrapExports(eventhandler);
|
|
346
|
-
var eventhandler_1 = eventhandler.EventHandler;
|
|
347
|
-
|
|
348
133
|
var Vec2_1 = createCommonjsModule(function (module, exports) {
|
|
349
134
|
|
|
350
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
351
|
-
var extendStatics = function (d, b) {
|
|
352
|
-
extendStatics = Object.setPrototypeOf || {
|
|
353
|
-
__proto__: []
|
|
354
|
-
} instanceof Array && function (d, b) {
|
|
355
|
-
d.__proto__ = b;
|
|
356
|
-
} || function (d, b) {
|
|
357
|
-
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
return extendStatics(d, b);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
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
|
-
extendStatics(d, b);
|
|
366
|
-
|
|
367
|
-
function __() {
|
|
368
|
-
this.constructor = d;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
372
|
-
};
|
|
373
|
-
}();
|
|
374
|
-
|
|
375
135
|
Object.defineProperty(exports, "__esModule", {
|
|
376
136
|
value: true
|
|
377
137
|
});
|
|
378
138
|
exports.v2 = exports.Vec2 = void 0;
|
|
379
139
|
|
|
380
|
-
|
|
381
|
-
|
|
382
140
|
var Vec2 =
|
|
383
141
|
/** @class */
|
|
384
|
-
function (
|
|
385
|
-
__extends(Vec2, _super);
|
|
386
|
-
|
|
142
|
+
function () {
|
|
387
143
|
function Vec2(_x, _y) {
|
|
388
144
|
if (_x === void 0) {
|
|
389
145
|
_x = 0;
|
|
@@ -393,12 +149,9 @@
|
|
|
393
149
|
_y = 0;
|
|
394
150
|
}
|
|
395
151
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
_this._y = _y;
|
|
400
|
-
_this.isVec2 = true;
|
|
401
|
-
return _this;
|
|
152
|
+
this._x = _x;
|
|
153
|
+
this._y = _y;
|
|
154
|
+
this.isVec2 = true;
|
|
402
155
|
}
|
|
403
156
|
|
|
404
157
|
Object.defineProperty(Vec2.prototype, "x", {
|
|
@@ -407,8 +160,7 @@
|
|
|
407
160
|
},
|
|
408
161
|
set: function (value) {
|
|
409
162
|
if (this._x !== value) {
|
|
410
|
-
this._x = value;
|
|
411
|
-
this.fire('change', 'x', this._x, value);
|
|
163
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
412
164
|
}
|
|
413
165
|
},
|
|
414
166
|
enumerable: false,
|
|
@@ -420,8 +172,7 @@
|
|
|
420
172
|
},
|
|
421
173
|
set: function (value) {
|
|
422
174
|
if (this._y !== value) {
|
|
423
|
-
this._y = value;
|
|
424
|
-
this.fire('change', 'y', this._y, value);
|
|
175
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
425
176
|
}
|
|
426
177
|
},
|
|
427
178
|
enumerable: false,
|
|
@@ -780,7 +531,7 @@
|
|
|
780
531
|
};
|
|
781
532
|
|
|
782
533
|
return Vec2;
|
|
783
|
-
}(
|
|
534
|
+
}();
|
|
784
535
|
|
|
785
536
|
exports.Vec2 = Vec2;
|
|
786
537
|
|
|
@@ -1070,31 +821,6 @@
|
|
|
1070
821
|
|
|
1071
822
|
var Quat_1 = createCommonjsModule(function (module, exports) {
|
|
1072
823
|
|
|
1073
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
1074
|
-
var extendStatics = function (d, b) {
|
|
1075
|
-
extendStatics = Object.setPrototypeOf || {
|
|
1076
|
-
__proto__: []
|
|
1077
|
-
} instanceof Array && function (d, b) {
|
|
1078
|
-
d.__proto__ = b;
|
|
1079
|
-
} || function (d, b) {
|
|
1080
|
-
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
return extendStatics(d, b);
|
|
1084
|
-
};
|
|
1085
|
-
|
|
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
|
-
extendStatics(d, b);
|
|
1089
|
-
|
|
1090
|
-
function __() {
|
|
1091
|
-
this.constructor = d;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1095
|
-
};
|
|
1096
|
-
}();
|
|
1097
|
-
|
|
1098
824
|
Object.defineProperty(exports, "__esModule", {
|
|
1099
825
|
value: true
|
|
1100
826
|
});
|
|
@@ -1102,13 +828,9 @@
|
|
|
1102
828
|
|
|
1103
829
|
|
|
1104
830
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
831
|
var Quat =
|
|
1108
832
|
/** @class */
|
|
1109
|
-
function (
|
|
1110
|
-
__extends(Quat, _super);
|
|
1111
|
-
|
|
833
|
+
function () {
|
|
1112
834
|
function Quat(_x, _y, _z, _w) {
|
|
1113
835
|
if (_x === void 0) {
|
|
1114
836
|
_x = 0;
|
|
@@ -1126,14 +848,11 @@
|
|
|
1126
848
|
_w = 1;
|
|
1127
849
|
}
|
|
1128
850
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
_this._w = _w;
|
|
1135
|
-
_this.isQuat = true;
|
|
1136
|
-
return _this;
|
|
851
|
+
this._x = _x;
|
|
852
|
+
this._y = _y;
|
|
853
|
+
this._z = _z;
|
|
854
|
+
this._w = _w;
|
|
855
|
+
this.isQuat = true;
|
|
1137
856
|
}
|
|
1138
857
|
|
|
1139
858
|
Object.defineProperty(Quat.prototype, "x", {
|
|
@@ -1142,8 +861,7 @@
|
|
|
1142
861
|
},
|
|
1143
862
|
set: function (value) {
|
|
1144
863
|
if (this._x !== value) {
|
|
1145
|
-
this._x = value;
|
|
1146
|
-
this.fire('change', 'x', this._x, value);
|
|
864
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
1147
865
|
}
|
|
1148
866
|
},
|
|
1149
867
|
enumerable: false,
|
|
@@ -1155,8 +873,7 @@
|
|
|
1155
873
|
},
|
|
1156
874
|
set: function (value) {
|
|
1157
875
|
if (this._y !== value) {
|
|
1158
|
-
this._y = value;
|
|
1159
|
-
this.fire('change', 'y', this._y, value);
|
|
876
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
1160
877
|
}
|
|
1161
878
|
},
|
|
1162
879
|
enumerable: false,
|
|
@@ -1168,8 +885,7 @@
|
|
|
1168
885
|
},
|
|
1169
886
|
set: function (value) {
|
|
1170
887
|
if (this._z !== value) {
|
|
1171
|
-
this._z = value;
|
|
1172
|
-
this.fire('change', 'z', this._z, value);
|
|
888
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
1173
889
|
}
|
|
1174
890
|
},
|
|
1175
891
|
enumerable: false,
|
|
@@ -1181,8 +897,7 @@
|
|
|
1181
897
|
},
|
|
1182
898
|
set: function (value) {
|
|
1183
899
|
if (this._w !== value) {
|
|
1184
|
-
this._w = value;
|
|
1185
|
-
this.fire('change', 'w', this._w, value);
|
|
900
|
+
this._w = value; // this.fire('change', 'w', this._w, value)
|
|
1186
901
|
}
|
|
1187
902
|
},
|
|
1188
903
|
enumerable: false,
|
|
@@ -1258,8 +973,8 @@
|
|
|
1258
973
|
this._x = x;
|
|
1259
974
|
this._y = y;
|
|
1260
975
|
this._z = z;
|
|
1261
|
-
this._w = w;
|
|
1262
|
-
|
|
976
|
+
this._w = w; // this.fire("change", this);
|
|
977
|
+
|
|
1263
978
|
return this;
|
|
1264
979
|
};
|
|
1265
980
|
|
|
@@ -1271,16 +986,12 @@
|
|
|
1271
986
|
this._x = quat.x;
|
|
1272
987
|
this._y = quat.y;
|
|
1273
988
|
this._z = quat.z;
|
|
1274
|
-
this._w = quat.w;
|
|
1275
|
-
|
|
989
|
+
this._w = quat.w; // this.fire("change", this);
|
|
990
|
+
|
|
1276
991
|
return this;
|
|
1277
992
|
};
|
|
1278
993
|
|
|
1279
994
|
Quat.prototype.setFromEuler = function (euler, update) {
|
|
1280
|
-
if (!(euler && euler.isEuler)) {
|
|
1281
|
-
throw new Error("Quat: .setFromEuler() now expects an Euler rotation rather than a Vec3 and order.");
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
995
|
var x = euler._x,
|
|
1285
996
|
y = euler._y,
|
|
1286
997
|
z = euler._z,
|
|
@@ -1327,9 +1038,10 @@
|
|
|
1327
1038
|
this._y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
1328
1039
|
this._z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
1329
1040
|
this._w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
1330
|
-
}
|
|
1041
|
+
} // if (update !== false)
|
|
1042
|
+
// this.fire("change", this);
|
|
1043
|
+
|
|
1331
1044
|
|
|
1332
|
-
if (update !== false) this.fire("change", this);
|
|
1333
1045
|
return this;
|
|
1334
1046
|
};
|
|
1335
1047
|
|
|
@@ -1341,8 +1053,8 @@
|
|
|
1341
1053
|
this._x = axis.x * s;
|
|
1342
1054
|
this._y = axis.y * s;
|
|
1343
1055
|
this._z = axis.z * s;
|
|
1344
|
-
this._w = Math.cos(halfAngle);
|
|
1345
|
-
|
|
1056
|
+
this._w = Math.cos(halfAngle); // this.fire("change", this);
|
|
1057
|
+
|
|
1346
1058
|
return this;
|
|
1347
1059
|
};
|
|
1348
1060
|
|
|
@@ -1386,9 +1098,9 @@
|
|
|
1386
1098
|
this._x = (m13 + m31) / s;
|
|
1387
1099
|
this._y = (m23 + m32) / s;
|
|
1388
1100
|
this._z = 0.25 * s;
|
|
1389
|
-
}
|
|
1101
|
+
} // this.fire("change", this);
|
|
1102
|
+
|
|
1390
1103
|
|
|
1391
|
-
this.fire("change", this);
|
|
1392
1104
|
return this;
|
|
1393
1105
|
};
|
|
1394
1106
|
|
|
@@ -1423,7 +1135,7 @@
|
|
|
1423
1135
|
};
|
|
1424
1136
|
|
|
1425
1137
|
Quat.prototype.angleTo = function (q) {
|
|
1426
|
-
return 2 * Math.acos(Math.abs(
|
|
1138
|
+
return 2 * Math.acos(Math.abs(_Math.clamp(this.dot(q), -1, 1)));
|
|
1427
1139
|
};
|
|
1428
1140
|
|
|
1429
1141
|
Quat.prototype.rotateTowards = function (q, step) {
|
|
@@ -1447,8 +1159,8 @@
|
|
|
1447
1159
|
Quat.prototype.conjugate = function () {
|
|
1448
1160
|
this._x *= -1;
|
|
1449
1161
|
this._y *= -1;
|
|
1450
|
-
this._z *= -1;
|
|
1451
|
-
|
|
1162
|
+
this._z *= -1; // this.fire("change", this);
|
|
1163
|
+
|
|
1452
1164
|
return this;
|
|
1453
1165
|
};
|
|
1454
1166
|
|
|
@@ -1478,9 +1190,9 @@
|
|
|
1478
1190
|
this._y = this._y * l;
|
|
1479
1191
|
this._z = this._z * l;
|
|
1480
1192
|
this._w = this._w * l;
|
|
1481
|
-
}
|
|
1193
|
+
} // this.fire("change", this);
|
|
1194
|
+
|
|
1482
1195
|
|
|
1483
|
-
this.fire("change", this);
|
|
1484
1196
|
return this;
|
|
1485
1197
|
};
|
|
1486
1198
|
|
|
@@ -1509,8 +1221,8 @@
|
|
|
1509
1221
|
this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
|
|
1510
1222
|
this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
|
|
1511
1223
|
this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
|
|
1512
|
-
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
|
|
1513
|
-
|
|
1224
|
+
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; // this.fire("change", this);
|
|
1225
|
+
|
|
1514
1226
|
return this;
|
|
1515
1227
|
};
|
|
1516
1228
|
|
|
@@ -1550,8 +1262,8 @@
|
|
|
1550
1262
|
this._x = s * x + t * this._x;
|
|
1551
1263
|
this._y = s * y + t * this._y;
|
|
1552
1264
|
this._z = s * z + t * this._z;
|
|
1553
|
-
this.normalize();
|
|
1554
|
-
|
|
1265
|
+
this.normalize(); // this.fire("change", this);
|
|
1266
|
+
|
|
1555
1267
|
return this;
|
|
1556
1268
|
}
|
|
1557
1269
|
|
|
@@ -1562,8 +1274,8 @@
|
|
|
1562
1274
|
this._w = w * ratioA + this._w * ratioB;
|
|
1563
1275
|
this._x = x * ratioA + this._x * ratioB;
|
|
1564
1276
|
this._y = y * ratioA + this._y * ratioB;
|
|
1565
|
-
this._z = z * ratioA + this._z * ratioB;
|
|
1566
|
-
|
|
1277
|
+
this._z = z * ratioA + this._z * ratioB; // this.fire("change", this);
|
|
1278
|
+
|
|
1567
1279
|
return this;
|
|
1568
1280
|
};
|
|
1569
1281
|
|
|
@@ -1579,8 +1291,8 @@
|
|
|
1579
1291
|
this._x = array[offset];
|
|
1580
1292
|
this._y = array[offset + 1];
|
|
1581
1293
|
this._z = array[offset + 2];
|
|
1582
|
-
this._w = array[offset + 3];
|
|
1583
|
-
|
|
1294
|
+
this._w = array[offset + 3]; // this.fire("change", this);
|
|
1295
|
+
|
|
1584
1296
|
return this;
|
|
1585
1297
|
};
|
|
1586
1298
|
|
|
@@ -1601,7 +1313,7 @@
|
|
|
1601
1313
|
};
|
|
1602
1314
|
|
|
1603
1315
|
return Quat;
|
|
1604
|
-
}(
|
|
1316
|
+
}();
|
|
1605
1317
|
|
|
1606
1318
|
exports.Quat = Quat;
|
|
1607
1319
|
|
|
@@ -1625,14 +1337,13 @@
|
|
|
1625
1337
|
} instanceof Array && function (d, b) {
|
|
1626
1338
|
d.__proto__ = b;
|
|
1627
1339
|
} || function (d, b) {
|
|
1628
|
-
for (var p in b) if (
|
|
1340
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1629
1341
|
};
|
|
1630
1342
|
|
|
1631
1343
|
return extendStatics(d, b);
|
|
1632
1344
|
};
|
|
1633
1345
|
|
|
1634
1346
|
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
1347
|
extendStatics(d, b);
|
|
1637
1348
|
|
|
1638
1349
|
function __() {
|
|
@@ -1663,24 +1374,24 @@
|
|
|
1663
1374
|
|
|
1664
1375
|
function Segment(_p0, _p1) {
|
|
1665
1376
|
if (_p0 === void 0) {
|
|
1666
|
-
_p0 =
|
|
1377
|
+
_p0 = Vec3_1.v3();
|
|
1667
1378
|
}
|
|
1668
1379
|
|
|
1669
1380
|
if (_p1 === void 0) {
|
|
1670
|
-
_p1 =
|
|
1381
|
+
_p1 = Vec3_1.v3();
|
|
1671
1382
|
}
|
|
1672
1383
|
|
|
1673
1384
|
var _this = _super.call(this) || this;
|
|
1674
1385
|
|
|
1675
1386
|
Object.setPrototypeOf(_this, Segment.prototype);
|
|
1676
1387
|
|
|
1677
|
-
_this.push(
|
|
1388
|
+
_this.push(Vec3_1.v3().copy(_p0), Vec3_1.v3().copy(_p1));
|
|
1678
1389
|
|
|
1679
|
-
_this.center =
|
|
1680
|
-
_this.extentDirection =
|
|
1390
|
+
_this.center = Vec3_1.v3().addVecs(_p0, _p1).multiplyScalar(0.5);
|
|
1391
|
+
_this.extentDirection = Vec3_1.v3().subVecs(_p1, _p0);
|
|
1681
1392
|
_this.extentSqr = _this.extentDirection.lengthSq();
|
|
1682
1393
|
_this.extent = Math.sqrt(_this.extentSqr);
|
|
1683
|
-
_this.direction =
|
|
1394
|
+
_this.direction = Vec3_1.v3().copy(_this.extentDirection).normalize();
|
|
1684
1395
|
return _this;
|
|
1685
1396
|
}
|
|
1686
1397
|
|
|
@@ -1995,31 +1706,6 @@
|
|
|
1995
1706
|
|
|
1996
1707
|
var Vec3_1 = createCommonjsModule(function (module, exports) {
|
|
1997
1708
|
|
|
1998
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
1999
|
-
var extendStatics = function (d, b) {
|
|
2000
|
-
extendStatics = Object.setPrototypeOf || {
|
|
2001
|
-
__proto__: []
|
|
2002
|
-
} instanceof Array && function (d, b) {
|
|
2003
|
-
d.__proto__ = b;
|
|
2004
|
-
} || function (d, b) {
|
|
2005
|
-
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
return extendStatics(d, b);
|
|
2009
|
-
};
|
|
2010
|
-
|
|
2011
|
-
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
|
-
extendStatics(d, b);
|
|
2014
|
-
|
|
2015
|
-
function __() {
|
|
2016
|
-
this.constructor = d;
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2020
|
-
};
|
|
2021
|
-
}();
|
|
2022
|
-
|
|
2023
1709
|
Object.defineProperty(exports, "__esModule", {
|
|
2024
1710
|
value: true
|
|
2025
1711
|
});
|
|
@@ -2031,13 +1717,9 @@
|
|
|
2031
1717
|
|
|
2032
1718
|
|
|
2033
1719
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
1720
|
var Vec3 =
|
|
2037
1721
|
/** @class */
|
|
2038
|
-
function (
|
|
2039
|
-
__extends(Vec3, _super);
|
|
2040
|
-
|
|
1722
|
+
function () {
|
|
2041
1723
|
function Vec3(_x, _y, _z) {
|
|
2042
1724
|
if (_x === void 0) {
|
|
2043
1725
|
_x = 0;
|
|
@@ -2051,12 +1733,9 @@
|
|
|
2051
1733
|
_z = 0;
|
|
2052
1734
|
}
|
|
2053
1735
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
_this._y = _y;
|
|
2058
|
-
_this._z = _z;
|
|
2059
|
-
return _this;
|
|
1736
|
+
this._x = _x;
|
|
1737
|
+
this._y = _y;
|
|
1738
|
+
this._z = _z;
|
|
2060
1739
|
}
|
|
2061
1740
|
|
|
2062
1741
|
Object.defineProperty(Vec3.prototype, "x", {
|
|
@@ -2065,8 +1744,7 @@
|
|
|
2065
1744
|
},
|
|
2066
1745
|
set: function (value) {
|
|
2067
1746
|
if (this._x !== value) {
|
|
2068
|
-
this._x = value;
|
|
2069
|
-
this.fire('change', 'x', this._x, value);
|
|
1747
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
2070
1748
|
}
|
|
2071
1749
|
},
|
|
2072
1750
|
enumerable: false,
|
|
@@ -2078,8 +1756,7 @@
|
|
|
2078
1756
|
},
|
|
2079
1757
|
set: function (value) {
|
|
2080
1758
|
if (this._y !== value) {
|
|
2081
|
-
this._y = value;
|
|
2082
|
-
this.fire('change', 'y', this._y, value);
|
|
1759
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
2083
1760
|
}
|
|
2084
1761
|
},
|
|
2085
1762
|
enumerable: false,
|
|
@@ -2091,8 +1768,7 @@
|
|
|
2091
1768
|
},
|
|
2092
1769
|
set: function (value) {
|
|
2093
1770
|
if (this._z !== value) {
|
|
2094
|
-
this._z = value;
|
|
2095
|
-
this.fire('change', 'z', this._z, value);
|
|
1771
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
2096
1772
|
}
|
|
2097
1773
|
},
|
|
2098
1774
|
enumerable: false,
|
|
@@ -2149,16 +1825,16 @@
|
|
|
2149
1825
|
Vec3.prototype.set = function (x, y, z) {
|
|
2150
1826
|
this._x = x;
|
|
2151
1827
|
this._y = y;
|
|
2152
|
-
this._z = z;
|
|
2153
|
-
|
|
1828
|
+
this._z = z; //// this.fire('change');
|
|
1829
|
+
|
|
2154
1830
|
return this;
|
|
2155
1831
|
};
|
|
2156
1832
|
|
|
2157
1833
|
Vec3.prototype.setScalar = function (scalar) {
|
|
2158
1834
|
this._x = scalar;
|
|
2159
1835
|
this._y = scalar;
|
|
2160
|
-
this._z = scalar;
|
|
2161
|
-
|
|
1836
|
+
this._z = scalar; // this.fire('change');
|
|
1837
|
+
|
|
2162
1838
|
return this;
|
|
2163
1839
|
};
|
|
2164
1840
|
|
|
@@ -2206,8 +1882,8 @@
|
|
|
2206
1882
|
Vec3.prototype.copy = function (v) {
|
|
2207
1883
|
this._x = v.x;
|
|
2208
1884
|
this._y = v.y;
|
|
2209
|
-
this._z = v.z;
|
|
2210
|
-
|
|
1885
|
+
this._z = v.z; // this.fire('change');
|
|
1886
|
+
|
|
2211
1887
|
return this;
|
|
2212
1888
|
};
|
|
2213
1889
|
|
|
@@ -2219,32 +1895,32 @@
|
|
|
2219
1895
|
|
|
2220
1896
|
this._x += v.x;
|
|
2221
1897
|
this._y += v.y;
|
|
2222
|
-
this._z += v.z;
|
|
2223
|
-
|
|
1898
|
+
this._z += v.z; // this.fire('change');
|
|
1899
|
+
|
|
2224
1900
|
return this;
|
|
2225
1901
|
};
|
|
2226
1902
|
|
|
2227
1903
|
Vec3.prototype.addScalar = function (s) {
|
|
2228
1904
|
this._x += s;
|
|
2229
1905
|
this._y += s;
|
|
2230
|
-
this._z += s;
|
|
2231
|
-
|
|
1906
|
+
this._z += s; // this.fire('change');
|
|
1907
|
+
|
|
2232
1908
|
return this;
|
|
2233
1909
|
};
|
|
2234
1910
|
|
|
2235
1911
|
Vec3.prototype.addVecs = function (a, b) {
|
|
2236
1912
|
this._x = a.x + b.x;
|
|
2237
1913
|
this._y = a.y + b.y;
|
|
2238
|
-
this._z = a.z + b.z;
|
|
2239
|
-
|
|
1914
|
+
this._z = a.z + b.z; // this.fire('change');
|
|
1915
|
+
|
|
2240
1916
|
return this;
|
|
2241
1917
|
};
|
|
2242
1918
|
|
|
2243
1919
|
Vec3.prototype.addScaledVec = function (v, s) {
|
|
2244
1920
|
this._x += v.x * s;
|
|
2245
1921
|
this._y += v.y * s;
|
|
2246
|
-
this._z += v.z * s;
|
|
2247
|
-
|
|
1922
|
+
this._z += v.z * s; // this.fire('change');
|
|
1923
|
+
|
|
2248
1924
|
return this;
|
|
2249
1925
|
};
|
|
2250
1926
|
|
|
@@ -2256,24 +1932,24 @@
|
|
|
2256
1932
|
|
|
2257
1933
|
this._x -= v.x;
|
|
2258
1934
|
this._y -= v.y;
|
|
2259
|
-
this._z -= v.z;
|
|
2260
|
-
|
|
1935
|
+
this._z -= v.z; // this.fire('change');
|
|
1936
|
+
|
|
2261
1937
|
return this;
|
|
2262
1938
|
};
|
|
2263
1939
|
|
|
2264
1940
|
Vec3.prototype.subScalar = function (s) {
|
|
2265
1941
|
this._x -= s;
|
|
2266
1942
|
this._y -= s;
|
|
2267
|
-
this._z -= s;
|
|
2268
|
-
|
|
1943
|
+
this._z -= s; // this.fire('change');
|
|
1944
|
+
|
|
2269
1945
|
return this;
|
|
2270
1946
|
};
|
|
2271
1947
|
|
|
2272
1948
|
Vec3.prototype.subVecs = function (a, b) {
|
|
2273
1949
|
this._x = a.x - b.x;
|
|
2274
1950
|
this._y = a.y - b.y;
|
|
2275
|
-
this._z = a.z - b.z;
|
|
2276
|
-
|
|
1951
|
+
this._z = a.z - b.z; // this.fire('change');
|
|
1952
|
+
|
|
2277
1953
|
return this;
|
|
2278
1954
|
};
|
|
2279
1955
|
|
|
@@ -2284,24 +1960,24 @@
|
|
|
2284
1960
|
|
|
2285
1961
|
this._x *= v.x;
|
|
2286
1962
|
this._y *= v.y;
|
|
2287
|
-
this._z *= v.z;
|
|
2288
|
-
|
|
1963
|
+
this._z *= v.z; // this.fire('change');
|
|
1964
|
+
|
|
2289
1965
|
return this;
|
|
2290
1966
|
};
|
|
2291
1967
|
|
|
2292
1968
|
Vec3.prototype.multiplyScalar = function (scalar) {
|
|
2293
1969
|
this._x *= scalar;
|
|
2294
1970
|
this._y *= scalar;
|
|
2295
|
-
this._z *= scalar;
|
|
2296
|
-
|
|
1971
|
+
this._z *= scalar; // this.fire('change');
|
|
1972
|
+
|
|
2297
1973
|
return this;
|
|
2298
1974
|
};
|
|
2299
1975
|
|
|
2300
1976
|
Vec3.prototype.multiplyVecs = function (a, b) {
|
|
2301
1977
|
this._x = a.x * b.x;
|
|
2302
1978
|
this._y = a.y * b.y;
|
|
2303
|
-
this._z = a.z * b.z;
|
|
2304
|
-
|
|
1979
|
+
this._z = a.z * b.z; // this.fire('change');
|
|
1980
|
+
|
|
2305
1981
|
return this;
|
|
2306
1982
|
};
|
|
2307
1983
|
|
|
@@ -2328,8 +2004,8 @@
|
|
|
2328
2004
|
var e = m.elements;
|
|
2329
2005
|
this._x = e[0] * x + e[3] * y + e[6] * z;
|
|
2330
2006
|
this._y = e[1] * x + e[4] * y + e[7] * z;
|
|
2331
|
-
this._z = e[2] * x + e[5] * y + e[8] * z;
|
|
2332
|
-
|
|
2007
|
+
this._z = e[2] * x + e[5] * y + e[8] * z; // this.fire('change');
|
|
2008
|
+
|
|
2333
2009
|
return this;
|
|
2334
2010
|
};
|
|
2335
2011
|
|
|
@@ -2341,8 +2017,8 @@
|
|
|
2341
2017
|
var w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
|
|
2342
2018
|
this._x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
|
|
2343
2019
|
this._y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
|
|
2344
|
-
this._z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
|
|
2345
|
-
|
|
2020
|
+
this._z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w; // this.fire('change');
|
|
2021
|
+
|
|
2346
2022
|
return this;
|
|
2347
2023
|
};
|
|
2348
2024
|
|
|
@@ -2362,8 +2038,8 @@
|
|
|
2362
2038
|
|
|
2363
2039
|
this._x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
|
2364
2040
|
this._y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
2365
|
-
this._z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
2366
|
-
|
|
2041
|
+
this._z = iz * qw + iw * -qz + ix * -qy - iy * -qx; // this.fire('change');
|
|
2042
|
+
|
|
2367
2043
|
return this;
|
|
2368
2044
|
};
|
|
2369
2045
|
|
|
@@ -2384,16 +2060,16 @@
|
|
|
2384
2060
|
var e = m.elements;
|
|
2385
2061
|
this._x = e[0] * x + e[4] * y + e[8] * z;
|
|
2386
2062
|
this._y = e[1] * x + e[5] * y + e[9] * z;
|
|
2387
|
-
this._z = e[2] * x + e[6] * y + e[10] * z;
|
|
2388
|
-
|
|
2063
|
+
this._z = e[2] * x + e[6] * y + e[10] * z; // this.fire('change');
|
|
2064
|
+
|
|
2389
2065
|
return this.normalize();
|
|
2390
2066
|
};
|
|
2391
2067
|
|
|
2392
2068
|
Vec3.prototype.divide = function (v) {
|
|
2393
2069
|
this._x /= v.x;
|
|
2394
2070
|
this._y /= v.y;
|
|
2395
|
-
this._z /= v.z;
|
|
2396
|
-
|
|
2071
|
+
this._z /= v.z; // this.fire('change');
|
|
2072
|
+
|
|
2397
2073
|
return this;
|
|
2398
2074
|
};
|
|
2399
2075
|
|
|
@@ -2404,16 +2080,16 @@
|
|
|
2404
2080
|
Vec3.prototype.min = function (v) {
|
|
2405
2081
|
this._x = Math.min(this._x, v.x);
|
|
2406
2082
|
this._y = Math.min(this._y, v.y);
|
|
2407
|
-
this._z = Math.min(this._z, v.z);
|
|
2408
|
-
|
|
2083
|
+
this._z = Math.min(this._z, v.z); // this.fire('change');
|
|
2084
|
+
|
|
2409
2085
|
return this;
|
|
2410
2086
|
};
|
|
2411
2087
|
|
|
2412
2088
|
Vec3.prototype.max = function (v) {
|
|
2413
2089
|
this._x = Math.max(this._x, v.x);
|
|
2414
2090
|
this._y = Math.max(this._y, v.y);
|
|
2415
|
-
this._z = Math.max(this._z, v.z);
|
|
2416
|
-
|
|
2091
|
+
this._z = Math.max(this._z, v.z); // this.fire('change');
|
|
2092
|
+
|
|
2417
2093
|
return this;
|
|
2418
2094
|
};
|
|
2419
2095
|
|
|
@@ -2421,16 +2097,16 @@
|
|
|
2421
2097
|
// assumes min < max, componentwise
|
|
2422
2098
|
this._x = Math.max(min.x, Math.min(max.x, this._x));
|
|
2423
2099
|
this._y = Math.max(min.y, Math.min(max.y, this._y));
|
|
2424
|
-
this._z = Math.max(min.z, Math.min(max.z, this._z));
|
|
2425
|
-
|
|
2100
|
+
this._z = Math.max(min.z, Math.min(max.z, this._z)); // this.fire('change');
|
|
2101
|
+
|
|
2426
2102
|
return this;
|
|
2427
2103
|
};
|
|
2428
2104
|
|
|
2429
2105
|
Vec3.prototype.clampScalar = function (minVal, maxVal) {
|
|
2430
2106
|
this._x = Math.max(minVal, Math.min(maxVal, this._x));
|
|
2431
2107
|
this._y = Math.max(minVal, Math.min(maxVal, this._y));
|
|
2432
|
-
this._z = Math.max(minVal, Math.min(maxVal, this._z));
|
|
2433
|
-
|
|
2108
|
+
this._z = Math.max(minVal, Math.min(maxVal, this._z)); // this.fire('change');
|
|
2109
|
+
|
|
2434
2110
|
return this;
|
|
2435
2111
|
};
|
|
2436
2112
|
|
|
@@ -2442,40 +2118,40 @@
|
|
|
2442
2118
|
Vec3.prototype.floor = function () {
|
|
2443
2119
|
this._x = Math.floor(this._x);
|
|
2444
2120
|
this._y = Math.floor(this._y);
|
|
2445
|
-
this._z = Math.floor(this._z);
|
|
2446
|
-
|
|
2121
|
+
this._z = Math.floor(this._z); // this.fire('change');
|
|
2122
|
+
|
|
2447
2123
|
return this;
|
|
2448
2124
|
};
|
|
2449
2125
|
|
|
2450
2126
|
Vec3.prototype.ceil = function () {
|
|
2451
2127
|
this._x = Math.ceil(this._x);
|
|
2452
2128
|
this._y = Math.ceil(this._y);
|
|
2453
|
-
this._z = Math.ceil(this._z);
|
|
2454
|
-
|
|
2129
|
+
this._z = Math.ceil(this._z); // this.fire('change');
|
|
2130
|
+
|
|
2455
2131
|
return this;
|
|
2456
2132
|
};
|
|
2457
2133
|
|
|
2458
2134
|
Vec3.prototype.round = function () {
|
|
2459
2135
|
this._x = Math.round(this._x);
|
|
2460
2136
|
this._y = Math.round(this._y);
|
|
2461
|
-
this._z = Math.round(this._z);
|
|
2462
|
-
|
|
2137
|
+
this._z = Math.round(this._z); // this.fire('change');
|
|
2138
|
+
|
|
2463
2139
|
return this;
|
|
2464
2140
|
};
|
|
2465
2141
|
|
|
2466
2142
|
Vec3.prototype.roundToZero = function () {
|
|
2467
2143
|
this._x = this._x < 0 ? Math.ceil(this._x) : Math.floor(this._x);
|
|
2468
2144
|
this._y = this._y < 0 ? Math.ceil(this._y) : Math.floor(this._y);
|
|
2469
|
-
this._z = this._z < 0 ? Math.ceil(this._z) : Math.floor(this._z);
|
|
2470
|
-
|
|
2145
|
+
this._z = this._z < 0 ? Math.ceil(this._z) : Math.floor(this._z); // this.fire('change');
|
|
2146
|
+
|
|
2471
2147
|
return this;
|
|
2472
2148
|
};
|
|
2473
2149
|
|
|
2474
2150
|
Vec3.prototype.negate = function () {
|
|
2475
2151
|
this._x = -this._x;
|
|
2476
2152
|
this._y = -this._y;
|
|
2477
|
-
this._z = -this._z;
|
|
2478
|
-
|
|
2153
|
+
this._z = -this._z; // this.fire('change');
|
|
2154
|
+
|
|
2479
2155
|
return this;
|
|
2480
2156
|
};
|
|
2481
2157
|
|
|
@@ -2675,12 +2351,12 @@
|
|
|
2675
2351
|
Vec3.prototype.angleTo = function (v, normal) {
|
|
2676
2352
|
if (normal) return this.angleToEx(v, normal);
|
|
2677
2353
|
var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
|
|
2678
|
-
return Math.acos(
|
|
2354
|
+
return Math.acos(_Math.clamp(theta, -1, 1));
|
|
2679
2355
|
};
|
|
2680
2356
|
|
|
2681
2357
|
Vec3.prototype.angleToEx = function (v, normal) {
|
|
2682
2358
|
var theta = this.dot(v) / Math.sqrt(this.lengthSq() * v.lengthSq());
|
|
2683
|
-
if (this.clone().cross(v).dot(normal) > 0) return Math.acos(
|
|
2359
|
+
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
2360
|
};
|
|
2685
2361
|
|
|
2686
2362
|
Vec3.prototype.distanceTo = function (v) {
|
|
@@ -3257,13 +2933,13 @@
|
|
|
3257
2933
|
};
|
|
3258
2934
|
|
|
3259
2935
|
return Vec3;
|
|
3260
|
-
}(
|
|
2936
|
+
}();
|
|
3261
2937
|
|
|
3262
2938
|
exports.Vec3 = Vec3;
|
|
3263
2939
|
|
|
3264
2940
|
var _vec = v3();
|
|
3265
2941
|
|
|
3266
|
-
var _quat =
|
|
2942
|
+
var _quat = Quat_1.quat();
|
|
3267
2943
|
|
|
3268
2944
|
function v3(x, y, z) {
|
|
3269
2945
|
return new Vec3(x, y, z);
|
|
@@ -3278,43 +2954,14 @@
|
|
|
3278
2954
|
|
|
3279
2955
|
var Vec4_1 = createCommonjsModule(function (module, exports) {
|
|
3280
2956
|
|
|
3281
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
3282
|
-
var extendStatics = function (d, b) {
|
|
3283
|
-
extendStatics = Object.setPrototypeOf || {
|
|
3284
|
-
__proto__: []
|
|
3285
|
-
} instanceof Array && function (d, b) {
|
|
3286
|
-
d.__proto__ = b;
|
|
3287
|
-
} || function (d, b) {
|
|
3288
|
-
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
3289
|
-
};
|
|
3290
|
-
|
|
3291
|
-
return extendStatics(d, b);
|
|
3292
|
-
};
|
|
3293
|
-
|
|
3294
|
-
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
|
-
extendStatics(d, b);
|
|
3297
|
-
|
|
3298
|
-
function __() {
|
|
3299
|
-
this.constructor = d;
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3303
|
-
};
|
|
3304
|
-
}();
|
|
3305
|
-
|
|
3306
2957
|
Object.defineProperty(exports, "__esModule", {
|
|
3307
2958
|
value: true
|
|
3308
2959
|
});
|
|
3309
2960
|
exports.v4 = exports.Vec4 = void 0;
|
|
3310
2961
|
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
2962
|
var Vec4 =
|
|
3314
2963
|
/** @class */
|
|
3315
|
-
function (
|
|
3316
|
-
__extends(Vec4, _super);
|
|
3317
|
-
|
|
2964
|
+
function () {
|
|
3318
2965
|
function Vec4(_x, _y, _z, _w) {
|
|
3319
2966
|
if (_x === void 0) {
|
|
3320
2967
|
_x = 0;
|
|
@@ -3332,14 +2979,11 @@
|
|
|
3332
2979
|
_w = 1;
|
|
3333
2980
|
}
|
|
3334
2981
|
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
_this._w = _w;
|
|
3341
|
-
_this.isVec4 = true;
|
|
3342
|
-
return _this;
|
|
2982
|
+
this._x = _x;
|
|
2983
|
+
this._y = _y;
|
|
2984
|
+
this._z = _z;
|
|
2985
|
+
this._w = _w;
|
|
2986
|
+
this.isVec4 = true;
|
|
3343
2987
|
}
|
|
3344
2988
|
|
|
3345
2989
|
Object.defineProperty(Vec4.prototype, "x", {
|
|
@@ -3348,8 +2992,7 @@
|
|
|
3348
2992
|
},
|
|
3349
2993
|
set: function (value) {
|
|
3350
2994
|
if (this._x !== value) {
|
|
3351
|
-
this._x = value;
|
|
3352
|
-
this.fire('change', 'x', this._x, value);
|
|
2995
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
3353
2996
|
}
|
|
3354
2997
|
},
|
|
3355
2998
|
enumerable: false,
|
|
@@ -3361,8 +3004,7 @@
|
|
|
3361
3004
|
},
|
|
3362
3005
|
set: function (value) {
|
|
3363
3006
|
if (this._y !== value) {
|
|
3364
|
-
this._y = value;
|
|
3365
|
-
this.fire('change', 'y', this._y, value);
|
|
3007
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
3366
3008
|
}
|
|
3367
3009
|
},
|
|
3368
3010
|
enumerable: false,
|
|
@@ -3374,8 +3016,7 @@
|
|
|
3374
3016
|
},
|
|
3375
3017
|
set: function (value) {
|
|
3376
3018
|
if (this._z !== value) {
|
|
3377
|
-
this._z = value;
|
|
3378
|
-
this.fire('change', 'z', this._z, value);
|
|
3019
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
3379
3020
|
}
|
|
3380
3021
|
},
|
|
3381
3022
|
enumerable: false,
|
|
@@ -3387,8 +3028,7 @@
|
|
|
3387
3028
|
},
|
|
3388
3029
|
set: function (value) {
|
|
3389
3030
|
if (this._w !== value) {
|
|
3390
|
-
this._w = value;
|
|
3391
|
-
this.fire('change', 'w', this._w, value);
|
|
3031
|
+
this._w = value; // this.fire('change', 'w', this._w, value)
|
|
3392
3032
|
}
|
|
3393
3033
|
},
|
|
3394
3034
|
enumerable: false,
|
|
@@ -3874,7 +3514,7 @@
|
|
|
3874
3514
|
};
|
|
3875
3515
|
|
|
3876
3516
|
return Vec4;
|
|
3877
|
-
}(
|
|
3517
|
+
}();
|
|
3878
3518
|
|
|
3879
3519
|
exports.Vec4 = Vec4;
|
|
3880
3520
|
|
|
@@ -3898,7 +3538,7 @@
|
|
|
3898
3538
|
|
|
3899
3539
|
|
|
3900
3540
|
|
|
3901
|
-
var _Vec =
|
|
3541
|
+
var _Vec = Vec3_1.v3();
|
|
3902
3542
|
|
|
3903
3543
|
var Mat3 =
|
|
3904
3544
|
/** @class */
|
|
@@ -5088,21 +4728,21 @@
|
|
|
5088
4728
|
|
|
5089
4729
|
exports.Mat4 = Mat4;
|
|
5090
4730
|
|
|
5091
|
-
var _v1 =
|
|
4731
|
+
var _v1 = Vec3_1.v3();
|
|
5092
4732
|
|
|
5093
4733
|
var _m1 = m4();
|
|
5094
4734
|
|
|
5095
4735
|
var _m2 = m4();
|
|
5096
4736
|
|
|
5097
|
-
var _zero =
|
|
4737
|
+
var _zero = Vec3_1.v3(0, 0, 0);
|
|
5098
4738
|
|
|
5099
|
-
var _one =
|
|
4739
|
+
var _one = Vec3_1.v3(1, 1, 1);
|
|
5100
4740
|
|
|
5101
|
-
var _x =
|
|
4741
|
+
var _x = Vec3_1.v3();
|
|
5102
4742
|
|
|
5103
|
-
var _y =
|
|
4743
|
+
var _y = Vec3_1.v3();
|
|
5104
4744
|
|
|
5105
|
-
var _z =
|
|
4745
|
+
var _z = Vec3_1.v3();
|
|
5106
4746
|
|
|
5107
4747
|
function m4() {
|
|
5108
4748
|
return new Mat4();
|
|
@@ -5117,31 +4757,6 @@
|
|
|
5117
4757
|
|
|
5118
4758
|
var Euler_1 = createCommonjsModule(function (module, exports) {
|
|
5119
4759
|
|
|
5120
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
5121
|
-
var extendStatics = function (d, b) {
|
|
5122
|
-
extendStatics = Object.setPrototypeOf || {
|
|
5123
|
-
__proto__: []
|
|
5124
|
-
} instanceof Array && function (d, b) {
|
|
5125
|
-
d.__proto__ = b;
|
|
5126
|
-
} || function (d, b) {
|
|
5127
|
-
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
5128
|
-
};
|
|
5129
|
-
|
|
5130
|
-
return extendStatics(d, b);
|
|
5131
|
-
};
|
|
5132
|
-
|
|
5133
|
-
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
|
-
extendStatics(d, b);
|
|
5136
|
-
|
|
5137
|
-
function __() {
|
|
5138
|
-
this.constructor = d;
|
|
5139
|
-
}
|
|
5140
|
-
|
|
5141
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
5142
|
-
};
|
|
5143
|
-
}();
|
|
5144
|
-
|
|
5145
4760
|
Object.defineProperty(exports, "__esModule", {
|
|
5146
4761
|
value: true
|
|
5147
4762
|
});
|
|
@@ -5155,18 +4770,14 @@
|
|
|
5155
4770
|
|
|
5156
4771
|
|
|
5157
4772
|
|
|
4773
|
+
var _matrix = Mat4_1.m4();
|
|
5158
4774
|
|
|
5159
|
-
|
|
5160
|
-
var _matrix = (0, Mat4_1.m4)();
|
|
5161
|
-
|
|
5162
|
-
var _Quat = (0, Quat_1.quat)();
|
|
4775
|
+
var _Quat = Quat_1.quat();
|
|
5163
4776
|
var DefaultOrder = "XYZ";
|
|
5164
4777
|
|
|
5165
4778
|
var Euler =
|
|
5166
4779
|
/** @class */
|
|
5167
|
-
function (
|
|
5168
|
-
__extends(Euler, _super);
|
|
5169
|
-
|
|
4780
|
+
function () {
|
|
5170
4781
|
function Euler(_x, _y, _z, _order) {
|
|
5171
4782
|
if (_x === void 0) {
|
|
5172
4783
|
_x = 0;
|
|
@@ -5184,14 +4795,11 @@
|
|
|
5184
4795
|
_order = DefaultOrder;
|
|
5185
4796
|
}
|
|
5186
4797
|
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
_this._order = _order;
|
|
5193
|
-
_this.isEuler = true;
|
|
5194
|
-
return _this;
|
|
4798
|
+
this._x = _x;
|
|
4799
|
+
this._y = _y;
|
|
4800
|
+
this._z = _z;
|
|
4801
|
+
this._order = _order;
|
|
4802
|
+
this.isEuler = true;
|
|
5195
4803
|
}
|
|
5196
4804
|
|
|
5197
4805
|
Object.defineProperty(Euler.prototype, "x", {
|
|
@@ -5200,8 +4808,7 @@
|
|
|
5200
4808
|
},
|
|
5201
4809
|
set: function (value) {
|
|
5202
4810
|
if (this._x !== value) {
|
|
5203
|
-
this._x = value;
|
|
5204
|
-
this.fire('change', 'x', this._x, value);
|
|
4811
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
5205
4812
|
}
|
|
5206
4813
|
},
|
|
5207
4814
|
enumerable: false,
|
|
@@ -5213,8 +4820,7 @@
|
|
|
5213
4820
|
},
|
|
5214
4821
|
set: function (value) {
|
|
5215
4822
|
if (this._y !== value) {
|
|
5216
|
-
this._y = value;
|
|
5217
|
-
this.fire('change', 'y', this._y, value);
|
|
4823
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
5218
4824
|
}
|
|
5219
4825
|
},
|
|
5220
4826
|
enumerable: false,
|
|
@@ -5226,8 +4832,7 @@
|
|
|
5226
4832
|
},
|
|
5227
4833
|
set: function (value) {
|
|
5228
4834
|
if (this._z !== value) {
|
|
5229
|
-
this._z = value;
|
|
5230
|
-
this.fire('change', 'z', this._z, value);
|
|
4835
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
5231
4836
|
}
|
|
5232
4837
|
},
|
|
5233
4838
|
enumerable: false,
|
|
@@ -5239,7 +4844,7 @@
|
|
|
5239
4844
|
},
|
|
5240
4845
|
set: function (value) {
|
|
5241
4846
|
if (this._order !== value) {
|
|
5242
|
-
this.fire('change', 'order', this._order, value)
|
|
4847
|
+
// this.fire('change', 'order', this._order, value)
|
|
5243
4848
|
this._order = value;
|
|
5244
4849
|
}
|
|
5245
4850
|
},
|
|
@@ -5251,8 +4856,8 @@
|
|
|
5251
4856
|
this._x = x;
|
|
5252
4857
|
this._y = y;
|
|
5253
4858
|
this._z = z;
|
|
5254
|
-
this._order = order || this._order;
|
|
5255
|
-
|
|
4859
|
+
this._order = order || this._order; // this.fire('change')
|
|
4860
|
+
|
|
5256
4861
|
return this;
|
|
5257
4862
|
};
|
|
5258
4863
|
|
|
@@ -5264,8 +4869,8 @@
|
|
|
5264
4869
|
this._x = Euler._x;
|
|
5265
4870
|
this._y = Euler._y;
|
|
5266
4871
|
this._z = Euler._z;
|
|
5267
|
-
this._order = Euler._order;
|
|
5268
|
-
|
|
4872
|
+
this._order = Euler._order; // this.fire('change')
|
|
4873
|
+
|
|
5269
4874
|
return this;
|
|
5270
4875
|
};
|
|
5271
4876
|
|
|
@@ -5284,7 +4889,7 @@
|
|
|
5284
4889
|
order = order || this._order;
|
|
5285
4890
|
|
|
5286
4891
|
if (order === "XYZ") {
|
|
5287
|
-
this._y = Math.asin(
|
|
4892
|
+
this._y = Math.asin(_Math.clamp(m13, -1, 1));
|
|
5288
4893
|
|
|
5289
4894
|
if (Math.abs(m13) < 0.9999999) {
|
|
5290
4895
|
this._x = Math.atan2(-m23, m33);
|
|
@@ -5294,7 +4899,7 @@
|
|
|
5294
4899
|
this._z = 0;
|
|
5295
4900
|
}
|
|
5296
4901
|
} else if (order === "YXZ") {
|
|
5297
|
-
this._x = Math.asin(-
|
|
4902
|
+
this._x = Math.asin(-_Math.clamp(m23, -1, 1));
|
|
5298
4903
|
|
|
5299
4904
|
if (Math.abs(m23) < 0.9999999) {
|
|
5300
4905
|
this._y = Math.atan2(m13, m33);
|
|
@@ -5304,7 +4909,7 @@
|
|
|
5304
4909
|
this._z = 0;
|
|
5305
4910
|
}
|
|
5306
4911
|
} else if (order === "ZXY") {
|
|
5307
|
-
this._x = Math.asin(
|
|
4912
|
+
this._x = Math.asin(_Math.clamp(m32, -1, 1));
|
|
5308
4913
|
|
|
5309
4914
|
if (Math.abs(m32) < 0.9999999) {
|
|
5310
4915
|
this._y = Math.atan2(-m31, m33);
|
|
@@ -5314,7 +4919,7 @@
|
|
|
5314
4919
|
this._z = Math.atan2(m21, m11);
|
|
5315
4920
|
}
|
|
5316
4921
|
} else if (order === "ZYX") {
|
|
5317
|
-
this._y = Math.asin(-
|
|
4922
|
+
this._y = Math.asin(-_Math.clamp(m31, -1, 1));
|
|
5318
4923
|
|
|
5319
4924
|
if (Math.abs(m31) < 0.9999999) {
|
|
5320
4925
|
this._x = Math.atan2(m32, m33);
|
|
@@ -5324,7 +4929,7 @@
|
|
|
5324
4929
|
this._z = Math.atan2(-m12, m22);
|
|
5325
4930
|
}
|
|
5326
4931
|
} else if (order === "YZX") {
|
|
5327
|
-
this._z = Math.asin(
|
|
4932
|
+
this._z = Math.asin(_Math.clamp(m21, -1, 1));
|
|
5328
4933
|
|
|
5329
4934
|
if (Math.abs(m21) < 0.9999999) {
|
|
5330
4935
|
this._x = Math.atan2(-m23, m22);
|
|
@@ -5334,7 +4939,7 @@
|
|
|
5334
4939
|
this._y = Math.atan2(m13, m33);
|
|
5335
4940
|
}
|
|
5336
4941
|
} else if (order === "XZY") {
|
|
5337
|
-
this._z = Math.asin(-
|
|
4942
|
+
this._z = Math.asin(-_Math.clamp(m12, -1, 1));
|
|
5338
4943
|
|
|
5339
4944
|
if (Math.abs(m12) < 0.9999999) {
|
|
5340
4945
|
this._x = Math.atan2(m32, m22);
|
|
@@ -5348,8 +4953,8 @@
|
|
|
5348
4953
|
}
|
|
5349
4954
|
|
|
5350
4955
|
this._order = order;
|
|
5351
|
-
if (update !== false) this.fire('change')
|
|
5352
|
-
|
|
4956
|
+
if (update !== false) // this.fire('change')
|
|
4957
|
+
return this;
|
|
5353
4958
|
};
|
|
5354
4959
|
|
|
5355
4960
|
Euler.prototype.setFromQuat = function (q, order, update) {
|
|
@@ -5377,8 +4982,8 @@
|
|
|
5377
4982
|
this._x = array[0];
|
|
5378
4983
|
this._y = array[1];
|
|
5379
4984
|
this._z = array[2];
|
|
5380
|
-
if (array[3] !== undefined) this._order = array[3];
|
|
5381
|
-
|
|
4985
|
+
if (array[3] !== undefined) this._order = array[3]; // this.fire('change')
|
|
4986
|
+
|
|
5382
4987
|
return this;
|
|
5383
4988
|
};
|
|
5384
4989
|
|
|
@@ -5402,12 +5007,12 @@
|
|
|
5402
5007
|
if (optionalResult) {
|
|
5403
5008
|
return optionalResult.set(this._x, this._y, this._z);
|
|
5404
5009
|
} else {
|
|
5405
|
-
return
|
|
5010
|
+
return Vec3_1.v3(this._x, this._y, this._z);
|
|
5406
5011
|
}
|
|
5407
5012
|
};
|
|
5408
5013
|
|
|
5409
5014
|
return Euler;
|
|
5410
|
-
}(
|
|
5015
|
+
}();
|
|
5411
5016
|
|
|
5412
5017
|
exports.Euler = Euler;
|
|
5413
5018
|
|
|
@@ -5422,6 +5027,253 @@
|
|
|
5422
5027
|
var Euler_2 = Euler_1.euler;
|
|
5423
5028
|
var Euler_3 = Euler_1.Euler;
|
|
5424
5029
|
|
|
5030
|
+
var Color_1 = createCommonjsModule(function (module, exports) {
|
|
5031
|
+
|
|
5032
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5033
|
+
value: true
|
|
5034
|
+
});
|
|
5035
|
+
exports.Color = void 0;
|
|
5036
|
+
|
|
5037
|
+
var Color =
|
|
5038
|
+
/** @class */
|
|
5039
|
+
function () {
|
|
5040
|
+
function Color(r, g, b, a) {
|
|
5041
|
+
if (r === void 0) {
|
|
5042
|
+
r = 0;
|
|
5043
|
+
}
|
|
5044
|
+
|
|
5045
|
+
if (g === void 0) {
|
|
5046
|
+
g = 0;
|
|
5047
|
+
}
|
|
5048
|
+
|
|
5049
|
+
if (b === void 0) {
|
|
5050
|
+
b = 0;
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
if (a === void 0) {
|
|
5054
|
+
a = 1;
|
|
5055
|
+
}
|
|
5056
|
+
|
|
5057
|
+
this._r = 0.0;
|
|
5058
|
+
this._g = 0.0;
|
|
5059
|
+
this._b = 0.0;
|
|
5060
|
+
this._a = 1.0;
|
|
5061
|
+
this._r = r;
|
|
5062
|
+
this._g = g;
|
|
5063
|
+
this._b = b;
|
|
5064
|
+
this._a = a;
|
|
5065
|
+
}
|
|
5066
|
+
|
|
5067
|
+
Object.defineProperty(Color.prototype, "isColor", {
|
|
5068
|
+
get: function () {
|
|
5069
|
+
return true;
|
|
5070
|
+
},
|
|
5071
|
+
enumerable: false,
|
|
5072
|
+
configurable: true
|
|
5073
|
+
});
|
|
5074
|
+
Object.defineProperty(Color.prototype, "r", {
|
|
5075
|
+
get: function () {
|
|
5076
|
+
return this._r;
|
|
5077
|
+
},
|
|
5078
|
+
set: function (value) {
|
|
5079
|
+
if (this._r !== value) {
|
|
5080
|
+
this._r = value; // this.fire('change', 'r', this._r, value)
|
|
5081
|
+
}
|
|
5082
|
+
},
|
|
5083
|
+
enumerable: false,
|
|
5084
|
+
configurable: true
|
|
5085
|
+
});
|
|
5086
|
+
Object.defineProperty(Color.prototype, "g", {
|
|
5087
|
+
get: function () {
|
|
5088
|
+
return this._g;
|
|
5089
|
+
},
|
|
5090
|
+
set: function (value) {
|
|
5091
|
+
if (this._g !== value) {
|
|
5092
|
+
this._g = value; // this.fire('change', 'g', this._g, value)
|
|
5093
|
+
}
|
|
5094
|
+
},
|
|
5095
|
+
enumerable: false,
|
|
5096
|
+
configurable: true
|
|
5097
|
+
});
|
|
5098
|
+
Object.defineProperty(Color.prototype, "b", {
|
|
5099
|
+
get: function () {
|
|
5100
|
+
return this._g;
|
|
5101
|
+
},
|
|
5102
|
+
set: function (value) {
|
|
5103
|
+
if (this._b !== value) {
|
|
5104
|
+
this._b = value; // this.fire('change', 'b', this._b, value)
|
|
5105
|
+
}
|
|
5106
|
+
},
|
|
5107
|
+
enumerable: false,
|
|
5108
|
+
configurable: true
|
|
5109
|
+
});
|
|
5110
|
+
Object.defineProperty(Color.prototype, "a", {
|
|
5111
|
+
get: function () {
|
|
5112
|
+
return this._a;
|
|
5113
|
+
},
|
|
5114
|
+
set: function (value) {
|
|
5115
|
+
if (this._a !== value) {
|
|
5116
|
+
this._a = value; // this.fire('change', 'a', this._a, value)
|
|
5117
|
+
}
|
|
5118
|
+
},
|
|
5119
|
+
enumerable: false,
|
|
5120
|
+
configurable: true
|
|
5121
|
+
});
|
|
5122
|
+
|
|
5123
|
+
Color.prototype.set = function (value) {
|
|
5124
|
+
if (value && value.isColor) {
|
|
5125
|
+
this.copy(value);
|
|
5126
|
+
} else if (typeof value === 'number') {
|
|
5127
|
+
this.setHex(value);
|
|
5128
|
+
}
|
|
5129
|
+
|
|
5130
|
+
if (typeof value === 'string') {
|
|
5131
|
+
if (value.indexOf("#") === 0) this.setHexCssString(value);else console.error("未匹配的颜色数据");
|
|
5132
|
+
}
|
|
5133
|
+
|
|
5134
|
+
return this;
|
|
5135
|
+
};
|
|
5136
|
+
|
|
5137
|
+
Color.prototype.setHex = function (hex) {
|
|
5138
|
+
hex = Math.floor(hex);
|
|
5139
|
+
this._r = (hex >> 16 & 255) / 255;
|
|
5140
|
+
this._g = (hex >> 8 & 255) / 255;
|
|
5141
|
+
this._b = (hex & 255) / 255;
|
|
5142
|
+
return this;
|
|
5143
|
+
};
|
|
5144
|
+
|
|
5145
|
+
Color.prototype.setHexCssString = function (style) {
|
|
5146
|
+
var m = /^\#([A-Fa-f\d]+)$/.exec(style); // hex color
|
|
5147
|
+
|
|
5148
|
+
var hex = m[1];
|
|
5149
|
+
var size = hex.length;
|
|
5150
|
+
|
|
5151
|
+
if (size === 3) {
|
|
5152
|
+
// #ff0
|
|
5153
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
|
|
5154
|
+
this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
|
|
5155
|
+
this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
|
|
5156
|
+
return this;
|
|
5157
|
+
} else if (size === 6) {
|
|
5158
|
+
// #ff0000
|
|
5159
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
|
|
5160
|
+
this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
|
|
5161
|
+
this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
|
|
5162
|
+
return this;
|
|
5163
|
+
} else if (size === 4) {
|
|
5164
|
+
// #ff0000
|
|
5165
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
|
|
5166
|
+
this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
|
|
5167
|
+
this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
|
|
5168
|
+
this.a = parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255;
|
|
5169
|
+
return this;
|
|
5170
|
+
} else if (size === 8) {
|
|
5171
|
+
// #ff0000
|
|
5172
|
+
this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
|
|
5173
|
+
this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
|
|
5174
|
+
this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
|
|
5175
|
+
this.a = parseInt(hex.charAt(6) + hex.charAt(7), 16) / 255;
|
|
5176
|
+
return this;
|
|
5177
|
+
}
|
|
5178
|
+
};
|
|
5179
|
+
|
|
5180
|
+
Color.prototype.setRGB = function (r, g, b, a) {
|
|
5181
|
+
if (a === void 0) {
|
|
5182
|
+
a = 1.0;
|
|
5183
|
+
}
|
|
5184
|
+
|
|
5185
|
+
this._r = r;
|
|
5186
|
+
this._g = g;
|
|
5187
|
+
this._b = b;
|
|
5188
|
+
this._a = a;
|
|
5189
|
+
return this;
|
|
5190
|
+
};
|
|
5191
|
+
|
|
5192
|
+
Color.prototype.clone = function () {
|
|
5193
|
+
return new this.constructor(this.r, this.g, this.b, this.a);
|
|
5194
|
+
};
|
|
5195
|
+
|
|
5196
|
+
Color.prototype.copy = function (color) {
|
|
5197
|
+
this._r = color.r;
|
|
5198
|
+
this._g = color.g;
|
|
5199
|
+
this._b = color.b;
|
|
5200
|
+
this._a = color.a;
|
|
5201
|
+
return this;
|
|
5202
|
+
};
|
|
5203
|
+
|
|
5204
|
+
Color.prototype.equals = function (c) {
|
|
5205
|
+
return c.r === this.r && c.g === this.g && c.b === this.b && c.a === this.a;
|
|
5206
|
+
};
|
|
5207
|
+
|
|
5208
|
+
Color.prototype.toArray = function (array, offset) {
|
|
5209
|
+
if (array === void 0) {
|
|
5210
|
+
array = [];
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5213
|
+
if (offset === void 0) {
|
|
5214
|
+
offset = 0;
|
|
5215
|
+
}
|
|
5216
|
+
|
|
5217
|
+
array[offset] = this.r;
|
|
5218
|
+
array[offset + 1] = this.g;
|
|
5219
|
+
array[offset + 2] = this.b;
|
|
5220
|
+
array[offset + 3] = this.a;
|
|
5221
|
+
return array;
|
|
5222
|
+
};
|
|
5223
|
+
|
|
5224
|
+
Color.prototype.byteToFloat = function (val) {
|
|
5225
|
+
return val / 255.0;
|
|
5226
|
+
};
|
|
5227
|
+
|
|
5228
|
+
Color.prototype.floatToByte = function (val) {
|
|
5229
|
+
return val === 1.0 ? 255.0 : val * 256.0 | 0;
|
|
5230
|
+
};
|
|
5231
|
+
|
|
5232
|
+
Color.prototype.getHexCssString = function () {
|
|
5233
|
+
var r = this.floatToByte(this._r).toString(16);
|
|
5234
|
+
|
|
5235
|
+
if (r.length < 2) {
|
|
5236
|
+
r = "0" + r;
|
|
5237
|
+
}
|
|
5238
|
+
|
|
5239
|
+
var g = this.floatToByte(this._g).toString(16);
|
|
5240
|
+
|
|
5241
|
+
if (g.length < 2) {
|
|
5242
|
+
g = "0" + g;
|
|
5243
|
+
}
|
|
5244
|
+
|
|
5245
|
+
var b = this.floatToByte(this._b).toString(16);
|
|
5246
|
+
|
|
5247
|
+
if (b.length < 2) {
|
|
5248
|
+
b = "0" + b;
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5251
|
+
if (this._a < 1) {
|
|
5252
|
+
var hexAlpha = this.floatToByte(this._a).toString(16);
|
|
5253
|
+
|
|
5254
|
+
if (hexAlpha.length < 2) {
|
|
5255
|
+
hexAlpha = "0" + hexAlpha;
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5258
|
+
return "#" + r + g + b + hexAlpha;
|
|
5259
|
+
}
|
|
5260
|
+
|
|
5261
|
+
return "#" + r + g + b;
|
|
5262
|
+
};
|
|
5263
|
+
|
|
5264
|
+
Color.prototype.toJSON = function () {
|
|
5265
|
+
return this.getHexCssString();
|
|
5266
|
+
};
|
|
5267
|
+
|
|
5268
|
+
return Color;
|
|
5269
|
+
}();
|
|
5270
|
+
|
|
5271
|
+
exports.Color = Color;
|
|
5272
|
+
});
|
|
5273
|
+
|
|
5274
|
+
unwrapExports(Color_1);
|
|
5275
|
+
var Color_2 = Color_1.Color;
|
|
5276
|
+
|
|
5425
5277
|
var types = createCommonjsModule(function (module, exports) {
|
|
5426
5278
|
|
|
5427
5279
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -5480,11 +5332,11 @@
|
|
|
5480
5332
|
function () {
|
|
5481
5333
|
function Line(origin, end) {
|
|
5482
5334
|
if (origin === void 0) {
|
|
5483
|
-
origin =
|
|
5335
|
+
origin = Vec3_1.v3();
|
|
5484
5336
|
}
|
|
5485
5337
|
|
|
5486
5338
|
if (end === void 0) {
|
|
5487
|
-
end =
|
|
5339
|
+
end = Vec3_1.v3();
|
|
5488
5340
|
}
|
|
5489
5341
|
|
|
5490
5342
|
this.origin = origin;
|
|
@@ -5677,9 +5529,9 @@
|
|
|
5677
5529
|
|
|
5678
5530
|
if (numInputs === 1) {
|
|
5679
5531
|
if (Math.abs(v[0][0]) > Math.abs(v[0][1])) {
|
|
5680
|
-
v[1] =
|
|
5532
|
+
v[1] = Vec3_1.v3(-v[0].z, 0, +v[0].x);
|
|
5681
5533
|
} else {
|
|
5682
|
-
v[1] =
|
|
5534
|
+
v[1] = Vec3_1.v3(0, +v[0].z, -v[0].y);
|
|
5683
5535
|
}
|
|
5684
5536
|
numInputs = 2;
|
|
5685
5537
|
}
|
|
@@ -5908,7 +5760,7 @@
|
|
|
5908
5760
|
Circle.prototype.arc1 = function (fixp0, fixp1, movep, normal) {
|
|
5909
5761
|
this.setFrom3Points(fixp0, fixp1, movep);
|
|
5910
5762
|
this.startAngle = 0;
|
|
5911
|
-
this.endAngle =
|
|
5763
|
+
this.endAngle = common.angle(fixp0.clone().sub(this.center).normalize(), fixp1.clone().sub(this.center).normalize(), this.normal || normal);
|
|
5912
5764
|
};
|
|
5913
5765
|
/**
|
|
5914
5766
|
* 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
|
|
@@ -5924,7 +5776,7 @@
|
|
|
5924
5776
|
this.center.copy(center);
|
|
5925
5777
|
var v2 = movep.clone().sub(center);
|
|
5926
5778
|
var v1 = fixp1.clone().sub(center);
|
|
5927
|
-
var jd =
|
|
5779
|
+
var jd = common.angle(v1, v2);
|
|
5928
5780
|
};
|
|
5929
5781
|
|
|
5930
5782
|
Circle.prototype.setFrom3Points = function (p0, p1, p2, normal) {
|
|
@@ -5948,121 +5800,51 @@
|
|
|
5948
5800
|
return this;
|
|
5949
5801
|
};
|
|
5950
5802
|
|
|
5951
|
-
return Circle;
|
|
5952
|
-
}();
|
|
5953
|
-
|
|
5954
|
-
exports.Circle = Circle;
|
|
5955
|
-
|
|
5956
|
-
function circle(center, radius, normal) {
|
|
5957
|
-
return new Circle(center, radius, normal);
|
|
5958
|
-
}
|
|
5959
|
-
|
|
5960
|
-
exports.circle = circle;
|
|
5961
|
-
});
|
|
5962
|
-
|
|
5963
|
-
unwrapExports(Circle_1);
|
|
5964
|
-
var Circle_2 = Circle_1.circle;
|
|
5965
|
-
var Circle_3 = Circle_1.Circle;
|
|
5966
|
-
|
|
5967
|
-
var type = createCommonjsModule(function (module, exports) {
|
|
5968
|
-
|
|
5969
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5970
|
-
value: true
|
|
5971
|
-
});
|
|
5972
|
-
exports.Orientation = exports.IntersectType = void 0;
|
|
5973
|
-
var IntersectType;
|
|
5974
|
-
|
|
5975
|
-
(function (IntersectType) {
|
|
5976
|
-
IntersectType[IntersectType["None"] = 0] = "None";
|
|
5977
|
-
IntersectType[IntersectType["Parallel"] = 1] = "Parallel";
|
|
5978
|
-
IntersectType[IntersectType["Perpendicular"] = 2] = "Perpendicular";
|
|
5979
|
-
IntersectType[IntersectType["Collineation"] = 3] = "Collineation";
|
|
5980
|
-
})(IntersectType = exports.IntersectType || (exports.IntersectType = {}));
|
|
5981
|
-
|
|
5982
|
-
var Orientation;
|
|
5983
|
-
|
|
5984
|
-
(function (Orientation) {
|
|
5985
|
-
Orientation[Orientation["None"] = -1] = "None";
|
|
5986
|
-
Orientation[Orientation["Positive"] = 1] = "Positive";
|
|
5987
|
-
Orientation[Orientation["Negative"] = 2] = "Negative";
|
|
5988
|
-
Orientation[Orientation["Common"] = 3] = "Common";
|
|
5989
|
-
Orientation[Orientation["Intersect"] = 3] = "Intersect";
|
|
5990
|
-
})(Orientation = exports.Orientation || (exports.Orientation = {}));
|
|
5991
|
-
});
|
|
5992
|
-
|
|
5993
|
-
unwrapExports(type);
|
|
5994
|
-
var type_1 = type.Orientation;
|
|
5995
|
-
var type_2 = type.IntersectType;
|
|
5996
|
-
|
|
5997
|
-
var Vec_1 = createCommonjsModule(function (module, exports) {
|
|
5998
|
-
|
|
5999
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
6000
|
-
var extendStatics = function (d, b) {
|
|
6001
|
-
extendStatics = Object.setPrototypeOf || {
|
|
6002
|
-
__proto__: []
|
|
6003
|
-
} instanceof Array && function (d, b) {
|
|
6004
|
-
d.__proto__ = b;
|
|
6005
|
-
} || function (d, b) {
|
|
6006
|
-
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
6007
|
-
};
|
|
6008
|
-
|
|
6009
|
-
return extendStatics(d, b);
|
|
6010
|
-
};
|
|
6011
|
-
|
|
6012
|
-
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
|
-
extendStatics(d, b);
|
|
6015
|
-
|
|
6016
|
-
function __() {
|
|
6017
|
-
this.constructor = d;
|
|
6018
|
-
}
|
|
6019
|
-
|
|
6020
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6021
|
-
};
|
|
6022
|
-
}();
|
|
6023
|
-
|
|
6024
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6025
|
-
value: true
|
|
6026
|
-
});
|
|
6027
|
-
exports.Vec = void 0;
|
|
6028
|
-
/**
|
|
6029
|
-
* 暂不使用
|
|
6030
|
-
*/
|
|
6031
|
-
|
|
6032
|
-
var Vec =
|
|
6033
|
-
/** @class */
|
|
6034
|
-
function (_super) {
|
|
6035
|
-
__extends(Vec, _super);
|
|
5803
|
+
return Circle;
|
|
5804
|
+
}();
|
|
6036
5805
|
|
|
6037
|
-
|
|
6038
|
-
var _this = _super.call(this) || this;
|
|
5806
|
+
exports.Circle = Circle;
|
|
6039
5807
|
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
5808
|
+
function circle(center, radius, normal) {
|
|
5809
|
+
return new Circle(center, radius, normal);
|
|
5810
|
+
}
|
|
6043
5811
|
|
|
6044
|
-
|
|
6045
|
-
|
|
5812
|
+
exports.circle = circle;
|
|
5813
|
+
});
|
|
6046
5814
|
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
5815
|
+
unwrapExports(Circle_1);
|
|
5816
|
+
var Circle_2 = Circle_1.circle;
|
|
5817
|
+
var Circle_3 = Circle_1.Circle;
|
|
6050
5818
|
|
|
6051
|
-
|
|
6052
|
-
if (array[i] > max) max = array[i];
|
|
6053
|
-
}
|
|
5819
|
+
var type = createCommonjsModule(function (module, exports) {
|
|
6054
5820
|
|
|
6055
|
-
|
|
6056
|
-
|
|
5821
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5822
|
+
value: true
|
|
5823
|
+
});
|
|
5824
|
+
exports.Orientation = exports.IntersectType = void 0;
|
|
5825
|
+
var IntersectType;
|
|
6057
5826
|
|
|
6058
|
-
|
|
6059
|
-
|
|
5827
|
+
(function (IntersectType) {
|
|
5828
|
+
IntersectType[IntersectType["None"] = 0] = "None";
|
|
5829
|
+
IntersectType[IntersectType["Parallel"] = 1] = "Parallel";
|
|
5830
|
+
IntersectType[IntersectType["Perpendicular"] = 2] = "Perpendicular";
|
|
5831
|
+
IntersectType[IntersectType["Collineation"] = 3] = "Collineation";
|
|
5832
|
+
})(IntersectType = exports.IntersectType || (exports.IntersectType = {}));
|
|
5833
|
+
|
|
5834
|
+
var Orientation;
|
|
6060
5835
|
|
|
6061
|
-
|
|
5836
|
+
(function (Orientation) {
|
|
5837
|
+
Orientation[Orientation["None"] = -1] = "None";
|
|
5838
|
+
Orientation[Orientation["Positive"] = 1] = "Positive";
|
|
5839
|
+
Orientation[Orientation["Negative"] = 2] = "Negative";
|
|
5840
|
+
Orientation[Orientation["Common"] = 3] = "Common";
|
|
5841
|
+
Orientation[Orientation["Intersect"] = 3] = "Intersect";
|
|
5842
|
+
})(Orientation = exports.Orientation || (exports.Orientation = {}));
|
|
6062
5843
|
});
|
|
6063
5844
|
|
|
6064
|
-
unwrapExports(
|
|
6065
|
-
var
|
|
5845
|
+
unwrapExports(type);
|
|
5846
|
+
var type_1 = type.Orientation;
|
|
5847
|
+
var type_2 = type.IntersectType;
|
|
6066
5848
|
|
|
6067
5849
|
var Box_1 = createCommonjsModule(function (module, exports) {
|
|
6068
5850
|
|
|
@@ -6080,14 +5862,14 @@
|
|
|
6080
5862
|
function () {
|
|
6081
5863
|
function Box(min, max) {
|
|
6082
5864
|
if (min === void 0) {
|
|
6083
|
-
min =
|
|
5865
|
+
min = Vec3_1.v3(Infinity, Infinity, Infinity);
|
|
6084
5866
|
}
|
|
6085
5867
|
|
|
6086
5868
|
if (max === void 0) {
|
|
6087
|
-
max =
|
|
5869
|
+
max = Vec3_1.v3(-Infinity, -Infinity, -Infinity);
|
|
6088
5870
|
}
|
|
6089
5871
|
|
|
6090
|
-
this._center =
|
|
5872
|
+
this._center = Vec3_1.v3();
|
|
6091
5873
|
this.min = min;
|
|
6092
5874
|
this.max = max; // if (points) {
|
|
6093
5875
|
// this.setFromPoints(points);
|
|
@@ -6219,7 +6001,7 @@
|
|
|
6219
6001
|
function () {
|
|
6220
6002
|
function Sphere(center, radius) {
|
|
6221
6003
|
if (center === void 0) {
|
|
6222
|
-
center =
|
|
6004
|
+
center = Vec3_1.v3();
|
|
6223
6005
|
}
|
|
6224
6006
|
|
|
6225
6007
|
if (radius === void 0) {
|
|
@@ -6268,14 +6050,13 @@
|
|
|
6268
6050
|
} instanceof Array && function (d, b) {
|
|
6269
6051
|
d.__proto__ = b;
|
|
6270
6052
|
} || function (d, b) {
|
|
6271
|
-
for (var p in b) if (
|
|
6053
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
6272
6054
|
};
|
|
6273
6055
|
|
|
6274
6056
|
return extendStatics(d, b);
|
|
6275
6057
|
};
|
|
6276
6058
|
|
|
6277
6059
|
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
6060
|
extendStatics(d, b);
|
|
6280
6061
|
|
|
6281
6062
|
function __() {
|
|
@@ -6298,6 +6079,11 @@
|
|
|
6298
6079
|
|
|
6299
6080
|
|
|
6300
6081
|
var _vector = new Vec3_1.Vec3();
|
|
6082
|
+
/**
|
|
6083
|
+
* 几何体buffer属性
|
|
6084
|
+
* 记录每个几何数据属性的细节
|
|
6085
|
+
*/
|
|
6086
|
+
|
|
6301
6087
|
|
|
6302
6088
|
var BufferAttribute =
|
|
6303
6089
|
/** @class */
|
|
@@ -6592,8 +6378,11 @@
|
|
|
6592
6378
|
normalized = false;
|
|
6593
6379
|
}
|
|
6594
6380
|
|
|
6381
|
+
var _this = this;
|
|
6382
|
+
|
|
6595
6383
|
if (Array.isArray(array)) array = new Int8Array(array);
|
|
6596
|
-
|
|
6384
|
+
_this = _super.call(this, new Int8Array(array), itemSize, normalized) || this;
|
|
6385
|
+
return _this;
|
|
6597
6386
|
}
|
|
6598
6387
|
|
|
6599
6388
|
return Int8BufferAttribute;
|
|
@@ -6611,8 +6400,11 @@
|
|
|
6611
6400
|
normalized = false;
|
|
6612
6401
|
}
|
|
6613
6402
|
|
|
6403
|
+
var _this = this;
|
|
6404
|
+
|
|
6614
6405
|
if (Array.isArray(array)) array = new Uint8Array(array);
|
|
6615
|
-
|
|
6406
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6407
|
+
return _this;
|
|
6616
6408
|
}
|
|
6617
6409
|
|
|
6618
6410
|
return Uint8BufferAttribute;
|
|
@@ -6630,8 +6422,11 @@
|
|
|
6630
6422
|
normalized = false;
|
|
6631
6423
|
}
|
|
6632
6424
|
|
|
6425
|
+
var _this = this;
|
|
6426
|
+
|
|
6633
6427
|
if (Array.isArray(array)) array = new Uint8ClampedArray(array);
|
|
6634
|
-
|
|
6428
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6429
|
+
return _this;
|
|
6635
6430
|
}
|
|
6636
6431
|
|
|
6637
6432
|
return Uint8ClampedBufferAttribute;
|
|
@@ -6649,8 +6444,11 @@
|
|
|
6649
6444
|
normalized = false;
|
|
6650
6445
|
}
|
|
6651
6446
|
|
|
6447
|
+
var _this = this;
|
|
6448
|
+
|
|
6652
6449
|
if (Array.isArray(array)) array = new Int16Array(array);
|
|
6653
|
-
|
|
6450
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6451
|
+
return _this;
|
|
6654
6452
|
}
|
|
6655
6453
|
|
|
6656
6454
|
return Int16BufferAttribute;
|
|
@@ -6665,8 +6463,11 @@
|
|
|
6665
6463
|
|
|
6666
6464
|
function Uint16BufferAttribute(array, itemSize, normalized) {
|
|
6667
6465
|
|
|
6466
|
+
var _this = this;
|
|
6467
|
+
|
|
6668
6468
|
if (Array.isArray(array)) array = new Uint16Array(array);
|
|
6669
|
-
|
|
6469
|
+
_this = _super.call(this, array, itemSize) || this;
|
|
6470
|
+
return _this;
|
|
6670
6471
|
}
|
|
6671
6472
|
|
|
6672
6473
|
return Uint16BufferAttribute;
|
|
@@ -6684,8 +6485,11 @@
|
|
|
6684
6485
|
normalized = false;
|
|
6685
6486
|
}
|
|
6686
6487
|
|
|
6488
|
+
var _this = this;
|
|
6489
|
+
|
|
6687
6490
|
if (Array.isArray(array)) array = new Int32Array(array);
|
|
6688
|
-
|
|
6491
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6492
|
+
return _this;
|
|
6689
6493
|
}
|
|
6690
6494
|
|
|
6691
6495
|
return Int32BufferAttribute;
|
|
@@ -6703,8 +6507,11 @@
|
|
|
6703
6507
|
normalized = false;
|
|
6704
6508
|
}
|
|
6705
6509
|
|
|
6510
|
+
var _this = this;
|
|
6511
|
+
|
|
6706
6512
|
if (Array.isArray(array)) array = new Uint32Array(array);
|
|
6707
|
-
|
|
6513
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6514
|
+
return _this;
|
|
6708
6515
|
}
|
|
6709
6516
|
|
|
6710
6517
|
return Uint32BufferAttribute;
|
|
@@ -6722,8 +6529,11 @@
|
|
|
6722
6529
|
normalized = false;
|
|
6723
6530
|
}
|
|
6724
6531
|
|
|
6532
|
+
var _this = this;
|
|
6533
|
+
|
|
6725
6534
|
if (Array.isArray(array)) array = new Float32Array(array);
|
|
6726
|
-
|
|
6535
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6536
|
+
return _this;
|
|
6727
6537
|
}
|
|
6728
6538
|
|
|
6729
6539
|
return Float32BufferAttribute;
|
|
@@ -6741,8 +6551,11 @@
|
|
|
6741
6551
|
normalized = false;
|
|
6742
6552
|
}
|
|
6743
6553
|
|
|
6554
|
+
var _this = this;
|
|
6555
|
+
|
|
6744
6556
|
if (Array.isArray(array)) array = new Float64Array(array);
|
|
6745
|
-
|
|
6557
|
+
_this = _super.call(this, array, itemSize, normalized) || this;
|
|
6558
|
+
return _this;
|
|
6746
6559
|
}
|
|
6747
6560
|
|
|
6748
6561
|
return Float64BufferAttribute;
|
|
@@ -6770,12 +6583,10 @@
|
|
|
6770
6583
|
});
|
|
6771
6584
|
exports.isBufferArray = void 0;
|
|
6772
6585
|
|
|
6773
|
-
|
|
6586
|
+
exports.isBufferArray = function (obj) {
|
|
6774
6587
|
var types = ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'];
|
|
6775
6588
|
return types.indexOf(obj.constructor.name) > -1;
|
|
6776
6589
|
};
|
|
6777
|
-
|
|
6778
|
-
exports.isBufferArray = isBufferArray;
|
|
6779
6590
|
});
|
|
6780
6591
|
|
|
6781
6592
|
unwrapExports(types$1);
|
|
@@ -6783,12 +6594,6 @@
|
|
|
6783
6594
|
|
|
6784
6595
|
var geometry = createCommonjsModule(function (module, exports) {
|
|
6785
6596
|
|
|
6786
|
-
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
|
|
6787
|
-
return mod && mod.__esModule ? mod : {
|
|
6788
|
-
"default": mod
|
|
6789
|
-
};
|
|
6790
|
-
};
|
|
6791
|
-
|
|
6792
6597
|
Object.defineProperty(exports, "__esModule", {
|
|
6793
6598
|
value: true
|
|
6794
6599
|
});
|
|
@@ -6813,8 +6618,6 @@
|
|
|
6813
6618
|
|
|
6814
6619
|
|
|
6815
6620
|
|
|
6816
|
-
|
|
6817
|
-
var vector_1$1 = __importDefault(vector_1);
|
|
6818
6621
|
|
|
6819
6622
|
var _bufferGeometryId = 1; // BufferGeometry uses odd numbers as Id
|
|
6820
6623
|
|
|
@@ -6837,10 +6640,8 @@
|
|
|
6837
6640
|
function () {
|
|
6838
6641
|
function BufferGeometry() {
|
|
6839
6642
|
this.isBufferGeometry = true;
|
|
6840
|
-
this.uuid = "";
|
|
6841
|
-
this.type = "BufferGeometry";
|
|
6842
6643
|
Object.defineProperty(this, 'id', {
|
|
6843
|
-
value: _bufferGeometryId +=
|
|
6644
|
+
value: _bufferGeometryId += 1
|
|
6844
6645
|
});
|
|
6845
6646
|
this.name = '';
|
|
6846
6647
|
this.attributes = {};
|
|
@@ -6871,11 +6672,11 @@
|
|
|
6871
6672
|
|
|
6872
6673
|
BufferGeometry.prototype.setIndex = function (index) {
|
|
6873
6674
|
if (Array.isArray(index)) {
|
|
6874
|
-
this.index = new (
|
|
6675
|
+
this.index = new (vecs_1.vecs.max(index) > 65535 ? bufferAttribute.Uint32BufferAttribute : bufferAttribute.Uint16BufferAttribute)(index, 1);
|
|
6875
6676
|
} else if (index instanceof bufferAttribute.BufferAttribute) {
|
|
6876
6677
|
this.index = index;
|
|
6877
6678
|
} else {
|
|
6878
|
-
this.index = new (
|
|
6679
|
+
this.index = new (vecs_1.vecs.max(index) > 65535 ? bufferAttribute.Uint32BufferAttribute : bufferAttribute.Uint16BufferAttribute)(index, 1);
|
|
6879
6680
|
}
|
|
6880
6681
|
};
|
|
6881
6682
|
|
|
@@ -6895,13 +6696,13 @@
|
|
|
6895
6696
|
|
|
6896
6697
|
if (Array.isArray(attribute)) {
|
|
6897
6698
|
if (attribute[0] instanceof Vec2_1.Vec2) {
|
|
6898
|
-
var nums =
|
|
6699
|
+
var nums = vecs_1.vecs.verctorToNumbers(attribute);
|
|
6899
6700
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(nums, 2));
|
|
6900
6701
|
} else if (attribute[0] instanceof Vec3_1.Vec3) {
|
|
6901
|
-
var nums =
|
|
6702
|
+
var nums = vecs_1.vecs.verctorToNumbers(attribute);
|
|
6902
6703
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(nums, 3));
|
|
6903
6704
|
} else if (attribute[0] instanceof Vec4_1.Vec4) {
|
|
6904
|
-
var nums =
|
|
6705
|
+
var nums = vecs_1.vecs.verctorToNumbers(attribute);
|
|
6905
6706
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(nums, 4));
|
|
6906
6707
|
} else if (!isNaN(attribute[0])) {
|
|
6907
6708
|
this.setAttribute(name, new bufferAttribute.Float32BufferAttribute(attribute, itemSize));
|
|
@@ -6910,7 +6711,7 @@
|
|
|
6910
6711
|
}
|
|
6911
6712
|
} else if (attribute instanceof bufferAttribute.BufferAttribute) {
|
|
6912
6713
|
this.attributes[name] = attribute;
|
|
6913
|
-
} else if (
|
|
6714
|
+
} else if (types$1.isBufferArray(attribute)) {
|
|
6914
6715
|
this.setAttribute(name, new bufferAttribute.BufferAttribute(attribute, itemSize));
|
|
6915
6716
|
}
|
|
6916
6717
|
|
|
@@ -7014,7 +6815,7 @@
|
|
|
7014
6815
|
};
|
|
7015
6816
|
|
|
7016
6817
|
BufferGeometry.prototype.lookAt = function (vector) {
|
|
7017
|
-
_m1.lookAt(
|
|
6818
|
+
_m1.lookAt(Vec3_1.v3(), vector, Vec3_1.Vec3.UnitY);
|
|
7018
6819
|
|
|
7019
6820
|
this.applyMat4(_m1);
|
|
7020
6821
|
return this;
|
|
@@ -7560,9 +7361,9 @@
|
|
|
7560
7361
|
generator: 'BufferGeometry.toJSON'
|
|
7561
7362
|
}
|
|
7562
7363
|
}; // standard BufferGeometry serialization
|
|
7364
|
+
// data.uuid = this.uuid;
|
|
7365
|
+
// data.type = this.type;
|
|
7563
7366
|
|
|
7564
|
-
data.uuid = this.uuid;
|
|
7565
|
-
data.type = this.type;
|
|
7566
7367
|
if (this.name !== '') data.name = this.name;
|
|
7567
7368
|
if (Object.keys(this.userData).length > 0) data.userData = this.userData;
|
|
7568
7369
|
|
|
@@ -8436,14 +8237,12 @@
|
|
|
8436
8237
|
return __assign.apply(this, arguments);
|
|
8437
8238
|
};
|
|
8438
8239
|
|
|
8439
|
-
var
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
}
|
|
8446
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
8240
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
8241
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
8242
|
+
|
|
8243
|
+
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];
|
|
8244
|
+
|
|
8245
|
+
return r;
|
|
8447
8246
|
};
|
|
8448
8247
|
|
|
8449
8248
|
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
|
|
@@ -8467,7 +8266,7 @@
|
|
|
8467
8266
|
|
|
8468
8267
|
|
|
8469
8268
|
|
|
8470
|
-
|
|
8269
|
+
|
|
8471
8270
|
|
|
8472
8271
|
var AxisPlane;
|
|
8473
8272
|
|
|
@@ -8508,15 +8307,15 @@
|
|
|
8508
8307
|
var normal = options.normal;
|
|
8509
8308
|
|
|
8510
8309
|
if (normal && normal.dot(Vec3_1.Vec3.UnitZ) < 1 - _Math.delta4) {
|
|
8511
|
-
boundary =
|
|
8512
|
-
|
|
8310
|
+
boundary = common.clone(inboundary);
|
|
8311
|
+
common.rotateByUnitVectors(boundary, normal, Vec3_1.Vec3.UnitZ);
|
|
8513
8312
|
} else {
|
|
8514
8313
|
boundary = inboundary;
|
|
8515
8314
|
}
|
|
8516
8315
|
|
|
8517
|
-
var allV =
|
|
8316
|
+
var allV = __spreadArrays(boundary, array.flat(holes));
|
|
8518
8317
|
|
|
8519
|
-
var vertextNumbers =
|
|
8318
|
+
var vertextNumbers = vecs_1.vecs.verctorToNumbers(allV, feature);
|
|
8520
8319
|
var holesIndex = [];
|
|
8521
8320
|
var baseIndex = boundary.length;
|
|
8522
8321
|
|
|
@@ -8527,7 +8326,7 @@
|
|
|
8527
8326
|
baseIndex += hole.length;
|
|
8528
8327
|
}
|
|
8529
8328
|
|
|
8530
|
-
var result =
|
|
8329
|
+
var result = earcut_1$1.default(vertextNumbers, holesIndex, dim);
|
|
8531
8330
|
return result;
|
|
8532
8331
|
}
|
|
8533
8332
|
|
|
@@ -8540,20 +8339,18 @@
|
|
|
8540
8339
|
|
|
8541
8340
|
var mesh = createCommonjsModule(function (module, exports) {
|
|
8542
8341
|
|
|
8543
|
-
var
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
}
|
|
8550
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
8342
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
8343
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
8344
|
+
|
|
8345
|
+
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];
|
|
8346
|
+
|
|
8347
|
+
return r;
|
|
8551
8348
|
};
|
|
8552
8349
|
|
|
8553
8350
|
Object.defineProperty(exports, "__esModule", {
|
|
8554
8351
|
value: true
|
|
8555
8352
|
});
|
|
8556
|
-
exports.
|
|
8353
|
+
exports.MeshTool = void 0;
|
|
8557
8354
|
/*
|
|
8558
8355
|
* @Description :
|
|
8559
8356
|
* @Author : 赵耀圣
|
|
@@ -8570,103 +8367,106 @@
|
|
|
8570
8367
|
|
|
8571
8368
|
|
|
8572
8369
|
|
|
8370
|
+
/**
|
|
8371
|
+
* 网格工具
|
|
8372
|
+
*/
|
|
8573
8373
|
|
|
8574
|
-
function indexable(obj, refIndexInfo, force) {
|
|
8575
|
-
if (refIndexInfo === void 0) {
|
|
8576
|
-
refIndexInfo = {
|
|
8577
|
-
index: 0
|
|
8578
|
-
};
|
|
8579
|
-
}
|
|
8580
8374
|
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8375
|
+
var MeshTool =
|
|
8376
|
+
/** @class */
|
|
8377
|
+
function () {
|
|
8378
|
+
function MeshTool() {}
|
|
8584
8379
|
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8380
|
+
MeshTool.indexable = function (obj, refIndexInfo, force) {
|
|
8381
|
+
if (refIndexInfo === void 0) {
|
|
8382
|
+
refIndexInfo = {
|
|
8383
|
+
index: 0
|
|
8384
|
+
};
|
|
8385
|
+
}
|
|
8591
8386
|
|
|
8592
|
-
|
|
8387
|
+
if (force === void 0) {
|
|
8388
|
+
force = false;
|
|
8389
|
+
}
|
|
8593
8390
|
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
}
|
|
8600
|
-
return toGeoBuffer(vertices, indices);
|
|
8601
|
-
}
|
|
8391
|
+
if (obj instanceof Array) {
|
|
8392
|
+
for (var i = 0; i < obj.length; i++) MeshTool.indexable(obj[i], refIndexInfo);
|
|
8393
|
+
} else if (obj instanceof Object) {
|
|
8394
|
+
if (obj.index === undefined) obj.index = refIndexInfo.index++;else if (force) obj.index = refIndexInfo.index++;
|
|
8395
|
+
}
|
|
8396
|
+
};
|
|
8602
8397
|
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8398
|
+
MeshTool.triangListToBuffer = function (vertices, triangleList) {
|
|
8399
|
+
MeshTool.indexable(triangleList);
|
|
8400
|
+
var indices = [];
|
|
8401
|
+
array.forall(triangleList, function (v) {
|
|
8402
|
+
indices.push(v.index);
|
|
8403
|
+
});
|
|
8404
|
+
return MeshTool.toGeoBuffer(vertices, indices);
|
|
8405
|
+
};
|
|
8406
|
+
/**
|
|
8407
|
+
* 顶点纹理坐标所以转化为buffer数据
|
|
8408
|
+
* @param {Array<Verctor3|Number>} vertices
|
|
8409
|
+
* @param {Array<Number>} indices
|
|
8410
|
+
* @param {Array<Verctor2|Number>} uvs
|
|
8411
|
+
*/
|
|
8610
8412
|
|
|
8611
|
-
function toGeoBuffer(vertices, indices, uvs) {
|
|
8612
|
-
var geometry$1 = new geometry.BufferGeometry();
|
|
8613
|
-
geometry$1.addAttribute('position', vertices, 3);
|
|
8614
|
-
geometry$1.addAttribute('uv', uvs || new Float32Array(geometry$1.getAttribute('position').array.length / 3 * 2), 2);
|
|
8615
|
-
geometry$1.setIndex(indices);
|
|
8616
|
-
return geometry$1;
|
|
8617
|
-
}
|
|
8618
8413
|
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8414
|
+
MeshTool.toGeoBuffer = function (vertices, indices, uvs) {
|
|
8415
|
+
var geometry$1 = new geometry.BufferGeometry();
|
|
8416
|
+
geometry$1.addAttribute('position', vertices, 3);
|
|
8417
|
+
geometry$1.addAttribute('uv', uvs || new Float32Array(geometry$1.getAttribute('position').array.length / 3 * 2), 2);
|
|
8418
|
+
geometry$1.setIndex(indices);
|
|
8419
|
+
return geometry$1;
|
|
8420
|
+
};
|
|
8421
|
+
/**
|
|
8422
|
+
* 三角剖分后转成几何体
|
|
8423
|
+
* 只考虑XY平面
|
|
8424
|
+
* @param {*} boundary
|
|
8425
|
+
* @param {*} hole
|
|
8426
|
+
* @param {*} options
|
|
8427
|
+
*/
|
|
8627
8428
|
|
|
8628
|
-
function trianglutionToGeometryBuffer(boundary, holes, options) {
|
|
8629
|
-
if (holes === void 0) {
|
|
8630
|
-
holes = [];
|
|
8631
|
-
}
|
|
8632
8429
|
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
}
|
|
8637
|
-
|
|
8430
|
+
MeshTool.trianglutionToGeometryBuffer = function (boundary, holes, options) {
|
|
8431
|
+
if (holes === void 0) {
|
|
8432
|
+
holes = [];
|
|
8433
|
+
}
|
|
8434
|
+
|
|
8435
|
+
if (options === void 0) {
|
|
8436
|
+
options = {
|
|
8437
|
+
normal: Vec3_1.Vec3.UnitZ
|
|
8438
|
+
};
|
|
8439
|
+
}
|
|
8638
8440
|
|
|
8639
|
-
|
|
8441
|
+
var triangles = trianglution.triangulation(boundary, holes, options);
|
|
8640
8442
|
|
|
8641
|
-
|
|
8443
|
+
var vertices = __spreadArrays(boundary, array.flat(holes));
|
|
8642
8444
|
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8445
|
+
var uvs = [];
|
|
8446
|
+
vertices.forEach(function (v) {
|
|
8447
|
+
uvs.push(v.x, v.z);
|
|
8448
|
+
});
|
|
8449
|
+
var geometry = MeshTool.toGeoBuffer(vertices, triangles, uvs);
|
|
8450
|
+
return geometry;
|
|
8451
|
+
};
|
|
8452
|
+
|
|
8453
|
+
return MeshTool;
|
|
8454
|
+
}();
|
|
8650
8455
|
|
|
8651
|
-
exports.
|
|
8456
|
+
exports.MeshTool = MeshTool;
|
|
8652
8457
|
});
|
|
8653
8458
|
|
|
8654
8459
|
unwrapExports(mesh);
|
|
8655
|
-
var mesh_1 = mesh.
|
|
8656
|
-
var mesh_2 = mesh.toGeoBuffer;
|
|
8657
|
-
var mesh_3 = mesh.triangListToBuffer;
|
|
8658
|
-
var mesh_4 = mesh.indexable;
|
|
8460
|
+
var mesh_1 = mesh.MeshTool;
|
|
8659
8461
|
|
|
8660
8462
|
var Plane_1 = createCommonjsModule(function (module, exports) {
|
|
8661
8463
|
|
|
8662
|
-
var
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
}
|
|
8669
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
8464
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
8465
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
8466
|
+
|
|
8467
|
+
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];
|
|
8468
|
+
|
|
8469
|
+
return r;
|
|
8670
8470
|
};
|
|
8671
8471
|
|
|
8672
8472
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -8754,8 +8554,8 @@
|
|
|
8754
8554
|
|
|
8755
8555
|
Plane.prototype.frontback = function (point) {
|
|
8756
8556
|
var value = this.normal.dot(point);
|
|
8757
|
-
if (
|
|
8758
|
-
return
|
|
8557
|
+
if (_Math.approximateEqual(value, 0)) return 0;
|
|
8558
|
+
return _Math.sign(this.normal.dot(point));
|
|
8759
8559
|
}; //---Distance-------------------------------------------------------------------------------
|
|
8760
8560
|
|
|
8761
8561
|
|
|
@@ -8912,8 +8712,8 @@
|
|
|
8912
8712
|
|
|
8913
8713
|
|
|
8914
8714
|
Plane.prototype.splitPolyVS = function (polyVS) {
|
|
8915
|
-
polyVS =
|
|
8916
|
-
|
|
8715
|
+
polyVS = __spreadArrays(polyVS);
|
|
8716
|
+
mesh.MeshTool.indexable(polyVS);
|
|
8917
8717
|
|
|
8918
8718
|
var jdp0; //找出第一个交点
|
|
8919
8719
|
|
|
@@ -9023,7 +8823,7 @@
|
|
|
9023
8823
|
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
8824
|
};
|
|
9025
8825
|
|
|
9026
|
-
var _vector =
|
|
8826
|
+
var _vector = Vec3_1.v3();
|
|
9027
8827
|
/**
|
|
9028
8828
|
* 数组深度复制
|
|
9029
8829
|
* @param {Array} array
|
|
@@ -9031,7 +8831,7 @@
|
|
|
9031
8831
|
|
|
9032
8832
|
|
|
9033
8833
|
function clone(array) {
|
|
9034
|
-
if (!
|
|
8834
|
+
if (!types.isDefined(array)) return array;
|
|
9035
8835
|
|
|
9036
8836
|
if (Array.isArray(array)) {
|
|
9037
8837
|
var result = new Array();
|
|
@@ -9082,23 +8882,23 @@
|
|
|
9082
8882
|
/**
|
|
9083
8883
|
*
|
|
9084
8884
|
* @param {*} points
|
|
9085
|
-
* @param {*}
|
|
8885
|
+
* @param {*} quat
|
|
9086
8886
|
* @param {Boolean} ref 是否是引用
|
|
9087
8887
|
*/
|
|
9088
8888
|
|
|
9089
|
-
function applyQuat(points,
|
|
8889
|
+
function applyQuat(points, quat, ref) {
|
|
9090
8890
|
if (ref === void 0) {
|
|
9091
8891
|
ref = true;
|
|
9092
8892
|
}
|
|
9093
8893
|
|
|
9094
8894
|
if (ref) {
|
|
9095
8895
|
points.flat(Infinity).forEach(function (point) {
|
|
9096
|
-
point.applyQuat(
|
|
8896
|
+
point.applyQuat(quat);
|
|
9097
8897
|
});
|
|
9098
8898
|
return points;
|
|
9099
8899
|
}
|
|
9100
8900
|
|
|
9101
|
-
return applyQuat(clone(points),
|
|
8901
|
+
return applyQuat(clone(points), quat);
|
|
9102
8902
|
}
|
|
9103
8903
|
|
|
9104
8904
|
exports.applyQuat = applyQuat;
|
|
@@ -9396,14 +9196,12 @@
|
|
|
9396
9196
|
|
|
9397
9197
|
var ArrayList_1 = createCommonjsModule(function (module, exports) {
|
|
9398
9198
|
|
|
9399
|
-
var
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
}
|
|
9406
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9199
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
9200
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
9201
|
+
|
|
9202
|
+
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];
|
|
9203
|
+
|
|
9204
|
+
return r;
|
|
9407
9205
|
};
|
|
9408
9206
|
|
|
9409
9207
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -9512,7 +9310,7 @@
|
|
|
9512
9310
|
value[_i - 1] = arguments[_i];
|
|
9513
9311
|
}
|
|
9514
9312
|
|
|
9515
|
-
(_a = this._array).splice.apply(_a,
|
|
9313
|
+
(_a = this._array).splice.apply(_a, __spreadArrays([i, 0], value));
|
|
9516
9314
|
};
|
|
9517
9315
|
|
|
9518
9316
|
ArrayList.prototype.splice = function (start, deleteCount) {
|
|
@@ -9524,7 +9322,7 @@
|
|
|
9524
9322
|
items[_i - 2] = arguments[_i];
|
|
9525
9323
|
}
|
|
9526
9324
|
|
|
9527
|
-
(_a = this._array).splice.apply(_a,
|
|
9325
|
+
(_a = this._array).splice.apply(_a, __spreadArrays([start, deleteCount], items));
|
|
9528
9326
|
};
|
|
9529
9327
|
|
|
9530
9328
|
ArrayList.prototype.get = function (index) {
|
|
@@ -9548,7 +9346,7 @@
|
|
|
9548
9346
|
|
|
9549
9347
|
|
|
9550
9348
|
ArrayList.prototype.clone = function () {
|
|
9551
|
-
return new this.constructor(
|
|
9349
|
+
return new this.constructor(common.clone(this._array));
|
|
9552
9350
|
};
|
|
9553
9351
|
/**
|
|
9554
9352
|
* 分类
|
|
@@ -9640,7 +9438,7 @@
|
|
|
9640
9438
|
|
|
9641
9439
|
|
|
9642
9440
|
|
|
9643
|
-
var _Vec =
|
|
9441
|
+
var _Vec = Vec3_1.v3();
|
|
9644
9442
|
/**
|
|
9645
9443
|
* 点排序函数
|
|
9646
9444
|
* @param {Vec*} a
|
|
@@ -9693,7 +9491,7 @@
|
|
|
9693
9491
|
return points;
|
|
9694
9492
|
}
|
|
9695
9493
|
|
|
9696
|
-
return applyQuat(
|
|
9494
|
+
return applyQuat(common.clone(points), quat);
|
|
9697
9495
|
}
|
|
9698
9496
|
|
|
9699
9497
|
exports.applyQuat = applyQuat;
|
|
@@ -9716,7 +9514,7 @@
|
|
|
9716
9514
|
return points;
|
|
9717
9515
|
}
|
|
9718
9516
|
|
|
9719
|
-
return translate(
|
|
9517
|
+
return translate(common.clone(points));
|
|
9720
9518
|
}
|
|
9721
9519
|
|
|
9722
9520
|
exports.translate = translate;
|
|
@@ -9774,7 +9572,7 @@
|
|
|
9774
9572
|
return points;
|
|
9775
9573
|
}
|
|
9776
9574
|
|
|
9777
|
-
return applyMat4(
|
|
9575
|
+
return applyMat4(common.clone(points), mat4);
|
|
9778
9576
|
}
|
|
9779
9577
|
|
|
9780
9578
|
exports.applyMat4 = applyMat4;
|
|
@@ -9856,7 +9654,7 @@
|
|
|
9856
9654
|
|
|
9857
9655
|
return points;
|
|
9858
9656
|
} else {
|
|
9859
|
-
return projectOnPlane(
|
|
9657
|
+
return projectOnPlane(common.clone(points), plane, projectDirect);
|
|
9860
9658
|
}
|
|
9861
9659
|
}
|
|
9862
9660
|
|
|
@@ -9943,14 +9741,13 @@
|
|
|
9943
9741
|
} instanceof Array && function (d, b) {
|
|
9944
9742
|
d.__proto__ = b;
|
|
9945
9743
|
} || function (d, b) {
|
|
9946
|
-
for (var p in b) if (
|
|
9744
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
9947
9745
|
};
|
|
9948
9746
|
|
|
9949
9747
|
return extendStatics(d, b);
|
|
9950
9748
|
};
|
|
9951
9749
|
|
|
9952
9750
|
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
9751
|
extendStatics(d, b);
|
|
9955
9752
|
|
|
9956
9753
|
function __() {
|
|
@@ -10042,16 +9839,16 @@
|
|
|
10042
9839
|
var normal = new Vec3_1.Vec3();
|
|
10043
9840
|
normal.crossVecs(d1, d2).normalize();
|
|
10044
9841
|
this.get(i).normal = normal;
|
|
10045
|
-
var bdir =
|
|
9842
|
+
var bdir = Vec3_1.v3().addVecs(d1, d2).normalize();
|
|
10046
9843
|
this.get(i).bdirection = bdir;
|
|
10047
|
-
this.get(i).bnormal =
|
|
9844
|
+
this.get(i).bnormal = Vec3_1.v3().crossVecs(bdir, normal).normalize(); // }
|
|
10048
9845
|
}
|
|
10049
9846
|
|
|
10050
9847
|
if (!this._closed) {
|
|
10051
9848
|
//不闭合路径 最后一个点没有
|
|
10052
|
-
this.get(-1).bdirection =
|
|
10053
|
-
this.get(-1).normal =
|
|
10054
|
-
this.get(-1).bnormal =
|
|
9849
|
+
this.get(-1).bdirection = Vec3_1.v3();
|
|
9850
|
+
this.get(-1).normal = Vec3_1.v3();
|
|
9851
|
+
this.get(-1).bnormal = Vec3_1.v3();
|
|
10055
9852
|
}
|
|
10056
9853
|
|
|
10057
9854
|
if (!this._closed) {
|
|
@@ -10088,11 +9885,11 @@
|
|
|
10088
9885
|
});
|
|
10089
9886
|
|
|
10090
9887
|
Path.prototype.applyMat4 = function (mat4) {
|
|
10091
|
-
|
|
9888
|
+
pointset.applyMat4(this._array, mat4);
|
|
10092
9889
|
};
|
|
10093
9890
|
|
|
10094
9891
|
Path.prototype.scale = function (x, y, z) {
|
|
10095
|
-
|
|
9892
|
+
common.scale(this._array, Vec3_1.v3(x, y, z), true);
|
|
10096
9893
|
};
|
|
10097
9894
|
/**
|
|
10098
9895
|
* 截取一段从from到to的path
|
|
@@ -10150,7 +9947,7 @@
|
|
|
10150
9947
|
right = this.length - 1;
|
|
10151
9948
|
}
|
|
10152
9949
|
|
|
10153
|
-
var distance =
|
|
9950
|
+
var distance = _Math.clamp(arg_distance, 0, this.get(-1).tlen);
|
|
10154
9951
|
if (distance !== arg_distance) return null;
|
|
10155
9952
|
|
|
10156
9953
|
if (right - left === 1) {
|
|
@@ -10183,7 +9980,7 @@
|
|
|
10183
9980
|
right = this.length - 1;
|
|
10184
9981
|
}
|
|
10185
9982
|
|
|
10186
|
-
var distance =
|
|
9983
|
+
var distance = _Math.clamp(arg_distance, 0, this.get(-1).tlen);
|
|
10187
9984
|
if (distance !== arg_distance) return null;
|
|
10188
9985
|
|
|
10189
9986
|
if (right - left === 1) {
|
|
@@ -10309,7 +10106,7 @@
|
|
|
10309
10106
|
}
|
|
10310
10107
|
|
|
10311
10108
|
if (normalize) {
|
|
10312
|
-
var tl =
|
|
10109
|
+
var tl = types.isDefined(totalMileage) ? totalMileage : this.totalMileages(ps);
|
|
10313
10110
|
|
|
10314
10111
|
for (var i = 0, len = ps.length; i < len; i++) {
|
|
10315
10112
|
res[i] /= tl;
|
|
@@ -10330,12 +10127,6 @@
|
|
|
10330
10127
|
|
|
10331
10128
|
var distance = createCommonjsModule(function (module, exports) {
|
|
10332
10129
|
|
|
10333
|
-
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
|
|
10334
|
-
return mod && mod.__esModule ? mod : {
|
|
10335
|
-
"default": mod
|
|
10336
|
-
};
|
|
10337
|
-
};
|
|
10338
|
-
|
|
10339
10130
|
Object.defineProperty(exports, "__esModule", {
|
|
10340
10131
|
value: true
|
|
10341
10132
|
});
|
|
@@ -10343,7 +10134,7 @@
|
|
|
10343
10134
|
|
|
10344
10135
|
|
|
10345
10136
|
|
|
10346
|
-
|
|
10137
|
+
|
|
10347
10138
|
/*
|
|
10348
10139
|
* @Description : 如无必要,勿增实体
|
|
10349
10140
|
* @Author : 赵耀圣
|
|
@@ -10362,7 +10153,7 @@
|
|
|
10362
10153
|
function Distance() {}
|
|
10363
10154
|
|
|
10364
10155
|
Distance.Point2Point_Number = function (x0, y0, z0, x1, y1, z1) {
|
|
10365
|
-
return
|
|
10156
|
+
return vecs_1.vecs.distance(x0, y0, z0, x1, y1, z1);
|
|
10366
10157
|
};
|
|
10367
10158
|
|
|
10368
10159
|
Distance.Point2Line_Number = function (x0, y0, z0, sox, soy, soz, sdx, sdy, sdz) {};
|
|
@@ -10419,20 +10210,12 @@
|
|
|
10419
10210
|
return __assign.apply(this, arguments);
|
|
10420
10211
|
};
|
|
10421
10212
|
|
|
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
|
-
};
|
|
10213
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
10214
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
10431
10215
|
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
};
|
|
10216
|
+
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];
|
|
10217
|
+
|
|
10218
|
+
return r;
|
|
10436
10219
|
};
|
|
10437
10220
|
|
|
10438
10221
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -10464,7 +10247,7 @@
|
|
|
10464
10247
|
|
|
10465
10248
|
|
|
10466
10249
|
|
|
10467
|
-
|
|
10250
|
+
|
|
10468
10251
|
|
|
10469
10252
|
|
|
10470
10253
|
/**
|
|
@@ -10508,7 +10291,7 @@
|
|
|
10508
10291
|
triangles.push(v10);
|
|
10509
10292
|
}
|
|
10510
10293
|
} else {
|
|
10511
|
-
if (
|
|
10294
|
+
if (types.isDefined(side0[0].index)) {
|
|
10512
10295
|
//含索引的顶点
|
|
10513
10296
|
for (var i = 0; i < length; i++) {
|
|
10514
10297
|
var v00 = side0[i];
|
|
@@ -10597,7 +10380,7 @@
|
|
|
10597
10380
|
if (hasHole) allVertics.push(holess);
|
|
10598
10381
|
var orgShape = options.orgShape || shapes[0];
|
|
10599
10382
|
var orgHoles = options.orgHoles || holess && holess[0];
|
|
10600
|
-
if (index)
|
|
10383
|
+
if (index) mesh.MeshTool.indexable(allVertics, index);
|
|
10601
10384
|
|
|
10602
10385
|
for (var i = 0; i < length; i++) {
|
|
10603
10386
|
if (holess) triangles.push.apply(triangles, linkSide({
|
|
@@ -10614,15 +10397,15 @@
|
|
|
10614
10397
|
}
|
|
10615
10398
|
|
|
10616
10399
|
if (options.sealStart) {
|
|
10617
|
-
var startShape =
|
|
10400
|
+
var startShape = common.clone(shapes[0]);
|
|
10618
10401
|
allVertics.push(startShape);
|
|
10619
10402
|
|
|
10620
10403
|
if (holess && holess[0]) {
|
|
10621
|
-
var startHoles =
|
|
10404
|
+
var startHoles = common.clone(holess[0]);
|
|
10622
10405
|
allVertics.push(startHoles);
|
|
10623
10406
|
}
|
|
10624
10407
|
|
|
10625
|
-
var startTris =
|
|
10408
|
+
var startTris = trianglution.triangulation(orgShape, orgHoles, {
|
|
10626
10409
|
feature: trianglution.AxisPlane.XYZ
|
|
10627
10410
|
});
|
|
10628
10411
|
|
|
@@ -10640,15 +10423,15 @@
|
|
|
10640
10423
|
}
|
|
10641
10424
|
|
|
10642
10425
|
if (options.sealEnd) {
|
|
10643
|
-
var endShape =
|
|
10426
|
+
var endShape = common.clone(shapes[shapes.length - 1]);
|
|
10644
10427
|
allVertics.push(endShape);
|
|
10645
10428
|
|
|
10646
10429
|
if (holess && holess[0]) {
|
|
10647
|
-
var endHoles =
|
|
10430
|
+
var endHoles = common.clone(common.clone(holess[holess.length - 1]));
|
|
10648
10431
|
allVertics.push(endHoles);
|
|
10649
10432
|
}
|
|
10650
10433
|
|
|
10651
|
-
var endTris =
|
|
10434
|
+
var endTris = trianglution.triangulation(orgShape, orgHoles, {
|
|
10652
10435
|
feature: trianglution.AxisPlane.XYZ
|
|
10653
10436
|
});
|
|
10654
10437
|
|
|
@@ -10757,7 +10540,7 @@
|
|
|
10757
10540
|
break;
|
|
10758
10541
|
}
|
|
10759
10542
|
|
|
10760
|
-
uvs.push.apply(uvs,
|
|
10543
|
+
uvs.push.apply(uvs, __spreadArrays(sealUvs, sealUvs));
|
|
10761
10544
|
}
|
|
10762
10545
|
|
|
10763
10546
|
var indices = triangles || []; // if (isDefined(shapes[0][0].index)) {
|
|
@@ -10771,7 +10554,7 @@
|
|
|
10771
10554
|
// }
|
|
10772
10555
|
// }
|
|
10773
10556
|
|
|
10774
|
-
var positions =
|
|
10557
|
+
var positions = vecs_1.vecs.verctorToNumbers(allVertics);
|
|
10775
10558
|
shapes.pop();
|
|
10776
10559
|
shapes.pop();
|
|
10777
10560
|
return {
|
|
@@ -10791,17 +10574,17 @@
|
|
|
10791
10574
|
normal: Vec3_1.Vec3.UnitZ
|
|
10792
10575
|
};
|
|
10793
10576
|
|
|
10794
|
-
var _matrix =
|
|
10577
|
+
var _matrix = Mat4_1.m4();
|
|
10795
10578
|
|
|
10796
|
-
var _matrix1 =
|
|
10579
|
+
var _matrix1 = Mat4_1.m4();
|
|
10797
10580
|
|
|
10798
|
-
var _quat =
|
|
10581
|
+
var _quat = Quat_1.quat();
|
|
10799
10582
|
|
|
10800
|
-
var _quat1 =
|
|
10583
|
+
var _quat1 = Quat_1.quat();
|
|
10801
10584
|
|
|
10802
|
-
var _vec1 =
|
|
10585
|
+
var _vec1 = Vec3_1.v3();
|
|
10803
10586
|
|
|
10804
|
-
var _vec2 =
|
|
10587
|
+
var _vec2 = Vec3_1.v3();
|
|
10805
10588
|
/**
|
|
10806
10589
|
* @description : 挤压形状生成几何体
|
|
10807
10590
|
* @param {IExtrudeOptionsEx} options
|
|
@@ -10840,9 +10623,9 @@
|
|
|
10840
10623
|
smoothAngle: 30 * _Math.RADIANS_PER_DEGREE,
|
|
10841
10624
|
enableSmooth: false
|
|
10842
10625
|
}, options);
|
|
10843
|
-
if (!
|
|
10626
|
+
if (!vecs_1.vecs.isCCW(options.shape)) options.shape.reverse();
|
|
10844
10627
|
if (options.holes) options.holes.forEach(function (hole) {
|
|
10845
|
-
if (!
|
|
10628
|
+
if (!vecs_1.vecs.isCCW(hole)) hole.reverse();
|
|
10846
10629
|
});
|
|
10847
10630
|
var path = new Path_1.Path(options.path);
|
|
10848
10631
|
var shapes = [];
|
|
@@ -10858,9 +10641,9 @@
|
|
|
10858
10641
|
}
|
|
10859
10642
|
var ups = options.ups || [];
|
|
10860
10643
|
|
|
10861
|
-
if (
|
|
10644
|
+
if (types.isUndefined(shapePath.first.z)) {
|
|
10862
10645
|
shapePath.array = shapePath.array.map(function (e) {
|
|
10863
|
-
return
|
|
10646
|
+
return Vec3_1.v3(e.x, e.y, 0);
|
|
10864
10647
|
});
|
|
10865
10648
|
options.normal = options.normal || Vec3_1.Vec3.UnitZ;
|
|
10866
10649
|
}
|
|
@@ -10873,9 +10656,9 @@
|
|
|
10873
10656
|
var point = path.get(i);
|
|
10874
10657
|
var direction = point.direction;
|
|
10875
10658
|
var upi = void 0;
|
|
10876
|
-
upi = ups[i] || up ||
|
|
10659
|
+
upi = ups[i] || up || Vec3_1.v3().crossVecs(right, direction);
|
|
10877
10660
|
var righti = right;
|
|
10878
|
-
if (!right) righti =
|
|
10661
|
+
if (!right) righti = Vec3_1.v3().crossVecs(upi, direction).normalize();
|
|
10879
10662
|
|
|
10880
10663
|
_matrix.makeBasis(righti, upi, direction);
|
|
10881
10664
|
|
|
@@ -10886,7 +10669,7 @@
|
|
|
10886
10669
|
shapes.push(new_shape);
|
|
10887
10670
|
|
|
10888
10671
|
if (options.holes) {
|
|
10889
|
-
var mholes =
|
|
10672
|
+
var mholes = pointset.applyMat4(options.holes, _matrix, false);
|
|
10890
10673
|
newholes.push(mholes);
|
|
10891
10674
|
}
|
|
10892
10675
|
}
|
|
@@ -10937,10 +10720,10 @@
|
|
|
10937
10720
|
throw "路径节点数必须大于2";
|
|
10938
10721
|
}
|
|
10939
10722
|
|
|
10940
|
-
var isCCW =
|
|
10723
|
+
var isCCW = vecs_1.vecs.isCCW(shape);
|
|
10941
10724
|
if (!isCCW) shape.reverse();
|
|
10942
10725
|
var normal = options.normal;
|
|
10943
|
-
var startSeal =
|
|
10726
|
+
var startSeal = common.clone(shape);
|
|
10944
10727
|
var shapepath = new Path_1.Path(shape);
|
|
10945
10728
|
var insertNum = 0;
|
|
10946
10729
|
|
|
@@ -10964,26 +10747,26 @@
|
|
|
10964
10747
|
for (var i = 0; i < path.length; i++) {
|
|
10965
10748
|
var node = path[i];
|
|
10966
10749
|
var dir = node.tangent;
|
|
10967
|
-
var newShape =
|
|
10968
|
-
|
|
10750
|
+
var newShape = common.clone(shape);
|
|
10751
|
+
common.rotateByUnitVectors(newShape, normal, dir);
|
|
10969
10752
|
|
|
10970
10753
|
if (options.fixedY) {
|
|
10971
10754
|
var v = Vec3_1.Vec3.UnitX;
|
|
10972
|
-
|
|
10755
|
+
common.rotateByUnitVectors([v], normal, dir);
|
|
10973
10756
|
var v1 = v.clone();
|
|
10974
10757
|
v1.y = 0;
|
|
10975
|
-
|
|
10758
|
+
common.rotateByUnitVectors(newShape, v, v1);
|
|
10976
10759
|
}
|
|
10977
10760
|
|
|
10978
|
-
|
|
10761
|
+
pointset.translate(newShape, node);
|
|
10979
10762
|
shapeArray.push(newShape);
|
|
10980
10763
|
}
|
|
10981
10764
|
|
|
10982
10765
|
var gindex = {
|
|
10983
10766
|
index: 0
|
|
10984
10767
|
};
|
|
10985
|
-
var vertices =
|
|
10986
|
-
|
|
10768
|
+
var vertices = array.flat(shapeArray);
|
|
10769
|
+
mesh.MeshTool.indexable(vertices, gindex);
|
|
10987
10770
|
var index = linkSides({
|
|
10988
10771
|
shapes: shapeArray,
|
|
10989
10772
|
shapeClosed: options.shapeClosed,
|
|
@@ -10999,37 +10782,37 @@
|
|
|
10999
10782
|
}
|
|
11000
10783
|
}
|
|
11001
10784
|
|
|
11002
|
-
var sealUv =
|
|
11003
|
-
if (normal.dot(Vec3_1.Vec3.UnitZ) < 1 - 1e-4)
|
|
11004
|
-
var endSeal =
|
|
11005
|
-
|
|
10785
|
+
var sealUv = common.clone(startSeal);
|
|
10786
|
+
if (normal.dot(Vec3_1.Vec3.UnitZ) < 1 - 1e-4) common.rotateByUnitVectors(sealUv, normal, Vec3_1.Vec3.UnitZ);
|
|
10787
|
+
var endSeal = common.clone(startSeal);
|
|
10788
|
+
common.rotateByUnitVectors(startSeal, normal, path[0].tangent);
|
|
11006
10789
|
|
|
11007
10790
|
if (options.fixedY) {
|
|
11008
10791
|
var v = Vec3_1.Vec3.UnitX;
|
|
11009
|
-
|
|
10792
|
+
common.rotateByUnitVectors([v], normal, path[0].tangent);
|
|
11010
10793
|
var v1 = v.clone();
|
|
11011
10794
|
v1.y = 0;
|
|
11012
|
-
|
|
10795
|
+
common.rotateByUnitVectors(startSeal, v, v1);
|
|
11013
10796
|
}
|
|
11014
10797
|
|
|
11015
|
-
|
|
11016
|
-
|
|
10798
|
+
pointset.translate(startSeal, path[0]);
|
|
10799
|
+
common.rotateByUnitVectors(endSeal, normal, path.get(-1).tangent);
|
|
11017
10800
|
|
|
11018
10801
|
if (options.fixedY) {
|
|
11019
10802
|
var v = Vec3_1.Vec3.UnitX;
|
|
11020
|
-
|
|
10803
|
+
common.rotateByUnitVectors([v], normal, path.get(-1).tangent);
|
|
11021
10804
|
var v1 = v.clone();
|
|
11022
10805
|
v1.y = 0;
|
|
11023
|
-
|
|
10806
|
+
common.rotateByUnitVectors(endSeal, v, v1);
|
|
11024
10807
|
}
|
|
11025
10808
|
|
|
11026
|
-
|
|
11027
|
-
var sealStartTris =
|
|
10809
|
+
pointset.translate(endSeal, path.get(-1));
|
|
10810
|
+
var sealStartTris = trianglution.triangulation(sealUv, [], {
|
|
11028
10811
|
normal: normal
|
|
11029
10812
|
});
|
|
11030
10813
|
sealStartTris.reverse();
|
|
11031
|
-
if (options.sealStart)
|
|
11032
|
-
if (options.sealEnd)
|
|
10814
|
+
if (options.sealStart) mesh.MeshTool.indexable(startSeal, gindex);
|
|
10815
|
+
if (options.sealEnd) mesh.MeshTool.indexable(endSeal, gindex);
|
|
11033
10816
|
var sealEndTris = [];
|
|
11034
10817
|
var hasVLen = vertices.length;
|
|
11035
10818
|
if (options.sealStart) for (var i = 0; i < sealStartTris.length; i++) {
|
|
@@ -11111,12 +10894,12 @@
|
|
|
11111
10894
|
smoothAngle: 30 * _Math.RADIANS_PER_DEGREE,
|
|
11112
10895
|
enableSmooth: false
|
|
11113
10896
|
}, options);
|
|
11114
|
-
var path = options.shapeCenter ?
|
|
10897
|
+
var path = options.shapeCenter ? pointset.translate(options.path, options.shapeCenter, false) : options.path;
|
|
11115
10898
|
var shape = options.shape;
|
|
11116
|
-
|
|
10899
|
+
array.unique(path, function (a, b) {
|
|
11117
10900
|
return a.equals(b);
|
|
11118
10901
|
});
|
|
11119
|
-
|
|
10902
|
+
array.unique(shape, function (a, b) {
|
|
11120
10903
|
return a.equals(b);
|
|
11121
10904
|
});
|
|
11122
10905
|
var pathPath = new Path_1.Path(path, options.pathClosed, true);
|
|
@@ -11131,9 +10914,9 @@
|
|
|
11131
10914
|
}
|
|
11132
10915
|
options.normal = options.normal || Vec3_1.Vec3.UnitZ;
|
|
11133
10916
|
|
|
11134
|
-
if (
|
|
10917
|
+
if (types.isUndefined(shapePath.first.z)) {
|
|
11135
10918
|
shapePath.array = shapePath.array.map(function (e) {
|
|
11136
|
-
return
|
|
10919
|
+
return Vec3_1.v3(e.x, e.y, 0);
|
|
11137
10920
|
});
|
|
11138
10921
|
}
|
|
11139
10922
|
|
|
@@ -11141,7 +10924,7 @@
|
|
|
11141
10924
|
var right = options.right;
|
|
11142
10925
|
var shapes = [],
|
|
11143
10926
|
newholes = [];
|
|
11144
|
-
var accMat =
|
|
10927
|
+
var accMat = Mat4_1.m4();
|
|
11145
10928
|
/**
|
|
11146
10929
|
* 如果路径闭合 要考虑首尾shape矩阵变化后还能一致吻合
|
|
11147
10930
|
*/
|
|
@@ -11338,14 +11121,13 @@
|
|
|
11338
11121
|
} instanceof Array && function (d, b) {
|
|
11339
11122
|
d.__proto__ = b;
|
|
11340
11123
|
} || function (d, b) {
|
|
11341
|
-
for (var p in b) if (
|
|
11124
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
11342
11125
|
};
|
|
11343
11126
|
|
|
11344
11127
|
return extendStatics(d, b);
|
|
11345
11128
|
};
|
|
11346
11129
|
|
|
11347
11130
|
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
11131
|
extendStatics(d, b);
|
|
11350
11132
|
|
|
11351
11133
|
function __() {
|
|
@@ -11507,14 +11289,13 @@
|
|
|
11507
11289
|
} instanceof Array && function (d, b) {
|
|
11508
11290
|
d.__proto__ = b;
|
|
11509
11291
|
} || function (d, b) {
|
|
11510
|
-
for (var p in b) if (
|
|
11292
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
11511
11293
|
};
|
|
11512
11294
|
|
|
11513
11295
|
return extendStatics(d, b);
|
|
11514
11296
|
};
|
|
11515
11297
|
|
|
11516
11298
|
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
11299
|
extendStatics(d, b);
|
|
11519
11300
|
|
|
11520
11301
|
function __() {
|
|
@@ -11589,7 +11370,7 @@
|
|
|
11589
11370
|
unwrapExports(Polygon_1);
|
|
11590
11371
|
var Polygon_2 = Polygon_1.Polygon;
|
|
11591
11372
|
|
|
11592
|
-
var
|
|
11373
|
+
var vecs_1 = createCommonjsModule(function (module, exports) {
|
|
11593
11374
|
/**
|
|
11594
11375
|
* 当向量以数组的方式出现,一个计算单元库
|
|
11595
11376
|
* @Description : 向量数组
|
|
@@ -11600,19 +11381,18 @@
|
|
|
11600
11381
|
* @FilePath : \cga.js\src\math\VecArray.ts
|
|
11601
11382
|
*/
|
|
11602
11383
|
|
|
11603
|
-
var
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
}
|
|
11610
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
11384
|
+
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
11385
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
11386
|
+
|
|
11387
|
+
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];
|
|
11388
|
+
|
|
11389
|
+
return r;
|
|
11611
11390
|
};
|
|
11612
11391
|
|
|
11613
11392
|
Object.defineProperty(exports, "__esModule", {
|
|
11614
11393
|
value: true
|
|
11615
11394
|
});
|
|
11395
|
+
exports.vecs = void 0;
|
|
11616
11396
|
|
|
11617
11397
|
|
|
11618
11398
|
|
|
@@ -11626,6 +11406,14 @@
|
|
|
11626
11406
|
|
|
11627
11407
|
|
|
11628
11408
|
|
|
11409
|
+
|
|
11410
|
+
|
|
11411
|
+
var _vec21 = new Vec2_1.Vec2();
|
|
11412
|
+
|
|
11413
|
+
var _vec31 = new Vec3_1.Vec3();
|
|
11414
|
+
|
|
11415
|
+
var _vec41 = new Vec4_1.Vec4();
|
|
11416
|
+
|
|
11629
11417
|
var ckeckVec = function (vs, component) {
|
|
11630
11418
|
if (vs.length % component !== 0) throw "向量组件数量不一样";
|
|
11631
11419
|
};
|
|
@@ -11634,10 +11422,10 @@
|
|
|
11634
11422
|
*/
|
|
11635
11423
|
|
|
11636
11424
|
|
|
11637
|
-
var
|
|
11425
|
+
var vecs =
|
|
11638
11426
|
/** @class */
|
|
11639
11427
|
function () {
|
|
11640
|
-
function
|
|
11428
|
+
function vecs() {}
|
|
11641
11429
|
/**
|
|
11642
11430
|
* 去除相邻的重复向量
|
|
11643
11431
|
* @param vs 矢量集合
|
|
@@ -11646,7 +11434,7 @@
|
|
|
11646
11434
|
*/
|
|
11647
11435
|
|
|
11648
11436
|
|
|
11649
|
-
|
|
11437
|
+
vecs.uniqueNeighborVecs = function (vs, delta) {
|
|
11650
11438
|
if (delta === void 0) {
|
|
11651
11439
|
delta = _Math.delta4;
|
|
11652
11440
|
}
|
|
@@ -11658,12 +11446,46 @@
|
|
|
11658
11446
|
|
|
11659
11447
|
return vs;
|
|
11660
11448
|
};
|
|
11449
|
+
/**
|
|
11450
|
+
* 找到最大值
|
|
11451
|
+
* @param array
|
|
11452
|
+
* @returns
|
|
11453
|
+
*/
|
|
11454
|
+
|
|
11455
|
+
|
|
11456
|
+
vecs.max = function (array) {
|
|
11457
|
+
if (array.length === 0) return -Infinity;
|
|
11458
|
+
var max = array[0];
|
|
11459
|
+
|
|
11460
|
+
for (var i = 1, l = array.length; i < l; ++i) {
|
|
11461
|
+
if (array[i] > max) max = array[i];
|
|
11462
|
+
}
|
|
11463
|
+
|
|
11464
|
+
return max;
|
|
11465
|
+
};
|
|
11466
|
+
/**
|
|
11467
|
+
* 找到最小值
|
|
11468
|
+
* @param array
|
|
11469
|
+
* @returns
|
|
11470
|
+
*/
|
|
11471
|
+
|
|
11472
|
+
|
|
11473
|
+
vecs.min = function (array) {
|
|
11474
|
+
if (array.length === 0) return -Infinity;
|
|
11475
|
+
var min = array[0];
|
|
11476
|
+
|
|
11477
|
+
for (var i = 1, l = array.length; i < l; ++i) {
|
|
11478
|
+
if (array[i] < min) min = array[i];
|
|
11479
|
+
}
|
|
11480
|
+
|
|
11481
|
+
return min;
|
|
11482
|
+
};
|
|
11661
11483
|
/**
|
|
11662
11484
|
* 去除相邻没有重复点
|
|
11663
11485
|
*/
|
|
11664
11486
|
|
|
11665
11487
|
|
|
11666
|
-
|
|
11488
|
+
vecs.uniqueNeighbor = function (vs, component, delta) {
|
|
11667
11489
|
if (component === void 0) {
|
|
11668
11490
|
component = 3;
|
|
11669
11491
|
}
|
|
@@ -11694,7 +11516,7 @@
|
|
|
11694
11516
|
*/
|
|
11695
11517
|
|
|
11696
11518
|
|
|
11697
|
-
|
|
11519
|
+
vecs.unique = function (vs, component) {
|
|
11698
11520
|
if (component === void 0) {
|
|
11699
11521
|
component = 3;
|
|
11700
11522
|
}
|
|
@@ -11721,7 +11543,7 @@
|
|
|
11721
11543
|
*/
|
|
11722
11544
|
|
|
11723
11545
|
|
|
11724
|
-
|
|
11546
|
+
vecs.reverse = function (vecs, component) {
|
|
11725
11547
|
if (component === void 0) {
|
|
11726
11548
|
component = 3;
|
|
11727
11549
|
}
|
|
@@ -11742,7 +11564,7 @@
|
|
|
11742
11564
|
*/
|
|
11743
11565
|
|
|
11744
11566
|
|
|
11745
|
-
|
|
11567
|
+
vecs.dot = function () {
|
|
11746
11568
|
var vecs = [];
|
|
11747
11569
|
|
|
11748
11570
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11766,7 +11588,7 @@
|
|
|
11766
11588
|
*/
|
|
11767
11589
|
|
|
11768
11590
|
|
|
11769
|
-
|
|
11591
|
+
vecs.distanceSq = function () {
|
|
11770
11592
|
var vecs = [];
|
|
11771
11593
|
|
|
11772
11594
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11791,7 +11613,7 @@
|
|
|
11791
11613
|
*/
|
|
11792
11614
|
|
|
11793
11615
|
|
|
11794
|
-
|
|
11616
|
+
vecs.distance = function () {
|
|
11795
11617
|
var vecs = [];
|
|
11796
11618
|
|
|
11797
11619
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11807,7 +11629,7 @@
|
|
|
11807
11629
|
*/
|
|
11808
11630
|
|
|
11809
11631
|
|
|
11810
|
-
|
|
11632
|
+
vecs.add = function () {
|
|
11811
11633
|
var vecs = [];
|
|
11812
11634
|
|
|
11813
11635
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11841,7 +11663,7 @@
|
|
|
11841
11663
|
*/
|
|
11842
11664
|
|
|
11843
11665
|
|
|
11844
|
-
|
|
11666
|
+
vecs.sub = function () {
|
|
11845
11667
|
var vecs = [];
|
|
11846
11668
|
|
|
11847
11669
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11875,7 +11697,7 @@
|
|
|
11875
11697
|
*/
|
|
11876
11698
|
|
|
11877
11699
|
|
|
11878
|
-
|
|
11700
|
+
vecs.mul = function () {
|
|
11879
11701
|
var vecs = [];
|
|
11880
11702
|
|
|
11881
11703
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -11911,7 +11733,7 @@
|
|
|
11911
11733
|
*/
|
|
11912
11734
|
|
|
11913
11735
|
|
|
11914
|
-
|
|
11736
|
+
vecs.getVecAt = function (vecs, i, component) {
|
|
11915
11737
|
|
|
11916
11738
|
return [vecs[3 * i], vecs[3 * i + 1], vecs[3 * i + 2]];
|
|
11917
11739
|
};
|
|
@@ -11923,14 +11745,14 @@
|
|
|
11923
11745
|
*/
|
|
11924
11746
|
|
|
11925
11747
|
|
|
11926
|
-
|
|
11748
|
+
vecs.insertAt = function (vecs, i) {
|
|
11927
11749
|
var vec = [];
|
|
11928
11750
|
|
|
11929
11751
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
11930
11752
|
vec[_i - 2] = arguments[_i];
|
|
11931
11753
|
}
|
|
11932
11754
|
|
|
11933
|
-
vecs.splice.apply(vecs,
|
|
11755
|
+
vecs.splice.apply(vecs, __spreadArrays([i * vecs.length, 0], vecs));
|
|
11934
11756
|
}; //
|
|
11935
11757
|
|
|
11936
11758
|
/**
|
|
@@ -11939,7 +11761,7 @@
|
|
|
11939
11761
|
*/
|
|
11940
11762
|
|
|
11941
11763
|
|
|
11942
|
-
|
|
11764
|
+
vecs.isCCW = function (shape, component) {
|
|
11943
11765
|
if (component === void 0) {
|
|
11944
11766
|
component = 3;
|
|
11945
11767
|
}
|
|
@@ -11976,47 +11798,47 @@
|
|
|
11976
11798
|
*/
|
|
11977
11799
|
|
|
11978
11800
|
|
|
11979
|
-
|
|
11801
|
+
vecs.verctorToNumbers = function (vectors, comSort) {
|
|
11980
11802
|
if (comSort === void 0) {
|
|
11981
11803
|
comSort = "xyz";
|
|
11982
11804
|
}
|
|
11983
11805
|
|
|
11984
|
-
if (!(
|
|
11806
|
+
if (!(vectors instanceof Array)) {
|
|
11985
11807
|
console.error("传入参数必须是数组");
|
|
11986
11808
|
return [];
|
|
11987
11809
|
}
|
|
11988
11810
|
|
|
11989
11811
|
var numbers = [];
|
|
11990
11812
|
|
|
11991
|
-
if (
|
|
11813
|
+
if (vectors[0].x !== undefined && vectors[0].y !== undefined && vectors[0].z !== undefined && vectors[0].w !== undefined) {
|
|
11992
11814
|
comSort = comSort.length !== 4 ? 'xyzw' : comSort;
|
|
11993
11815
|
|
|
11994
|
-
for (var i = 0; i <
|
|
11816
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
11995
11817
|
for (var j = 0; j < comSort.length; j++) {
|
|
11996
|
-
numbers.push(
|
|
11818
|
+
numbers.push(vectors[i][comSort[j]]);
|
|
11997
11819
|
}
|
|
11998
11820
|
}
|
|
11999
11821
|
}
|
|
12000
11822
|
|
|
12001
|
-
if (
|
|
11823
|
+
if (vectors[0].x !== undefined && vectors[0].y !== undefined && vectors[0].z !== undefined) {
|
|
12002
11824
|
comSort = comSort.length !== 3 ? 'xyz' : comSort;
|
|
12003
11825
|
|
|
12004
|
-
for (var i = 0; i <
|
|
11826
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
12005
11827
|
for (var j = 0; j < comSort.length; j++) {
|
|
12006
|
-
numbers.push(
|
|
11828
|
+
numbers.push(vectors[i][comSort[j]]);
|
|
12007
11829
|
}
|
|
12008
11830
|
}
|
|
12009
|
-
} else if (
|
|
11831
|
+
} else if (vectors[0].x !== undefined && vectors[0].y !== undefined) {
|
|
12010
11832
|
comSort = comSort.length !== 2 ? 'xy' : comSort;
|
|
12011
11833
|
|
|
12012
|
-
for (var i = 0; i <
|
|
11834
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
12013
11835
|
for (var j = 0; j < comSort.length; j++) {
|
|
12014
|
-
numbers.push(
|
|
11836
|
+
numbers.push(vectors[i][comSort[j]]);
|
|
12015
11837
|
}
|
|
12016
11838
|
}
|
|
12017
|
-
} else if (
|
|
12018
|
-
for (var i = 0; i <
|
|
12019
|
-
numbers = numbers.concat(
|
|
11839
|
+
} else if (vectors[0] instanceof Array) {
|
|
11840
|
+
for (var i = 0; i < vectors.length; i++) {
|
|
11841
|
+
numbers = numbers.concat(vecs.verctorToNumbers(vectors[i]));
|
|
12020
11842
|
}
|
|
12021
11843
|
} else {
|
|
12022
11844
|
console.error("数组内部的元素不是向量");
|
|
@@ -12025,7 +11847,7 @@
|
|
|
12025
11847
|
return numbers;
|
|
12026
11848
|
};
|
|
12027
11849
|
|
|
12028
|
-
|
|
11850
|
+
vecs.vec = function (component) {
|
|
12029
11851
|
if (component === void 0) {
|
|
12030
11852
|
component = 3;
|
|
12031
11853
|
}
|
|
@@ -12043,30 +11865,84 @@
|
|
|
12043
11865
|
*/
|
|
12044
11866
|
|
|
12045
11867
|
|
|
12046
|
-
|
|
11868
|
+
vecs.numbersToVecs = function (vss, component) {
|
|
12047
11869
|
if (component === void 0) {
|
|
12048
11870
|
component = 3;
|
|
12049
11871
|
}
|
|
12050
11872
|
|
|
12051
11873
|
var result = [];
|
|
12052
|
-
var length = vss.length;
|
|
12053
11874
|
|
|
12054
|
-
for (var i = 0; i <
|
|
12055
|
-
var vec =
|
|
12056
|
-
vec.fromArray(vss
|
|
11875
|
+
for (var i = 0, length_1 = vss.length; i < length_1; i += component) {
|
|
11876
|
+
var vec = vecs.vec(component);
|
|
11877
|
+
vec.fromArray(vss, i);
|
|
12057
11878
|
result.push(vec);
|
|
12058
11879
|
}
|
|
12059
11880
|
|
|
12060
11881
|
return result;
|
|
12061
11882
|
};
|
|
12062
11883
|
|
|
12063
|
-
|
|
11884
|
+
vecs.applyQuat = function (vss, quat, component) {
|
|
11885
|
+
if (component === void 0) {
|
|
11886
|
+
component = 3;
|
|
11887
|
+
}
|
|
11888
|
+
|
|
11889
|
+
var vec;
|
|
11890
|
+
if (component === 3) vec = _vec31;else if (component === 2) vec = _vec21;else if (component === 4) vec = _vec41;
|
|
11891
|
+
|
|
11892
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
11893
|
+
vec.fromArray(vss, i).applyQuat(quat).toArray(vss, i);
|
|
11894
|
+
}
|
|
11895
|
+
};
|
|
11896
|
+
|
|
11897
|
+
vecs.applyMat4 = function (vss, mat, component) {
|
|
11898
|
+
if (component === void 0) {
|
|
11899
|
+
component = 3;
|
|
11900
|
+
}
|
|
11901
|
+
|
|
11902
|
+
var vec;
|
|
11903
|
+
if (component === 3) vec = _vec31;else if (component === 2) vec = _vec21;else if (component === 4) vec = _vec41;
|
|
11904
|
+
|
|
11905
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
11906
|
+
vec.fromArray(vss, i).applyMat4(mat).toArray(vss, i);
|
|
11907
|
+
}
|
|
11908
|
+
};
|
|
11909
|
+
|
|
11910
|
+
vecs.translate = function (vss, distance, component) {
|
|
11911
|
+
if (component === void 0) {
|
|
11912
|
+
component = 3;
|
|
11913
|
+
}
|
|
11914
|
+
|
|
11915
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
11916
|
+
for (var j = 0; j < component; j++) {
|
|
11917
|
+
vss[i + j] += distance[j];
|
|
11918
|
+
}
|
|
11919
|
+
}
|
|
11920
|
+
};
|
|
11921
|
+
|
|
11922
|
+
vecs.rotate = function (vss, axis, angle) {
|
|
11923
|
+
vecs.applyQuat(vss, new Quat_1.Quat().setFromAxisAngle(axis, angle));
|
|
11924
|
+
};
|
|
11925
|
+
|
|
11926
|
+
vecs.scale = function (vss, _scale, component) {
|
|
11927
|
+
if (component === void 0) {
|
|
11928
|
+
component = 3;
|
|
11929
|
+
}
|
|
11930
|
+
|
|
11931
|
+
for (var i = 0; i < vss.length; i += component) {
|
|
11932
|
+
for (var j = 0; j < component; j++) {
|
|
11933
|
+
vss[i + j] *= _scale[j];
|
|
11934
|
+
}
|
|
11935
|
+
}
|
|
11936
|
+
};
|
|
11937
|
+
|
|
11938
|
+
return vecs;
|
|
12064
11939
|
}();
|
|
12065
11940
|
|
|
12066
|
-
exports.
|
|
11941
|
+
exports.vecs = vecs;
|
|
12067
11942
|
});
|
|
12068
11943
|
|
|
12069
|
-
unwrapExports(
|
|
11944
|
+
unwrapExports(vecs_1);
|
|
11945
|
+
var vecs_2 = vecs_1.vecs;
|
|
12070
11946
|
|
|
12071
11947
|
var result = createCommonjsModule(function (module, exports) {
|
|
12072
11948
|
|
|
@@ -13606,14 +13482,13 @@
|
|
|
13606
13482
|
} instanceof Array && function (d, b) {
|
|
13607
13483
|
d.__proto__ = b;
|
|
13608
13484
|
} || function (d, b) {
|
|
13609
|
-
for (var p in b) if (
|
|
13485
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
13610
13486
|
};
|
|
13611
13487
|
|
|
13612
13488
|
return extendStatics(d, b);
|
|
13613
13489
|
};
|
|
13614
13490
|
|
|
13615
13491
|
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
13492
|
extendStatics(d, b);
|
|
13618
13493
|
|
|
13619
13494
|
function __() {
|
|
@@ -13680,7 +13555,7 @@
|
|
|
13680
13555
|
normal = Vec3_1.Vec3.UnitY;
|
|
13681
13556
|
}
|
|
13682
13557
|
|
|
13683
|
-
this.center = center ||
|
|
13558
|
+
this.center = center || Vec3_1.v3();
|
|
13684
13559
|
this.normal = normal;
|
|
13685
13560
|
this.radius = radius || 0;
|
|
13686
13561
|
this.w = this.normal.dot(center);
|
|
@@ -13715,14 +13590,13 @@
|
|
|
13715
13590
|
} instanceof Array && function (d, b) {
|
|
13716
13591
|
d.__proto__ = b;
|
|
13717
13592
|
} || function (d, b) {
|
|
13718
|
-
for (var p in b) if (
|
|
13593
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
13719
13594
|
};
|
|
13720
13595
|
|
|
13721
13596
|
return extendStatics(d, b);
|
|
13722
13597
|
};
|
|
13723
13598
|
|
|
13724
13599
|
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
13600
|
extendStatics(d, b);
|
|
13727
13601
|
|
|
13728
13602
|
function __() {
|
|
@@ -14056,14 +13930,13 @@
|
|
|
14056
13930
|
} instanceof Array && function (d, b) {
|
|
14057
13931
|
d.__proto__ = b;
|
|
14058
13932
|
} || function (d, b) {
|
|
14059
|
-
for (var p in b) if (
|
|
13933
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
14060
13934
|
};
|
|
14061
13935
|
|
|
14062
13936
|
return extendStatics(d, b);
|
|
14063
13937
|
};
|
|
14064
13938
|
|
|
14065
13939
|
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
13940
|
extendStatics(d, b);
|
|
14068
13941
|
|
|
14069
13942
|
function __() {
|
|
@@ -14346,14 +14219,6 @@
|
|
|
14346
14219
|
value: true
|
|
14347
14220
|
});
|
|
14348
14221
|
exports.linksToGeometry = exports.linkToGeometry = exports.extrudeToGeometryBuffer = exports.toGeometryBuffer = void 0;
|
|
14349
|
-
/*
|
|
14350
|
-
* @Description :
|
|
14351
|
-
* @Author : 赵耀圣
|
|
14352
|
-
* @Q群 : 632839661
|
|
14353
|
-
* @Date : 2020-12-10 15:01:42
|
|
14354
|
-
* @LastEditTime : 2021-03-11 10:54:11
|
|
14355
|
-
* @FilePath : \cga.js\src\extends\geometryaid.ts
|
|
14356
|
-
*/
|
|
14357
14222
|
|
|
14358
14223
|
|
|
14359
14224
|
|
|
@@ -14364,7 +14229,7 @@
|
|
|
14364
14229
|
|
|
14365
14230
|
|
|
14366
14231
|
function toGeometryBuffer(geo) {
|
|
14367
|
-
var buffer =
|
|
14232
|
+
var buffer = mesh.MeshTool.toGeoBuffer(geo.position, geo.index, geo.uv);
|
|
14368
14233
|
return buffer;
|
|
14369
14234
|
}
|
|
14370
14235
|
|
|
@@ -14377,8 +14242,8 @@
|
|
|
14377
14242
|
*/
|
|
14378
14243
|
|
|
14379
14244
|
function extrudeToGeometryBuffer(shape, arg_path, options) {
|
|
14380
|
-
var extrudeRes =
|
|
14381
|
-
return
|
|
14245
|
+
var extrudeRes = extrude_1.extrude_obsolete(shape, arg_path, options);
|
|
14246
|
+
return mesh.MeshTool.toGeoBuffer(extrudeRes.vertices, extrudeRes.index, extrudeRes.uvs);
|
|
14382
14247
|
}
|
|
14383
14248
|
|
|
14384
14249
|
exports.extrudeToGeometryBuffer = extrudeToGeometryBuffer;
|
|
@@ -14399,7 +14264,7 @@
|
|
|
14399
14264
|
shapeClose = false;
|
|
14400
14265
|
}
|
|
14401
14266
|
|
|
14402
|
-
var geo =
|
|
14267
|
+
var geo = extrude_1.linkSides({
|
|
14403
14268
|
shapes: [shape, shape1],
|
|
14404
14269
|
shapeClosed: shapeClose,
|
|
14405
14270
|
orgShape: shape,
|
|
@@ -14422,9 +14287,9 @@
|
|
|
14422
14287
|
pathClosed = true;
|
|
14423
14288
|
}
|
|
14424
14289
|
|
|
14425
|
-
var vertices =
|
|
14426
|
-
|
|
14427
|
-
var geo =
|
|
14290
|
+
var vertices = array.flat(shapes);
|
|
14291
|
+
mesh.MeshTool.indexable(vertices);
|
|
14292
|
+
var geo = extrude_1.linkSides({
|
|
14428
14293
|
shapes: shapes,
|
|
14429
14294
|
shapeClosed: pathClosed,
|
|
14430
14295
|
orgShape: shapes[0]
|
|
@@ -14436,9 +14301,9 @@
|
|
|
14436
14301
|
exports.linksToGeometry = linksToGeometry; // /**
|
|
14437
14302
|
// * 三角剖分后转成几何体
|
|
14438
14303
|
// * 只考虑XY平面
|
|
14439
|
-
// * @param {*} boundary
|
|
14440
|
-
// * @param {*} hole
|
|
14441
|
-
// * @param {*} options
|
|
14304
|
+
// * @param {*} boundary
|
|
14305
|
+
// * @param {*} hole
|
|
14306
|
+
// * @param {*} options
|
|
14442
14307
|
// */
|
|
14443
14308
|
// export function trianglutionToGeometryBuffer(boundary: any, holes: any[] = [], options: any = { normal: Vec3.UnitZ }) {
|
|
14444
14309
|
// var triangles = triangulation(boundary, holes, options)
|
|
@@ -14459,29 +14324,23 @@
|
|
|
14459
14324
|
var geometryaid_3 = geometryaid.extrudeToGeometryBuffer;
|
|
14460
14325
|
var geometryaid_4 = geometryaid.toGeometryBuffer;
|
|
14461
14326
|
|
|
14462
|
-
var
|
|
14327
|
+
var dist = createCommonjsModule(function (module, exports) {
|
|
14463
14328
|
|
|
14464
14329
|
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
14465
14330
|
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);
|
|
14331
|
+
Object.defineProperty(o, k2, {
|
|
14332
|
+
enumerable: true,
|
|
14333
|
+
get: function () {
|
|
14334
|
+
return m[k];
|
|
14335
|
+
}
|
|
14336
|
+
});
|
|
14478
14337
|
} : function (o, m, k, k2) {
|
|
14479
14338
|
if (k2 === undefined) k2 = k;
|
|
14480
14339
|
o[k2] = m[k];
|
|
14481
14340
|
});
|
|
14482
14341
|
|
|
14483
14342
|
var __exportStar = commonjsGlobal && commonjsGlobal.__exportStar || function (m, exports) {
|
|
14484
|
-
for (var p in m) if (p !== "default" && !
|
|
14343
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
14485
14344
|
};
|
|
14486
14345
|
|
|
14487
14346
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -14504,10 +14363,12 @@
|
|
|
14504
14363
|
|
|
14505
14364
|
__exportStar(_Math, exports);
|
|
14506
14365
|
|
|
14507
|
-
__exportStar(Euler_1, exports);
|
|
14366
|
+
__exportStar(Euler_1, exports);
|
|
14367
|
+
|
|
14368
|
+
__exportStar(Color_1, exports); //common
|
|
14508
14369
|
|
|
14509
14370
|
|
|
14510
|
-
__exportStar(
|
|
14371
|
+
__exportStar(vecs_1, exports);
|
|
14511
14372
|
|
|
14512
14373
|
__exportStar(common, exports);
|
|
14513
14374
|
|
|
@@ -14563,7 +14424,7 @@
|
|
|
14563
14424
|
__exportStar(mesh, exports);
|
|
14564
14425
|
});
|
|
14565
14426
|
|
|
14566
|
-
var index = unwrapExports(
|
|
14427
|
+
var index = unwrapExports(dist);
|
|
14567
14428
|
|
|
14568
14429
|
return index;
|
|
14569
14430
|
|