@xort/cga 0.0.84 → 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 +290 -754
- package/dist/math/Color.d.ts +1 -0
- package/dist/math/Color.js +10 -0
- package/package.json +1 -1
- package/src/math/Color.ts +14 -1
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 __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function () {
|
|
136
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
137
|
-
|
|
138
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
139
|
-
|
|
140
|
-
return r;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
Object.defineProperty(exports, "__esModule", {
|
|
144
|
-
value: true
|
|
145
|
-
});
|
|
146
|
-
exports.EventHandler = void 0;
|
|
147
|
-
|
|
148
|
-
var EventHandler =
|
|
149
|
-
/** @class */
|
|
150
|
-
function () {
|
|
151
|
-
function EventHandler() {
|
|
152
|
-
this._callbacks = {};
|
|
153
|
-
this._callbackActive = {};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
EventHandler.prototype._addCallback = function (name, callback, scope, once) {
|
|
157
|
-
if (!name || typeof name !== 'string' || !callback) return;
|
|
158
|
-
if (!this._callbacks[name]) this._callbacks[name] = [];
|
|
159
|
-
if (this._callbackActive[name] && this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
160
|
-
|
|
161
|
-
this._callbacks[name].push({
|
|
162
|
-
callback: callback,
|
|
163
|
-
scope: scope || this,
|
|
164
|
-
once: once || false
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* @function
|
|
169
|
-
* @name EventHandler#on
|
|
170
|
-
* @description Attach an event handler to an event.
|
|
171
|
-
* @param {string} name - Name of the event to bind the callback to.
|
|
172
|
-
* @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
|
|
173
|
-
* @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
|
|
174
|
-
* @returns {EventHandler} Self for chaining.
|
|
175
|
-
* @example
|
|
176
|
-
* obj.on('test', function (a, b) {
|
|
177
|
-
* console.log(a + b);
|
|
178
|
-
* });
|
|
179
|
-
* obj.fire('test', 1, 2); // prints 3 to the console
|
|
180
|
-
*/
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
EventHandler.prototype.on = function (name, callback, scope) {
|
|
184
|
-
var _this = this;
|
|
185
|
-
|
|
186
|
-
if (Array.isArray(name)) name.forEach(function (v) {
|
|
187
|
-
return _this._addCallback(v, callback, scope, false);
|
|
188
|
-
});else this._addCallback(name, callback, scope, false);
|
|
189
|
-
return this;
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* @function
|
|
193
|
-
* @name EventHandler#off
|
|
194
|
-
* @description Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event,
|
|
195
|
-
* if scope is not provided then all events with the callback will be unbound.
|
|
196
|
-
* @param {string} [name] - Name of the event to unbind.
|
|
197
|
-
* @param {callbacks.HandleEvent} [callback] - Function to be unbound.
|
|
198
|
-
* @param {object} [scope] - Scope that was used as the this when the event is fired.
|
|
199
|
-
* @returns {EventHandler} Self for chaining.
|
|
200
|
-
* @example
|
|
201
|
-
* var handler = function () {
|
|
202
|
-
* };
|
|
203
|
-
* obj.on('test', handler);
|
|
204
|
-
*
|
|
205
|
-
* obj.off(); // Removes all events
|
|
206
|
-
* obj.off('test'); // Removes all events called 'test'
|
|
207
|
-
* obj.off('test', handler); // Removes all handler functions, called 'test'
|
|
208
|
-
* obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
EventHandler.prototype.off = function (name, callback, scope) {
|
|
213
|
-
if (name) {
|
|
214
|
-
if (this._callbackActive[name] && this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
215
|
-
} else {
|
|
216
|
-
for (var key in this._callbackActive) {
|
|
217
|
-
if (!this._callbacks[key]) continue;
|
|
218
|
-
if (this._callbacks[key] !== this._callbackActive[key]) continue;
|
|
219
|
-
this._callbackActive[key] = this._callbackActive[key].slice();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (!name) {
|
|
224
|
-
this._callbacks = {};
|
|
225
|
-
} else if (!callback) {
|
|
226
|
-
if (this._callbacks[name]) this._callbacks[name] = [];
|
|
227
|
-
} else {
|
|
228
|
-
var events = this._callbacks[name];
|
|
229
|
-
if (!events) return this;
|
|
230
|
-
var count = events.length;
|
|
231
|
-
|
|
232
|
-
for (var i = 0; i < count; i++) {
|
|
233
|
-
if (events[i].callback !== callback) continue;
|
|
234
|
-
if (scope && events[i].scope !== scope) continue;
|
|
235
|
-
events[i--] = events[--count];
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
events.length = count;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return this;
|
|
242
|
-
}; // ESLint rule disabled here as documenting arg1, arg2...argN as [...] rest
|
|
243
|
-
// arguments is preferable to documenting each one individually.
|
|
244
|
-
|
|
245
|
-
/* eslint-disable valid-jsdoc */
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* @function
|
|
249
|
-
* @name EventHandler#fire
|
|
250
|
-
* @description Fire an event, all additional arguments are passed on to the event listener.
|
|
251
|
-
* @param {object} name - Name of event to fire.
|
|
252
|
-
* @param {*} [args] - arguments that is passed to the event handler.
|
|
253
|
-
* obj.fire('test', 'This is the message');
|
|
254
|
-
*/
|
|
255
|
-
|
|
256
|
-
/* eslint-enable valid-jsdoc */
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
EventHandler.prototype.fire = function (name) {
|
|
260
|
-
var _a;
|
|
261
|
-
|
|
262
|
-
var args = [];
|
|
263
|
-
|
|
264
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
265
|
-
args[_i - 1] = arguments[_i];
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (!name || !this._callbacks[name]) return this;
|
|
269
|
-
var callbacks;
|
|
270
|
-
|
|
271
|
-
if (!this._callbackActive[name]) {
|
|
272
|
-
this._callbackActive[name] = this._callbacks[name];
|
|
273
|
-
} else {
|
|
274
|
-
if (this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
275
|
-
callbacks = this._callbacks[name].slice();
|
|
276
|
-
} // TODO: What does callbacks do here?
|
|
277
|
-
// In particular this condition check looks wrong: (i < (callbacks || this._callbackActive[name]).length)
|
|
278
|
-
// Because callbacks is not an integer
|
|
279
|
-
// eslint-disable-next-line no-unmodified-loop-condition
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
for (var i = 0; (callbacks || this._callbackActive[name]) && i < (callbacks || this._callbackActive[name]).length; i++) {
|
|
283
|
-
var evt = (callbacks || this._callbackActive[name])[i];
|
|
284
|
-
|
|
285
|
-
(_a = evt.callback).call.apply(_a, __spreadArrays([evt.scope], args));
|
|
286
|
-
|
|
287
|
-
if (evt.once) {
|
|
288
|
-
var ind = this._callbacks[name].indexOf(evt);
|
|
289
|
-
|
|
290
|
-
if (ind !== -1) {
|
|
291
|
-
if (this._callbackActive[name] === this._callbacks[name]) this._callbackActive[name] = this._callbackActive[name].slice();
|
|
292
|
-
|
|
293
|
-
this._callbacks[name].splice(ind, 1);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (!callbacks) this._callbackActive[name] = null;
|
|
299
|
-
return this;
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* @function
|
|
303
|
-
* @name EventHandler#once
|
|
304
|
-
* @description Attach an event handler to an event. This handler will be removed after being fired once.
|
|
305
|
-
* @param {string} name - Name of the event to bind the callback to.
|
|
306
|
-
* @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
|
|
307
|
-
* @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
|
|
308
|
-
* @returns {EventHandler} Self for chaining.
|
|
309
|
-
* @example
|
|
310
|
-
* obj.once('test', function (a, b) {
|
|
311
|
-
* console.log(a + b);
|
|
312
|
-
* });
|
|
313
|
-
* obj.fire('test', 1, 2); // prints 3 to the console
|
|
314
|
-
* obj.fire('test', 1, 2); // not going to get handled
|
|
315
|
-
*/
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
EventHandler.prototype.once = function (name, callback, scope) {
|
|
319
|
-
this._addCallback(name, callback, scope, true);
|
|
320
|
-
|
|
321
|
-
return this;
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* @function
|
|
325
|
-
* @name EventHandler#hasEvent
|
|
326
|
-
* @description Test if there are any handlers bound to an event name.
|
|
327
|
-
* @param {string} name - The name of the event to test.
|
|
328
|
-
* @returns {boolean} True if the object has handlers bound to the specified event name.
|
|
329
|
-
* @example
|
|
330
|
-
* obj.on('test', function () { }); // bind an event to 'test'
|
|
331
|
-
* obj.hasEvent('test'); // returns true
|
|
332
|
-
* obj.hasEvent('hello'); // returns false
|
|
333
|
-
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
EventHandler.prototype.hasEvent = function (name) {
|
|
337
|
-
return this._callbacks[name] && this._callbacks[name].length !== 0 || false;
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
return EventHandler;
|
|
341
|
-
}();
|
|
342
|
-
|
|
343
|
-
exports.EventHandler = EventHandler;
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
unwrapExports(eventhandler);
|
|
347
|
-
var eventhandler_1 = eventhandler.EventHandler;
|
|
348
|
-
|
|
349
133
|
var Vec2_1 = createCommonjsModule(function (module, exports) {
|
|
350
134
|
|
|
351
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
352
|
-
var extendStatics = function (d, b) {
|
|
353
|
-
extendStatics = Object.setPrototypeOf || {
|
|
354
|
-
__proto__: []
|
|
355
|
-
} instanceof Array && function (d, b) {
|
|
356
|
-
d.__proto__ = b;
|
|
357
|
-
} || function (d, b) {
|
|
358
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
return extendStatics(d, b);
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
return function (d, b) {
|
|
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,30 +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 (b.hasOwnProperty(p)) d[p] = b[p];
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
return extendStatics(d, b);
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
return function (d, b) {
|
|
1087
|
-
extendStatics(d, b);
|
|
1088
|
-
|
|
1089
|
-
function __() {
|
|
1090
|
-
this.constructor = d;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1094
|
-
};
|
|
1095
|
-
}();
|
|
1096
|
-
|
|
1097
824
|
Object.defineProperty(exports, "__esModule", {
|
|
1098
825
|
value: true
|
|
1099
826
|
});
|
|
@@ -1101,13 +828,9 @@
|
|
|
1101
828
|
|
|
1102
829
|
|
|
1103
830
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
831
|
var Quat =
|
|
1107
832
|
/** @class */
|
|
1108
|
-
function (
|
|
1109
|
-
__extends(Quat, _super);
|
|
1110
|
-
|
|
833
|
+
function () {
|
|
1111
834
|
function Quat(_x, _y, _z, _w) {
|
|
1112
835
|
if (_x === void 0) {
|
|
1113
836
|
_x = 0;
|
|
@@ -1125,14 +848,11 @@
|
|
|
1125
848
|
_w = 1;
|
|
1126
849
|
}
|
|
1127
850
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
_this._w = _w;
|
|
1134
|
-
_this.isQuat = true;
|
|
1135
|
-
return _this;
|
|
851
|
+
this._x = _x;
|
|
852
|
+
this._y = _y;
|
|
853
|
+
this._z = _z;
|
|
854
|
+
this._w = _w;
|
|
855
|
+
this.isQuat = true;
|
|
1136
856
|
}
|
|
1137
857
|
|
|
1138
858
|
Object.defineProperty(Quat.prototype, "x", {
|
|
@@ -1141,8 +861,7 @@
|
|
|
1141
861
|
},
|
|
1142
862
|
set: function (value) {
|
|
1143
863
|
if (this._x !== value) {
|
|
1144
|
-
this._x = value;
|
|
1145
|
-
this.fire('change', 'x', this._x, value);
|
|
864
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
1146
865
|
}
|
|
1147
866
|
},
|
|
1148
867
|
enumerable: false,
|
|
@@ -1154,8 +873,7 @@
|
|
|
1154
873
|
},
|
|
1155
874
|
set: function (value) {
|
|
1156
875
|
if (this._y !== value) {
|
|
1157
|
-
this._y = value;
|
|
1158
|
-
this.fire('change', 'y', this._y, value);
|
|
876
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
1159
877
|
}
|
|
1160
878
|
},
|
|
1161
879
|
enumerable: false,
|
|
@@ -1167,8 +885,7 @@
|
|
|
1167
885
|
},
|
|
1168
886
|
set: function (value) {
|
|
1169
887
|
if (this._z !== value) {
|
|
1170
|
-
this._z = value;
|
|
1171
|
-
this.fire('change', 'z', this._z, value);
|
|
888
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
1172
889
|
}
|
|
1173
890
|
},
|
|
1174
891
|
enumerable: false,
|
|
@@ -1180,8 +897,7 @@
|
|
|
1180
897
|
},
|
|
1181
898
|
set: function (value) {
|
|
1182
899
|
if (this._w !== value) {
|
|
1183
|
-
this._w = value;
|
|
1184
|
-
this.fire('change', 'w', this._w, value);
|
|
900
|
+
this._w = value; // this.fire('change', 'w', this._w, value)
|
|
1185
901
|
}
|
|
1186
902
|
},
|
|
1187
903
|
enumerable: false,
|
|
@@ -1257,8 +973,8 @@
|
|
|
1257
973
|
this._x = x;
|
|
1258
974
|
this._y = y;
|
|
1259
975
|
this._z = z;
|
|
1260
|
-
this._w = w;
|
|
1261
|
-
|
|
976
|
+
this._w = w; // this.fire("change", this);
|
|
977
|
+
|
|
1262
978
|
return this;
|
|
1263
979
|
};
|
|
1264
980
|
|
|
@@ -1270,16 +986,12 @@
|
|
|
1270
986
|
this._x = quat.x;
|
|
1271
987
|
this._y = quat.y;
|
|
1272
988
|
this._z = quat.z;
|
|
1273
|
-
this._w = quat.w;
|
|
1274
|
-
|
|
989
|
+
this._w = quat.w; // this.fire("change", this);
|
|
990
|
+
|
|
1275
991
|
return this;
|
|
1276
992
|
};
|
|
1277
993
|
|
|
1278
994
|
Quat.prototype.setFromEuler = function (euler, update) {
|
|
1279
|
-
if (!(euler && euler.isEuler)) {
|
|
1280
|
-
throw new Error("Quat: .setFromEuler() now expects an Euler rotation rather than a Vec3 and order.");
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
995
|
var x = euler._x,
|
|
1284
996
|
y = euler._y,
|
|
1285
997
|
z = euler._z,
|
|
@@ -1326,9 +1038,10 @@
|
|
|
1326
1038
|
this._y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
1327
1039
|
this._z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
1328
1040
|
this._w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
1329
|
-
}
|
|
1041
|
+
} // if (update !== false)
|
|
1042
|
+
// this.fire("change", this);
|
|
1043
|
+
|
|
1330
1044
|
|
|
1331
|
-
if (update !== false) this.fire("change", this);
|
|
1332
1045
|
return this;
|
|
1333
1046
|
};
|
|
1334
1047
|
|
|
@@ -1340,8 +1053,8 @@
|
|
|
1340
1053
|
this._x = axis.x * s;
|
|
1341
1054
|
this._y = axis.y * s;
|
|
1342
1055
|
this._z = axis.z * s;
|
|
1343
|
-
this._w = Math.cos(halfAngle);
|
|
1344
|
-
|
|
1056
|
+
this._w = Math.cos(halfAngle); // this.fire("change", this);
|
|
1057
|
+
|
|
1345
1058
|
return this;
|
|
1346
1059
|
};
|
|
1347
1060
|
|
|
@@ -1385,9 +1098,9 @@
|
|
|
1385
1098
|
this._x = (m13 + m31) / s;
|
|
1386
1099
|
this._y = (m23 + m32) / s;
|
|
1387
1100
|
this._z = 0.25 * s;
|
|
1388
|
-
}
|
|
1101
|
+
} // this.fire("change", this);
|
|
1102
|
+
|
|
1389
1103
|
|
|
1390
|
-
this.fire("change", this);
|
|
1391
1104
|
return this;
|
|
1392
1105
|
};
|
|
1393
1106
|
|
|
@@ -1446,8 +1159,8 @@
|
|
|
1446
1159
|
Quat.prototype.conjugate = function () {
|
|
1447
1160
|
this._x *= -1;
|
|
1448
1161
|
this._y *= -1;
|
|
1449
|
-
this._z *= -1;
|
|
1450
|
-
|
|
1162
|
+
this._z *= -1; // this.fire("change", this);
|
|
1163
|
+
|
|
1451
1164
|
return this;
|
|
1452
1165
|
};
|
|
1453
1166
|
|
|
@@ -1477,9 +1190,9 @@
|
|
|
1477
1190
|
this._y = this._y * l;
|
|
1478
1191
|
this._z = this._z * l;
|
|
1479
1192
|
this._w = this._w * l;
|
|
1480
|
-
}
|
|
1193
|
+
} // this.fire("change", this);
|
|
1194
|
+
|
|
1481
1195
|
|
|
1482
|
-
this.fire("change", this);
|
|
1483
1196
|
return this;
|
|
1484
1197
|
};
|
|
1485
1198
|
|
|
@@ -1508,8 +1221,8 @@
|
|
|
1508
1221
|
this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
|
|
1509
1222
|
this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
|
|
1510
1223
|
this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
|
|
1511
|
-
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
|
|
1512
|
-
|
|
1224
|
+
this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; // this.fire("change", this);
|
|
1225
|
+
|
|
1513
1226
|
return this;
|
|
1514
1227
|
};
|
|
1515
1228
|
|
|
@@ -1549,8 +1262,8 @@
|
|
|
1549
1262
|
this._x = s * x + t * this._x;
|
|
1550
1263
|
this._y = s * y + t * this._y;
|
|
1551
1264
|
this._z = s * z + t * this._z;
|
|
1552
|
-
this.normalize();
|
|
1553
|
-
|
|
1265
|
+
this.normalize(); // this.fire("change", this);
|
|
1266
|
+
|
|
1554
1267
|
return this;
|
|
1555
1268
|
}
|
|
1556
1269
|
|
|
@@ -1561,8 +1274,8 @@
|
|
|
1561
1274
|
this._w = w * ratioA + this._w * ratioB;
|
|
1562
1275
|
this._x = x * ratioA + this._x * ratioB;
|
|
1563
1276
|
this._y = y * ratioA + this._y * ratioB;
|
|
1564
|
-
this._z = z * ratioA + this._z * ratioB;
|
|
1565
|
-
|
|
1277
|
+
this._z = z * ratioA + this._z * ratioB; // this.fire("change", this);
|
|
1278
|
+
|
|
1566
1279
|
return this;
|
|
1567
1280
|
};
|
|
1568
1281
|
|
|
@@ -1578,8 +1291,8 @@
|
|
|
1578
1291
|
this._x = array[offset];
|
|
1579
1292
|
this._y = array[offset + 1];
|
|
1580
1293
|
this._z = array[offset + 2];
|
|
1581
|
-
this._w = array[offset + 3];
|
|
1582
|
-
|
|
1294
|
+
this._w = array[offset + 3]; // this.fire("change", this);
|
|
1295
|
+
|
|
1583
1296
|
return this;
|
|
1584
1297
|
};
|
|
1585
1298
|
|
|
@@ -1600,7 +1313,7 @@
|
|
|
1600
1313
|
};
|
|
1601
1314
|
|
|
1602
1315
|
return Quat;
|
|
1603
|
-
}(
|
|
1316
|
+
}();
|
|
1604
1317
|
|
|
1605
1318
|
exports.Quat = Quat;
|
|
1606
1319
|
|
|
@@ -1993,30 +1706,6 @@
|
|
|
1993
1706
|
|
|
1994
1707
|
var Vec3_1 = createCommonjsModule(function (module, exports) {
|
|
1995
1708
|
|
|
1996
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
1997
|
-
var extendStatics = function (d, b) {
|
|
1998
|
-
extendStatics = Object.setPrototypeOf || {
|
|
1999
|
-
__proto__: []
|
|
2000
|
-
} instanceof Array && function (d, b) {
|
|
2001
|
-
d.__proto__ = b;
|
|
2002
|
-
} || function (d, b) {
|
|
2003
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
2004
|
-
};
|
|
2005
|
-
|
|
2006
|
-
return extendStatics(d, b);
|
|
2007
|
-
};
|
|
2008
|
-
|
|
2009
|
-
return function (d, b) {
|
|
2010
|
-
extendStatics(d, b);
|
|
2011
|
-
|
|
2012
|
-
function __() {
|
|
2013
|
-
this.constructor = d;
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2017
|
-
};
|
|
2018
|
-
}();
|
|
2019
|
-
|
|
2020
1709
|
Object.defineProperty(exports, "__esModule", {
|
|
2021
1710
|
value: true
|
|
2022
1711
|
});
|
|
@@ -2028,13 +1717,9 @@
|
|
|
2028
1717
|
|
|
2029
1718
|
|
|
2030
1719
|
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
1720
|
var Vec3 =
|
|
2034
1721
|
/** @class */
|
|
2035
|
-
function (
|
|
2036
|
-
__extends(Vec3, _super);
|
|
2037
|
-
|
|
1722
|
+
function () {
|
|
2038
1723
|
function Vec3(_x, _y, _z) {
|
|
2039
1724
|
if (_x === void 0) {
|
|
2040
1725
|
_x = 0;
|
|
@@ -2048,12 +1733,9 @@
|
|
|
2048
1733
|
_z = 0;
|
|
2049
1734
|
}
|
|
2050
1735
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
_this._y = _y;
|
|
2055
|
-
_this._z = _z;
|
|
2056
|
-
return _this;
|
|
1736
|
+
this._x = _x;
|
|
1737
|
+
this._y = _y;
|
|
1738
|
+
this._z = _z;
|
|
2057
1739
|
}
|
|
2058
1740
|
|
|
2059
1741
|
Object.defineProperty(Vec3.prototype, "x", {
|
|
@@ -2062,8 +1744,7 @@
|
|
|
2062
1744
|
},
|
|
2063
1745
|
set: function (value) {
|
|
2064
1746
|
if (this._x !== value) {
|
|
2065
|
-
this._x = value;
|
|
2066
|
-
this.fire('change', 'x', this._x, value);
|
|
1747
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
2067
1748
|
}
|
|
2068
1749
|
},
|
|
2069
1750
|
enumerable: false,
|
|
@@ -2075,8 +1756,7 @@
|
|
|
2075
1756
|
},
|
|
2076
1757
|
set: function (value) {
|
|
2077
1758
|
if (this._y !== value) {
|
|
2078
|
-
this._y = value;
|
|
2079
|
-
this.fire('change', 'y', this._y, value);
|
|
1759
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
2080
1760
|
}
|
|
2081
1761
|
},
|
|
2082
1762
|
enumerable: false,
|
|
@@ -2088,8 +1768,7 @@
|
|
|
2088
1768
|
},
|
|
2089
1769
|
set: function (value) {
|
|
2090
1770
|
if (this._z !== value) {
|
|
2091
|
-
this._z = value;
|
|
2092
|
-
this.fire('change', 'z', this._z, value);
|
|
1771
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
2093
1772
|
}
|
|
2094
1773
|
},
|
|
2095
1774
|
enumerable: false,
|
|
@@ -2146,16 +1825,16 @@
|
|
|
2146
1825
|
Vec3.prototype.set = function (x, y, z) {
|
|
2147
1826
|
this._x = x;
|
|
2148
1827
|
this._y = y;
|
|
2149
|
-
this._z = z;
|
|
2150
|
-
|
|
1828
|
+
this._z = z; //// this.fire('change');
|
|
1829
|
+
|
|
2151
1830
|
return this;
|
|
2152
1831
|
};
|
|
2153
1832
|
|
|
2154
1833
|
Vec3.prototype.setScalar = function (scalar) {
|
|
2155
1834
|
this._x = scalar;
|
|
2156
1835
|
this._y = scalar;
|
|
2157
|
-
this._z = scalar;
|
|
2158
|
-
|
|
1836
|
+
this._z = scalar; // this.fire('change');
|
|
1837
|
+
|
|
2159
1838
|
return this;
|
|
2160
1839
|
};
|
|
2161
1840
|
|
|
@@ -2203,8 +1882,8 @@
|
|
|
2203
1882
|
Vec3.prototype.copy = function (v) {
|
|
2204
1883
|
this._x = v.x;
|
|
2205
1884
|
this._y = v.y;
|
|
2206
|
-
this._z = v.z;
|
|
2207
|
-
|
|
1885
|
+
this._z = v.z; // this.fire('change');
|
|
1886
|
+
|
|
2208
1887
|
return this;
|
|
2209
1888
|
};
|
|
2210
1889
|
|
|
@@ -2216,32 +1895,32 @@
|
|
|
2216
1895
|
|
|
2217
1896
|
this._x += v.x;
|
|
2218
1897
|
this._y += v.y;
|
|
2219
|
-
this._z += v.z;
|
|
2220
|
-
|
|
1898
|
+
this._z += v.z; // this.fire('change');
|
|
1899
|
+
|
|
2221
1900
|
return this;
|
|
2222
1901
|
};
|
|
2223
1902
|
|
|
2224
1903
|
Vec3.prototype.addScalar = function (s) {
|
|
2225
1904
|
this._x += s;
|
|
2226
1905
|
this._y += s;
|
|
2227
|
-
this._z += s;
|
|
2228
|
-
|
|
1906
|
+
this._z += s; // this.fire('change');
|
|
1907
|
+
|
|
2229
1908
|
return this;
|
|
2230
1909
|
};
|
|
2231
1910
|
|
|
2232
1911
|
Vec3.prototype.addVecs = function (a, b) {
|
|
2233
1912
|
this._x = a.x + b.x;
|
|
2234
1913
|
this._y = a.y + b.y;
|
|
2235
|
-
this._z = a.z + b.z;
|
|
2236
|
-
|
|
1914
|
+
this._z = a.z + b.z; // this.fire('change');
|
|
1915
|
+
|
|
2237
1916
|
return this;
|
|
2238
1917
|
};
|
|
2239
1918
|
|
|
2240
1919
|
Vec3.prototype.addScaledVec = function (v, s) {
|
|
2241
1920
|
this._x += v.x * s;
|
|
2242
1921
|
this._y += v.y * s;
|
|
2243
|
-
this._z += v.z * s;
|
|
2244
|
-
|
|
1922
|
+
this._z += v.z * s; // this.fire('change');
|
|
1923
|
+
|
|
2245
1924
|
return this;
|
|
2246
1925
|
};
|
|
2247
1926
|
|
|
@@ -2253,24 +1932,24 @@
|
|
|
2253
1932
|
|
|
2254
1933
|
this._x -= v.x;
|
|
2255
1934
|
this._y -= v.y;
|
|
2256
|
-
this._z -= v.z;
|
|
2257
|
-
|
|
1935
|
+
this._z -= v.z; // this.fire('change');
|
|
1936
|
+
|
|
2258
1937
|
return this;
|
|
2259
1938
|
};
|
|
2260
1939
|
|
|
2261
1940
|
Vec3.prototype.subScalar = function (s) {
|
|
2262
1941
|
this._x -= s;
|
|
2263
1942
|
this._y -= s;
|
|
2264
|
-
this._z -= s;
|
|
2265
|
-
|
|
1943
|
+
this._z -= s; // this.fire('change');
|
|
1944
|
+
|
|
2266
1945
|
return this;
|
|
2267
1946
|
};
|
|
2268
1947
|
|
|
2269
1948
|
Vec3.prototype.subVecs = function (a, b) {
|
|
2270
1949
|
this._x = a.x - b.x;
|
|
2271
1950
|
this._y = a.y - b.y;
|
|
2272
|
-
this._z = a.z - b.z;
|
|
2273
|
-
|
|
1951
|
+
this._z = a.z - b.z; // this.fire('change');
|
|
1952
|
+
|
|
2274
1953
|
return this;
|
|
2275
1954
|
};
|
|
2276
1955
|
|
|
@@ -2281,24 +1960,24 @@
|
|
|
2281
1960
|
|
|
2282
1961
|
this._x *= v.x;
|
|
2283
1962
|
this._y *= v.y;
|
|
2284
|
-
this._z *= v.z;
|
|
2285
|
-
|
|
1963
|
+
this._z *= v.z; // this.fire('change');
|
|
1964
|
+
|
|
2286
1965
|
return this;
|
|
2287
1966
|
};
|
|
2288
1967
|
|
|
2289
1968
|
Vec3.prototype.multiplyScalar = function (scalar) {
|
|
2290
1969
|
this._x *= scalar;
|
|
2291
1970
|
this._y *= scalar;
|
|
2292
|
-
this._z *= scalar;
|
|
2293
|
-
|
|
1971
|
+
this._z *= scalar; // this.fire('change');
|
|
1972
|
+
|
|
2294
1973
|
return this;
|
|
2295
1974
|
};
|
|
2296
1975
|
|
|
2297
1976
|
Vec3.prototype.multiplyVecs = function (a, b) {
|
|
2298
1977
|
this._x = a.x * b.x;
|
|
2299
1978
|
this._y = a.y * b.y;
|
|
2300
|
-
this._z = a.z * b.z;
|
|
2301
|
-
|
|
1979
|
+
this._z = a.z * b.z; // this.fire('change');
|
|
1980
|
+
|
|
2302
1981
|
return this;
|
|
2303
1982
|
};
|
|
2304
1983
|
|
|
@@ -2325,8 +2004,8 @@
|
|
|
2325
2004
|
var e = m.elements;
|
|
2326
2005
|
this._x = e[0] * x + e[3] * y + e[6] * z;
|
|
2327
2006
|
this._y = e[1] * x + e[4] * y + e[7] * z;
|
|
2328
|
-
this._z = e[2] * x + e[5] * y + e[8] * z;
|
|
2329
|
-
|
|
2007
|
+
this._z = e[2] * x + e[5] * y + e[8] * z; // this.fire('change');
|
|
2008
|
+
|
|
2330
2009
|
return this;
|
|
2331
2010
|
};
|
|
2332
2011
|
|
|
@@ -2338,8 +2017,8 @@
|
|
|
2338
2017
|
var w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
|
|
2339
2018
|
this._x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
|
|
2340
2019
|
this._y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
|
|
2341
|
-
this._z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
|
|
2342
|
-
|
|
2020
|
+
this._z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w; // this.fire('change');
|
|
2021
|
+
|
|
2343
2022
|
return this;
|
|
2344
2023
|
};
|
|
2345
2024
|
|
|
@@ -2359,8 +2038,8 @@
|
|
|
2359
2038
|
|
|
2360
2039
|
this._x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
|
2361
2040
|
this._y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
2362
|
-
this._z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
2363
|
-
|
|
2041
|
+
this._z = iz * qw + iw * -qz + ix * -qy - iy * -qx; // this.fire('change');
|
|
2042
|
+
|
|
2364
2043
|
return this;
|
|
2365
2044
|
};
|
|
2366
2045
|
|
|
@@ -2381,16 +2060,16 @@
|
|
|
2381
2060
|
var e = m.elements;
|
|
2382
2061
|
this._x = e[0] * x + e[4] * y + e[8] * z;
|
|
2383
2062
|
this._y = e[1] * x + e[5] * y + e[9] * z;
|
|
2384
|
-
this._z = e[2] * x + e[6] * y + e[10] * z;
|
|
2385
|
-
|
|
2063
|
+
this._z = e[2] * x + e[6] * y + e[10] * z; // this.fire('change');
|
|
2064
|
+
|
|
2386
2065
|
return this.normalize();
|
|
2387
2066
|
};
|
|
2388
2067
|
|
|
2389
2068
|
Vec3.prototype.divide = function (v) {
|
|
2390
2069
|
this._x /= v.x;
|
|
2391
2070
|
this._y /= v.y;
|
|
2392
|
-
this._z /= v.z;
|
|
2393
|
-
|
|
2071
|
+
this._z /= v.z; // this.fire('change');
|
|
2072
|
+
|
|
2394
2073
|
return this;
|
|
2395
2074
|
};
|
|
2396
2075
|
|
|
@@ -2401,16 +2080,16 @@
|
|
|
2401
2080
|
Vec3.prototype.min = function (v) {
|
|
2402
2081
|
this._x = Math.min(this._x, v.x);
|
|
2403
2082
|
this._y = Math.min(this._y, v.y);
|
|
2404
|
-
this._z = Math.min(this._z, v.z);
|
|
2405
|
-
|
|
2083
|
+
this._z = Math.min(this._z, v.z); // this.fire('change');
|
|
2084
|
+
|
|
2406
2085
|
return this;
|
|
2407
2086
|
};
|
|
2408
2087
|
|
|
2409
2088
|
Vec3.prototype.max = function (v) {
|
|
2410
2089
|
this._x = Math.max(this._x, v.x);
|
|
2411
2090
|
this._y = Math.max(this._y, v.y);
|
|
2412
|
-
this._z = Math.max(this._z, v.z);
|
|
2413
|
-
|
|
2091
|
+
this._z = Math.max(this._z, v.z); // this.fire('change');
|
|
2092
|
+
|
|
2414
2093
|
return this;
|
|
2415
2094
|
};
|
|
2416
2095
|
|
|
@@ -2418,16 +2097,16 @@
|
|
|
2418
2097
|
// assumes min < max, componentwise
|
|
2419
2098
|
this._x = Math.max(min.x, Math.min(max.x, this._x));
|
|
2420
2099
|
this._y = Math.max(min.y, Math.min(max.y, this._y));
|
|
2421
|
-
this._z = Math.max(min.z, Math.min(max.z, this._z));
|
|
2422
|
-
|
|
2100
|
+
this._z = Math.max(min.z, Math.min(max.z, this._z)); // this.fire('change');
|
|
2101
|
+
|
|
2423
2102
|
return this;
|
|
2424
2103
|
};
|
|
2425
2104
|
|
|
2426
2105
|
Vec3.prototype.clampScalar = function (minVal, maxVal) {
|
|
2427
2106
|
this._x = Math.max(minVal, Math.min(maxVal, this._x));
|
|
2428
2107
|
this._y = Math.max(minVal, Math.min(maxVal, this._y));
|
|
2429
|
-
this._z = Math.max(minVal, Math.min(maxVal, this._z));
|
|
2430
|
-
|
|
2108
|
+
this._z = Math.max(minVal, Math.min(maxVal, this._z)); // this.fire('change');
|
|
2109
|
+
|
|
2431
2110
|
return this;
|
|
2432
2111
|
};
|
|
2433
2112
|
|
|
@@ -2439,40 +2118,40 @@
|
|
|
2439
2118
|
Vec3.prototype.floor = function () {
|
|
2440
2119
|
this._x = Math.floor(this._x);
|
|
2441
2120
|
this._y = Math.floor(this._y);
|
|
2442
|
-
this._z = Math.floor(this._z);
|
|
2443
|
-
|
|
2121
|
+
this._z = Math.floor(this._z); // this.fire('change');
|
|
2122
|
+
|
|
2444
2123
|
return this;
|
|
2445
2124
|
};
|
|
2446
2125
|
|
|
2447
2126
|
Vec3.prototype.ceil = function () {
|
|
2448
2127
|
this._x = Math.ceil(this._x);
|
|
2449
2128
|
this._y = Math.ceil(this._y);
|
|
2450
|
-
this._z = Math.ceil(this._z);
|
|
2451
|
-
|
|
2129
|
+
this._z = Math.ceil(this._z); // this.fire('change');
|
|
2130
|
+
|
|
2452
2131
|
return this;
|
|
2453
2132
|
};
|
|
2454
2133
|
|
|
2455
2134
|
Vec3.prototype.round = function () {
|
|
2456
2135
|
this._x = Math.round(this._x);
|
|
2457
2136
|
this._y = Math.round(this._y);
|
|
2458
|
-
this._z = Math.round(this._z);
|
|
2459
|
-
|
|
2137
|
+
this._z = Math.round(this._z); // this.fire('change');
|
|
2138
|
+
|
|
2460
2139
|
return this;
|
|
2461
2140
|
};
|
|
2462
2141
|
|
|
2463
2142
|
Vec3.prototype.roundToZero = function () {
|
|
2464
2143
|
this._x = this._x < 0 ? Math.ceil(this._x) : Math.floor(this._x);
|
|
2465
2144
|
this._y = this._y < 0 ? Math.ceil(this._y) : Math.floor(this._y);
|
|
2466
|
-
this._z = this._z < 0 ? Math.ceil(this._z) : Math.floor(this._z);
|
|
2467
|
-
|
|
2145
|
+
this._z = this._z < 0 ? Math.ceil(this._z) : Math.floor(this._z); // this.fire('change');
|
|
2146
|
+
|
|
2468
2147
|
return this;
|
|
2469
2148
|
};
|
|
2470
2149
|
|
|
2471
2150
|
Vec3.prototype.negate = function () {
|
|
2472
2151
|
this._x = -this._x;
|
|
2473
2152
|
this._y = -this._y;
|
|
2474
|
-
this._z = -this._z;
|
|
2475
|
-
|
|
2153
|
+
this._z = -this._z; // this.fire('change');
|
|
2154
|
+
|
|
2476
2155
|
return this;
|
|
2477
2156
|
};
|
|
2478
2157
|
|
|
@@ -3254,63 +2933,35 @@
|
|
|
3254
2933
|
};
|
|
3255
2934
|
|
|
3256
2935
|
return Vec3;
|
|
3257
|
-
}(
|
|
2936
|
+
}();
|
|
3258
2937
|
|
|
3259
2938
|
exports.Vec3 = Vec3;
|
|
3260
2939
|
|
|
3261
|
-
var _vec = v3();
|
|
3262
|
-
|
|
3263
|
-
var _quat = Quat_1.quat();
|
|
3264
|
-
|
|
3265
|
-
function v3(x, y, z) {
|
|
3266
|
-
return new Vec3(x, y, z);
|
|
3267
|
-
}
|
|
3268
|
-
|
|
3269
|
-
exports.v3 = v3;
|
|
3270
|
-
});
|
|
3271
|
-
|
|
3272
|
-
unwrapExports(Vec3_1);
|
|
3273
|
-
var Vec3_2 = Vec3_1.v3;
|
|
3274
|
-
var Vec3_3 = Vec3_1.Vec3;
|
|
3275
|
-
|
|
3276
|
-
var Vec4_1 = createCommonjsModule(function (module, exports) {
|
|
3277
|
-
|
|
3278
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
3279
|
-
var extendStatics = function (d, b) {
|
|
3280
|
-
extendStatics = Object.setPrototypeOf || {
|
|
3281
|
-
__proto__: []
|
|
3282
|
-
} instanceof Array && function (d, b) {
|
|
3283
|
-
d.__proto__ = b;
|
|
3284
|
-
} || function (d, b) {
|
|
3285
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
3286
|
-
};
|
|
3287
|
-
|
|
3288
|
-
return extendStatics(d, b);
|
|
3289
|
-
};
|
|
2940
|
+
var _vec = v3();
|
|
3290
2941
|
|
|
3291
|
-
|
|
3292
|
-
extendStatics(d, b);
|
|
2942
|
+
var _quat = Quat_1.quat();
|
|
3293
2943
|
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
2944
|
+
function v3(x, y, z) {
|
|
2945
|
+
return new Vec3(x, y, z);
|
|
2946
|
+
}
|
|
3297
2947
|
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
2948
|
+
exports.v3 = v3;
|
|
2949
|
+
});
|
|
2950
|
+
|
|
2951
|
+
unwrapExports(Vec3_1);
|
|
2952
|
+
var Vec3_2 = Vec3_1.v3;
|
|
2953
|
+
var Vec3_3 = Vec3_1.Vec3;
|
|
2954
|
+
|
|
2955
|
+
var Vec4_1 = createCommonjsModule(function (module, exports) {
|
|
3301
2956
|
|
|
3302
2957
|
Object.defineProperty(exports, "__esModule", {
|
|
3303
2958
|
value: true
|
|
3304
2959
|
});
|
|
3305
2960
|
exports.v4 = exports.Vec4 = void 0;
|
|
3306
2961
|
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
2962
|
var Vec4 =
|
|
3310
2963
|
/** @class */
|
|
3311
|
-
function (
|
|
3312
|
-
__extends(Vec4, _super);
|
|
3313
|
-
|
|
2964
|
+
function () {
|
|
3314
2965
|
function Vec4(_x, _y, _z, _w) {
|
|
3315
2966
|
if (_x === void 0) {
|
|
3316
2967
|
_x = 0;
|
|
@@ -3328,14 +2979,11 @@
|
|
|
3328
2979
|
_w = 1;
|
|
3329
2980
|
}
|
|
3330
2981
|
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
_this._w = _w;
|
|
3337
|
-
_this.isVec4 = true;
|
|
3338
|
-
return _this;
|
|
2982
|
+
this._x = _x;
|
|
2983
|
+
this._y = _y;
|
|
2984
|
+
this._z = _z;
|
|
2985
|
+
this._w = _w;
|
|
2986
|
+
this.isVec4 = true;
|
|
3339
2987
|
}
|
|
3340
2988
|
|
|
3341
2989
|
Object.defineProperty(Vec4.prototype, "x", {
|
|
@@ -3344,8 +2992,7 @@
|
|
|
3344
2992
|
},
|
|
3345
2993
|
set: function (value) {
|
|
3346
2994
|
if (this._x !== value) {
|
|
3347
|
-
this._x = value;
|
|
3348
|
-
this.fire('change', 'x', this._x, value);
|
|
2995
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
3349
2996
|
}
|
|
3350
2997
|
},
|
|
3351
2998
|
enumerable: false,
|
|
@@ -3357,8 +3004,7 @@
|
|
|
3357
3004
|
},
|
|
3358
3005
|
set: function (value) {
|
|
3359
3006
|
if (this._y !== value) {
|
|
3360
|
-
this._y = value;
|
|
3361
|
-
this.fire('change', 'y', this._y, value);
|
|
3007
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
3362
3008
|
}
|
|
3363
3009
|
},
|
|
3364
3010
|
enumerable: false,
|
|
@@ -3370,8 +3016,7 @@
|
|
|
3370
3016
|
},
|
|
3371
3017
|
set: function (value) {
|
|
3372
3018
|
if (this._z !== value) {
|
|
3373
|
-
this._z = value;
|
|
3374
|
-
this.fire('change', 'z', this._z, value);
|
|
3019
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
3375
3020
|
}
|
|
3376
3021
|
},
|
|
3377
3022
|
enumerable: false,
|
|
@@ -3383,8 +3028,7 @@
|
|
|
3383
3028
|
},
|
|
3384
3029
|
set: function (value) {
|
|
3385
3030
|
if (this._w !== value) {
|
|
3386
|
-
this._w = value;
|
|
3387
|
-
this.fire('change', 'w', this._w, value);
|
|
3031
|
+
this._w = value; // this.fire('change', 'w', this._w, value)
|
|
3388
3032
|
}
|
|
3389
3033
|
},
|
|
3390
3034
|
enumerable: false,
|
|
@@ -3870,7 +3514,7 @@
|
|
|
3870
3514
|
};
|
|
3871
3515
|
|
|
3872
3516
|
return Vec4;
|
|
3873
|
-
}(
|
|
3517
|
+
}();
|
|
3874
3518
|
|
|
3875
3519
|
exports.Vec4 = Vec4;
|
|
3876
3520
|
|
|
@@ -5113,30 +4757,6 @@
|
|
|
5113
4757
|
|
|
5114
4758
|
var Euler_1 = createCommonjsModule(function (module, exports) {
|
|
5115
4759
|
|
|
5116
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
5117
|
-
var extendStatics = function (d, b) {
|
|
5118
|
-
extendStatics = Object.setPrototypeOf || {
|
|
5119
|
-
__proto__: []
|
|
5120
|
-
} instanceof Array && function (d, b) {
|
|
5121
|
-
d.__proto__ = b;
|
|
5122
|
-
} || function (d, b) {
|
|
5123
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
5124
|
-
};
|
|
5125
|
-
|
|
5126
|
-
return extendStatics(d, b);
|
|
5127
|
-
};
|
|
5128
|
-
|
|
5129
|
-
return function (d, b) {
|
|
5130
|
-
extendStatics(d, b);
|
|
5131
|
-
|
|
5132
|
-
function __() {
|
|
5133
|
-
this.constructor = d;
|
|
5134
|
-
}
|
|
5135
|
-
|
|
5136
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
5137
|
-
};
|
|
5138
|
-
}();
|
|
5139
|
-
|
|
5140
4760
|
Object.defineProperty(exports, "__esModule", {
|
|
5141
4761
|
value: true
|
|
5142
4762
|
});
|
|
@@ -5150,8 +4770,6 @@
|
|
|
5150
4770
|
|
|
5151
4771
|
|
|
5152
4772
|
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
4773
|
var _matrix = Mat4_1.m4();
|
|
5156
4774
|
|
|
5157
4775
|
var _Quat = Quat_1.quat();
|
|
@@ -5159,9 +4777,7 @@
|
|
|
5159
4777
|
|
|
5160
4778
|
var Euler =
|
|
5161
4779
|
/** @class */
|
|
5162
|
-
function (
|
|
5163
|
-
__extends(Euler, _super);
|
|
5164
|
-
|
|
4780
|
+
function () {
|
|
5165
4781
|
function Euler(_x, _y, _z, _order) {
|
|
5166
4782
|
if (_x === void 0) {
|
|
5167
4783
|
_x = 0;
|
|
@@ -5179,14 +4795,11 @@
|
|
|
5179
4795
|
_order = DefaultOrder;
|
|
5180
4796
|
}
|
|
5181
4797
|
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
_this._order = _order;
|
|
5188
|
-
_this.isEuler = true;
|
|
5189
|
-
return _this;
|
|
4798
|
+
this._x = _x;
|
|
4799
|
+
this._y = _y;
|
|
4800
|
+
this._z = _z;
|
|
4801
|
+
this._order = _order;
|
|
4802
|
+
this.isEuler = true;
|
|
5190
4803
|
}
|
|
5191
4804
|
|
|
5192
4805
|
Object.defineProperty(Euler.prototype, "x", {
|
|
@@ -5195,8 +4808,7 @@
|
|
|
5195
4808
|
},
|
|
5196
4809
|
set: function (value) {
|
|
5197
4810
|
if (this._x !== value) {
|
|
5198
|
-
this._x = value;
|
|
5199
|
-
this.fire('change', 'x', this._x, value);
|
|
4811
|
+
this._x = value; // this.fire('change', 'x', this._x, value)
|
|
5200
4812
|
}
|
|
5201
4813
|
},
|
|
5202
4814
|
enumerable: false,
|
|
@@ -5208,8 +4820,7 @@
|
|
|
5208
4820
|
},
|
|
5209
4821
|
set: function (value) {
|
|
5210
4822
|
if (this._y !== value) {
|
|
5211
|
-
this._y = value;
|
|
5212
|
-
this.fire('change', 'y', this._y, value);
|
|
4823
|
+
this._y = value; // this.fire('change', 'y', this._y, value)
|
|
5213
4824
|
}
|
|
5214
4825
|
},
|
|
5215
4826
|
enumerable: false,
|
|
@@ -5221,8 +4832,7 @@
|
|
|
5221
4832
|
},
|
|
5222
4833
|
set: function (value) {
|
|
5223
4834
|
if (this._z !== value) {
|
|
5224
|
-
this._z = value;
|
|
5225
|
-
this.fire('change', 'z', this._z, value);
|
|
4835
|
+
this._z = value; // this.fire('change', 'z', this._z, value)
|
|
5226
4836
|
}
|
|
5227
4837
|
},
|
|
5228
4838
|
enumerable: false,
|
|
@@ -5234,7 +4844,7 @@
|
|
|
5234
4844
|
},
|
|
5235
4845
|
set: function (value) {
|
|
5236
4846
|
if (this._order !== value) {
|
|
5237
|
-
this.fire('change', 'order', this._order, value)
|
|
4847
|
+
// this.fire('change', 'order', this._order, value)
|
|
5238
4848
|
this._order = value;
|
|
5239
4849
|
}
|
|
5240
4850
|
},
|
|
@@ -5246,8 +4856,8 @@
|
|
|
5246
4856
|
this._x = x;
|
|
5247
4857
|
this._y = y;
|
|
5248
4858
|
this._z = z;
|
|
5249
|
-
this._order = order || this._order;
|
|
5250
|
-
|
|
4859
|
+
this._order = order || this._order; // this.fire('change')
|
|
4860
|
+
|
|
5251
4861
|
return this;
|
|
5252
4862
|
};
|
|
5253
4863
|
|
|
@@ -5259,8 +4869,8 @@
|
|
|
5259
4869
|
this._x = Euler._x;
|
|
5260
4870
|
this._y = Euler._y;
|
|
5261
4871
|
this._z = Euler._z;
|
|
5262
|
-
this._order = Euler._order;
|
|
5263
|
-
|
|
4872
|
+
this._order = Euler._order; // this.fire('change')
|
|
4873
|
+
|
|
5264
4874
|
return this;
|
|
5265
4875
|
};
|
|
5266
4876
|
|
|
@@ -5343,8 +4953,8 @@
|
|
|
5343
4953
|
}
|
|
5344
4954
|
|
|
5345
4955
|
this._order = order;
|
|
5346
|
-
if (update !== false) this.fire('change')
|
|
5347
|
-
|
|
4956
|
+
if (update !== false) // this.fire('change')
|
|
4957
|
+
return this;
|
|
5348
4958
|
};
|
|
5349
4959
|
|
|
5350
4960
|
Euler.prototype.setFromQuat = function (q, order, update) {
|
|
@@ -5372,8 +4982,8 @@
|
|
|
5372
4982
|
this._x = array[0];
|
|
5373
4983
|
this._y = array[1];
|
|
5374
4984
|
this._z = array[2];
|
|
5375
|
-
if (array[3] !== undefined) this._order = array[3];
|
|
5376
|
-
|
|
4985
|
+
if (array[3] !== undefined) this._order = array[3]; // this.fire('change')
|
|
4986
|
+
|
|
5377
4987
|
return this;
|
|
5378
4988
|
};
|
|
5379
4989
|
|
|
@@ -5402,7 +5012,7 @@
|
|
|
5402
5012
|
};
|
|
5403
5013
|
|
|
5404
5014
|
return Euler;
|
|
5405
|
-
}(
|
|
5015
|
+
}();
|
|
5406
5016
|
|
|
5407
5017
|
exports.Euler = Euler;
|
|
5408
5018
|
|
|
@@ -5419,42 +5029,14 @@
|
|
|
5419
5029
|
|
|
5420
5030
|
var Color_1 = createCommonjsModule(function (module, exports) {
|
|
5421
5031
|
|
|
5422
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
5423
|
-
var extendStatics = function (d, b) {
|
|
5424
|
-
extendStatics = Object.setPrototypeOf || {
|
|
5425
|
-
__proto__: []
|
|
5426
|
-
} instanceof Array && function (d, b) {
|
|
5427
|
-
d.__proto__ = b;
|
|
5428
|
-
} || function (d, b) {
|
|
5429
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
5430
|
-
};
|
|
5431
|
-
|
|
5432
|
-
return extendStatics(d, b);
|
|
5433
|
-
};
|
|
5434
|
-
|
|
5435
|
-
return function (d, b) {
|
|
5436
|
-
extendStatics(d, b);
|
|
5437
|
-
|
|
5438
|
-
function __() {
|
|
5439
|
-
this.constructor = d;
|
|
5440
|
-
}
|
|
5441
|
-
|
|
5442
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
5443
|
-
};
|
|
5444
|
-
}();
|
|
5445
|
-
|
|
5446
5032
|
Object.defineProperty(exports, "__esModule", {
|
|
5447
5033
|
value: true
|
|
5448
5034
|
});
|
|
5449
5035
|
exports.Color = void 0;
|
|
5450
5036
|
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
5037
|
var Color =
|
|
5454
5038
|
/** @class */
|
|
5455
|
-
function (
|
|
5456
|
-
__extends(Color, _super);
|
|
5457
|
-
|
|
5039
|
+
function () {
|
|
5458
5040
|
function Color(r, g, b, a) {
|
|
5459
5041
|
if (r === void 0) {
|
|
5460
5042
|
r = 0;
|
|
@@ -5472,17 +5054,14 @@
|
|
|
5472
5054
|
a = 1;
|
|
5473
5055
|
}
|
|
5474
5056
|
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
_this._b = b;
|
|
5484
|
-
_this._a = a;
|
|
5485
|
-
return _this;
|
|
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;
|
|
5486
5065
|
}
|
|
5487
5066
|
|
|
5488
5067
|
Object.defineProperty(Color.prototype, "isColor", {
|
|
@@ -5498,8 +5077,7 @@
|
|
|
5498
5077
|
},
|
|
5499
5078
|
set: function (value) {
|
|
5500
5079
|
if (this._r !== value) {
|
|
5501
|
-
this._r = value;
|
|
5502
|
-
this.fire('change', 'r', this._r, value);
|
|
5080
|
+
this._r = value; // this.fire('change', 'r', this._r, value)
|
|
5503
5081
|
}
|
|
5504
5082
|
},
|
|
5505
5083
|
enumerable: false,
|
|
@@ -5511,8 +5089,7 @@
|
|
|
5511
5089
|
},
|
|
5512
5090
|
set: function (value) {
|
|
5513
5091
|
if (this._g !== value) {
|
|
5514
|
-
this._g = value;
|
|
5515
|
-
this.fire('change', 'g', this._g, value);
|
|
5092
|
+
this._g = value; // this.fire('change', 'g', this._g, value)
|
|
5516
5093
|
}
|
|
5517
5094
|
},
|
|
5518
5095
|
enumerable: false,
|
|
@@ -5524,8 +5101,7 @@
|
|
|
5524
5101
|
},
|
|
5525
5102
|
set: function (value) {
|
|
5526
5103
|
if (this._b !== value) {
|
|
5527
|
-
this._b = value;
|
|
5528
|
-
this.fire('change', 'b', this._b, value);
|
|
5104
|
+
this._b = value; // this.fire('change', 'b', this._b, value)
|
|
5529
5105
|
}
|
|
5530
5106
|
},
|
|
5531
5107
|
enumerable: false,
|
|
@@ -5537,8 +5113,7 @@
|
|
|
5537
5113
|
},
|
|
5538
5114
|
set: function (value) {
|
|
5539
5115
|
if (this._a !== value) {
|
|
5540
|
-
this._a = value;
|
|
5541
|
-
this.fire('change', 'a', this._a, value);
|
|
5116
|
+
this._a = value; // this.fire('change', 'a', this._a, value)
|
|
5542
5117
|
}
|
|
5543
5118
|
},
|
|
5544
5119
|
enumerable: false,
|
|
@@ -5691,7 +5266,7 @@
|
|
|
5691
5266
|
};
|
|
5692
5267
|
|
|
5693
5268
|
return Color;
|
|
5694
|
-
}(
|
|
5269
|
+
}();
|
|
5695
5270
|
|
|
5696
5271
|
exports.Color = Color;
|
|
5697
5272
|
});
|
|
@@ -6271,75 +5846,6 @@
|
|
|
6271
5846
|
var type_1 = type.Orientation;
|
|
6272
5847
|
var type_2 = type.IntersectType;
|
|
6273
5848
|
|
|
6274
|
-
var Vec_1 = createCommonjsModule(function (module, exports) {
|
|
6275
|
-
|
|
6276
|
-
var __extends = commonjsGlobal && commonjsGlobal.__extends || function () {
|
|
6277
|
-
var extendStatics = function (d, b) {
|
|
6278
|
-
extendStatics = Object.setPrototypeOf || {
|
|
6279
|
-
__proto__: []
|
|
6280
|
-
} instanceof Array && function (d, b) {
|
|
6281
|
-
d.__proto__ = b;
|
|
6282
|
-
} || function (d, b) {
|
|
6283
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
6284
|
-
};
|
|
6285
|
-
|
|
6286
|
-
return extendStatics(d, b);
|
|
6287
|
-
};
|
|
6288
|
-
|
|
6289
|
-
return function (d, b) {
|
|
6290
|
-
extendStatics(d, b);
|
|
6291
|
-
|
|
6292
|
-
function __() {
|
|
6293
|
-
this.constructor = d;
|
|
6294
|
-
}
|
|
6295
|
-
|
|
6296
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6297
|
-
};
|
|
6298
|
-
}();
|
|
6299
|
-
|
|
6300
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6301
|
-
value: true
|
|
6302
|
-
});
|
|
6303
|
-
exports.Vec = void 0;
|
|
6304
|
-
/**
|
|
6305
|
-
* 暂不使用
|
|
6306
|
-
*/
|
|
6307
|
-
|
|
6308
|
-
var Vec =
|
|
6309
|
-
/** @class */
|
|
6310
|
-
function (_super) {
|
|
6311
|
-
__extends(Vec, _super);
|
|
6312
|
-
|
|
6313
|
-
function Vec(n) {
|
|
6314
|
-
var _this = _super.call(this) || this;
|
|
6315
|
-
|
|
6316
|
-
while (n-- > 0) {
|
|
6317
|
-
_this[_this.length] = 0;
|
|
6318
|
-
}
|
|
6319
|
-
|
|
6320
|
-
return _this;
|
|
6321
|
-
}
|
|
6322
|
-
|
|
6323
|
-
Vec.max = function (array) {
|
|
6324
|
-
if (array.length === 0) return -Infinity;
|
|
6325
|
-
var max = array[0];
|
|
6326
|
-
|
|
6327
|
-
for (var i = 1, l = array.length; i < l; ++i) {
|
|
6328
|
-
if (array[i] > max) max = array[i];
|
|
6329
|
-
}
|
|
6330
|
-
|
|
6331
|
-
return max;
|
|
6332
|
-
};
|
|
6333
|
-
|
|
6334
|
-
return Vec;
|
|
6335
|
-
}(Array);
|
|
6336
|
-
|
|
6337
|
-
exports.Vec = Vec;
|
|
6338
|
-
});
|
|
6339
|
-
|
|
6340
|
-
unwrapExports(Vec_1);
|
|
6341
|
-
var Vec_2 = Vec_1.Vec;
|
|
6342
|
-
|
|
6343
5849
|
var Box_1 = createCommonjsModule(function (module, exports) {
|
|
6344
5850
|
|
|
6345
5851
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6573,6 +6079,11 @@
|
|
|
6573
6079
|
|
|
6574
6080
|
|
|
6575
6081
|
var _vector = new Vec3_1.Vec3();
|
|
6082
|
+
/**
|
|
6083
|
+
* 几何体buffer属性
|
|
6084
|
+
* 记录每个几何数据属性的细节
|
|
6085
|
+
*/
|
|
6086
|
+
|
|
6576
6087
|
|
|
6577
6088
|
var BufferAttribute =
|
|
6578
6089
|
/** @class */
|
|
@@ -7105,8 +6616,6 @@
|
|
|
7105
6616
|
|
|
7106
6617
|
|
|
7107
6618
|
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
6619
|
|
|
7111
6620
|
|
|
7112
6621
|
|
|
@@ -7131,10 +6640,8 @@
|
|
|
7131
6640
|
function () {
|
|
7132
6641
|
function BufferGeometry() {
|
|
7133
6642
|
this.isBufferGeometry = true;
|
|
7134
|
-
this.uuid = "";
|
|
7135
|
-
this.type = "BufferGeometry";
|
|
7136
6643
|
Object.defineProperty(this, 'id', {
|
|
7137
|
-
value: _bufferGeometryId +=
|
|
6644
|
+
value: _bufferGeometryId += 1
|
|
7138
6645
|
});
|
|
7139
6646
|
this.name = '';
|
|
7140
6647
|
this.attributes = {};
|
|
@@ -7165,11 +6672,11 @@
|
|
|
7165
6672
|
|
|
7166
6673
|
BufferGeometry.prototype.setIndex = function (index) {
|
|
7167
6674
|
if (Array.isArray(index)) {
|
|
7168
|
-
this.index = new (
|
|
6675
|
+
this.index = new (vecs_1.vecs.max(index) > 65535 ? bufferAttribute.Uint32BufferAttribute : bufferAttribute.Uint16BufferAttribute)(index, 1);
|
|
7169
6676
|
} else if (index instanceof bufferAttribute.BufferAttribute) {
|
|
7170
6677
|
this.index = index;
|
|
7171
6678
|
} else {
|
|
7172
|
-
this.index = new (
|
|
6679
|
+
this.index = new (vecs_1.vecs.max(index) > 65535 ? bufferAttribute.Uint32BufferAttribute : bufferAttribute.Uint16BufferAttribute)(index, 1);
|
|
7173
6680
|
}
|
|
7174
6681
|
};
|
|
7175
6682
|
|
|
@@ -7854,9 +7361,9 @@
|
|
|
7854
7361
|
generator: 'BufferGeometry.toJSON'
|
|
7855
7362
|
}
|
|
7856
7363
|
}; // standard BufferGeometry serialization
|
|
7364
|
+
// data.uuid = this.uuid;
|
|
7365
|
+
// data.type = this.type;
|
|
7857
7366
|
|
|
7858
|
-
data.uuid = this.uuid;
|
|
7859
|
-
data.type = this.type;
|
|
7860
7367
|
if (this.name !== '') data.name = this.name;
|
|
7861
7368
|
if (Object.keys(this.userData).length > 0) data.userData = this.userData;
|
|
7862
7369
|
|
|
@@ -8843,7 +8350,7 @@
|
|
|
8843
8350
|
Object.defineProperty(exports, "__esModule", {
|
|
8844
8351
|
value: true
|
|
8845
8352
|
});
|
|
8846
|
-
exports.
|
|
8353
|
+
exports.MeshTool = void 0;
|
|
8847
8354
|
/*
|
|
8848
8355
|
* @Description :
|
|
8849
8356
|
* @Author : 赵耀圣
|
|
@@ -8860,92 +8367,97 @@
|
|
|
8860
8367
|
|
|
8861
8368
|
|
|
8862
8369
|
|
|
8370
|
+
/**
|
|
8371
|
+
* 网格工具
|
|
8372
|
+
*/
|
|
8863
8373
|
|
|
8864
|
-
function indexable(obj, refIndexInfo, force) {
|
|
8865
|
-
if (refIndexInfo === void 0) {
|
|
8866
|
-
refIndexInfo = {
|
|
8867
|
-
index: 0
|
|
8868
|
-
};
|
|
8869
|
-
}
|
|
8870
8374
|
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8375
|
+
var MeshTool =
|
|
8376
|
+
/** @class */
|
|
8377
|
+
function () {
|
|
8378
|
+
function MeshTool() {}
|
|
8874
8379
|
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8380
|
+
MeshTool.indexable = function (obj, refIndexInfo, force) {
|
|
8381
|
+
if (refIndexInfo === void 0) {
|
|
8382
|
+
refIndexInfo = {
|
|
8383
|
+
index: 0
|
|
8384
|
+
};
|
|
8385
|
+
}
|
|
8881
8386
|
|
|
8882
|
-
|
|
8387
|
+
if (force === void 0) {
|
|
8388
|
+
force = false;
|
|
8389
|
+
}
|
|
8883
8390
|
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
}
|
|
8890
|
-
return toGeoBuffer(vertices, indices);
|
|
8891
|
-
}
|
|
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
|
+
};
|
|
8892
8397
|
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
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
|
+
*/
|
|
8900
8412
|
|
|
8901
|
-
function toGeoBuffer(vertices, indices, uvs) {
|
|
8902
|
-
var geometry$1 = new geometry.BufferGeometry();
|
|
8903
|
-
geometry$1.addAttribute('position', vertices, 3);
|
|
8904
|
-
geometry$1.addAttribute('uv', uvs || new Float32Array(geometry$1.getAttribute('position').array.length / 3 * 2), 2);
|
|
8905
|
-
geometry$1.setIndex(indices);
|
|
8906
|
-
return geometry$1;
|
|
8907
|
-
}
|
|
8908
8413
|
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
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
|
+
*/
|
|
8917
8428
|
|
|
8918
|
-
function trianglutionToGeometryBuffer(boundary, holes, options) {
|
|
8919
|
-
if (holes === void 0) {
|
|
8920
|
-
holes = [];
|
|
8921
|
-
}
|
|
8922
8429
|
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
}
|
|
8927
|
-
}
|
|
8430
|
+
MeshTool.trianglutionToGeometryBuffer = function (boundary, holes, options) {
|
|
8431
|
+
if (holes === void 0) {
|
|
8432
|
+
holes = [];
|
|
8433
|
+
}
|
|
8928
8434
|
|
|
8929
|
-
|
|
8435
|
+
if (options === void 0) {
|
|
8436
|
+
options = {
|
|
8437
|
+
normal: Vec3_1.Vec3.UnitZ
|
|
8438
|
+
};
|
|
8439
|
+
}
|
|
8930
8440
|
|
|
8931
|
-
|
|
8441
|
+
var triangles = trianglution.triangulation(boundary, holes, options);
|
|
8932
8442
|
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
uvs
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8443
|
+
var vertices = __spreadArrays(boundary, array.flat(holes));
|
|
8444
|
+
|
|
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
|
+
}();
|
|
8940
8455
|
|
|
8941
|
-
exports.
|
|
8456
|
+
exports.MeshTool = MeshTool;
|
|
8942
8457
|
});
|
|
8943
8458
|
|
|
8944
8459
|
unwrapExports(mesh);
|
|
8945
|
-
var mesh_1 = mesh.
|
|
8946
|
-
var mesh_2 = mesh.toGeoBuffer;
|
|
8947
|
-
var mesh_3 = mesh.triangListToBuffer;
|
|
8948
|
-
var mesh_4 = mesh.indexable;
|
|
8460
|
+
var mesh_1 = mesh.MeshTool;
|
|
8949
8461
|
|
|
8950
8462
|
var Plane_1 = createCommonjsModule(function (module, exports) {
|
|
8951
8463
|
|
|
@@ -9201,7 +8713,7 @@
|
|
|
9201
8713
|
|
|
9202
8714
|
Plane.prototype.splitPolyVS = function (polyVS) {
|
|
9203
8715
|
polyVS = __spreadArrays(polyVS);
|
|
9204
|
-
mesh.indexable(polyVS);
|
|
8716
|
+
mesh.MeshTool.indexable(polyVS);
|
|
9205
8717
|
|
|
9206
8718
|
var jdp0; //找出第一个交点
|
|
9207
8719
|
|
|
@@ -10868,7 +10380,7 @@
|
|
|
10868
10380
|
if (hasHole) allVertics.push(holess);
|
|
10869
10381
|
var orgShape = options.orgShape || shapes[0];
|
|
10870
10382
|
var orgHoles = options.orgHoles || holess && holess[0];
|
|
10871
|
-
if (index) mesh.indexable(allVertics, index);
|
|
10383
|
+
if (index) mesh.MeshTool.indexable(allVertics, index);
|
|
10872
10384
|
|
|
10873
10385
|
for (var i = 0; i < length; i++) {
|
|
10874
10386
|
if (holess) triangles.push.apply(triangles, linkSide({
|
|
@@ -11254,7 +10766,7 @@
|
|
|
11254
10766
|
index: 0
|
|
11255
10767
|
};
|
|
11256
10768
|
var vertices = array.flat(shapeArray);
|
|
11257
|
-
mesh.indexable(vertices, gindex);
|
|
10769
|
+
mesh.MeshTool.indexable(vertices, gindex);
|
|
11258
10770
|
var index = linkSides({
|
|
11259
10771
|
shapes: shapeArray,
|
|
11260
10772
|
shapeClosed: options.shapeClosed,
|
|
@@ -11299,8 +10811,8 @@
|
|
|
11299
10811
|
normal: normal
|
|
11300
10812
|
});
|
|
11301
10813
|
sealStartTris.reverse();
|
|
11302
|
-
if (options.sealStart) mesh.indexable(startSeal, gindex);
|
|
11303
|
-
if (options.sealEnd) mesh.indexable(endSeal, gindex);
|
|
10814
|
+
if (options.sealStart) mesh.MeshTool.indexable(startSeal, gindex);
|
|
10815
|
+
if (options.sealEnd) mesh.MeshTool.indexable(endSeal, gindex);
|
|
11304
10816
|
var sealEndTris = [];
|
|
11305
10817
|
var hasVLen = vertices.length;
|
|
11306
10818
|
if (options.sealStart) for (var i = 0; i < sealStartTris.length; i++) {
|
|
@@ -11934,6 +11446,40 @@
|
|
|
11934
11446
|
|
|
11935
11447
|
return vs;
|
|
11936
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
|
+
};
|
|
11937
11483
|
/**
|
|
11938
11484
|
* 去除相邻没有重复点
|
|
11939
11485
|
*/
|
|
@@ -14673,14 +14219,6 @@
|
|
|
14673
14219
|
value: true
|
|
14674
14220
|
});
|
|
14675
14221
|
exports.linksToGeometry = exports.linkToGeometry = exports.extrudeToGeometryBuffer = exports.toGeometryBuffer = void 0;
|
|
14676
|
-
/*
|
|
14677
|
-
* @Description :
|
|
14678
|
-
* @Author : 赵耀圣
|
|
14679
|
-
* @Q群 : 632839661
|
|
14680
|
-
* @Date : 2020-12-10 15:01:42
|
|
14681
|
-
* @LastEditTime : 2021-03-11 10:54:11
|
|
14682
|
-
* @FilePath : \cga.js\src\extends\geometryaid.ts
|
|
14683
|
-
*/
|
|
14684
14222
|
|
|
14685
14223
|
|
|
14686
14224
|
|
|
@@ -14691,7 +14229,7 @@
|
|
|
14691
14229
|
|
|
14692
14230
|
|
|
14693
14231
|
function toGeometryBuffer(geo) {
|
|
14694
|
-
var buffer = mesh.toGeoBuffer(geo.position, geo.index, geo.uv);
|
|
14232
|
+
var buffer = mesh.MeshTool.toGeoBuffer(geo.position, geo.index, geo.uv);
|
|
14695
14233
|
return buffer;
|
|
14696
14234
|
}
|
|
14697
14235
|
|
|
@@ -14705,7 +14243,7 @@
|
|
|
14705
14243
|
|
|
14706
14244
|
function extrudeToGeometryBuffer(shape, arg_path, options) {
|
|
14707
14245
|
var extrudeRes = extrude_1.extrude_obsolete(shape, arg_path, options);
|
|
14708
|
-
return mesh.toGeoBuffer(extrudeRes.vertices, extrudeRes.index, extrudeRes.uvs);
|
|
14246
|
+
return mesh.MeshTool.toGeoBuffer(extrudeRes.vertices, extrudeRes.index, extrudeRes.uvs);
|
|
14709
14247
|
}
|
|
14710
14248
|
|
|
14711
14249
|
exports.extrudeToGeometryBuffer = extrudeToGeometryBuffer;
|
|
@@ -14750,7 +14288,7 @@
|
|
|
14750
14288
|
}
|
|
14751
14289
|
|
|
14752
14290
|
var vertices = array.flat(shapes);
|
|
14753
|
-
mesh.indexable(vertices);
|
|
14291
|
+
mesh.MeshTool.indexable(vertices);
|
|
14754
14292
|
var geo = extrude_1.linkSides({
|
|
14755
14293
|
shapes: shapes,
|
|
14756
14294
|
shapeClosed: pathClosed,
|
|
@@ -14763,9 +14301,9 @@
|
|
|
14763
14301
|
exports.linksToGeometry = linksToGeometry; // /**
|
|
14764
14302
|
// * 三角剖分后转成几何体
|
|
14765
14303
|
// * 只考虑XY平面
|
|
14766
|
-
// * @param {*} boundary
|
|
14767
|
-
// * @param {*} hole
|
|
14768
|
-
// * @param {*} options
|
|
14304
|
+
// * @param {*} boundary
|
|
14305
|
+
// * @param {*} hole
|
|
14306
|
+
// * @param {*} options
|
|
14769
14307
|
// */
|
|
14770
14308
|
// export function trianglutionToGeometryBuffer(boundary: any, holes: any[] = [], options: any = { normal: Vec3.UnitZ }) {
|
|
14771
14309
|
// var triangles = triangulation(boundary, holes, options)
|
|
@@ -14876,8 +14414,6 @@
|
|
|
14876
14414
|
|
|
14877
14415
|
__exportStar(voronoi, exports);
|
|
14878
14416
|
|
|
14879
|
-
__exportStar(eventhandler, exports);
|
|
14880
|
-
|
|
14881
14417
|
__exportStar(geometryaid, exports); //Geometry
|
|
14882
14418
|
|
|
14883
14419
|
|