@loaders.gl/gltf 3.2.5 → 3.3.0-alpha.1
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/dist/dist.min.js +1402 -36
- package/dist/es5/lib/api/gltf-extensions.js +3 -1
- package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
- package/dist/es5/lib/extensions/KHR_texture_transform.js +293 -0
- package/dist/es5/lib/extensions/KHR_texture_transform.js.map +1 -0
- package/dist/es5/lib/gltf-utils/gltf-constants.js +3 -0
- package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/esm/lib/api/gltf-extensions.js +2 -1
- package/dist/esm/lib/api/gltf-extensions.js.map +1 -1
- package/dist/esm/lib/extensions/KHR_texture_transform.js +218 -0
- package/dist/esm/lib/extensions/KHR_texture_transform.js.map +1 -0
- package/dist/esm/lib/gltf-utils/gltf-constants.js +2 -2
- package/dist/esm/lib/gltf-utils/gltf-constants.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/lib/api/gltf-extensions.d.ts +5 -0
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.js +3 -1
- package/dist/lib/extensions/KHR_texture_transform.d.ts +13 -0
- package/dist/lib/extensions/KHR_texture_transform.d.ts.map +1 -0
- package/dist/lib/extensions/KHR_texture_transform.js +230 -0
- package/dist/lib/gltf-utils/gltf-constants.d.ts +17 -0
- package/dist/lib/gltf-utils/gltf-constants.d.ts.map +1 -1
- package/dist/lib/gltf-utils/gltf-constants.js +5 -5
- package/dist/lib/types/gltf-json-schema.d.ts +2 -2
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/lib/api/gltf-extensions.ts +11 -2
- package/src/lib/extensions/KHR_texture_transform.ts +305 -0
- package/src/lib/gltf-utils/gltf-constants.ts +2 -2
- package/src/lib/types/gltf-json-schema.ts +2 -2
package/dist/dist.min.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
};
|
|
15
15
|
var __export = (target, all) => {
|
|
16
16
|
__markAsModule(target);
|
|
17
|
-
for (var
|
|
18
|
-
__defProp(target,
|
|
17
|
+
for (var name9 in all)
|
|
18
|
+
__defProp(target, name9, { get: all[name9], enumerable: true });
|
|
19
19
|
};
|
|
20
20
|
var __reExport = (target, module, desc) => {
|
|
21
21
|
if (module && typeof module === "object" || typeof module === "function") {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
var DEFAULT_VERSION, VERSION2;
|
|
73
73
|
var init_version2 = __esm({
|
|
74
74
|
"../worker-utils/src/lib/env-utils/version.ts"() {
|
|
75
|
-
DEFAULT_VERSION = "
|
|
75
|
+
DEFAULT_VERSION = "beta";
|
|
76
76
|
VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : DEFAULT_VERSION;
|
|
77
77
|
if (typeof __VERSION__ === "undefined") {
|
|
78
78
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
node = __toModule(require_require_utils());
|
|
192
192
|
init_assert2();
|
|
193
193
|
init_version2();
|
|
194
|
-
LATEST = "
|
|
194
|
+
LATEST = "beta";
|
|
195
195
|
VERSION3 = typeof VERSION2 !== "undefined" ? VERSION2 : LATEST;
|
|
196
196
|
loadLibraryPromises = {};
|
|
197
197
|
}
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
var VERSION4;
|
|
325
325
|
var init_version3 = __esm({
|
|
326
326
|
"../textures/src/lib/utils/version.ts"() {
|
|
327
|
-
VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "
|
|
327
|
+
VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
|
|
@@ -1396,12 +1396,12 @@
|
|
|
1396
1396
|
return extras[key];
|
|
1397
1397
|
}
|
|
1398
1398
|
getExtension(extensionName) {
|
|
1399
|
-
const isExtension = this.getUsedExtensions().find((
|
|
1399
|
+
const isExtension = this.getUsedExtensions().find((name9) => name9 === extensionName);
|
|
1400
1400
|
const extensions = this.json.extensions || {};
|
|
1401
1401
|
return isExtension ? extensions[extensionName] || true : null;
|
|
1402
1402
|
}
|
|
1403
1403
|
getRequiredExtension(extensionName) {
|
|
1404
|
-
const isRequired = this.getRequiredExtensions().find((
|
|
1404
|
+
const isRequired = this.getRequiredExtensions().find((name9) => name9 === extensionName);
|
|
1405
1405
|
return isRequired ? this.getExtension(extensionName) : null;
|
|
1406
1406
|
}
|
|
1407
1407
|
getRequiredExtensions() {
|
|
@@ -2171,8 +2171,8 @@
|
|
|
2171
2171
|
}
|
|
2172
2172
|
select(...columnNames) {
|
|
2173
2173
|
const nameMap = Object.create(null);
|
|
2174
|
-
for (const
|
|
2175
|
-
nameMap[
|
|
2174
|
+
for (const name9 of columnNames) {
|
|
2175
|
+
nameMap[name9] = true;
|
|
2176
2176
|
}
|
|
2177
2177
|
const selectedFields = this.fields.filter((field) => nameMap[field.name]);
|
|
2178
2178
|
return new Schema(selectedFields, this.metadata);
|
|
@@ -2210,8 +2210,8 @@
|
|
|
2210
2210
|
var init_field = __esm({
|
|
2211
2211
|
"../schema/src/lib/schema/impl/field.ts"() {
|
|
2212
2212
|
Field = class {
|
|
2213
|
-
constructor(
|
|
2214
|
-
this.name =
|
|
2213
|
+
constructor(name9, type, nullable = false, metadata = new Map()) {
|
|
2214
|
+
this.name = name9;
|
|
2215
2215
|
this.type = type;
|
|
2216
2216
|
this.nullable = nullable;
|
|
2217
2217
|
this.metadata = metadata;
|
|
@@ -3134,11 +3134,11 @@
|
|
|
3134
3134
|
// src/lib/gltf-utils/gltf-attribute-utils.ts
|
|
3135
3135
|
function getGLTFAccessors(attributes) {
|
|
3136
3136
|
const accessors = {};
|
|
3137
|
-
for (const
|
|
3138
|
-
const attribute = attributes[
|
|
3139
|
-
if (
|
|
3137
|
+
for (const name9 in attributes) {
|
|
3138
|
+
const attribute = attributes[name9];
|
|
3139
|
+
if (name9 !== "indices") {
|
|
3140
3140
|
const glTFAccessor = getGLTFAccessor(attribute);
|
|
3141
|
-
accessors[
|
|
3141
|
+
accessors[name9] = glTFAccessor;
|
|
3142
3142
|
}
|
|
3143
3143
|
}
|
|
3144
3144
|
return accessors;
|
|
@@ -3301,14 +3301,1378 @@
|
|
|
3301
3301
|
}
|
|
3302
3302
|
});
|
|
3303
3303
|
|
|
3304
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
|
|
3305
|
+
function assert5(condition, message) {
|
|
3306
|
+
if (!condition) {
|
|
3307
|
+
throw new Error("math.gl assertion ".concat(message));
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
var init_assert5 = __esm({
|
|
3311
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/assert.js"() {
|
|
3312
|
+
}
|
|
3313
|
+
});
|
|
3314
|
+
|
|
3315
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/common.js
|
|
3316
|
+
function round(value) {
|
|
3317
|
+
return Math.round(value / config.EPSILON) * config.EPSILON;
|
|
3318
|
+
}
|
|
3319
|
+
function formatValue(value, {
|
|
3320
|
+
precision = config.precision || 4
|
|
3321
|
+
} = {}) {
|
|
3322
|
+
value = round(value);
|
|
3323
|
+
return "".concat(parseFloat(value.toPrecision(precision)));
|
|
3324
|
+
}
|
|
3325
|
+
function isArray(value) {
|
|
3326
|
+
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
3327
|
+
}
|
|
3328
|
+
function equals(a2, b, epsilon) {
|
|
3329
|
+
const oldEpsilon = config.EPSILON;
|
|
3330
|
+
if (epsilon) {
|
|
3331
|
+
config.EPSILON = epsilon;
|
|
3332
|
+
}
|
|
3333
|
+
try {
|
|
3334
|
+
if (a2 === b) {
|
|
3335
|
+
return true;
|
|
3336
|
+
}
|
|
3337
|
+
if (isArray(a2) && isArray(b)) {
|
|
3338
|
+
if (a2.length !== b.length) {
|
|
3339
|
+
return false;
|
|
3340
|
+
}
|
|
3341
|
+
for (let i2 = 0; i2 < a2.length; ++i2) {
|
|
3342
|
+
if (!equals(a2[i2], b[i2])) {
|
|
3343
|
+
return false;
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
return true;
|
|
3347
|
+
}
|
|
3348
|
+
if (a2 && a2.equals) {
|
|
3349
|
+
return a2.equals(b);
|
|
3350
|
+
}
|
|
3351
|
+
if (b && b.equals) {
|
|
3352
|
+
return b.equals(a2);
|
|
3353
|
+
}
|
|
3354
|
+
if (Number.isFinite(a2) && Number.isFinite(b)) {
|
|
3355
|
+
return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
|
|
3356
|
+
}
|
|
3357
|
+
return false;
|
|
3358
|
+
} finally {
|
|
3359
|
+
config.EPSILON = oldEpsilon;
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
var RADIANS_TO_DEGREES, DEGREES_TO_RADIANS, config;
|
|
3363
|
+
var init_common = __esm({
|
|
3364
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/common.js"() {
|
|
3365
|
+
RADIANS_TO_DEGREES = 1 / Math.PI * 180;
|
|
3366
|
+
DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
|
|
3367
|
+
config = {};
|
|
3368
|
+
config.EPSILON = 1e-12;
|
|
3369
|
+
config.debug = false;
|
|
3370
|
+
config.precision = 4;
|
|
3371
|
+
config.printTypes = false;
|
|
3372
|
+
config.printDegrees = false;
|
|
3373
|
+
config.printRowMajor = true;
|
|
3374
|
+
}
|
|
3375
|
+
});
|
|
3376
|
+
|
|
3377
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
|
|
3378
|
+
function _extendableBuiltin(cls) {
|
|
3379
|
+
function ExtendableBuiltin() {
|
|
3380
|
+
var instance = Reflect.construct(cls, Array.from(arguments));
|
|
3381
|
+
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
|
|
3382
|
+
return instance;
|
|
3383
|
+
}
|
|
3384
|
+
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
|
|
3385
|
+
constructor: {
|
|
3386
|
+
value: cls,
|
|
3387
|
+
enumerable: false,
|
|
3388
|
+
writable: true,
|
|
3389
|
+
configurable: true
|
|
3390
|
+
}
|
|
3391
|
+
});
|
|
3392
|
+
if (Object.setPrototypeOf) {
|
|
3393
|
+
Object.setPrototypeOf(ExtendableBuiltin, cls);
|
|
3394
|
+
} else {
|
|
3395
|
+
ExtendableBuiltin.__proto__ = cls;
|
|
3396
|
+
}
|
|
3397
|
+
return ExtendableBuiltin;
|
|
3398
|
+
}
|
|
3399
|
+
var MathArray;
|
|
3400
|
+
var init_math_array = __esm({
|
|
3401
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js"() {
|
|
3402
|
+
init_common();
|
|
3403
|
+
init_assert5();
|
|
3404
|
+
MathArray = class extends _extendableBuiltin(Array) {
|
|
3405
|
+
get ELEMENTS() {
|
|
3406
|
+
assert5(false);
|
|
3407
|
+
return 0;
|
|
3408
|
+
}
|
|
3409
|
+
clone() {
|
|
3410
|
+
return new this.constructor().copy(this);
|
|
3411
|
+
}
|
|
3412
|
+
from(arrayOrObject) {
|
|
3413
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
|
|
3414
|
+
}
|
|
3415
|
+
fromArray(array, offset = 0) {
|
|
3416
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3417
|
+
this[i2] = array[i2 + offset];
|
|
3418
|
+
}
|
|
3419
|
+
return this.check();
|
|
3420
|
+
}
|
|
3421
|
+
to(arrayOrObject) {
|
|
3422
|
+
if (arrayOrObject === this) {
|
|
3423
|
+
return this;
|
|
3424
|
+
}
|
|
3425
|
+
return isArray(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
|
|
3426
|
+
}
|
|
3427
|
+
toTarget(target) {
|
|
3428
|
+
return target ? this.to(target) : this;
|
|
3429
|
+
}
|
|
3430
|
+
toArray(array = [], offset = 0) {
|
|
3431
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3432
|
+
array[offset + i2] = this[i2];
|
|
3433
|
+
}
|
|
3434
|
+
return array;
|
|
3435
|
+
}
|
|
3436
|
+
toFloat32Array() {
|
|
3437
|
+
return new Float32Array(this);
|
|
3438
|
+
}
|
|
3439
|
+
toString() {
|
|
3440
|
+
return this.formatString(config);
|
|
3441
|
+
}
|
|
3442
|
+
formatString(opts) {
|
|
3443
|
+
let string = "";
|
|
3444
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3445
|
+
string += (i2 > 0 ? ", " : "") + formatValue(this[i2], opts);
|
|
3446
|
+
}
|
|
3447
|
+
return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
|
|
3448
|
+
}
|
|
3449
|
+
equals(array) {
|
|
3450
|
+
if (!array || this.length !== array.length) {
|
|
3451
|
+
return false;
|
|
3452
|
+
}
|
|
3453
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3454
|
+
if (!equals(this[i2], array[i2])) {
|
|
3455
|
+
return false;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
return true;
|
|
3459
|
+
}
|
|
3460
|
+
exactEquals(array) {
|
|
3461
|
+
if (!array || this.length !== array.length) {
|
|
3462
|
+
return false;
|
|
3463
|
+
}
|
|
3464
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3465
|
+
if (this[i2] !== array[i2]) {
|
|
3466
|
+
return false;
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
return true;
|
|
3470
|
+
}
|
|
3471
|
+
negate() {
|
|
3472
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3473
|
+
this[i2] = -this[i2];
|
|
3474
|
+
}
|
|
3475
|
+
return this.check();
|
|
3476
|
+
}
|
|
3477
|
+
lerp(a2, b, t2) {
|
|
3478
|
+
if (t2 === void 0) {
|
|
3479
|
+
t2 = b;
|
|
3480
|
+
b = a2;
|
|
3481
|
+
a2 = this;
|
|
3482
|
+
}
|
|
3483
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3484
|
+
const ai = a2[i2];
|
|
3485
|
+
this[i2] = ai + t2 * (b[i2] - ai);
|
|
3486
|
+
}
|
|
3487
|
+
return this.check();
|
|
3488
|
+
}
|
|
3489
|
+
min(vector) {
|
|
3490
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3491
|
+
this[i2] = Math.min(vector[i2], this[i2]);
|
|
3492
|
+
}
|
|
3493
|
+
return this.check();
|
|
3494
|
+
}
|
|
3495
|
+
max(vector) {
|
|
3496
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3497
|
+
this[i2] = Math.max(vector[i2], this[i2]);
|
|
3498
|
+
}
|
|
3499
|
+
return this.check();
|
|
3500
|
+
}
|
|
3501
|
+
clamp(minVector, maxVector) {
|
|
3502
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3503
|
+
this[i2] = Math.min(Math.max(this[i2], minVector[i2]), maxVector[i2]);
|
|
3504
|
+
}
|
|
3505
|
+
return this.check();
|
|
3506
|
+
}
|
|
3507
|
+
add(...vectors) {
|
|
3508
|
+
for (const vector of vectors) {
|
|
3509
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3510
|
+
this[i2] += vector[i2];
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
return this.check();
|
|
3514
|
+
}
|
|
3515
|
+
subtract(...vectors) {
|
|
3516
|
+
for (const vector of vectors) {
|
|
3517
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3518
|
+
this[i2] -= vector[i2];
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
return this.check();
|
|
3522
|
+
}
|
|
3523
|
+
scale(scale2) {
|
|
3524
|
+
if (Array.isArray(scale2)) {
|
|
3525
|
+
return this.multiply(scale2);
|
|
3526
|
+
}
|
|
3527
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3528
|
+
this[i2] *= scale2;
|
|
3529
|
+
}
|
|
3530
|
+
return this.check();
|
|
3531
|
+
}
|
|
3532
|
+
sub(a2) {
|
|
3533
|
+
return this.subtract(a2);
|
|
3534
|
+
}
|
|
3535
|
+
setScalar(a2) {
|
|
3536
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3537
|
+
this[i2] = a2;
|
|
3538
|
+
}
|
|
3539
|
+
return this.check();
|
|
3540
|
+
}
|
|
3541
|
+
addScalar(a2) {
|
|
3542
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3543
|
+
this[i2] += a2;
|
|
3544
|
+
}
|
|
3545
|
+
return this.check();
|
|
3546
|
+
}
|
|
3547
|
+
subScalar(a2) {
|
|
3548
|
+
return this.addScalar(-a2);
|
|
3549
|
+
}
|
|
3550
|
+
multiplyScalar(scalar) {
|
|
3551
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3552
|
+
this[i2] *= scalar;
|
|
3553
|
+
}
|
|
3554
|
+
return this.check();
|
|
3555
|
+
}
|
|
3556
|
+
divideScalar(a2) {
|
|
3557
|
+
return this.scale(1 / a2);
|
|
3558
|
+
}
|
|
3559
|
+
clampScalar(min, max) {
|
|
3560
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3561
|
+
this[i2] = Math.min(Math.max(this[i2], min), max);
|
|
3562
|
+
}
|
|
3563
|
+
return this.check();
|
|
3564
|
+
}
|
|
3565
|
+
multiplyByScalar(scalar) {
|
|
3566
|
+
return this.scale(scalar);
|
|
3567
|
+
}
|
|
3568
|
+
get elements() {
|
|
3569
|
+
return this;
|
|
3570
|
+
}
|
|
3571
|
+
check() {
|
|
3572
|
+
if (config.debug && !this.validate()) {
|
|
3573
|
+
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
|
|
3574
|
+
}
|
|
3575
|
+
return this;
|
|
3576
|
+
}
|
|
3577
|
+
validate() {
|
|
3578
|
+
let valid = this.length === this.ELEMENTS;
|
|
3579
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3580
|
+
valid = valid && Number.isFinite(this[i2]);
|
|
3581
|
+
}
|
|
3582
|
+
return valid;
|
|
3583
|
+
}
|
|
3584
|
+
};
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
|
|
3588
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
|
|
3589
|
+
function validateVector(v, length) {
|
|
3590
|
+
if (v.length !== length) {
|
|
3591
|
+
return false;
|
|
3592
|
+
}
|
|
3593
|
+
for (let i2 = 0; i2 < v.length; ++i2) {
|
|
3594
|
+
if (!Number.isFinite(v[i2])) {
|
|
3595
|
+
return false;
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
return true;
|
|
3599
|
+
}
|
|
3600
|
+
function checkNumber(value) {
|
|
3601
|
+
if (!Number.isFinite(value)) {
|
|
3602
|
+
throw new Error("Invalid number ".concat(value));
|
|
3603
|
+
}
|
|
3604
|
+
return value;
|
|
3605
|
+
}
|
|
3606
|
+
function checkVector(v, length, callerName = "") {
|
|
3607
|
+
if (config.debug && !validateVector(v, length)) {
|
|
3608
|
+
throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
|
|
3609
|
+
}
|
|
3610
|
+
return v;
|
|
3611
|
+
}
|
|
3612
|
+
function deprecated(method, version) {
|
|
3613
|
+
if (!map[method]) {
|
|
3614
|
+
map[method] = true;
|
|
3615
|
+
console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information"));
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
var map;
|
|
3619
|
+
var init_validators = __esm({
|
|
3620
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/validators.js"() {
|
|
3621
|
+
init_common();
|
|
3622
|
+
map = {};
|
|
3623
|
+
}
|
|
3624
|
+
});
|
|
3625
|
+
|
|
3626
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
|
|
3627
|
+
var Vector;
|
|
3628
|
+
var init_vector = __esm({
|
|
3629
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js"() {
|
|
3630
|
+
init_math_array();
|
|
3631
|
+
init_validators();
|
|
3632
|
+
init_assert5();
|
|
3633
|
+
Vector = class extends MathArray {
|
|
3634
|
+
get ELEMENTS() {
|
|
3635
|
+
assert5(false);
|
|
3636
|
+
return 0;
|
|
3637
|
+
}
|
|
3638
|
+
copy(vector) {
|
|
3639
|
+
assert5(false);
|
|
3640
|
+
return this;
|
|
3641
|
+
}
|
|
3642
|
+
get x() {
|
|
3643
|
+
return this[0];
|
|
3644
|
+
}
|
|
3645
|
+
set x(value) {
|
|
3646
|
+
this[0] = checkNumber(value);
|
|
3647
|
+
}
|
|
3648
|
+
get y() {
|
|
3649
|
+
return this[1];
|
|
3650
|
+
}
|
|
3651
|
+
set y(value) {
|
|
3652
|
+
this[1] = checkNumber(value);
|
|
3653
|
+
}
|
|
3654
|
+
len() {
|
|
3655
|
+
return Math.sqrt(this.lengthSquared());
|
|
3656
|
+
}
|
|
3657
|
+
magnitude() {
|
|
3658
|
+
return this.len();
|
|
3659
|
+
}
|
|
3660
|
+
lengthSquared() {
|
|
3661
|
+
let length = 0;
|
|
3662
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3663
|
+
length += this[i2] * this[i2];
|
|
3664
|
+
}
|
|
3665
|
+
return length;
|
|
3666
|
+
}
|
|
3667
|
+
magnitudeSquared() {
|
|
3668
|
+
return this.lengthSquared();
|
|
3669
|
+
}
|
|
3670
|
+
distance(mathArray) {
|
|
3671
|
+
return Math.sqrt(this.distanceSquared(mathArray));
|
|
3672
|
+
}
|
|
3673
|
+
distanceSquared(mathArray) {
|
|
3674
|
+
let length = 0;
|
|
3675
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3676
|
+
const dist = this[i2] - mathArray[i2];
|
|
3677
|
+
length += dist * dist;
|
|
3678
|
+
}
|
|
3679
|
+
return checkNumber(length);
|
|
3680
|
+
}
|
|
3681
|
+
dot(mathArray) {
|
|
3682
|
+
let product = 0;
|
|
3683
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3684
|
+
product += this[i2] * mathArray[i2];
|
|
3685
|
+
}
|
|
3686
|
+
return checkNumber(product);
|
|
3687
|
+
}
|
|
3688
|
+
normalize() {
|
|
3689
|
+
const length = this.magnitude();
|
|
3690
|
+
if (length !== 0) {
|
|
3691
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3692
|
+
this[i2] /= length;
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
return this.check();
|
|
3696
|
+
}
|
|
3697
|
+
multiply(...vectors) {
|
|
3698
|
+
for (const vector of vectors) {
|
|
3699
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3700
|
+
this[i2] *= vector[i2];
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
return this.check();
|
|
3704
|
+
}
|
|
3705
|
+
divide(...vectors) {
|
|
3706
|
+
for (const vector of vectors) {
|
|
3707
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
3708
|
+
this[i2] /= vector[i2];
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
return this.check();
|
|
3712
|
+
}
|
|
3713
|
+
lengthSq() {
|
|
3714
|
+
return this.lengthSquared();
|
|
3715
|
+
}
|
|
3716
|
+
distanceTo(vector) {
|
|
3717
|
+
return this.distance(vector);
|
|
3718
|
+
}
|
|
3719
|
+
distanceToSquared(vector) {
|
|
3720
|
+
return this.distanceSquared(vector);
|
|
3721
|
+
}
|
|
3722
|
+
getComponent(i2) {
|
|
3723
|
+
assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
|
|
3724
|
+
return checkNumber(this[i2]);
|
|
3725
|
+
}
|
|
3726
|
+
setComponent(i2, value) {
|
|
3727
|
+
assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
|
|
3728
|
+
this[i2] = value;
|
|
3729
|
+
return this.check();
|
|
3730
|
+
}
|
|
3731
|
+
addVectors(a2, b) {
|
|
3732
|
+
return this.copy(a2).add(b);
|
|
3733
|
+
}
|
|
3734
|
+
subVectors(a2, b) {
|
|
3735
|
+
return this.copy(a2).subtract(b);
|
|
3736
|
+
}
|
|
3737
|
+
multiplyVectors(a2, b) {
|
|
3738
|
+
return this.copy(a2).multiply(b);
|
|
3739
|
+
}
|
|
3740
|
+
addScaledVector(a2, b) {
|
|
3741
|
+
return this.add(new this.constructor(a2).multiplyScalar(b));
|
|
3742
|
+
}
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
});
|
|
3746
|
+
|
|
3747
|
+
// ../../node_modules/gl-matrix/esm/common.js
|
|
3748
|
+
var ARRAY_TYPE, degree;
|
|
3749
|
+
var init_common2 = __esm({
|
|
3750
|
+
"../../node_modules/gl-matrix/esm/common.js"() {
|
|
3751
|
+
ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
|
|
3752
|
+
degree = Math.PI / 180;
|
|
3753
|
+
if (!Math.hypot)
|
|
3754
|
+
Math.hypot = function() {
|
|
3755
|
+
var y = 0, i2 = arguments.length;
|
|
3756
|
+
while (i2--) {
|
|
3757
|
+
y += arguments[i2] * arguments[i2];
|
|
3758
|
+
}
|
|
3759
|
+
return Math.sqrt(y);
|
|
3760
|
+
};
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3763
|
+
|
|
3764
|
+
// ../../node_modules/gl-matrix/esm/vec2.js
|
|
3765
|
+
function create() {
|
|
3766
|
+
var out = new ARRAY_TYPE(2);
|
|
3767
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
3768
|
+
out[0] = 0;
|
|
3769
|
+
out[1] = 0;
|
|
3770
|
+
}
|
|
3771
|
+
return out;
|
|
3772
|
+
}
|
|
3773
|
+
function transformMat3(out, a2, m) {
|
|
3774
|
+
var x = a2[0], y = a2[1];
|
|
3775
|
+
out[0] = m[0] * x + m[3] * y + m[6];
|
|
3776
|
+
out[1] = m[1] * x + m[4] * y + m[7];
|
|
3777
|
+
return out;
|
|
3778
|
+
}
|
|
3779
|
+
var forEach;
|
|
3780
|
+
var init_vec2 = __esm({
|
|
3781
|
+
"../../node_modules/gl-matrix/esm/vec2.js"() {
|
|
3782
|
+
init_common2();
|
|
3783
|
+
forEach = function() {
|
|
3784
|
+
var vec = create();
|
|
3785
|
+
return function(a2, stride, offset, count, fn, arg) {
|
|
3786
|
+
var i2, l2;
|
|
3787
|
+
if (!stride) {
|
|
3788
|
+
stride = 2;
|
|
3789
|
+
}
|
|
3790
|
+
if (!offset) {
|
|
3791
|
+
offset = 0;
|
|
3792
|
+
}
|
|
3793
|
+
if (count) {
|
|
3794
|
+
l2 = Math.min(count * stride + offset, a2.length);
|
|
3795
|
+
} else {
|
|
3796
|
+
l2 = a2.length;
|
|
3797
|
+
}
|
|
3798
|
+
for (i2 = offset; i2 < l2; i2 += stride) {
|
|
3799
|
+
vec[0] = a2[i2];
|
|
3800
|
+
vec[1] = a2[i2 + 1];
|
|
3801
|
+
fn(vec, vec, arg);
|
|
3802
|
+
a2[i2] = vec[0];
|
|
3803
|
+
a2[i2 + 1] = vec[1];
|
|
3804
|
+
}
|
|
3805
|
+
return a2;
|
|
3806
|
+
};
|
|
3807
|
+
}();
|
|
3808
|
+
}
|
|
3809
|
+
});
|
|
3810
|
+
|
|
3811
|
+
// ../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js
|
|
3812
|
+
function vec3_transformMat4AsVector(out, a2, m) {
|
|
3813
|
+
const x = a2[0];
|
|
3814
|
+
const y = a2[1];
|
|
3815
|
+
const z = a2[2];
|
|
3816
|
+
const w = m[3] * x + m[7] * y + m[11] * z || 1;
|
|
3817
|
+
out[0] = (m[0] * x + m[4] * y + m[8] * z) / w;
|
|
3818
|
+
out[1] = (m[1] * x + m[5] * y + m[9] * z) / w;
|
|
3819
|
+
out[2] = (m[2] * x + m[6] * y + m[10] * z) / w;
|
|
3820
|
+
return out;
|
|
3821
|
+
}
|
|
3822
|
+
function vec3_transformMat2(out, a2, m) {
|
|
3823
|
+
const x = a2[0];
|
|
3824
|
+
const y = a2[1];
|
|
3825
|
+
out[0] = m[0] * x + m[2] * y;
|
|
3826
|
+
out[1] = m[1] * x + m[3] * y;
|
|
3827
|
+
out[2] = a2[2];
|
|
3828
|
+
return out;
|
|
3829
|
+
}
|
|
3830
|
+
function vec4_transformMat3(out, a2, m) {
|
|
3831
|
+
const x = a2[0];
|
|
3832
|
+
const y = a2[1];
|
|
3833
|
+
const z = a2[2];
|
|
3834
|
+
out[0] = m[0] * x + m[3] * y + m[6] * z;
|
|
3835
|
+
out[1] = m[1] * x + m[4] * y + m[7] * z;
|
|
3836
|
+
out[2] = m[2] * x + m[5] * y + m[8] * z;
|
|
3837
|
+
out[3] = a2[3];
|
|
3838
|
+
return out;
|
|
3839
|
+
}
|
|
3840
|
+
var init_gl_matrix_extras = __esm({
|
|
3841
|
+
"../../node_modules/@math.gl/core/dist/esm/lib/gl-matrix-extras.js"() {
|
|
3842
|
+
}
|
|
3843
|
+
});
|
|
3844
|
+
|
|
3845
|
+
// ../../node_modules/gl-matrix/esm/vec3.js
|
|
3846
|
+
function create2() {
|
|
3847
|
+
var out = new ARRAY_TYPE(3);
|
|
3848
|
+
if (ARRAY_TYPE != Float32Array) {
|
|
3849
|
+
out[0] = 0;
|
|
3850
|
+
out[1] = 0;
|
|
3851
|
+
out[2] = 0;
|
|
3852
|
+
}
|
|
3853
|
+
return out;
|
|
3854
|
+
}
|
|
3855
|
+
function dot(a2, b) {
|
|
3856
|
+
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
|
|
3857
|
+
}
|
|
3858
|
+
function cross(out, a2, b) {
|
|
3859
|
+
var ax = a2[0], ay = a2[1], az = a2[2];
|
|
3860
|
+
var bx = b[0], by = b[1], bz = b[2];
|
|
3861
|
+
out[0] = ay * bz - az * by;
|
|
3862
|
+
out[1] = az * bx - ax * bz;
|
|
3863
|
+
out[2] = ax * by - ay * bx;
|
|
3864
|
+
return out;
|
|
3865
|
+
}
|
|
3866
|
+
function transformMat4(out, a2, m) {
|
|
3867
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
3868
|
+
var w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
|
3869
|
+
w = w || 1;
|
|
3870
|
+
out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
|
3871
|
+
out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
|
|
3872
|
+
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
3873
|
+
return out;
|
|
3874
|
+
}
|
|
3875
|
+
function transformMat32(out, a2, m) {
|
|
3876
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
3877
|
+
out[0] = x * m[0] + y * m[3] + z * m[6];
|
|
3878
|
+
out[1] = x * m[1] + y * m[4] + z * m[7];
|
|
3879
|
+
out[2] = x * m[2] + y * m[5] + z * m[8];
|
|
3880
|
+
return out;
|
|
3881
|
+
}
|
|
3882
|
+
function transformQuat(out, a2, q) {
|
|
3883
|
+
var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
|
|
3884
|
+
var x = a2[0], y = a2[1], z = a2[2];
|
|
3885
|
+
var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x;
|
|
3886
|
+
var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
|
|
3887
|
+
var w2 = qw * 2;
|
|
3888
|
+
uvx *= w2;
|
|
3889
|
+
uvy *= w2;
|
|
3890
|
+
uvz *= w2;
|
|
3891
|
+
uuvx *= 2;
|
|
3892
|
+
uuvy *= 2;
|
|
3893
|
+
uuvz *= 2;
|
|
3894
|
+
out[0] = x + uvx + uuvx;
|
|
3895
|
+
out[1] = y + uvy + uuvy;
|
|
3896
|
+
out[2] = z + uvz + uuvz;
|
|
3897
|
+
return out;
|
|
3898
|
+
}
|
|
3899
|
+
function rotateX(out, a2, b, rad) {
|
|
3900
|
+
var p2 = [], r2 = [];
|
|
3901
|
+
p2[0] = a2[0] - b[0];
|
|
3902
|
+
p2[1] = a2[1] - b[1];
|
|
3903
|
+
p2[2] = a2[2] - b[2];
|
|
3904
|
+
r2[0] = p2[0];
|
|
3905
|
+
r2[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
|
|
3906
|
+
r2[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
|
|
3907
|
+
out[0] = r2[0] + b[0];
|
|
3908
|
+
out[1] = r2[1] + b[1];
|
|
3909
|
+
out[2] = r2[2] + b[2];
|
|
3910
|
+
return out;
|
|
3911
|
+
}
|
|
3912
|
+
function rotateY(out, a2, b, rad) {
|
|
3913
|
+
var p2 = [], r2 = [];
|
|
3914
|
+
p2[0] = a2[0] - b[0];
|
|
3915
|
+
p2[1] = a2[1] - b[1];
|
|
3916
|
+
p2[2] = a2[2] - b[2];
|
|
3917
|
+
r2[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
|
|
3918
|
+
r2[1] = p2[1];
|
|
3919
|
+
r2[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
|
|
3920
|
+
out[0] = r2[0] + b[0];
|
|
3921
|
+
out[1] = r2[1] + b[1];
|
|
3922
|
+
out[2] = r2[2] + b[2];
|
|
3923
|
+
return out;
|
|
3924
|
+
}
|
|
3925
|
+
function rotateZ(out, a2, b, rad) {
|
|
3926
|
+
var p2 = [], r2 = [];
|
|
3927
|
+
p2[0] = a2[0] - b[0];
|
|
3928
|
+
p2[1] = a2[1] - b[1];
|
|
3929
|
+
p2[2] = a2[2] - b[2];
|
|
3930
|
+
r2[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
|
|
3931
|
+
r2[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
|
|
3932
|
+
r2[2] = p2[2];
|
|
3933
|
+
out[0] = r2[0] + b[0];
|
|
3934
|
+
out[1] = r2[1] + b[1];
|
|
3935
|
+
out[2] = r2[2] + b[2];
|
|
3936
|
+
return out;
|
|
3937
|
+
}
|
|
3938
|
+
function angle(a2, b) {
|
|
3939
|
+
var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a2, b) / mag;
|
|
3940
|
+
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
3941
|
+
}
|
|
3942
|
+
var forEach2;
|
|
3943
|
+
var init_vec3 = __esm({
|
|
3944
|
+
"../../node_modules/gl-matrix/esm/vec3.js"() {
|
|
3945
|
+
init_common2();
|
|
3946
|
+
forEach2 = function() {
|
|
3947
|
+
var vec = create2();
|
|
3948
|
+
return function(a2, stride, offset, count, fn, arg) {
|
|
3949
|
+
var i2, l2;
|
|
3950
|
+
if (!stride) {
|
|
3951
|
+
stride = 3;
|
|
3952
|
+
}
|
|
3953
|
+
if (!offset) {
|
|
3954
|
+
offset = 0;
|
|
3955
|
+
}
|
|
3956
|
+
if (count) {
|
|
3957
|
+
l2 = Math.min(count * stride + offset, a2.length);
|
|
3958
|
+
} else {
|
|
3959
|
+
l2 = a2.length;
|
|
3960
|
+
}
|
|
3961
|
+
for (i2 = offset; i2 < l2; i2 += stride) {
|
|
3962
|
+
vec[0] = a2[i2];
|
|
3963
|
+
vec[1] = a2[i2 + 1];
|
|
3964
|
+
vec[2] = a2[i2 + 2];
|
|
3965
|
+
fn(vec, vec, arg);
|
|
3966
|
+
a2[i2] = vec[0];
|
|
3967
|
+
a2[i2 + 1] = vec[1];
|
|
3968
|
+
a2[i2 + 2] = vec[2];
|
|
3969
|
+
}
|
|
3970
|
+
return a2;
|
|
3971
|
+
};
|
|
3972
|
+
}();
|
|
3973
|
+
}
|
|
3974
|
+
});
|
|
3975
|
+
|
|
3976
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
|
|
3977
|
+
var ORIGIN, constants, Vector3;
|
|
3978
|
+
var init_vector3 = __esm({
|
|
3979
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/vector3.js"() {
|
|
3980
|
+
init_vector();
|
|
3981
|
+
init_common();
|
|
3982
|
+
init_validators();
|
|
3983
|
+
init_vec3();
|
|
3984
|
+
init_gl_matrix_extras();
|
|
3985
|
+
ORIGIN = [0, 0, 0];
|
|
3986
|
+
constants = {};
|
|
3987
|
+
Vector3 = class extends Vector {
|
|
3988
|
+
static get ZERO() {
|
|
3989
|
+
return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
|
|
3990
|
+
}
|
|
3991
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
3992
|
+
super(-0, -0, -0);
|
|
3993
|
+
if (arguments.length === 1 && isArray(x)) {
|
|
3994
|
+
this.copy(x);
|
|
3995
|
+
} else {
|
|
3996
|
+
if (config.debug) {
|
|
3997
|
+
checkNumber(x);
|
|
3998
|
+
checkNumber(y);
|
|
3999
|
+
checkNumber(z);
|
|
4000
|
+
}
|
|
4001
|
+
this[0] = x;
|
|
4002
|
+
this[1] = y;
|
|
4003
|
+
this[2] = z;
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
set(x, y, z) {
|
|
4007
|
+
this[0] = x;
|
|
4008
|
+
this[1] = y;
|
|
4009
|
+
this[2] = z;
|
|
4010
|
+
return this.check();
|
|
4011
|
+
}
|
|
4012
|
+
copy(array) {
|
|
4013
|
+
this[0] = array[0];
|
|
4014
|
+
this[1] = array[1];
|
|
4015
|
+
this[2] = array[2];
|
|
4016
|
+
return this.check();
|
|
4017
|
+
}
|
|
4018
|
+
fromObject(object) {
|
|
4019
|
+
if (config.debug) {
|
|
4020
|
+
checkNumber(object.x);
|
|
4021
|
+
checkNumber(object.y);
|
|
4022
|
+
checkNumber(object.z);
|
|
4023
|
+
}
|
|
4024
|
+
this[0] = object.x;
|
|
4025
|
+
this[1] = object.y;
|
|
4026
|
+
this[2] = object.z;
|
|
4027
|
+
return this.check();
|
|
4028
|
+
}
|
|
4029
|
+
toObject(object) {
|
|
4030
|
+
object.x = this[0];
|
|
4031
|
+
object.y = this[1];
|
|
4032
|
+
object.z = this[2];
|
|
4033
|
+
return object;
|
|
4034
|
+
}
|
|
4035
|
+
get ELEMENTS() {
|
|
4036
|
+
return 3;
|
|
4037
|
+
}
|
|
4038
|
+
get z() {
|
|
4039
|
+
return this[2];
|
|
4040
|
+
}
|
|
4041
|
+
set z(value) {
|
|
4042
|
+
this[2] = checkNumber(value);
|
|
4043
|
+
}
|
|
4044
|
+
angle(vector) {
|
|
4045
|
+
return angle(this, vector);
|
|
4046
|
+
}
|
|
4047
|
+
cross(vector) {
|
|
4048
|
+
cross(this, this, vector);
|
|
4049
|
+
return this.check();
|
|
4050
|
+
}
|
|
4051
|
+
rotateX({
|
|
4052
|
+
radians,
|
|
4053
|
+
origin = ORIGIN
|
|
4054
|
+
}) {
|
|
4055
|
+
rotateX(this, this, origin, radians);
|
|
4056
|
+
return this.check();
|
|
4057
|
+
}
|
|
4058
|
+
rotateY({
|
|
4059
|
+
radians,
|
|
4060
|
+
origin = ORIGIN
|
|
4061
|
+
}) {
|
|
4062
|
+
rotateY(this, this, origin, radians);
|
|
4063
|
+
return this.check();
|
|
4064
|
+
}
|
|
4065
|
+
rotateZ({
|
|
4066
|
+
radians,
|
|
4067
|
+
origin = ORIGIN
|
|
4068
|
+
}) {
|
|
4069
|
+
rotateZ(this, this, origin, radians);
|
|
4070
|
+
return this.check();
|
|
4071
|
+
}
|
|
4072
|
+
transform(matrix4) {
|
|
4073
|
+
return this.transformAsPoint(matrix4);
|
|
4074
|
+
}
|
|
4075
|
+
transformAsPoint(matrix4) {
|
|
4076
|
+
transformMat4(this, this, matrix4);
|
|
4077
|
+
return this.check();
|
|
4078
|
+
}
|
|
4079
|
+
transformAsVector(matrix4) {
|
|
4080
|
+
vec3_transformMat4AsVector(this, this, matrix4);
|
|
4081
|
+
return this.check();
|
|
4082
|
+
}
|
|
4083
|
+
transformByMatrix3(matrix3) {
|
|
4084
|
+
transformMat32(this, this, matrix3);
|
|
4085
|
+
return this.check();
|
|
4086
|
+
}
|
|
4087
|
+
transformByMatrix2(matrix2) {
|
|
4088
|
+
vec3_transformMat2(this, this, matrix2);
|
|
4089
|
+
return this.check();
|
|
4090
|
+
}
|
|
4091
|
+
transformByQuaternion(quaternion) {
|
|
4092
|
+
transformQuat(this, this, quaternion);
|
|
4093
|
+
return this.check();
|
|
4094
|
+
}
|
|
4095
|
+
};
|
|
4096
|
+
}
|
|
4097
|
+
});
|
|
4098
|
+
|
|
4099
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
|
|
4100
|
+
var Matrix;
|
|
4101
|
+
var init_matrix = __esm({
|
|
4102
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js"() {
|
|
4103
|
+
init_math_array();
|
|
4104
|
+
init_validators();
|
|
4105
|
+
init_common();
|
|
4106
|
+
init_assert5();
|
|
4107
|
+
Matrix = class extends MathArray {
|
|
4108
|
+
get ELEMENTS() {
|
|
4109
|
+
assert5(false);
|
|
4110
|
+
return 0;
|
|
4111
|
+
}
|
|
4112
|
+
get RANK() {
|
|
4113
|
+
assert5(false);
|
|
4114
|
+
return 0;
|
|
4115
|
+
}
|
|
4116
|
+
toString() {
|
|
4117
|
+
let string = "[";
|
|
4118
|
+
if (config.printRowMajor) {
|
|
4119
|
+
string += "row-major:";
|
|
4120
|
+
for (let row = 0; row < this.RANK; ++row) {
|
|
4121
|
+
for (let col = 0; col < this.RANK; ++col) {
|
|
4122
|
+
string += " ".concat(this[col * this.RANK + row]);
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
} else {
|
|
4126
|
+
string += "column-major:";
|
|
4127
|
+
for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
|
|
4128
|
+
string += " ".concat(this[i2]);
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4131
|
+
string += "]";
|
|
4132
|
+
return string;
|
|
4133
|
+
}
|
|
4134
|
+
getElementIndex(row, col) {
|
|
4135
|
+
return col * this.RANK + row;
|
|
4136
|
+
}
|
|
4137
|
+
getElement(row, col) {
|
|
4138
|
+
return this[col * this.RANK + row];
|
|
4139
|
+
}
|
|
4140
|
+
setElement(row, col, value) {
|
|
4141
|
+
this[col * this.RANK + row] = checkNumber(value);
|
|
4142
|
+
return this;
|
|
4143
|
+
}
|
|
4144
|
+
getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
|
|
4145
|
+
const firstIndex = columnIndex * this.RANK;
|
|
4146
|
+
for (let i2 = 0; i2 < this.RANK; ++i2) {
|
|
4147
|
+
result[i2] = this[firstIndex + i2];
|
|
4148
|
+
}
|
|
4149
|
+
return result;
|
|
4150
|
+
}
|
|
4151
|
+
setColumn(columnIndex, columnVector) {
|
|
4152
|
+
const firstIndex = columnIndex * this.RANK;
|
|
4153
|
+
for (let i2 = 0; i2 < this.RANK; ++i2) {
|
|
4154
|
+
this[firstIndex + i2] = columnVector[i2];
|
|
4155
|
+
}
|
|
4156
|
+
return this;
|
|
4157
|
+
}
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
4160
|
+
});
|
|
4161
|
+
|
|
4162
|
+
// ../../node_modules/gl-matrix/esm/mat3.js
|
|
4163
|
+
function transpose(out, a2) {
|
|
4164
|
+
if (out === a2) {
|
|
4165
|
+
var a01 = a2[1], a02 = a2[2], a12 = a2[5];
|
|
4166
|
+
out[1] = a2[3];
|
|
4167
|
+
out[2] = a2[6];
|
|
4168
|
+
out[3] = a01;
|
|
4169
|
+
out[5] = a2[7];
|
|
4170
|
+
out[6] = a02;
|
|
4171
|
+
out[7] = a12;
|
|
4172
|
+
} else {
|
|
4173
|
+
out[0] = a2[0];
|
|
4174
|
+
out[1] = a2[3];
|
|
4175
|
+
out[2] = a2[6];
|
|
4176
|
+
out[3] = a2[1];
|
|
4177
|
+
out[4] = a2[4];
|
|
4178
|
+
out[5] = a2[7];
|
|
4179
|
+
out[6] = a2[2];
|
|
4180
|
+
out[7] = a2[5];
|
|
4181
|
+
out[8] = a2[8];
|
|
4182
|
+
}
|
|
4183
|
+
return out;
|
|
4184
|
+
}
|
|
4185
|
+
function invert(out, a2) {
|
|
4186
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2];
|
|
4187
|
+
var a10 = a2[3], a11 = a2[4], a12 = a2[5];
|
|
4188
|
+
var a20 = a2[6], a21 = a2[7], a22 = a2[8];
|
|
4189
|
+
var b01 = a22 * a11 - a12 * a21;
|
|
4190
|
+
var b11 = -a22 * a10 + a12 * a20;
|
|
4191
|
+
var b21 = a21 * a10 - a11 * a20;
|
|
4192
|
+
var det = a00 * b01 + a01 * b11 + a02 * b21;
|
|
4193
|
+
if (!det) {
|
|
4194
|
+
return null;
|
|
4195
|
+
}
|
|
4196
|
+
det = 1 / det;
|
|
4197
|
+
out[0] = b01 * det;
|
|
4198
|
+
out[1] = (-a22 * a01 + a02 * a21) * det;
|
|
4199
|
+
out[2] = (a12 * a01 - a02 * a11) * det;
|
|
4200
|
+
out[3] = b11 * det;
|
|
4201
|
+
out[4] = (a22 * a00 - a02 * a20) * det;
|
|
4202
|
+
out[5] = (-a12 * a00 + a02 * a10) * det;
|
|
4203
|
+
out[6] = b21 * det;
|
|
4204
|
+
out[7] = (-a21 * a00 + a01 * a20) * det;
|
|
4205
|
+
out[8] = (a11 * a00 - a01 * a10) * det;
|
|
4206
|
+
return out;
|
|
4207
|
+
}
|
|
4208
|
+
function determinant(a2) {
|
|
4209
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2];
|
|
4210
|
+
var a10 = a2[3], a11 = a2[4], a12 = a2[5];
|
|
4211
|
+
var a20 = a2[6], a21 = a2[7], a22 = a2[8];
|
|
4212
|
+
return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
|
|
4213
|
+
}
|
|
4214
|
+
function multiply(out, a2, b) {
|
|
4215
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2];
|
|
4216
|
+
var a10 = a2[3], a11 = a2[4], a12 = a2[5];
|
|
4217
|
+
var a20 = a2[6], a21 = a2[7], a22 = a2[8];
|
|
4218
|
+
var b00 = b[0], b01 = b[1], b02 = b[2];
|
|
4219
|
+
var b10 = b[3], b11 = b[4], b12 = b[5];
|
|
4220
|
+
var b20 = b[6], b21 = b[7], b22 = b[8];
|
|
4221
|
+
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
|
|
4222
|
+
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
|
|
4223
|
+
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
|
|
4224
|
+
out[3] = b10 * a00 + b11 * a10 + b12 * a20;
|
|
4225
|
+
out[4] = b10 * a01 + b11 * a11 + b12 * a21;
|
|
4226
|
+
out[5] = b10 * a02 + b11 * a12 + b12 * a22;
|
|
4227
|
+
out[6] = b20 * a00 + b21 * a10 + b22 * a20;
|
|
4228
|
+
out[7] = b20 * a01 + b21 * a11 + b22 * a21;
|
|
4229
|
+
out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
|
4230
|
+
return out;
|
|
4231
|
+
}
|
|
4232
|
+
function translate(out, a2, v) {
|
|
4233
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], x = v[0], y = v[1];
|
|
4234
|
+
out[0] = a00;
|
|
4235
|
+
out[1] = a01;
|
|
4236
|
+
out[2] = a02;
|
|
4237
|
+
out[3] = a10;
|
|
4238
|
+
out[4] = a11;
|
|
4239
|
+
out[5] = a12;
|
|
4240
|
+
out[6] = x * a00 + y * a10 + a20;
|
|
4241
|
+
out[7] = x * a01 + y * a11 + a21;
|
|
4242
|
+
out[8] = x * a02 + y * a12 + a22;
|
|
4243
|
+
return out;
|
|
4244
|
+
}
|
|
4245
|
+
function rotate(out, a2, rad) {
|
|
4246
|
+
var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], s2 = Math.sin(rad), c = Math.cos(rad);
|
|
4247
|
+
out[0] = c * a00 + s2 * a10;
|
|
4248
|
+
out[1] = c * a01 + s2 * a11;
|
|
4249
|
+
out[2] = c * a02 + s2 * a12;
|
|
4250
|
+
out[3] = c * a10 - s2 * a00;
|
|
4251
|
+
out[4] = c * a11 - s2 * a01;
|
|
4252
|
+
out[5] = c * a12 - s2 * a02;
|
|
4253
|
+
out[6] = a20;
|
|
4254
|
+
out[7] = a21;
|
|
4255
|
+
out[8] = a22;
|
|
4256
|
+
return out;
|
|
4257
|
+
}
|
|
4258
|
+
function scale(out, a2, v) {
|
|
4259
|
+
var x = v[0], y = v[1];
|
|
4260
|
+
out[0] = x * a2[0];
|
|
4261
|
+
out[1] = x * a2[1];
|
|
4262
|
+
out[2] = x * a2[2];
|
|
4263
|
+
out[3] = y * a2[3];
|
|
4264
|
+
out[4] = y * a2[4];
|
|
4265
|
+
out[5] = y * a2[5];
|
|
4266
|
+
out[6] = a2[6];
|
|
4267
|
+
out[7] = a2[7];
|
|
4268
|
+
out[8] = a2[8];
|
|
4269
|
+
return out;
|
|
4270
|
+
}
|
|
4271
|
+
function fromQuat(out, q) {
|
|
4272
|
+
var x = q[0], y = q[1], z = q[2], w = q[3];
|
|
4273
|
+
var x2 = x + x;
|
|
4274
|
+
var y2 = y + y;
|
|
4275
|
+
var z2 = z + z;
|
|
4276
|
+
var xx = x * x2;
|
|
4277
|
+
var yx = y * x2;
|
|
4278
|
+
var yy = y * y2;
|
|
4279
|
+
var zx = z * x2;
|
|
4280
|
+
var zy = z * y2;
|
|
4281
|
+
var zz = z * z2;
|
|
4282
|
+
var wx = w * x2;
|
|
4283
|
+
var wy = w * y2;
|
|
4284
|
+
var wz = w * z2;
|
|
4285
|
+
out[0] = 1 - yy - zz;
|
|
4286
|
+
out[3] = yx - wz;
|
|
4287
|
+
out[6] = zx + wy;
|
|
4288
|
+
out[1] = yx + wz;
|
|
4289
|
+
out[4] = 1 - xx - zz;
|
|
4290
|
+
out[7] = zy - wx;
|
|
4291
|
+
out[2] = zx - wy;
|
|
4292
|
+
out[5] = zy + wx;
|
|
4293
|
+
out[8] = 1 - xx - yy;
|
|
4294
|
+
return out;
|
|
4295
|
+
}
|
|
4296
|
+
var init_mat3 = __esm({
|
|
4297
|
+
"../../node_modules/gl-matrix/esm/mat3.js"() {
|
|
4298
|
+
}
|
|
4299
|
+
});
|
|
4300
|
+
|
|
4301
|
+
// ../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js
|
|
4302
|
+
var IDENTITY, ZERO, INDICES, constants2, Matrix3;
|
|
4303
|
+
var init_matrix3 = __esm({
|
|
4304
|
+
"../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js"() {
|
|
4305
|
+
init_matrix();
|
|
4306
|
+
init_validators();
|
|
4307
|
+
init_gl_matrix_extras();
|
|
4308
|
+
init_mat3();
|
|
4309
|
+
init_vec2();
|
|
4310
|
+
init_vec3();
|
|
4311
|
+
IDENTITY = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
4312
|
+
ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
4313
|
+
INDICES = Object.freeze({
|
|
4314
|
+
COL0ROW0: 0,
|
|
4315
|
+
COL0ROW1: 1,
|
|
4316
|
+
COL0ROW2: 2,
|
|
4317
|
+
COL1ROW0: 3,
|
|
4318
|
+
COL1ROW1: 4,
|
|
4319
|
+
COL1ROW2: 5,
|
|
4320
|
+
COL2ROW0: 6,
|
|
4321
|
+
COL2ROW1: 7,
|
|
4322
|
+
COL2ROW2: 8
|
|
4323
|
+
});
|
|
4324
|
+
constants2 = {};
|
|
4325
|
+
Matrix3 = class extends Matrix {
|
|
4326
|
+
static get IDENTITY() {
|
|
4327
|
+
constants2.IDENTITY = constants2.IDENTITY || Object.freeze(new Matrix3(IDENTITY));
|
|
4328
|
+
return constants2.IDENTITY;
|
|
4329
|
+
}
|
|
4330
|
+
static get ZERO() {
|
|
4331
|
+
constants2.ZERO = constants2.ZERO || Object.freeze(new Matrix3(ZERO));
|
|
4332
|
+
return constants2.ZERO;
|
|
4333
|
+
}
|
|
4334
|
+
get ELEMENTS() {
|
|
4335
|
+
return 9;
|
|
4336
|
+
}
|
|
4337
|
+
get RANK() {
|
|
4338
|
+
return 3;
|
|
4339
|
+
}
|
|
4340
|
+
get INDICES() {
|
|
4341
|
+
return INDICES;
|
|
4342
|
+
}
|
|
4343
|
+
constructor(array) {
|
|
4344
|
+
super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
4345
|
+
if (arguments.length === 1 && Array.isArray(array)) {
|
|
4346
|
+
this.copy(array);
|
|
4347
|
+
} else {
|
|
4348
|
+
this.identity();
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
copy(array) {
|
|
4352
|
+
this[0] = array[0];
|
|
4353
|
+
this[1] = array[1];
|
|
4354
|
+
this[2] = array[2];
|
|
4355
|
+
this[3] = array[3];
|
|
4356
|
+
this[4] = array[4];
|
|
4357
|
+
this[5] = array[5];
|
|
4358
|
+
this[6] = array[6];
|
|
4359
|
+
this[7] = array[7];
|
|
4360
|
+
this[8] = array[8];
|
|
4361
|
+
return this.check();
|
|
4362
|
+
}
|
|
4363
|
+
set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
|
|
4364
|
+
this[0] = m00;
|
|
4365
|
+
this[1] = m10;
|
|
4366
|
+
this[2] = m20;
|
|
4367
|
+
this[3] = m01;
|
|
4368
|
+
this[4] = m11;
|
|
4369
|
+
this[5] = m21;
|
|
4370
|
+
this[6] = m02;
|
|
4371
|
+
this[7] = m12;
|
|
4372
|
+
this[8] = m22;
|
|
4373
|
+
return this.check();
|
|
4374
|
+
}
|
|
4375
|
+
setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
|
4376
|
+
this[0] = m00;
|
|
4377
|
+
this[1] = m10;
|
|
4378
|
+
this[2] = m20;
|
|
4379
|
+
this[3] = m01;
|
|
4380
|
+
this[4] = m11;
|
|
4381
|
+
this[5] = m21;
|
|
4382
|
+
this[6] = m02;
|
|
4383
|
+
this[7] = m12;
|
|
4384
|
+
this[8] = m22;
|
|
4385
|
+
return this.check();
|
|
4386
|
+
}
|
|
4387
|
+
determinant() {
|
|
4388
|
+
return determinant(this);
|
|
4389
|
+
}
|
|
4390
|
+
identity() {
|
|
4391
|
+
return this.copy(IDENTITY);
|
|
4392
|
+
}
|
|
4393
|
+
fromQuaternion(q) {
|
|
4394
|
+
fromQuat(this, q);
|
|
4395
|
+
return this.check();
|
|
4396
|
+
}
|
|
4397
|
+
transpose() {
|
|
4398
|
+
transpose(this, this);
|
|
4399
|
+
return this.check();
|
|
4400
|
+
}
|
|
4401
|
+
invert() {
|
|
4402
|
+
invert(this, this);
|
|
4403
|
+
return this.check();
|
|
4404
|
+
}
|
|
4405
|
+
multiplyLeft(a2) {
|
|
4406
|
+
multiply(this, a2, this);
|
|
4407
|
+
return this.check();
|
|
4408
|
+
}
|
|
4409
|
+
multiplyRight(a2) {
|
|
4410
|
+
multiply(this, this, a2);
|
|
4411
|
+
return this.check();
|
|
4412
|
+
}
|
|
4413
|
+
rotate(radians) {
|
|
4414
|
+
rotate(this, this, radians);
|
|
4415
|
+
return this.check();
|
|
4416
|
+
}
|
|
4417
|
+
scale(factor) {
|
|
4418
|
+
if (Array.isArray(factor)) {
|
|
4419
|
+
scale(this, this, factor);
|
|
4420
|
+
} else {
|
|
4421
|
+
scale(this, this, [factor, factor, factor]);
|
|
4422
|
+
}
|
|
4423
|
+
return this.check();
|
|
4424
|
+
}
|
|
4425
|
+
translate(vec) {
|
|
4426
|
+
translate(this, this, vec);
|
|
4427
|
+
return this.check();
|
|
4428
|
+
}
|
|
4429
|
+
transform(vector, result) {
|
|
4430
|
+
switch (vector.length) {
|
|
4431
|
+
case 2:
|
|
4432
|
+
result = transformMat3(result || [-0, -0], vector, this);
|
|
4433
|
+
break;
|
|
4434
|
+
case 3:
|
|
4435
|
+
result = transformMat32(result || [-0, -0, -0], vector, this);
|
|
4436
|
+
break;
|
|
4437
|
+
case 4:
|
|
4438
|
+
result = vec4_transformMat3(result || [-0, -0, -0, -0], vector, this);
|
|
4439
|
+
break;
|
|
4440
|
+
default:
|
|
4441
|
+
throw new Error("Illegal vector");
|
|
4442
|
+
}
|
|
4443
|
+
checkVector(result, vector.length);
|
|
4444
|
+
return result;
|
|
4445
|
+
}
|
|
4446
|
+
transformVector(vector, result) {
|
|
4447
|
+
deprecated("Matrix3.transformVector");
|
|
4448
|
+
return this.transform(vector, result);
|
|
4449
|
+
}
|
|
4450
|
+
transformVector2(vector, result) {
|
|
4451
|
+
deprecated("Matrix3.transformVector");
|
|
4452
|
+
return this.transform(vector, result);
|
|
4453
|
+
}
|
|
4454
|
+
transformVector3(vector, result) {
|
|
4455
|
+
deprecated("Matrix3.transformVector");
|
|
4456
|
+
return this.transform(vector, result);
|
|
4457
|
+
}
|
|
4458
|
+
};
|
|
4459
|
+
}
|
|
4460
|
+
});
|
|
4461
|
+
|
|
4462
|
+
// ../../node_modules/@math.gl/core/dist/esm/index.js
|
|
4463
|
+
var globals3, global_3;
|
|
4464
|
+
var init_esm = __esm({
|
|
4465
|
+
"../../node_modules/@math.gl/core/dist/esm/index.js"() {
|
|
4466
|
+
init_common();
|
|
4467
|
+
init_vector3();
|
|
4468
|
+
init_matrix3();
|
|
4469
|
+
globals3 = {
|
|
4470
|
+
self: typeof self !== "undefined" && self,
|
|
4471
|
+
window: typeof window !== "undefined" && window,
|
|
4472
|
+
global: typeof global !== "undefined" && global
|
|
4473
|
+
};
|
|
4474
|
+
global_3 = globals3.global || globals3.self || globals3.window;
|
|
4475
|
+
global_3.mathgl = {
|
|
4476
|
+
config
|
|
4477
|
+
};
|
|
4478
|
+
}
|
|
4479
|
+
});
|
|
4480
|
+
|
|
4481
|
+
// src/lib/gltf-utils/gltf-constants.ts
|
|
4482
|
+
var COMPONENTS, BYTES;
|
|
4483
|
+
var init_gltf_constants = __esm({
|
|
4484
|
+
"src/lib/gltf-utils/gltf-constants.ts"() {
|
|
4485
|
+
COMPONENTS = {
|
|
4486
|
+
SCALAR: 1,
|
|
4487
|
+
VEC2: 2,
|
|
4488
|
+
VEC3: 3,
|
|
4489
|
+
VEC4: 4,
|
|
4490
|
+
MAT2: 4,
|
|
4491
|
+
MAT3: 9,
|
|
4492
|
+
MAT4: 16
|
|
4493
|
+
};
|
|
4494
|
+
BYTES = {
|
|
4495
|
+
5120: 1,
|
|
4496
|
+
5121: 1,
|
|
4497
|
+
5122: 2,
|
|
4498
|
+
5123: 2,
|
|
4499
|
+
5125: 4,
|
|
4500
|
+
5126: 4
|
|
4501
|
+
};
|
|
4502
|
+
}
|
|
4503
|
+
});
|
|
4504
|
+
|
|
4505
|
+
// src/lib/extensions/KHR_texture_transform.ts
|
|
4506
|
+
var KHR_texture_transform_exports = {};
|
|
4507
|
+
__export(KHR_texture_transform_exports, {
|
|
4508
|
+
decode: () => decode4,
|
|
4509
|
+
name: () => name5
|
|
4510
|
+
});
|
|
4511
|
+
async function decode4(gltfData, options) {
|
|
4512
|
+
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
4513
|
+
const extension = gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);
|
|
4514
|
+
if (!extension) {
|
|
4515
|
+
return;
|
|
4516
|
+
}
|
|
4517
|
+
const materials = gltfData.json.materials || [];
|
|
4518
|
+
for (let i2 = 0; i2 < materials.length; i2++) {
|
|
4519
|
+
transformTexCoords(i2, gltfData);
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
function transformTexCoords(materialIndex, gltfData) {
|
|
4523
|
+
const processedTexCoords = [];
|
|
4524
|
+
const material = gltfData.json.materials?.[materialIndex];
|
|
4525
|
+
const baseColorTexture = material?.pbrMetallicRoughness?.baseColorTexture;
|
|
4526
|
+
if (baseColorTexture) {
|
|
4527
|
+
transformPrimitives(gltfData, materialIndex, baseColorTexture, processedTexCoords);
|
|
4528
|
+
}
|
|
4529
|
+
const emisiveTexture = material?.emissiveTexture;
|
|
4530
|
+
if (emisiveTexture) {
|
|
4531
|
+
transformPrimitives(gltfData, materialIndex, emisiveTexture, processedTexCoords);
|
|
4532
|
+
}
|
|
4533
|
+
const normalTexture = material?.normalTexture;
|
|
4534
|
+
if (normalTexture) {
|
|
4535
|
+
transformPrimitives(gltfData, materialIndex, normalTexture, processedTexCoords);
|
|
4536
|
+
}
|
|
4537
|
+
const occlusionTexture = material?.occlusionTexture;
|
|
4538
|
+
if (occlusionTexture) {
|
|
4539
|
+
transformPrimitives(gltfData, materialIndex, occlusionTexture, processedTexCoords);
|
|
4540
|
+
}
|
|
4541
|
+
const metallicRoughnessTexture = material?.pbrMetallicRoughness?.metallicRoughnessTexture;
|
|
4542
|
+
if (metallicRoughnessTexture) {
|
|
4543
|
+
transformPrimitives(gltfData, materialIndex, metallicRoughnessTexture, processedTexCoords);
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
function transformPrimitives(gltfData, materialIndex, texture, processedTexCoords) {
|
|
4547
|
+
const transformParameters = getTransformParameters(texture, processedTexCoords);
|
|
4548
|
+
if (!transformParameters) {
|
|
4549
|
+
return;
|
|
4550
|
+
}
|
|
4551
|
+
const meshes = gltfData.json.meshes || [];
|
|
4552
|
+
for (const mesh of meshes) {
|
|
4553
|
+
for (const primitive of mesh.primitives) {
|
|
4554
|
+
const material = primitive.material;
|
|
4555
|
+
if (Number.isFinite(material) && materialIndex === material) {
|
|
4556
|
+
transformPrimitive(gltfData, primitive, transformParameters);
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
function getTransformParameters(texture, processedTexCoords) {
|
|
4562
|
+
const textureInfo = texture.extensions?.[EXT_MESHOPT_TRANSFORM];
|
|
4563
|
+
const { texCoord: originalTexCoord = 0 } = texture;
|
|
4564
|
+
const { texCoord = originalTexCoord } = textureInfo;
|
|
4565
|
+
const isProcessed = processedTexCoords.findIndex(([original, newTexCoord]) => original === originalTexCoord && newTexCoord === texCoord) !== -1;
|
|
4566
|
+
if (!isProcessed) {
|
|
4567
|
+
const matrix = makeTransformationMatrix(textureInfo);
|
|
4568
|
+
if (originalTexCoord !== texCoord) {
|
|
4569
|
+
texture.texCoord = texCoord;
|
|
4570
|
+
}
|
|
4571
|
+
processedTexCoords.push([originalTexCoord, texCoord]);
|
|
4572
|
+
return { originalTexCoord, texCoord, matrix };
|
|
4573
|
+
}
|
|
4574
|
+
return null;
|
|
4575
|
+
}
|
|
4576
|
+
function transformPrimitive(gltfData, primitive, transformParameters) {
|
|
4577
|
+
const { originalTexCoord, texCoord, matrix } = transformParameters;
|
|
4578
|
+
const texCoordAccessor = primitive.attributes[`TEXCOORD_${originalTexCoord}`];
|
|
4579
|
+
if (Number.isFinite(texCoordAccessor)) {
|
|
4580
|
+
const accessor = gltfData.json.accessors?.[texCoordAccessor];
|
|
4581
|
+
if (accessor && accessor.bufferView) {
|
|
4582
|
+
const bufferView = gltfData.json.bufferViews?.[accessor.bufferView];
|
|
4583
|
+
if (bufferView) {
|
|
4584
|
+
const { arrayBuffer, byteOffset: bufferByteOffset } = gltfData.buffers[bufferView.buffer];
|
|
4585
|
+
const byteOffset = (bufferByteOffset || 0) + (accessor.byteOffset || 0) + (bufferView.byteOffset || 0);
|
|
4586
|
+
const { ArrayType, length } = getAccessorArrayTypeAndLength(accessor, bufferView);
|
|
4587
|
+
const bytes = BYTES[accessor.componentType];
|
|
4588
|
+
const components = COMPONENTS[accessor.type];
|
|
4589
|
+
const elementAddressScale = bufferView.byteStride || bytes * components;
|
|
4590
|
+
const result = new Float32Array(length);
|
|
4591
|
+
for (let i2 = 0; i2 < accessor.count; i2++) {
|
|
4592
|
+
const uv = new ArrayType(arrayBuffer, byteOffset + i2 * elementAddressScale, 2);
|
|
4593
|
+
scratchVector.set(uv[0], uv[1], 1);
|
|
4594
|
+
scratchVector.transformByMatrix3(matrix);
|
|
4595
|
+
result.set([scratchVector[0], scratchVector[1]], i2 * components);
|
|
4596
|
+
}
|
|
4597
|
+
if (originalTexCoord === texCoord) {
|
|
4598
|
+
updateGltf(accessor, bufferView, gltfData.buffers, result);
|
|
4599
|
+
} else {
|
|
4600
|
+
createAttribute(texCoord, accessor, primitive, gltfData, result);
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
function updateGltf(accessor, bufferView, buffers, newTexCoordArray) {
|
|
4607
|
+
accessor.componentType = 5126;
|
|
4608
|
+
buffers.push({
|
|
4609
|
+
arrayBuffer: newTexCoordArray.buffer,
|
|
4610
|
+
byteOffset: 0,
|
|
4611
|
+
byteLength: newTexCoordArray.buffer.byteLength
|
|
4612
|
+
});
|
|
4613
|
+
bufferView.buffer = buffers.length - 1;
|
|
4614
|
+
bufferView.byteLength = newTexCoordArray.buffer.byteLength;
|
|
4615
|
+
bufferView.byteOffset = 0;
|
|
4616
|
+
delete bufferView.byteStride;
|
|
4617
|
+
}
|
|
4618
|
+
function createAttribute(newTexCoord, originalAccessor, primitive, gltfData, newTexCoordArray) {
|
|
4619
|
+
gltfData.buffers.push({
|
|
4620
|
+
arrayBuffer: newTexCoordArray.buffer,
|
|
4621
|
+
byteOffset: 0,
|
|
4622
|
+
byteLength: newTexCoordArray.buffer.byteLength
|
|
4623
|
+
});
|
|
4624
|
+
const bufferViews = gltfData.json.bufferViews;
|
|
4625
|
+
if (!bufferViews) {
|
|
4626
|
+
return;
|
|
4627
|
+
}
|
|
4628
|
+
bufferViews.push({
|
|
4629
|
+
buffer: gltfData.buffers.length - 1,
|
|
4630
|
+
byteLength: newTexCoordArray.buffer.byteLength,
|
|
4631
|
+
byteOffset: 0
|
|
4632
|
+
});
|
|
4633
|
+
const accessors = gltfData.json.accessors;
|
|
4634
|
+
if (!accessors) {
|
|
4635
|
+
return;
|
|
4636
|
+
}
|
|
4637
|
+
accessors.push({
|
|
4638
|
+
bufferView: bufferViews?.length - 1,
|
|
4639
|
+
byteOffset: 0,
|
|
4640
|
+
componentType: 5126,
|
|
4641
|
+
count: originalAccessor.count,
|
|
4642
|
+
type: "VEC2"
|
|
4643
|
+
});
|
|
4644
|
+
primitive.attributes[`TEXCOORD_${newTexCoord}`] = accessors.length - 1;
|
|
4645
|
+
}
|
|
4646
|
+
function makeTransformationMatrix(extensionData) {
|
|
4647
|
+
const { offset = [0, 0], rotation = 0, scale: scale2 = [1, 1] } = extensionData;
|
|
4648
|
+
const translationMatirx = new Matrix3().set(1, 0, 0, 0, 1, 0, offset[0], offset[1], 1);
|
|
4649
|
+
const rotationMatirx = scratchRotationMatrix.set(Math.cos(rotation), Math.sin(rotation), 0, -Math.sin(rotation), Math.cos(rotation), 0, 0, 0, 1);
|
|
4650
|
+
const scaleMatrix = scratchScaleMatrix.set(scale2[0], 0, 0, 0, scale2[1], 0, 0, 0, 1);
|
|
4651
|
+
return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);
|
|
4652
|
+
}
|
|
4653
|
+
var EXT_MESHOPT_TRANSFORM, name5, scratchVector, scratchRotationMatrix, scratchScaleMatrix;
|
|
4654
|
+
var init_KHR_texture_transform = __esm({
|
|
4655
|
+
"src/lib/extensions/KHR_texture_transform.ts"() {
|
|
4656
|
+
init_esm();
|
|
4657
|
+
init_gltf_utils();
|
|
4658
|
+
init_gltf_constants();
|
|
4659
|
+
init_gltf_scenegraph();
|
|
4660
|
+
EXT_MESHOPT_TRANSFORM = "KHR_texture_transform";
|
|
4661
|
+
name5 = EXT_MESHOPT_TRANSFORM;
|
|
4662
|
+
scratchVector = new Vector3();
|
|
4663
|
+
scratchRotationMatrix = new Matrix3();
|
|
4664
|
+
scratchScaleMatrix = new Matrix3();
|
|
4665
|
+
}
|
|
4666
|
+
});
|
|
4667
|
+
|
|
3304
4668
|
// src/lib/extensions/deprecated/KHR_lights_punctual.ts
|
|
3305
4669
|
var KHR_lights_punctual_exports = {};
|
|
3306
4670
|
__export(KHR_lights_punctual_exports, {
|
|
3307
|
-
decode: () =>
|
|
4671
|
+
decode: () => decode5,
|
|
3308
4672
|
encode: () => encode2,
|
|
3309
|
-
name: () =>
|
|
4673
|
+
name: () => name6
|
|
3310
4674
|
});
|
|
3311
|
-
async function
|
|
4675
|
+
async function decode5(gltfData) {
|
|
3312
4676
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
3313
4677
|
const { json } = gltfScenegraph;
|
|
3314
4678
|
const extension = gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);
|
|
@@ -3341,24 +4705,24 @@
|
|
|
3341
4705
|
delete gltfScenegraph.json.lights;
|
|
3342
4706
|
}
|
|
3343
4707
|
}
|
|
3344
|
-
var KHR_LIGHTS_PUNCTUAL,
|
|
4708
|
+
var KHR_LIGHTS_PUNCTUAL, name6;
|
|
3345
4709
|
var init_KHR_lights_punctual = __esm({
|
|
3346
4710
|
"src/lib/extensions/deprecated/KHR_lights_punctual.ts"() {
|
|
3347
4711
|
init_assert3();
|
|
3348
4712
|
init_gltf_scenegraph();
|
|
3349
4713
|
KHR_LIGHTS_PUNCTUAL = "KHR_lights_punctual";
|
|
3350
|
-
|
|
4714
|
+
name6 = KHR_LIGHTS_PUNCTUAL;
|
|
3351
4715
|
}
|
|
3352
4716
|
});
|
|
3353
4717
|
|
|
3354
4718
|
// src/lib/extensions/deprecated/KHR_materials_unlit.ts
|
|
3355
4719
|
var KHR_materials_unlit_exports = {};
|
|
3356
4720
|
__export(KHR_materials_unlit_exports, {
|
|
3357
|
-
decode: () =>
|
|
4721
|
+
decode: () => decode6,
|
|
3358
4722
|
encode: () => encode3,
|
|
3359
|
-
name: () =>
|
|
4723
|
+
name: () => name7
|
|
3360
4724
|
});
|
|
3361
|
-
async function
|
|
4725
|
+
async function decode6(gltfData) {
|
|
3362
4726
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
3363
4727
|
const { json } = gltfScenegraph;
|
|
3364
4728
|
gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);
|
|
@@ -3383,23 +4747,23 @@
|
|
|
3383
4747
|
}
|
|
3384
4748
|
}
|
|
3385
4749
|
}
|
|
3386
|
-
var KHR_MATERIALS_UNLIT,
|
|
4750
|
+
var KHR_MATERIALS_UNLIT, name7;
|
|
3387
4751
|
var init_KHR_materials_unlit = __esm({
|
|
3388
4752
|
"src/lib/extensions/deprecated/KHR_materials_unlit.ts"() {
|
|
3389
4753
|
init_gltf_scenegraph();
|
|
3390
4754
|
KHR_MATERIALS_UNLIT = "KHR_materials_unlit";
|
|
3391
|
-
|
|
4755
|
+
name7 = KHR_MATERIALS_UNLIT;
|
|
3392
4756
|
}
|
|
3393
4757
|
});
|
|
3394
4758
|
|
|
3395
4759
|
// src/lib/extensions/deprecated/KHR_techniques_webgl.ts
|
|
3396
4760
|
var KHR_techniques_webgl_exports = {};
|
|
3397
4761
|
__export(KHR_techniques_webgl_exports, {
|
|
3398
|
-
decode: () =>
|
|
4762
|
+
decode: () => decode7,
|
|
3399
4763
|
encode: () => encode4,
|
|
3400
|
-
name: () =>
|
|
4764
|
+
name: () => name8
|
|
3401
4765
|
});
|
|
3402
|
-
async function
|
|
4766
|
+
async function decode7(gltfData) {
|
|
3403
4767
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
3404
4768
|
const { json } = gltfScenegraph;
|
|
3405
4769
|
const extension = gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);
|
|
@@ -3451,12 +4815,12 @@
|
|
|
3451
4815
|
});
|
|
3452
4816
|
return values;
|
|
3453
4817
|
}
|
|
3454
|
-
var KHR_TECHNIQUES_WEBGL,
|
|
4818
|
+
var KHR_TECHNIQUES_WEBGL, name8;
|
|
3455
4819
|
var init_KHR_techniques_webgl = __esm({
|
|
3456
4820
|
"src/lib/extensions/deprecated/KHR_techniques_webgl.ts"() {
|
|
3457
4821
|
init_gltf_scenegraph();
|
|
3458
4822
|
KHR_TECHNIQUES_WEBGL = "KHR_techniques_webgl";
|
|
3459
|
-
|
|
4823
|
+
name8 = KHR_TECHNIQUES_WEBGL;
|
|
3460
4824
|
}
|
|
3461
4825
|
});
|
|
3462
4826
|
|
|
@@ -3485,6 +4849,7 @@
|
|
|
3485
4849
|
init_EXT_texture_webp();
|
|
3486
4850
|
init_KHR_texture_basisu();
|
|
3487
4851
|
init_KHR_draco_mesh_compression();
|
|
4852
|
+
init_KHR_texture_transform();
|
|
3488
4853
|
init_KHR_lights_punctual();
|
|
3489
4854
|
init_KHR_materials_unlit();
|
|
3490
4855
|
init_KHR_techniques_webgl();
|
|
@@ -3495,7 +4860,8 @@
|
|
|
3495
4860
|
KHR_draco_mesh_compression_exports,
|
|
3496
4861
|
KHR_lights_punctual_exports,
|
|
3497
4862
|
KHR_materials_unlit_exports,
|
|
3498
|
-
KHR_techniques_webgl_exports
|
|
4863
|
+
KHR_techniques_webgl_exports,
|
|
4864
|
+
KHR_texture_transform_exports
|
|
3499
4865
|
];
|
|
3500
4866
|
}
|
|
3501
4867
|
});
|
|
@@ -3726,20 +5092,20 @@
|
|
|
3726
5092
|
|
|
3727
5093
|
// src/lib/api/post-process-gltf.ts
|
|
3728
5094
|
function getBytesFromComponentType(componentType) {
|
|
3729
|
-
return
|
|
5095
|
+
return BYTES2[componentType];
|
|
3730
5096
|
}
|
|
3731
5097
|
function getSizeFromAccessorType(type) {
|
|
3732
|
-
return
|
|
5098
|
+
return COMPONENTS2[type];
|
|
3733
5099
|
}
|
|
3734
5100
|
function postProcessGLTF(gltf, options) {
|
|
3735
5101
|
return new GLTFPostProcessor().postProcess(gltf, options);
|
|
3736
5102
|
}
|
|
3737
|
-
var
|
|
5103
|
+
var COMPONENTS2, BYTES2, GL_SAMPLER, SAMPLER_PARAMETER_GLTF_TO_GL, DEFAULT_SAMPLER, GLTFPostProcessor;
|
|
3738
5104
|
var init_post_process_gltf = __esm({
|
|
3739
5105
|
"src/lib/api/post-process-gltf.ts"() {
|
|
3740
5106
|
init_assert3();
|
|
3741
5107
|
init_gltf_utils();
|
|
3742
|
-
|
|
5108
|
+
COMPONENTS2 = {
|
|
3743
5109
|
SCALAR: 1,
|
|
3744
5110
|
VEC2: 2,
|
|
3745
5111
|
VEC3: 3,
|
|
@@ -3748,7 +5114,7 @@
|
|
|
3748
5114
|
MAT3: 9,
|
|
3749
5115
|
MAT4: 16
|
|
3750
5116
|
};
|
|
3751
|
-
|
|
5117
|
+
BYTES2 = {
|
|
3752
5118
|
5120: 1,
|
|
3753
5119
|
5121: 1,
|
|
3754
5120
|
5122: 2,
|