@deck.gl/geo-layers 9.2.0-alpha.1 → 9.2.0-alpha.3
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/a5-layer/a5-layer.js +1 -2
- package/dist/a5-layer/a5-layer.js.map +1 -1
- package/dist/dist.dev.js +1911 -929
- package/dist/index.cjs +4 -5
- package/dist/index.cjs.map +2 -2
- package/dist/mesh-layer/mesh-layer.d.ts.map +1 -1
- package/dist/mesh-layer/mesh-layer.js +1 -2
- package/dist/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/terrain-layer/terrain-layer.d.ts.map +1 -1
- package/dist/terrain-layer/terrain-layer.js +2 -3
- package/dist/terrain-layer/terrain-layer.js.map +1 -1
- package/dist.min.js +429 -16
- package/package.json +7 -7
- package/src/a5-layer/a5-layer.ts +2 -2
- package/src/mesh-layer/mesh-layer.ts +1 -2
- package/src/terrain-layer/terrain-layer.ts +4 -3
package/dist/dist.dev.js
CHANGED
|
@@ -3224,11 +3224,11 @@ var __exports__ = (() => {
|
|
|
3224
3224
|
ARRAY_TYPE = type;
|
|
3225
3225
|
}
|
|
3226
3226
|
var degree = Math.PI / 180;
|
|
3227
|
-
function toRadian(
|
|
3228
|
-
return
|
|
3227
|
+
function toRadian(a22) {
|
|
3228
|
+
return a22 * degree;
|
|
3229
3229
|
}
|
|
3230
|
-
function equals(
|
|
3231
|
-
return Math.abs(
|
|
3230
|
+
function equals(a22, b2) {
|
|
3231
|
+
return Math.abs(a22 - b2) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b2));
|
|
3232
3232
|
}
|
|
3233
3233
|
if (!Math.hypot)
|
|
3234
3234
|
Math.hypot = function() {
|
|
@@ -3277,19 +3277,19 @@ var __exports__ = (() => {
|
|
|
3277
3277
|
out[3] = 1;
|
|
3278
3278
|
return out;
|
|
3279
3279
|
}
|
|
3280
|
-
function clone(
|
|
3280
|
+
function clone(a22) {
|
|
3281
3281
|
var out = new ARRAY_TYPE(4);
|
|
3282
|
-
out[0] =
|
|
3283
|
-
out[1] =
|
|
3284
|
-
out[2] =
|
|
3285
|
-
out[3] =
|
|
3282
|
+
out[0] = a22[0];
|
|
3283
|
+
out[1] = a22[1];
|
|
3284
|
+
out[2] = a22[2];
|
|
3285
|
+
out[3] = a22[3];
|
|
3286
3286
|
return out;
|
|
3287
3287
|
}
|
|
3288
|
-
function copy(out,
|
|
3289
|
-
out[0] =
|
|
3290
|
-
out[1] =
|
|
3291
|
-
out[2] =
|
|
3292
|
-
out[3] =
|
|
3288
|
+
function copy(out, a22) {
|
|
3289
|
+
out[0] = a22[0];
|
|
3290
|
+
out[1] = a22[1];
|
|
3291
|
+
out[2] = a22[2];
|
|
3292
|
+
out[3] = a22[3];
|
|
3293
3293
|
return out;
|
|
3294
3294
|
}
|
|
3295
3295
|
function identity(out) {
|
|
@@ -3314,69 +3314,69 @@ var __exports__ = (() => {
|
|
|
3314
3314
|
out[3] = m11;
|
|
3315
3315
|
return out;
|
|
3316
3316
|
}
|
|
3317
|
-
function transpose(out,
|
|
3318
|
-
if (out ===
|
|
3319
|
-
var a1 =
|
|
3320
|
-
out[1] =
|
|
3317
|
+
function transpose(out, a22) {
|
|
3318
|
+
if (out === a22) {
|
|
3319
|
+
var a1 = a22[1];
|
|
3320
|
+
out[1] = a22[2];
|
|
3321
3321
|
out[2] = a1;
|
|
3322
3322
|
} else {
|
|
3323
|
-
out[0] =
|
|
3324
|
-
out[1] =
|
|
3325
|
-
out[2] =
|
|
3326
|
-
out[3] =
|
|
3323
|
+
out[0] = a22[0];
|
|
3324
|
+
out[1] = a22[2];
|
|
3325
|
+
out[2] = a22[1];
|
|
3326
|
+
out[3] = a22[3];
|
|
3327
3327
|
}
|
|
3328
3328
|
return out;
|
|
3329
3329
|
}
|
|
3330
|
-
function invert(out,
|
|
3331
|
-
var a0 =
|
|
3332
|
-
var det = a0 *
|
|
3330
|
+
function invert(out, a22) {
|
|
3331
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
3332
|
+
var det = a0 * a3 - a222 * a1;
|
|
3333
3333
|
if (!det) {
|
|
3334
3334
|
return null;
|
|
3335
3335
|
}
|
|
3336
3336
|
det = 1 / det;
|
|
3337
|
-
out[0] =
|
|
3337
|
+
out[0] = a3 * det;
|
|
3338
3338
|
out[1] = -a1 * det;
|
|
3339
|
-
out[2] = -
|
|
3339
|
+
out[2] = -a222 * det;
|
|
3340
3340
|
out[3] = a0 * det;
|
|
3341
3341
|
return out;
|
|
3342
3342
|
}
|
|
3343
|
-
function adjoint(out,
|
|
3344
|
-
var a0 =
|
|
3345
|
-
out[0] =
|
|
3346
|
-
out[1] = -
|
|
3347
|
-
out[2] = -
|
|
3343
|
+
function adjoint(out, a22) {
|
|
3344
|
+
var a0 = a22[0];
|
|
3345
|
+
out[0] = a22[3];
|
|
3346
|
+
out[1] = -a22[1];
|
|
3347
|
+
out[2] = -a22[2];
|
|
3348
3348
|
out[3] = a0;
|
|
3349
3349
|
return out;
|
|
3350
3350
|
}
|
|
3351
|
-
function determinant(
|
|
3352
|
-
return
|
|
3351
|
+
function determinant(a22) {
|
|
3352
|
+
return a22[0] * a22[3] - a22[2] * a22[1];
|
|
3353
3353
|
}
|
|
3354
|
-
function multiply(out,
|
|
3355
|
-
var a0 =
|
|
3354
|
+
function multiply(out, a22, b2) {
|
|
3355
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
3356
3356
|
var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3];
|
|
3357
|
-
out[0] = a0 * b0 +
|
|
3358
|
-
out[1] = a1 * b0 +
|
|
3359
|
-
out[2] = a0 * b22 +
|
|
3360
|
-
out[3] = a1 * b22 +
|
|
3357
|
+
out[0] = a0 * b0 + a222 * b1;
|
|
3358
|
+
out[1] = a1 * b0 + a3 * b1;
|
|
3359
|
+
out[2] = a0 * b22 + a222 * b3;
|
|
3360
|
+
out[3] = a1 * b22 + a3 * b3;
|
|
3361
3361
|
return out;
|
|
3362
3362
|
}
|
|
3363
|
-
function rotate(out,
|
|
3364
|
-
var a0 =
|
|
3363
|
+
function rotate(out, a22, rad) {
|
|
3364
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
3365
3365
|
var s2 = Math.sin(rad);
|
|
3366
3366
|
var c2 = Math.cos(rad);
|
|
3367
|
-
out[0] = a0 * c2 +
|
|
3368
|
-
out[1] = a1 * c2 +
|
|
3369
|
-
out[2] = a0 * -s2 +
|
|
3370
|
-
out[3] = a1 * -s2 +
|
|
3367
|
+
out[0] = a0 * c2 + a222 * s2;
|
|
3368
|
+
out[1] = a1 * c2 + a3 * s2;
|
|
3369
|
+
out[2] = a0 * -s2 + a222 * c2;
|
|
3370
|
+
out[3] = a1 * -s2 + a3 * c2;
|
|
3371
3371
|
return out;
|
|
3372
3372
|
}
|
|
3373
|
-
function scale(out,
|
|
3374
|
-
var a0 =
|
|
3373
|
+
function scale(out, a22, v2) {
|
|
3374
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
3375
3375
|
var v0 = v2[0], v1 = v2[1];
|
|
3376
3376
|
out[0] = a0 * v0;
|
|
3377
3377
|
out[1] = a1 * v0;
|
|
3378
|
-
out[2] =
|
|
3379
|
-
out[3] =
|
|
3378
|
+
out[2] = a222 * v1;
|
|
3379
|
+
out[3] = a3 * v1;
|
|
3380
3380
|
return out;
|
|
3381
3381
|
}
|
|
3382
3382
|
function fromRotation(out, rad) {
|
|
@@ -3395,53 +3395,53 @@ var __exports__ = (() => {
|
|
|
3395
3395
|
out[3] = v2[1];
|
|
3396
3396
|
return out;
|
|
3397
3397
|
}
|
|
3398
|
-
function str(
|
|
3399
|
-
return "mat2(" +
|
|
3398
|
+
function str(a22) {
|
|
3399
|
+
return "mat2(" + a22[0] + ", " + a22[1] + ", " + a22[2] + ", " + a22[3] + ")";
|
|
3400
3400
|
}
|
|
3401
|
-
function frob(
|
|
3402
|
-
return Math.hypot(
|
|
3401
|
+
function frob(a22) {
|
|
3402
|
+
return Math.hypot(a22[0], a22[1], a22[2], a22[3]);
|
|
3403
3403
|
}
|
|
3404
|
-
function LDU(L2, D, U,
|
|
3405
|
-
L2[2] =
|
|
3406
|
-
U[0] =
|
|
3407
|
-
U[1] =
|
|
3408
|
-
U[3] =
|
|
3404
|
+
function LDU(L2, D, U, a22) {
|
|
3405
|
+
L2[2] = a22[2] / a22[0];
|
|
3406
|
+
U[0] = a22[0];
|
|
3407
|
+
U[1] = a22[1];
|
|
3408
|
+
U[3] = a22[3] - L2[2] * U[1];
|
|
3409
3409
|
return [L2, D, U];
|
|
3410
3410
|
}
|
|
3411
|
-
function add(out,
|
|
3412
|
-
out[0] =
|
|
3413
|
-
out[1] =
|
|
3414
|
-
out[2] =
|
|
3415
|
-
out[3] =
|
|
3411
|
+
function add(out, a22, b2) {
|
|
3412
|
+
out[0] = a22[0] + b2[0];
|
|
3413
|
+
out[1] = a22[1] + b2[1];
|
|
3414
|
+
out[2] = a22[2] + b2[2];
|
|
3415
|
+
out[3] = a22[3] + b2[3];
|
|
3416
3416
|
return out;
|
|
3417
3417
|
}
|
|
3418
|
-
function subtract(out,
|
|
3419
|
-
out[0] =
|
|
3420
|
-
out[1] =
|
|
3421
|
-
out[2] =
|
|
3422
|
-
out[3] =
|
|
3418
|
+
function subtract(out, a22, b2) {
|
|
3419
|
+
out[0] = a22[0] - b2[0];
|
|
3420
|
+
out[1] = a22[1] - b2[1];
|
|
3421
|
+
out[2] = a22[2] - b2[2];
|
|
3422
|
+
out[3] = a22[3] - b2[3];
|
|
3423
3423
|
return out;
|
|
3424
3424
|
}
|
|
3425
|
-
function exactEquals(
|
|
3426
|
-
return
|
|
3425
|
+
function exactEquals(a22, b2) {
|
|
3426
|
+
return a22[0] === b2[0] && a22[1] === b2[1] && a22[2] === b2[2] && a22[3] === b2[3];
|
|
3427
3427
|
}
|
|
3428
|
-
function equals2(
|
|
3429
|
-
var a0 =
|
|
3428
|
+
function equals2(a22, b2) {
|
|
3429
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
3430
3430
|
var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3];
|
|
3431
|
-
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(
|
|
3431
|
+
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a222 - b22) <= EPSILON * Math.max(1, Math.abs(a222), Math.abs(b22)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));
|
|
3432
3432
|
}
|
|
3433
|
-
function multiplyScalar(out,
|
|
3434
|
-
out[0] =
|
|
3435
|
-
out[1] =
|
|
3436
|
-
out[2] =
|
|
3437
|
-
out[3] =
|
|
3433
|
+
function multiplyScalar(out, a22, b2) {
|
|
3434
|
+
out[0] = a22[0] * b2;
|
|
3435
|
+
out[1] = a22[1] * b2;
|
|
3436
|
+
out[2] = a22[2] * b2;
|
|
3437
|
+
out[3] = a22[3] * b2;
|
|
3438
3438
|
return out;
|
|
3439
3439
|
}
|
|
3440
|
-
function multiplyScalarAndAdd(out,
|
|
3441
|
-
out[0] =
|
|
3442
|
-
out[1] =
|
|
3443
|
-
out[2] =
|
|
3444
|
-
out[3] =
|
|
3440
|
+
function multiplyScalarAndAdd(out, a22, b2, scale72) {
|
|
3441
|
+
out[0] = a22[0] + b2[0] * scale72;
|
|
3442
|
+
out[1] = a22[1] + b2[1] * scale72;
|
|
3443
|
+
out[2] = a22[2] + b2[2] * scale72;
|
|
3444
|
+
out[3] = a22[3] + b2[3] * scale72;
|
|
3445
3445
|
return out;
|
|
3446
3446
|
}
|
|
3447
3447
|
var mul = multiply;
|
|
@@ -3563,17 +3563,17 @@ var __exports__ = (() => {
|
|
|
3563
3563
|
}
|
|
3564
3564
|
return out;
|
|
3565
3565
|
}
|
|
3566
|
-
function clone2(
|
|
3566
|
+
function clone2(a22) {
|
|
3567
3567
|
var out = new ARRAY_TYPE(3);
|
|
3568
|
-
out[0] =
|
|
3569
|
-
out[1] =
|
|
3570
|
-
out[2] =
|
|
3568
|
+
out[0] = a22[0];
|
|
3569
|
+
out[1] = a22[1];
|
|
3570
|
+
out[2] = a22[2];
|
|
3571
3571
|
return out;
|
|
3572
3572
|
}
|
|
3573
|
-
function length(
|
|
3574
|
-
var x2 =
|
|
3575
|
-
var y2 =
|
|
3576
|
-
var z =
|
|
3573
|
+
function length(a22) {
|
|
3574
|
+
var x2 = a22[0];
|
|
3575
|
+
var y2 = a22[1];
|
|
3576
|
+
var z = a22[2];
|
|
3577
3577
|
return Math.hypot(x2, y2, z);
|
|
3578
3578
|
}
|
|
3579
3579
|
function fromValues2(x2, y2, z) {
|
|
@@ -3583,10 +3583,10 @@ var __exports__ = (() => {
|
|
|
3583
3583
|
out[2] = z;
|
|
3584
3584
|
return out;
|
|
3585
3585
|
}
|
|
3586
|
-
function copy2(out,
|
|
3587
|
-
out[0] =
|
|
3588
|
-
out[1] =
|
|
3589
|
-
out[2] =
|
|
3586
|
+
function copy2(out, a22) {
|
|
3587
|
+
out[0] = a22[0];
|
|
3588
|
+
out[1] = a22[1];
|
|
3589
|
+
out[2] = a22[2];
|
|
3590
3590
|
return out;
|
|
3591
3591
|
}
|
|
3592
3592
|
function set2(out, x2, y2, z) {
|
|
@@ -3595,147 +3595,147 @@ var __exports__ = (() => {
|
|
|
3595
3595
|
out[2] = z;
|
|
3596
3596
|
return out;
|
|
3597
3597
|
}
|
|
3598
|
-
function add2(out,
|
|
3599
|
-
out[0] =
|
|
3600
|
-
out[1] =
|
|
3601
|
-
out[2] =
|
|
3598
|
+
function add2(out, a22, b2) {
|
|
3599
|
+
out[0] = a22[0] + b2[0];
|
|
3600
|
+
out[1] = a22[1] + b2[1];
|
|
3601
|
+
out[2] = a22[2] + b2[2];
|
|
3602
3602
|
return out;
|
|
3603
3603
|
}
|
|
3604
|
-
function subtract2(out,
|
|
3605
|
-
out[0] =
|
|
3606
|
-
out[1] =
|
|
3607
|
-
out[2] =
|
|
3604
|
+
function subtract2(out, a22, b2) {
|
|
3605
|
+
out[0] = a22[0] - b2[0];
|
|
3606
|
+
out[1] = a22[1] - b2[1];
|
|
3607
|
+
out[2] = a22[2] - b2[2];
|
|
3608
3608
|
return out;
|
|
3609
3609
|
}
|
|
3610
|
-
function multiply2(out,
|
|
3611
|
-
out[0] =
|
|
3612
|
-
out[1] =
|
|
3613
|
-
out[2] =
|
|
3610
|
+
function multiply2(out, a22, b2) {
|
|
3611
|
+
out[0] = a22[0] * b2[0];
|
|
3612
|
+
out[1] = a22[1] * b2[1];
|
|
3613
|
+
out[2] = a22[2] * b2[2];
|
|
3614
3614
|
return out;
|
|
3615
3615
|
}
|
|
3616
|
-
function divide(out,
|
|
3617
|
-
out[0] =
|
|
3618
|
-
out[1] =
|
|
3619
|
-
out[2] =
|
|
3616
|
+
function divide(out, a22, b2) {
|
|
3617
|
+
out[0] = a22[0] / b2[0];
|
|
3618
|
+
out[1] = a22[1] / b2[1];
|
|
3619
|
+
out[2] = a22[2] / b2[2];
|
|
3620
3620
|
return out;
|
|
3621
3621
|
}
|
|
3622
|
-
function ceil(out,
|
|
3623
|
-
out[0] = Math.ceil(
|
|
3624
|
-
out[1] = Math.ceil(
|
|
3625
|
-
out[2] = Math.ceil(
|
|
3622
|
+
function ceil(out, a22) {
|
|
3623
|
+
out[0] = Math.ceil(a22[0]);
|
|
3624
|
+
out[1] = Math.ceil(a22[1]);
|
|
3625
|
+
out[2] = Math.ceil(a22[2]);
|
|
3626
3626
|
return out;
|
|
3627
3627
|
}
|
|
3628
|
-
function floor(out,
|
|
3629
|
-
out[0] = Math.floor(
|
|
3630
|
-
out[1] = Math.floor(
|
|
3631
|
-
out[2] = Math.floor(
|
|
3628
|
+
function floor(out, a22) {
|
|
3629
|
+
out[0] = Math.floor(a22[0]);
|
|
3630
|
+
out[1] = Math.floor(a22[1]);
|
|
3631
|
+
out[2] = Math.floor(a22[2]);
|
|
3632
3632
|
return out;
|
|
3633
3633
|
}
|
|
3634
|
-
function min(out,
|
|
3635
|
-
out[0] = Math.min(
|
|
3636
|
-
out[1] = Math.min(
|
|
3637
|
-
out[2] = Math.min(
|
|
3634
|
+
function min(out, a22, b2) {
|
|
3635
|
+
out[0] = Math.min(a22[0], b2[0]);
|
|
3636
|
+
out[1] = Math.min(a22[1], b2[1]);
|
|
3637
|
+
out[2] = Math.min(a22[2], b2[2]);
|
|
3638
3638
|
return out;
|
|
3639
3639
|
}
|
|
3640
|
-
function max(out,
|
|
3641
|
-
out[0] = Math.max(
|
|
3642
|
-
out[1] = Math.max(
|
|
3643
|
-
out[2] = Math.max(
|
|
3640
|
+
function max(out, a22, b2) {
|
|
3641
|
+
out[0] = Math.max(a22[0], b2[0]);
|
|
3642
|
+
out[1] = Math.max(a22[1], b2[1]);
|
|
3643
|
+
out[2] = Math.max(a22[2], b2[2]);
|
|
3644
3644
|
return out;
|
|
3645
3645
|
}
|
|
3646
|
-
function round(out,
|
|
3647
|
-
out[0] = Math.round(
|
|
3648
|
-
out[1] = Math.round(
|
|
3649
|
-
out[2] = Math.round(
|
|
3646
|
+
function round(out, a22) {
|
|
3647
|
+
out[0] = Math.round(a22[0]);
|
|
3648
|
+
out[1] = Math.round(a22[1]);
|
|
3649
|
+
out[2] = Math.round(a22[2]);
|
|
3650
3650
|
return out;
|
|
3651
3651
|
}
|
|
3652
|
-
function scale2(out,
|
|
3653
|
-
out[0] =
|
|
3654
|
-
out[1] =
|
|
3655
|
-
out[2] =
|
|
3652
|
+
function scale2(out, a22, b2) {
|
|
3653
|
+
out[0] = a22[0] * b2;
|
|
3654
|
+
out[1] = a22[1] * b2;
|
|
3655
|
+
out[2] = a22[2] * b2;
|
|
3656
3656
|
return out;
|
|
3657
3657
|
}
|
|
3658
|
-
function scaleAndAdd(out,
|
|
3659
|
-
out[0] =
|
|
3660
|
-
out[1] =
|
|
3661
|
-
out[2] =
|
|
3658
|
+
function scaleAndAdd(out, a22, b2, scale72) {
|
|
3659
|
+
out[0] = a22[0] + b2[0] * scale72;
|
|
3660
|
+
out[1] = a22[1] + b2[1] * scale72;
|
|
3661
|
+
out[2] = a22[2] + b2[2] * scale72;
|
|
3662
3662
|
return out;
|
|
3663
3663
|
}
|
|
3664
|
-
function distance(
|
|
3665
|
-
var x2 = b2[0] -
|
|
3666
|
-
var y2 = b2[1] -
|
|
3667
|
-
var z = b2[2] -
|
|
3664
|
+
function distance(a22, b2) {
|
|
3665
|
+
var x2 = b2[0] - a22[0];
|
|
3666
|
+
var y2 = b2[1] - a22[1];
|
|
3667
|
+
var z = b2[2] - a22[2];
|
|
3668
3668
|
return Math.hypot(x2, y2, z);
|
|
3669
3669
|
}
|
|
3670
|
-
function squaredDistance(
|
|
3671
|
-
var x2 = b2[0] -
|
|
3672
|
-
var y2 = b2[1] -
|
|
3673
|
-
var z = b2[2] -
|
|
3670
|
+
function squaredDistance(a22, b2) {
|
|
3671
|
+
var x2 = b2[0] - a22[0];
|
|
3672
|
+
var y2 = b2[1] - a22[1];
|
|
3673
|
+
var z = b2[2] - a22[2];
|
|
3674
3674
|
return x2 * x2 + y2 * y2 + z * z;
|
|
3675
3675
|
}
|
|
3676
|
-
function squaredLength(
|
|
3677
|
-
var x2 =
|
|
3678
|
-
var y2 =
|
|
3679
|
-
var z =
|
|
3676
|
+
function squaredLength(a22) {
|
|
3677
|
+
var x2 = a22[0];
|
|
3678
|
+
var y2 = a22[1];
|
|
3679
|
+
var z = a22[2];
|
|
3680
3680
|
return x2 * x2 + y2 * y2 + z * z;
|
|
3681
3681
|
}
|
|
3682
|
-
function negate(out,
|
|
3683
|
-
out[0] = -
|
|
3684
|
-
out[1] = -
|
|
3685
|
-
out[2] = -
|
|
3682
|
+
function negate(out, a22) {
|
|
3683
|
+
out[0] = -a22[0];
|
|
3684
|
+
out[1] = -a22[1];
|
|
3685
|
+
out[2] = -a22[2];
|
|
3686
3686
|
return out;
|
|
3687
3687
|
}
|
|
3688
|
-
function inverse(out,
|
|
3689
|
-
out[0] = 1 /
|
|
3690
|
-
out[1] = 1 /
|
|
3691
|
-
out[2] = 1 /
|
|
3688
|
+
function inverse(out, a22) {
|
|
3689
|
+
out[0] = 1 / a22[0];
|
|
3690
|
+
out[1] = 1 / a22[1];
|
|
3691
|
+
out[2] = 1 / a22[2];
|
|
3692
3692
|
return out;
|
|
3693
3693
|
}
|
|
3694
|
-
function normalize(out,
|
|
3695
|
-
var x2 =
|
|
3696
|
-
var y2 =
|
|
3697
|
-
var z =
|
|
3694
|
+
function normalize(out, a22) {
|
|
3695
|
+
var x2 = a22[0];
|
|
3696
|
+
var y2 = a22[1];
|
|
3697
|
+
var z = a22[2];
|
|
3698
3698
|
var len42 = x2 * x2 + y2 * y2 + z * z;
|
|
3699
3699
|
if (len42 > 0) {
|
|
3700
3700
|
len42 = 1 / Math.sqrt(len42);
|
|
3701
3701
|
}
|
|
3702
|
-
out[0] =
|
|
3703
|
-
out[1] =
|
|
3704
|
-
out[2] =
|
|
3702
|
+
out[0] = a22[0] * len42;
|
|
3703
|
+
out[1] = a22[1] * len42;
|
|
3704
|
+
out[2] = a22[2] * len42;
|
|
3705
3705
|
return out;
|
|
3706
3706
|
}
|
|
3707
|
-
function dot(
|
|
3708
|
-
return
|
|
3707
|
+
function dot(a22, b2) {
|
|
3708
|
+
return a22[0] * b2[0] + a22[1] * b2[1] + a22[2] * b2[2];
|
|
3709
3709
|
}
|
|
3710
|
-
function cross(out,
|
|
3711
|
-
var ax =
|
|
3710
|
+
function cross(out, a22, b2) {
|
|
3711
|
+
var ax = a22[0], ay = a22[1], az = a22[2];
|
|
3712
3712
|
var bx = b2[0], by = b2[1], bz = b2[2];
|
|
3713
3713
|
out[0] = ay * bz - az * by;
|
|
3714
3714
|
out[1] = az * bx - ax * bz;
|
|
3715
3715
|
out[2] = ax * by - ay * bx;
|
|
3716
3716
|
return out;
|
|
3717
3717
|
}
|
|
3718
|
-
function lerp(out,
|
|
3719
|
-
var ax =
|
|
3720
|
-
var ay =
|
|
3721
|
-
var az =
|
|
3718
|
+
function lerp(out, a22, b2, t2) {
|
|
3719
|
+
var ax = a22[0];
|
|
3720
|
+
var ay = a22[1];
|
|
3721
|
+
var az = a22[2];
|
|
3722
3722
|
out[0] = ax + t2 * (b2[0] - ax);
|
|
3723
3723
|
out[1] = ay + t2 * (b2[1] - ay);
|
|
3724
3724
|
out[2] = az + t2 * (b2[2] - az);
|
|
3725
3725
|
return out;
|
|
3726
3726
|
}
|
|
3727
|
-
function hermite(out,
|
|
3727
|
+
function hermite(out, a22, b2, c2, d2, t2) {
|
|
3728
3728
|
var factorTimes2 = t2 * t2;
|
|
3729
3729
|
var factor1 = factorTimes2 * (2 * t2 - 3) + 1;
|
|
3730
3730
|
var factor2 = factorTimes2 * (t2 - 2) + t2;
|
|
3731
3731
|
var factor3 = factorTimes2 * (t2 - 1);
|
|
3732
3732
|
var factor4 = factorTimes2 * (3 - 2 * t2);
|
|
3733
|
-
out[0] =
|
|
3734
|
-
out[1] =
|
|
3735
|
-
out[2] =
|
|
3733
|
+
out[0] = a22[0] * factor1 + b2[0] * factor2 + c2[0] * factor3 + d2[0] * factor4;
|
|
3734
|
+
out[1] = a22[1] * factor1 + b2[1] * factor2 + c2[1] * factor3 + d2[1] * factor4;
|
|
3735
|
+
out[2] = a22[2] * factor1 + b2[2] * factor2 + c2[2] * factor3 + d2[2] * factor4;
|
|
3736
3736
|
return out;
|
|
3737
3737
|
}
|
|
3738
|
-
function bezier(out,
|
|
3738
|
+
function bezier(out, a22, b2, c2, d2, t2) {
|
|
3739
3739
|
var inverseFactor = 1 - t2;
|
|
3740
3740
|
var inverseFactorTimesTwo = inverseFactor * inverseFactor;
|
|
3741
3741
|
var factorTimes2 = t2 * t2;
|
|
@@ -3743,9 +3743,9 @@ var __exports__ = (() => {
|
|
|
3743
3743
|
var factor2 = 3 * t2 * inverseFactorTimesTwo;
|
|
3744
3744
|
var factor3 = 3 * factorTimes2 * inverseFactor;
|
|
3745
3745
|
var factor4 = factorTimes2 * t2;
|
|
3746
|
-
out[0] =
|
|
3747
|
-
out[1] =
|
|
3748
|
-
out[2] =
|
|
3746
|
+
out[0] = a22[0] * factor1 + b2[0] * factor2 + c2[0] * factor3 + d2[0] * factor4;
|
|
3747
|
+
out[1] = a22[1] * factor1 + b2[1] * factor2 + c2[1] * factor3 + d2[1] * factor4;
|
|
3748
|
+
out[2] = a22[2] * factor1 + b2[2] * factor2 + c2[2] * factor3 + d2[2] * factor4;
|
|
3749
3749
|
return out;
|
|
3750
3750
|
}
|
|
3751
3751
|
function random(out, scale72) {
|
|
@@ -3758,8 +3758,8 @@ var __exports__ = (() => {
|
|
|
3758
3758
|
out[2] = z * scale72;
|
|
3759
3759
|
return out;
|
|
3760
3760
|
}
|
|
3761
|
-
function transformMat4(out,
|
|
3762
|
-
var x2 =
|
|
3761
|
+
function transformMat4(out, a22, m) {
|
|
3762
|
+
var x2 = a22[0], y2 = a22[1], z = a22[2];
|
|
3763
3763
|
var w2 = m[3] * x2 + m[7] * y2 + m[11] * z + m[15];
|
|
3764
3764
|
w2 = w2 || 1;
|
|
3765
3765
|
out[0] = (m[0] * x2 + m[4] * y2 + m[8] * z + m[12]) / w2;
|
|
@@ -3767,16 +3767,16 @@ var __exports__ = (() => {
|
|
|
3767
3767
|
out[2] = (m[2] * x2 + m[6] * y2 + m[10] * z + m[14]) / w2;
|
|
3768
3768
|
return out;
|
|
3769
3769
|
}
|
|
3770
|
-
function transformMat3(out,
|
|
3771
|
-
var x2 =
|
|
3770
|
+
function transformMat3(out, a22, m) {
|
|
3771
|
+
var x2 = a22[0], y2 = a22[1], z = a22[2];
|
|
3772
3772
|
out[0] = x2 * m[0] + y2 * m[3] + z * m[6];
|
|
3773
3773
|
out[1] = x2 * m[1] + y2 * m[4] + z * m[7];
|
|
3774
3774
|
out[2] = x2 * m[2] + y2 * m[5] + z * m[8];
|
|
3775
3775
|
return out;
|
|
3776
3776
|
}
|
|
3777
|
-
function transformQuat(out,
|
|
3777
|
+
function transformQuat(out, a22, q) {
|
|
3778
3778
|
var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
|
|
3779
|
-
var x2 =
|
|
3779
|
+
var x2 = a22[0], y2 = a22[1], z = a22[2];
|
|
3780
3780
|
var uvx = qy * z - qz * y2, uvy = qz * x2 - qx * z, uvz = qx * y2 - qy * x2;
|
|
3781
3781
|
var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
|
|
3782
3782
|
var w2 = qw * 2;
|
|
@@ -3791,11 +3791,11 @@ var __exports__ = (() => {
|
|
|
3791
3791
|
out[2] = z + uvz + uuvz;
|
|
3792
3792
|
return out;
|
|
3793
3793
|
}
|
|
3794
|
-
function rotateX(out,
|
|
3794
|
+
function rotateX(out, a22, b2, rad) {
|
|
3795
3795
|
var p2 = [], r2 = [];
|
|
3796
|
-
p2[0] =
|
|
3797
|
-
p2[1] =
|
|
3798
|
-
p2[2] =
|
|
3796
|
+
p2[0] = a22[0] - b2[0];
|
|
3797
|
+
p2[1] = a22[1] - b2[1];
|
|
3798
|
+
p2[2] = a22[2] - b2[2];
|
|
3799
3799
|
r2[0] = p2[0];
|
|
3800
3800
|
r2[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
|
|
3801
3801
|
r2[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
|
|
@@ -3804,11 +3804,11 @@ var __exports__ = (() => {
|
|
|
3804
3804
|
out[2] = r2[2] + b2[2];
|
|
3805
3805
|
return out;
|
|
3806
3806
|
}
|
|
3807
|
-
function rotateY(out,
|
|
3807
|
+
function rotateY(out, a22, b2, rad) {
|
|
3808
3808
|
var p2 = [], r2 = [];
|
|
3809
|
-
p2[0] =
|
|
3810
|
-
p2[1] =
|
|
3811
|
-
p2[2] =
|
|
3809
|
+
p2[0] = a22[0] - b2[0];
|
|
3810
|
+
p2[1] = a22[1] - b2[1];
|
|
3811
|
+
p2[2] = a22[2] - b2[2];
|
|
3812
3812
|
r2[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
|
|
3813
3813
|
r2[1] = p2[1];
|
|
3814
3814
|
r2[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
|
|
@@ -3817,11 +3817,11 @@ var __exports__ = (() => {
|
|
|
3817
3817
|
out[2] = r2[2] + b2[2];
|
|
3818
3818
|
return out;
|
|
3819
3819
|
}
|
|
3820
|
-
function rotateZ(out,
|
|
3820
|
+
function rotateZ(out, a22, b2, rad) {
|
|
3821
3821
|
var p2 = [], r2 = [];
|
|
3822
|
-
p2[0] =
|
|
3823
|
-
p2[1] =
|
|
3824
|
-
p2[2] =
|
|
3822
|
+
p2[0] = a22[0] - b2[0];
|
|
3823
|
+
p2[1] = a22[1] - b2[1];
|
|
3824
|
+
p2[2] = a22[2] - b2[2];
|
|
3825
3825
|
r2[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
|
|
3826
3826
|
r2[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
|
|
3827
3827
|
r2[2] = p2[2];
|
|
@@ -3830,8 +3830,8 @@ var __exports__ = (() => {
|
|
|
3830
3830
|
out[2] = r2[2] + b2[2];
|
|
3831
3831
|
return out;
|
|
3832
3832
|
}
|
|
3833
|
-
function angle(
|
|
3834
|
-
var ax =
|
|
3833
|
+
function angle(a22, b2) {
|
|
3834
|
+
var ax = a22[0], ay = a22[1], az = a22[2], bx = b2[0], by = b2[1], bz = b2[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(a22, b2) / mag;
|
|
3835
3835
|
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
3836
3836
|
}
|
|
3837
3837
|
function zero(out) {
|
|
@@ -3840,16 +3840,16 @@ var __exports__ = (() => {
|
|
|
3840
3840
|
out[2] = 0;
|
|
3841
3841
|
return out;
|
|
3842
3842
|
}
|
|
3843
|
-
function str2(
|
|
3844
|
-
return "vec3(" +
|
|
3843
|
+
function str2(a22) {
|
|
3844
|
+
return "vec3(" + a22[0] + ", " + a22[1] + ", " + a22[2] + ")";
|
|
3845
3845
|
}
|
|
3846
|
-
function exactEquals2(
|
|
3847
|
-
return
|
|
3846
|
+
function exactEquals2(a22, b2) {
|
|
3847
|
+
return a22[0] === b2[0] && a22[1] === b2[1] && a22[2] === b2[2];
|
|
3848
3848
|
}
|
|
3849
|
-
function equals3(
|
|
3850
|
-
var a0 =
|
|
3849
|
+
function equals3(a22, b2) {
|
|
3850
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2];
|
|
3851
3851
|
var b0 = b2[0], b1 = b2[1], b22 = b2[2];
|
|
3852
|
-
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(
|
|
3852
|
+
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a222 - b22) <= EPSILON * Math.max(1, Math.abs(a222), Math.abs(b22));
|
|
3853
3853
|
}
|
|
3854
3854
|
var sub2 = subtract2;
|
|
3855
3855
|
var mul2 = multiply2;
|
|
@@ -3860,7 +3860,7 @@ var __exports__ = (() => {
|
|
|
3860
3860
|
var sqrLen = squaredLength;
|
|
3861
3861
|
var forEach = function() {
|
|
3862
3862
|
var vec = create3();
|
|
3863
|
-
return function(
|
|
3863
|
+
return function(a22, stride, offset, count, fn, arg) {
|
|
3864
3864
|
var i3, l2;
|
|
3865
3865
|
if (!stride) {
|
|
3866
3866
|
stride = 3;
|
|
@@ -3869,20 +3869,20 @@ var __exports__ = (() => {
|
|
|
3869
3869
|
offset = 0;
|
|
3870
3870
|
}
|
|
3871
3871
|
if (count) {
|
|
3872
|
-
l2 = Math.min(count * stride + offset,
|
|
3872
|
+
l2 = Math.min(count * stride + offset, a22.length);
|
|
3873
3873
|
} else {
|
|
3874
|
-
l2 =
|
|
3874
|
+
l2 = a22.length;
|
|
3875
3875
|
}
|
|
3876
3876
|
for (i3 = offset; i3 < l2; i3 += stride) {
|
|
3877
|
-
vec[0] =
|
|
3878
|
-
vec[1] =
|
|
3879
|
-
vec[2] =
|
|
3877
|
+
vec[0] = a22[i3];
|
|
3878
|
+
vec[1] = a22[i3 + 1];
|
|
3879
|
+
vec[2] = a22[i3 + 2];
|
|
3880
3880
|
fn(vec, vec, arg);
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3881
|
+
a22[i3] = vec[0];
|
|
3882
|
+
a22[i3 + 1] = vec[1];
|
|
3883
|
+
a22[i3 + 2] = vec[2];
|
|
3884
3884
|
}
|
|
3885
|
-
return
|
|
3885
|
+
return a22;
|
|
3886
3886
|
};
|
|
3887
3887
|
}();
|
|
3888
3888
|
function create4() {
|
|
@@ -3895,12 +3895,12 @@ var __exports__ = (() => {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
return out;
|
|
3897
3897
|
}
|
|
3898
|
-
function clone3(
|
|
3898
|
+
function clone3(a22) {
|
|
3899
3899
|
var out = new ARRAY_TYPE(4);
|
|
3900
|
-
out[0] =
|
|
3901
|
-
out[1] =
|
|
3902
|
-
out[2] =
|
|
3903
|
-
out[3] =
|
|
3900
|
+
out[0] = a22[0];
|
|
3901
|
+
out[1] = a22[1];
|
|
3902
|
+
out[2] = a22[2];
|
|
3903
|
+
out[3] = a22[3];
|
|
3904
3904
|
return out;
|
|
3905
3905
|
}
|
|
3906
3906
|
function fromValues3(x2, y2, z, w2) {
|
|
@@ -3911,11 +3911,11 @@ var __exports__ = (() => {
|
|
|
3911
3911
|
out[3] = w2;
|
|
3912
3912
|
return out;
|
|
3913
3913
|
}
|
|
3914
|
-
function copy3(out,
|
|
3915
|
-
out[0] =
|
|
3916
|
-
out[1] =
|
|
3917
|
-
out[2] =
|
|
3918
|
-
out[3] =
|
|
3914
|
+
function copy3(out, a22) {
|
|
3915
|
+
out[0] = a22[0];
|
|
3916
|
+
out[1] = a22[1];
|
|
3917
|
+
out[2] = a22[2];
|
|
3918
|
+
out[3] = a22[3];
|
|
3919
3919
|
return out;
|
|
3920
3920
|
}
|
|
3921
3921
|
function set3(out, x2, y2, z, w2) {
|
|
@@ -3925,39 +3925,39 @@ var __exports__ = (() => {
|
|
|
3925
3925
|
out[3] = w2;
|
|
3926
3926
|
return out;
|
|
3927
3927
|
}
|
|
3928
|
-
function add3(out,
|
|
3929
|
-
out[0] =
|
|
3930
|
-
out[1] =
|
|
3931
|
-
out[2] =
|
|
3932
|
-
out[3] =
|
|
3928
|
+
function add3(out, a22, b2) {
|
|
3929
|
+
out[0] = a22[0] + b2[0];
|
|
3930
|
+
out[1] = a22[1] + b2[1];
|
|
3931
|
+
out[2] = a22[2] + b2[2];
|
|
3932
|
+
out[3] = a22[3] + b2[3];
|
|
3933
3933
|
return out;
|
|
3934
3934
|
}
|
|
3935
|
-
function scale3(out,
|
|
3936
|
-
out[0] =
|
|
3937
|
-
out[1] =
|
|
3938
|
-
out[2] =
|
|
3939
|
-
out[3] =
|
|
3935
|
+
function scale3(out, a22, b2) {
|
|
3936
|
+
out[0] = a22[0] * b2;
|
|
3937
|
+
out[1] = a22[1] * b2;
|
|
3938
|
+
out[2] = a22[2] * b2;
|
|
3939
|
+
out[3] = a22[3] * b2;
|
|
3940
3940
|
return out;
|
|
3941
3941
|
}
|
|
3942
|
-
function length2(
|
|
3943
|
-
var x2 =
|
|
3944
|
-
var y2 =
|
|
3945
|
-
var z =
|
|
3946
|
-
var w2 =
|
|
3942
|
+
function length2(a22) {
|
|
3943
|
+
var x2 = a22[0];
|
|
3944
|
+
var y2 = a22[1];
|
|
3945
|
+
var z = a22[2];
|
|
3946
|
+
var w2 = a22[3];
|
|
3947
3947
|
return Math.hypot(x2, y2, z, w2);
|
|
3948
3948
|
}
|
|
3949
|
-
function squaredLength2(
|
|
3950
|
-
var x2 =
|
|
3951
|
-
var y2 =
|
|
3952
|
-
var z =
|
|
3953
|
-
var w2 =
|
|
3949
|
+
function squaredLength2(a22) {
|
|
3950
|
+
var x2 = a22[0];
|
|
3951
|
+
var y2 = a22[1];
|
|
3952
|
+
var z = a22[2];
|
|
3953
|
+
var w2 = a22[3];
|
|
3954
3954
|
return x2 * x2 + y2 * y2 + z * z + w2 * w2;
|
|
3955
3955
|
}
|
|
3956
|
-
function normalize2(out,
|
|
3957
|
-
var x2 =
|
|
3958
|
-
var y2 =
|
|
3959
|
-
var z =
|
|
3960
|
-
var w2 =
|
|
3956
|
+
function normalize2(out, a22) {
|
|
3957
|
+
var x2 = a22[0];
|
|
3958
|
+
var y2 = a22[1];
|
|
3959
|
+
var z = a22[2];
|
|
3960
|
+
var w2 = a22[3];
|
|
3961
3961
|
var len42 = x2 * x2 + y2 * y2 + z * z + w2 * w2;
|
|
3962
3962
|
if (len42 > 0) {
|
|
3963
3963
|
len42 = 1 / Math.sqrt(len42);
|
|
@@ -3968,31 +3968,31 @@ var __exports__ = (() => {
|
|
|
3968
3968
|
out[3] = w2 * len42;
|
|
3969
3969
|
return out;
|
|
3970
3970
|
}
|
|
3971
|
-
function dot2(
|
|
3972
|
-
return
|
|
3971
|
+
function dot2(a22, b2) {
|
|
3972
|
+
return a22[0] * b2[0] + a22[1] * b2[1] + a22[2] * b2[2] + a22[3] * b2[3];
|
|
3973
3973
|
}
|
|
3974
|
-
function lerp2(out,
|
|
3975
|
-
var ax =
|
|
3976
|
-
var ay =
|
|
3977
|
-
var az =
|
|
3978
|
-
var aw =
|
|
3974
|
+
function lerp2(out, a22, b2, t2) {
|
|
3975
|
+
var ax = a22[0];
|
|
3976
|
+
var ay = a22[1];
|
|
3977
|
+
var az = a22[2];
|
|
3978
|
+
var aw = a22[3];
|
|
3979
3979
|
out[0] = ax + t2 * (b2[0] - ax);
|
|
3980
3980
|
out[1] = ay + t2 * (b2[1] - ay);
|
|
3981
3981
|
out[2] = az + t2 * (b2[2] - az);
|
|
3982
3982
|
out[3] = aw + t2 * (b2[3] - aw);
|
|
3983
3983
|
return out;
|
|
3984
3984
|
}
|
|
3985
|
-
function exactEquals3(
|
|
3986
|
-
return
|
|
3985
|
+
function exactEquals3(a22, b2) {
|
|
3986
|
+
return a22[0] === b2[0] && a22[1] === b2[1] && a22[2] === b2[2] && a22[3] === b2[3];
|
|
3987
3987
|
}
|
|
3988
|
-
function equals4(
|
|
3989
|
-
var a0 =
|
|
3988
|
+
function equals4(a22, b2) {
|
|
3989
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
3990
3990
|
var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3];
|
|
3991
|
-
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(
|
|
3991
|
+
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a222 - b22) <= EPSILON * Math.max(1, Math.abs(a222), Math.abs(b22)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));
|
|
3992
3992
|
}
|
|
3993
3993
|
var forEach2 = function() {
|
|
3994
3994
|
var vec = create4();
|
|
3995
|
-
return function(
|
|
3995
|
+
return function(a22, stride, offset, count, fn, arg) {
|
|
3996
3996
|
var i3, l2;
|
|
3997
3997
|
if (!stride) {
|
|
3998
3998
|
stride = 4;
|
|
@@ -4001,22 +4001,22 @@ var __exports__ = (() => {
|
|
|
4001
4001
|
offset = 0;
|
|
4002
4002
|
}
|
|
4003
4003
|
if (count) {
|
|
4004
|
-
l2 = Math.min(count * stride + offset,
|
|
4004
|
+
l2 = Math.min(count * stride + offset, a22.length);
|
|
4005
4005
|
} else {
|
|
4006
|
-
l2 =
|
|
4006
|
+
l2 = a22.length;
|
|
4007
4007
|
}
|
|
4008
4008
|
for (i3 = offset; i3 < l2; i3 += stride) {
|
|
4009
|
-
vec[0] =
|
|
4010
|
-
vec[1] =
|
|
4011
|
-
vec[2] =
|
|
4012
|
-
vec[3] =
|
|
4009
|
+
vec[0] = a22[i3];
|
|
4010
|
+
vec[1] = a22[i3 + 1];
|
|
4011
|
+
vec[2] = a22[i3 + 2];
|
|
4012
|
+
vec[3] = a22[i3 + 3];
|
|
4013
4013
|
fn(vec, vec, arg);
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4014
|
+
a22[i3] = vec[0];
|
|
4015
|
+
a22[i3 + 1] = vec[1];
|
|
4016
|
+
a22[i3 + 2] = vec[2];
|
|
4017
|
+
a22[i3 + 3] = vec[3];
|
|
4018
4018
|
}
|
|
4019
|
-
return
|
|
4019
|
+
return a22;
|
|
4020
4020
|
};
|
|
4021
4021
|
}();
|
|
4022
4022
|
function create5() {
|
|
@@ -4059,12 +4059,12 @@ var __exports__ = (() => {
|
|
|
4059
4059
|
}
|
|
4060
4060
|
return rad;
|
|
4061
4061
|
}
|
|
4062
|
-
function getAngle(
|
|
4063
|
-
var dotproduct = dot3(
|
|
4062
|
+
function getAngle(a22, b2) {
|
|
4063
|
+
var dotproduct = dot3(a22, b2);
|
|
4064
4064
|
return Math.acos(2 * dotproduct * dotproduct - 1);
|
|
4065
4065
|
}
|
|
4066
|
-
function multiply3(out,
|
|
4067
|
-
var ax =
|
|
4066
|
+
function multiply3(out, a22, b2) {
|
|
4067
|
+
var ax = a22[0], ay = a22[1], az = a22[2], aw = a22[3];
|
|
4068
4068
|
var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3];
|
|
4069
4069
|
out[0] = ax * bw + aw * bx + ay * bz - az * by;
|
|
4070
4070
|
out[1] = ay * bw + aw * by + az * bx - ax * bz;
|
|
@@ -4072,9 +4072,9 @@ var __exports__ = (() => {
|
|
|
4072
4072
|
out[3] = aw * bw - ax * bx - ay * by - az * bz;
|
|
4073
4073
|
return out;
|
|
4074
4074
|
}
|
|
4075
|
-
function rotateX2(out,
|
|
4075
|
+
function rotateX2(out, a22, rad) {
|
|
4076
4076
|
rad *= 0.5;
|
|
4077
|
-
var ax =
|
|
4077
|
+
var ax = a22[0], ay = a22[1], az = a22[2], aw = a22[3];
|
|
4078
4078
|
var bx = Math.sin(rad), bw = Math.cos(rad);
|
|
4079
4079
|
out[0] = ax * bw + aw * bx;
|
|
4080
4080
|
out[1] = ay * bw + az * bx;
|
|
@@ -4082,9 +4082,9 @@ var __exports__ = (() => {
|
|
|
4082
4082
|
out[3] = aw * bw - ax * bx;
|
|
4083
4083
|
return out;
|
|
4084
4084
|
}
|
|
4085
|
-
function rotateY2(out,
|
|
4085
|
+
function rotateY2(out, a22, rad) {
|
|
4086
4086
|
rad *= 0.5;
|
|
4087
|
-
var ax =
|
|
4087
|
+
var ax = a22[0], ay = a22[1], az = a22[2], aw = a22[3];
|
|
4088
4088
|
var by = Math.sin(rad), bw = Math.cos(rad);
|
|
4089
4089
|
out[0] = ax * bw - az * by;
|
|
4090
4090
|
out[1] = ay * bw + aw * by;
|
|
@@ -4092,9 +4092,9 @@ var __exports__ = (() => {
|
|
|
4092
4092
|
out[3] = aw * bw - ay * by;
|
|
4093
4093
|
return out;
|
|
4094
4094
|
}
|
|
4095
|
-
function rotateZ2(out,
|
|
4095
|
+
function rotateZ2(out, a22, rad) {
|
|
4096
4096
|
rad *= 0.5;
|
|
4097
|
-
var ax =
|
|
4097
|
+
var ax = a22[0], ay = a22[1], az = a22[2], aw = a22[3];
|
|
4098
4098
|
var bz = Math.sin(rad), bw = Math.cos(rad);
|
|
4099
4099
|
out[0] = ax * bw + ay * bz;
|
|
4100
4100
|
out[1] = ay * bw - ax * bz;
|
|
@@ -4102,16 +4102,16 @@ var __exports__ = (() => {
|
|
|
4102
4102
|
out[3] = aw * bw - az * bz;
|
|
4103
4103
|
return out;
|
|
4104
4104
|
}
|
|
4105
|
-
function calculateW(out,
|
|
4106
|
-
var x2 =
|
|
4105
|
+
function calculateW(out, a22) {
|
|
4106
|
+
var x2 = a22[0], y2 = a22[1], z = a22[2];
|
|
4107
4107
|
out[0] = x2;
|
|
4108
4108
|
out[1] = y2;
|
|
4109
4109
|
out[2] = z;
|
|
4110
4110
|
out[3] = Math.sqrt(Math.abs(1 - x2 * x2 - y2 * y2 - z * z));
|
|
4111
4111
|
return out;
|
|
4112
4112
|
}
|
|
4113
|
-
function exp(out,
|
|
4114
|
-
var x2 =
|
|
4113
|
+
function exp(out, a22) {
|
|
4114
|
+
var x2 = a22[0], y2 = a22[1], z = a22[2], w2 = a22[3];
|
|
4115
4115
|
var r2 = Math.sqrt(x2 * x2 + y2 * y2 + z * z);
|
|
4116
4116
|
var et = Math.exp(w2);
|
|
4117
4117
|
var s2 = r2 > 0 ? et * Math.sin(r2) / r2 : 0;
|
|
@@ -4121,8 +4121,8 @@ var __exports__ = (() => {
|
|
|
4121
4121
|
out[3] = et * Math.cos(r2);
|
|
4122
4122
|
return out;
|
|
4123
4123
|
}
|
|
4124
|
-
function ln(out,
|
|
4125
|
-
var x2 =
|
|
4124
|
+
function ln(out, a22) {
|
|
4125
|
+
var x2 = a22[0], y2 = a22[1], z = a22[2], w2 = a22[3];
|
|
4126
4126
|
var r2 = Math.sqrt(x2 * x2 + y2 * y2 + z * z);
|
|
4127
4127
|
var t2 = r2 > 0 ? Math.atan2(r2, w2) / r2 : 0;
|
|
4128
4128
|
out[0] = x2 * t2;
|
|
@@ -4131,14 +4131,14 @@ var __exports__ = (() => {
|
|
|
4131
4131
|
out[3] = 0.5 * Math.log(x2 * x2 + y2 * y2 + z * z + w2 * w2);
|
|
4132
4132
|
return out;
|
|
4133
4133
|
}
|
|
4134
|
-
function pow(out,
|
|
4135
|
-
ln(out,
|
|
4134
|
+
function pow(out, a22, b2) {
|
|
4135
|
+
ln(out, a22);
|
|
4136
4136
|
scale4(out, out, b2);
|
|
4137
4137
|
exp(out, out);
|
|
4138
4138
|
return out;
|
|
4139
4139
|
}
|
|
4140
|
-
function slerp(out,
|
|
4141
|
-
var ax =
|
|
4140
|
+
function slerp(out, a22, b2, t2) {
|
|
4141
|
+
var ax = a22[0], ay = a22[1], az = a22[2], aw = a22[3];
|
|
4142
4142
|
var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3];
|
|
4143
4143
|
var omega, cosom, sinom, scale0, scale1;
|
|
4144
4144
|
cosom = ax * bx + ay * by + az * bz + aw * bw;
|
|
@@ -4176,21 +4176,21 @@ var __exports__ = (() => {
|
|
|
4176
4176
|
out[3] = sqrtU1 * Math.cos(2 * Math.PI * u3);
|
|
4177
4177
|
return out;
|
|
4178
4178
|
}
|
|
4179
|
-
function invert2(out,
|
|
4180
|
-
var a0 =
|
|
4181
|
-
var dot52 = a0 * a0 + a1 * a1 +
|
|
4179
|
+
function invert2(out, a22) {
|
|
4180
|
+
var a0 = a22[0], a1 = a22[1], a222 = a22[2], a3 = a22[3];
|
|
4181
|
+
var dot52 = a0 * a0 + a1 * a1 + a222 * a222 + a3 * a3;
|
|
4182
4182
|
var invDot = dot52 ? 1 / dot52 : 0;
|
|
4183
4183
|
out[0] = -a0 * invDot;
|
|
4184
4184
|
out[1] = -a1 * invDot;
|
|
4185
|
-
out[2] = -
|
|
4186
|
-
out[3] =
|
|
4185
|
+
out[2] = -a222 * invDot;
|
|
4186
|
+
out[3] = a3 * invDot;
|
|
4187
4187
|
return out;
|
|
4188
4188
|
}
|
|
4189
|
-
function conjugate(out,
|
|
4190
|
-
out[0] = -
|
|
4191
|
-
out[1] = -
|
|
4192
|
-
out[2] = -
|
|
4193
|
-
out[3] =
|
|
4189
|
+
function conjugate(out, a22) {
|
|
4190
|
+
out[0] = -a22[0];
|
|
4191
|
+
out[1] = -a22[1];
|
|
4192
|
+
out[2] = -a22[2];
|
|
4193
|
+
out[3] = a22[3];
|
|
4194
4194
|
return out;
|
|
4195
4195
|
}
|
|
4196
4196
|
function fromMat3(out, m) {
|
|
@@ -4237,8 +4237,8 @@ var __exports__ = (() => {
|
|
|
4237
4237
|
out[3] = cx * cy * cz + sx * sy * sz;
|
|
4238
4238
|
return out;
|
|
4239
4239
|
}
|
|
4240
|
-
function str3(
|
|
4241
|
-
return "quat(" +
|
|
4240
|
+
function str3(a22) {
|
|
4241
|
+
return "quat(" + a22[0] + ", " + a22[1] + ", " + a22[2] + ", " + a22[3] + ")";
|
|
4242
4242
|
}
|
|
4243
4243
|
var clone4 = clone3;
|
|
4244
4244
|
var fromValues4 = fromValues3;
|
|
@@ -4260,12 +4260,12 @@ var __exports__ = (() => {
|
|
|
4260
4260
|
var tmpvec3 = create3();
|
|
4261
4261
|
var xUnitVec3 = fromValues2(1, 0, 0);
|
|
4262
4262
|
var yUnitVec3 = fromValues2(0, 1, 0);
|
|
4263
|
-
return function(out,
|
|
4264
|
-
var dot52 = dot(
|
|
4263
|
+
return function(out, a22, b2) {
|
|
4264
|
+
var dot52 = dot(a22, b2);
|
|
4265
4265
|
if (dot52 < -0.999999) {
|
|
4266
|
-
cross(tmpvec3, xUnitVec3,
|
|
4266
|
+
cross(tmpvec3, xUnitVec3, a22);
|
|
4267
4267
|
if (len(tmpvec3) < 1e-6)
|
|
4268
|
-
cross(tmpvec3, yUnitVec3,
|
|
4268
|
+
cross(tmpvec3, yUnitVec3, a22);
|
|
4269
4269
|
normalize(tmpvec3, tmpvec3);
|
|
4270
4270
|
setAxisAngle(out, tmpvec3, Math.PI);
|
|
4271
4271
|
return out;
|
|
@@ -4276,7 +4276,7 @@ var __exports__ = (() => {
|
|
|
4276
4276
|
out[3] = 1;
|
|
4277
4277
|
return out;
|
|
4278
4278
|
} else {
|
|
4279
|
-
cross(tmpvec3,
|
|
4279
|
+
cross(tmpvec3, a22, b2);
|
|
4280
4280
|
out[0] = tmpvec3[0];
|
|
4281
4281
|
out[1] = tmpvec3[1];
|
|
4282
4282
|
out[2] = tmpvec3[2];
|
|
@@ -4288,8 +4288,8 @@ var __exports__ = (() => {
|
|
|
4288
4288
|
var sqlerp = function() {
|
|
4289
4289
|
var temp1 = create5();
|
|
4290
4290
|
var temp2 = create5();
|
|
4291
|
-
return function(out,
|
|
4292
|
-
slerp(temp1,
|
|
4291
|
+
return function(out, a22, b2, c2, d2, t2) {
|
|
4292
|
+
slerp(temp1, a22, d2, t2);
|
|
4293
4293
|
slerp(temp2, b2, c2, t2);
|
|
4294
4294
|
slerp(out, temp1, temp2, 2 * t2 * (1 - t2));
|
|
4295
4295
|
return out;
|
|
@@ -4366,10 +4366,10 @@ var __exports__ = (() => {
|
|
|
4366
4366
|
}
|
|
4367
4367
|
return out;
|
|
4368
4368
|
}
|
|
4369
|
-
function clone5(
|
|
4369
|
+
function clone5(a22) {
|
|
4370
4370
|
var out = new ARRAY_TYPE(2);
|
|
4371
|
-
out[0] =
|
|
4372
|
-
out[1] =
|
|
4371
|
+
out[0] = a22[0];
|
|
4372
|
+
out[1] = a22[1];
|
|
4373
4373
|
return out;
|
|
4374
4374
|
}
|
|
4375
4375
|
function fromValues5(x2, y2) {
|
|
@@ -4378,9 +4378,9 @@ var __exports__ = (() => {
|
|
|
4378
4378
|
out[1] = y2;
|
|
4379
4379
|
return out;
|
|
4380
4380
|
}
|
|
4381
|
-
function copy5(out,
|
|
4382
|
-
out[0] =
|
|
4383
|
-
out[1] =
|
|
4381
|
+
function copy5(out, a22) {
|
|
4382
|
+
out[0] = a22[0];
|
|
4383
|
+
out[1] = a22[1];
|
|
4384
4384
|
return out;
|
|
4385
4385
|
}
|
|
4386
4386
|
function set5(out, x2, y2) {
|
|
@@ -4388,108 +4388,108 @@ var __exports__ = (() => {
|
|
|
4388
4388
|
out[1] = y2;
|
|
4389
4389
|
return out;
|
|
4390
4390
|
}
|
|
4391
|
-
function add5(out,
|
|
4392
|
-
out[0] =
|
|
4393
|
-
out[1] =
|
|
4391
|
+
function add5(out, a22, b2) {
|
|
4392
|
+
out[0] = a22[0] + b2[0];
|
|
4393
|
+
out[1] = a22[1] + b2[1];
|
|
4394
4394
|
return out;
|
|
4395
4395
|
}
|
|
4396
|
-
function subtract3(out,
|
|
4397
|
-
out[0] =
|
|
4398
|
-
out[1] =
|
|
4396
|
+
function subtract3(out, a22, b2) {
|
|
4397
|
+
out[0] = a22[0] - b2[0];
|
|
4398
|
+
out[1] = a22[1] - b2[1];
|
|
4399
4399
|
return out;
|
|
4400
4400
|
}
|
|
4401
|
-
function multiply4(out,
|
|
4402
|
-
out[0] =
|
|
4403
|
-
out[1] =
|
|
4401
|
+
function multiply4(out, a22, b2) {
|
|
4402
|
+
out[0] = a22[0] * b2[0];
|
|
4403
|
+
out[1] = a22[1] * b2[1];
|
|
4404
4404
|
return out;
|
|
4405
4405
|
}
|
|
4406
|
-
function divide2(out,
|
|
4407
|
-
out[0] =
|
|
4408
|
-
out[1] =
|
|
4406
|
+
function divide2(out, a22, b2) {
|
|
4407
|
+
out[0] = a22[0] / b2[0];
|
|
4408
|
+
out[1] = a22[1] / b2[1];
|
|
4409
4409
|
return out;
|
|
4410
4410
|
}
|
|
4411
|
-
function ceil2(out,
|
|
4412
|
-
out[0] = Math.ceil(
|
|
4413
|
-
out[1] = Math.ceil(
|
|
4411
|
+
function ceil2(out, a22) {
|
|
4412
|
+
out[0] = Math.ceil(a22[0]);
|
|
4413
|
+
out[1] = Math.ceil(a22[1]);
|
|
4414
4414
|
return out;
|
|
4415
4415
|
}
|
|
4416
|
-
function floor2(out,
|
|
4417
|
-
out[0] = Math.floor(
|
|
4418
|
-
out[1] = Math.floor(
|
|
4416
|
+
function floor2(out, a22) {
|
|
4417
|
+
out[0] = Math.floor(a22[0]);
|
|
4418
|
+
out[1] = Math.floor(a22[1]);
|
|
4419
4419
|
return out;
|
|
4420
4420
|
}
|
|
4421
|
-
function min2(out,
|
|
4422
|
-
out[0] = Math.min(
|
|
4423
|
-
out[1] = Math.min(
|
|
4421
|
+
function min2(out, a22, b2) {
|
|
4422
|
+
out[0] = Math.min(a22[0], b2[0]);
|
|
4423
|
+
out[1] = Math.min(a22[1], b2[1]);
|
|
4424
4424
|
return out;
|
|
4425
4425
|
}
|
|
4426
|
-
function max2(out,
|
|
4427
|
-
out[0] = Math.max(
|
|
4428
|
-
out[1] = Math.max(
|
|
4426
|
+
function max2(out, a22, b2) {
|
|
4427
|
+
out[0] = Math.max(a22[0], b2[0]);
|
|
4428
|
+
out[1] = Math.max(a22[1], b2[1]);
|
|
4429
4429
|
return out;
|
|
4430
4430
|
}
|
|
4431
|
-
function round2(out,
|
|
4432
|
-
out[0] = Math.round(
|
|
4433
|
-
out[1] = Math.round(
|
|
4431
|
+
function round2(out, a22) {
|
|
4432
|
+
out[0] = Math.round(a22[0]);
|
|
4433
|
+
out[1] = Math.round(a22[1]);
|
|
4434
4434
|
return out;
|
|
4435
4435
|
}
|
|
4436
|
-
function scale5(out,
|
|
4437
|
-
out[0] =
|
|
4438
|
-
out[1] =
|
|
4436
|
+
function scale5(out, a22, b2) {
|
|
4437
|
+
out[0] = a22[0] * b2;
|
|
4438
|
+
out[1] = a22[1] * b2;
|
|
4439
4439
|
return out;
|
|
4440
4440
|
}
|
|
4441
|
-
function scaleAndAdd2(out,
|
|
4442
|
-
out[0] =
|
|
4443
|
-
out[1] =
|
|
4441
|
+
function scaleAndAdd2(out, a22, b2, scale72) {
|
|
4442
|
+
out[0] = a22[0] + b2[0] * scale72;
|
|
4443
|
+
out[1] = a22[1] + b2[1] * scale72;
|
|
4444
4444
|
return out;
|
|
4445
4445
|
}
|
|
4446
|
-
function distance2(
|
|
4447
|
-
var x2 = b2[0] -
|
|
4446
|
+
function distance2(a22, b2) {
|
|
4447
|
+
var x2 = b2[0] - a22[0], y2 = b2[1] - a22[1];
|
|
4448
4448
|
return Math.hypot(x2, y2);
|
|
4449
4449
|
}
|
|
4450
|
-
function squaredDistance2(
|
|
4451
|
-
var x2 = b2[0] -
|
|
4450
|
+
function squaredDistance2(a22, b2) {
|
|
4451
|
+
var x2 = b2[0] - a22[0], y2 = b2[1] - a22[1];
|
|
4452
4452
|
return x2 * x2 + y2 * y2;
|
|
4453
4453
|
}
|
|
4454
|
-
function length4(
|
|
4455
|
-
var x2 =
|
|
4454
|
+
function length4(a22) {
|
|
4455
|
+
var x2 = a22[0], y2 = a22[1];
|
|
4456
4456
|
return Math.hypot(x2, y2);
|
|
4457
4457
|
}
|
|
4458
|
-
function squaredLength4(
|
|
4459
|
-
var x2 =
|
|
4458
|
+
function squaredLength4(a22) {
|
|
4459
|
+
var x2 = a22[0], y2 = a22[1];
|
|
4460
4460
|
return x2 * x2 + y2 * y2;
|
|
4461
4461
|
}
|
|
4462
|
-
function negate2(out,
|
|
4463
|
-
out[0] = -
|
|
4464
|
-
out[1] = -
|
|
4462
|
+
function negate2(out, a22) {
|
|
4463
|
+
out[0] = -a22[0];
|
|
4464
|
+
out[1] = -a22[1];
|
|
4465
4465
|
return out;
|
|
4466
4466
|
}
|
|
4467
|
-
function inverse2(out,
|
|
4468
|
-
out[0] = 1 /
|
|
4469
|
-
out[1] = 1 /
|
|
4467
|
+
function inverse2(out, a22) {
|
|
4468
|
+
out[0] = 1 / a22[0];
|
|
4469
|
+
out[1] = 1 / a22[1];
|
|
4470
4470
|
return out;
|
|
4471
4471
|
}
|
|
4472
|
-
function normalize4(out,
|
|
4473
|
-
var x2 =
|
|
4472
|
+
function normalize4(out, a22) {
|
|
4473
|
+
var x2 = a22[0], y2 = a22[1];
|
|
4474
4474
|
var len42 = x2 * x2 + y2 * y2;
|
|
4475
4475
|
if (len42 > 0) {
|
|
4476
4476
|
len42 = 1 / Math.sqrt(len42);
|
|
4477
4477
|
}
|
|
4478
|
-
out[0] =
|
|
4479
|
-
out[1] =
|
|
4478
|
+
out[0] = a22[0] * len42;
|
|
4479
|
+
out[1] = a22[1] * len42;
|
|
4480
4480
|
return out;
|
|
4481
4481
|
}
|
|
4482
|
-
function dot4(
|
|
4483
|
-
return
|
|
4482
|
+
function dot4(a22, b2) {
|
|
4483
|
+
return a22[0] * b2[0] + a22[1] * b2[1];
|
|
4484
4484
|
}
|
|
4485
|
-
function cross2(out,
|
|
4486
|
-
var z =
|
|
4485
|
+
function cross2(out, a22, b2) {
|
|
4486
|
+
var z = a22[0] * b2[1] - a22[1] * b2[0];
|
|
4487
4487
|
out[0] = out[1] = 0;
|
|
4488
4488
|
out[2] = z;
|
|
4489
4489
|
return out;
|
|
4490
4490
|
}
|
|
4491
|
-
function lerp4(out,
|
|
4492
|
-
var ax =
|
|
4491
|
+
function lerp4(out, a22, b2, t2) {
|
|
4492
|
+
var ax = a22[0], ay = a22[1];
|
|
4493
4493
|
out[0] = ax + t2 * (b2[0] - ax);
|
|
4494
4494
|
out[1] = ay + t2 * (b2[1] - ay);
|
|
4495
4495
|
return out;
|
|
@@ -4501,39 +4501,39 @@ var __exports__ = (() => {
|
|
|
4501
4501
|
out[1] = Math.sin(r2) * scale72;
|
|
4502
4502
|
return out;
|
|
4503
4503
|
}
|
|
4504
|
-
function transformMat2(out,
|
|
4505
|
-
var x2 =
|
|
4504
|
+
function transformMat2(out, a22, m) {
|
|
4505
|
+
var x2 = a22[0], y2 = a22[1];
|
|
4506
4506
|
out[0] = m[0] * x2 + m[2] * y2;
|
|
4507
4507
|
out[1] = m[1] * x2 + m[3] * y2;
|
|
4508
4508
|
return out;
|
|
4509
4509
|
}
|
|
4510
|
-
function transformMat2d(out,
|
|
4511
|
-
var x2 =
|
|
4510
|
+
function transformMat2d(out, a22, m) {
|
|
4511
|
+
var x2 = a22[0], y2 = a22[1];
|
|
4512
4512
|
out[0] = m[0] * x2 + m[2] * y2 + m[4];
|
|
4513
4513
|
out[1] = m[1] * x2 + m[3] * y2 + m[5];
|
|
4514
4514
|
return out;
|
|
4515
4515
|
}
|
|
4516
|
-
function transformMat32(out,
|
|
4517
|
-
var x2 =
|
|
4516
|
+
function transformMat32(out, a22, m) {
|
|
4517
|
+
var x2 = a22[0], y2 = a22[1];
|
|
4518
4518
|
out[0] = m[0] * x2 + m[3] * y2 + m[6];
|
|
4519
4519
|
out[1] = m[1] * x2 + m[4] * y2 + m[7];
|
|
4520
4520
|
return out;
|
|
4521
4521
|
}
|
|
4522
|
-
function transformMat42(out,
|
|
4523
|
-
var x2 =
|
|
4524
|
-
var y2 =
|
|
4522
|
+
function transformMat42(out, a22, m) {
|
|
4523
|
+
var x2 = a22[0];
|
|
4524
|
+
var y2 = a22[1];
|
|
4525
4525
|
out[0] = m[0] * x2 + m[4] * y2 + m[12];
|
|
4526
4526
|
out[1] = m[1] * x2 + m[5] * y2 + m[13];
|
|
4527
4527
|
return out;
|
|
4528
4528
|
}
|
|
4529
|
-
function rotate2(out,
|
|
4530
|
-
var p0 =
|
|
4529
|
+
function rotate2(out, a22, b2, rad) {
|
|
4530
|
+
var p0 = a22[0] - b2[0], p1 = a22[1] - b2[1], sinC = Math.sin(rad), cosC = Math.cos(rad);
|
|
4531
4531
|
out[0] = p0 * cosC - p1 * sinC + b2[0];
|
|
4532
4532
|
out[1] = p0 * sinC + p1 * cosC + b2[1];
|
|
4533
4533
|
return out;
|
|
4534
4534
|
}
|
|
4535
|
-
function angle2(
|
|
4536
|
-
var x1 =
|
|
4535
|
+
function angle2(a22, b2) {
|
|
4536
|
+
var x1 = a22[0], y1 = a22[1], x2 = b2[0], y2 = b2[1], mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), cosine = mag && (x1 * x2 + y1 * y2) / mag;
|
|
4537
4537
|
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
4538
4538
|
}
|
|
4539
4539
|
function zero2(out) {
|
|
@@ -4541,14 +4541,14 @@ var __exports__ = (() => {
|
|
|
4541
4541
|
out[1] = 0;
|
|
4542
4542
|
return out;
|
|
4543
4543
|
}
|
|
4544
|
-
function str4(
|
|
4545
|
-
return "vec2(" +
|
|
4544
|
+
function str4(a22) {
|
|
4545
|
+
return "vec2(" + a22[0] + ", " + a22[1] + ")";
|
|
4546
4546
|
}
|
|
4547
|
-
function exactEquals5(
|
|
4548
|
-
return
|
|
4547
|
+
function exactEquals5(a22, b2) {
|
|
4548
|
+
return a22[0] === b2[0] && a22[1] === b2[1];
|
|
4549
4549
|
}
|
|
4550
|
-
function equals6(
|
|
4551
|
-
var a0 =
|
|
4550
|
+
function equals6(a22, b2) {
|
|
4551
|
+
var a0 = a22[0], a1 = a22[1];
|
|
4552
4552
|
var b0 = b2[0], b1 = b2[1];
|
|
4553
4553
|
return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1));
|
|
4554
4554
|
}
|
|
@@ -4561,7 +4561,7 @@ var __exports__ = (() => {
|
|
|
4561
4561
|
var sqrLen3 = squaredLength4;
|
|
4562
4562
|
var forEach3 = function() {
|
|
4563
4563
|
var vec = create6();
|
|
4564
|
-
return function(
|
|
4564
|
+
return function(a22, stride, offset, count, fn, arg) {
|
|
4565
4565
|
var i3, l2;
|
|
4566
4566
|
if (!stride) {
|
|
4567
4567
|
stride = 2;
|
|
@@ -4570,18 +4570,18 @@ var __exports__ = (() => {
|
|
|
4570
4570
|
offset = 0;
|
|
4571
4571
|
}
|
|
4572
4572
|
if (count) {
|
|
4573
|
-
l2 = Math.min(count * stride + offset,
|
|
4573
|
+
l2 = Math.min(count * stride + offset, a22.length);
|
|
4574
4574
|
} else {
|
|
4575
|
-
l2 =
|
|
4575
|
+
l2 = a22.length;
|
|
4576
4576
|
}
|
|
4577
4577
|
for (i3 = offset; i3 < l2; i3 += stride) {
|
|
4578
|
-
vec[0] =
|
|
4579
|
-
vec[1] =
|
|
4578
|
+
vec[0] = a22[i3];
|
|
4579
|
+
vec[1] = a22[i3 + 1];
|
|
4580
4580
|
fn(vec, vec, arg);
|
|
4581
|
-
|
|
4582
|
-
|
|
4581
|
+
a22[i3] = vec[0];
|
|
4582
|
+
a22[i3 + 1] = vec[1];
|
|
4583
4583
|
}
|
|
4584
|
-
return
|
|
4584
|
+
return a22;
|
|
4585
4585
|
};
|
|
4586
4586
|
}();
|
|
4587
4587
|
var \u03C6 = (1 + Math.sqrt(5)) / 2;
|
|
@@ -4592,42 +4592,30 @@ var __exports__ = (() => {
|
|
|
4592
4592
|
var dihedralAngle = 2 * Math.atan(\u03C6);
|
|
4593
4593
|
var interhedralAngle = Math.PI - dihedralAngle;
|
|
4594
4594
|
var faceEdgeAngle = -0.5 * Math.PI + Math.acos(-1 / Math.sqrt(3 - \u03C6));
|
|
4595
|
-
var distanceToEdge =
|
|
4596
|
-
var distanceToVertex =
|
|
4597
|
-
var WARP_FACTOR = 0.515;
|
|
4595
|
+
var distanceToEdge = (Math.sqrt(5) - 1) / 2;
|
|
4596
|
+
var distanceToVertex = 3 - Math.sqrt(5);
|
|
4598
4597
|
var Rmidedge = Math.sqrt(3 - \u03C6);
|
|
4599
4598
|
var Rcircumscribed = Math.sqrt(3) * Rmidedge / \u03C6;
|
|
4600
4599
|
common_exports.setMatrixArrayType(Float64Array);
|
|
4601
|
-
var Triangle = class {
|
|
4602
|
-
constructor(a3, b2, c2) {
|
|
4603
|
-
this.origin = vec2_exports.clone(a3);
|
|
4604
|
-
this.edge1 = vec2_exports.subtract(vec2_exports.create(), b2, this.origin);
|
|
4605
|
-
this.edge2 = vec2_exports.subtract(vec2_exports.create(), c2, this.origin);
|
|
4606
|
-
this.testPoint = vec2_exports.create();
|
|
4607
|
-
this.dot11 = vec2_exports.dot(this.edge1, this.edge1);
|
|
4608
|
-
this.dot12 = vec2_exports.dot(this.edge1, this.edge2);
|
|
4609
|
-
this.dot22 = vec2_exports.dot(this.edge2, this.edge2);
|
|
4610
|
-
const invDenom = 1 / (this.dot11 * this.dot22 - this.dot12 * this.dot12);
|
|
4611
|
-
this.dot11 *= invDenom;
|
|
4612
|
-
this.dot12 *= invDenom;
|
|
4613
|
-
this.dot22 *= invDenom;
|
|
4614
|
-
}
|
|
4615
|
-
containsPoint(p2) {
|
|
4616
|
-
vec2_exports.subtract(this.testPoint, p2, this.origin);
|
|
4617
|
-
const dotp1 = vec2_exports.dot(this.testPoint, this.edge1);
|
|
4618
|
-
const dotp2 = vec2_exports.dot(this.testPoint, this.edge2);
|
|
4619
|
-
const u2 = this.dot22 * dotp1 - this.dot12 * dotp2;
|
|
4620
|
-
if (u2 < 0)
|
|
4621
|
-
return false;
|
|
4622
|
-
const v2 = this.dot11 * dotp2 - this.dot12 * dotp1;
|
|
4623
|
-
return v2 >= 0 && u2 + v2 <= 1;
|
|
4624
|
-
}
|
|
4625
|
-
};
|
|
4626
|
-
common_exports.setMatrixArrayType(Float64Array);
|
|
4627
4600
|
var PentagonShape = class _PentagonShape {
|
|
4628
4601
|
constructor(vertices) {
|
|
4629
4602
|
this.vertices = vertices;
|
|
4630
4603
|
this.id = { i: 0, j: 0, k: 0, resolution: 1 };
|
|
4604
|
+
if (!this.isWindingCorrect()) {
|
|
4605
|
+
this.vertices.reverse();
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
getArea() {
|
|
4609
|
+
let signedArea2 = 0;
|
|
4610
|
+
const N = this.vertices.length;
|
|
4611
|
+
for (let i3 = 0; i3 < N; i3++) {
|
|
4612
|
+
const j = (i3 + 1) % N;
|
|
4613
|
+
signedArea2 += (this.vertices[j][0] - this.vertices[i3][0]) * (this.vertices[j][1] + this.vertices[i3][1]);
|
|
4614
|
+
}
|
|
4615
|
+
return signedArea2;
|
|
4616
|
+
}
|
|
4617
|
+
isWindingCorrect() {
|
|
4618
|
+
return this.getArea() >= 0;
|
|
4631
4619
|
}
|
|
4632
4620
|
getVertices() {
|
|
4633
4621
|
return this.vertices;
|
|
@@ -4650,12 +4638,14 @@ var __exports__ = (() => {
|
|
|
4650
4638
|
}
|
|
4651
4639
|
/**
|
|
4652
4640
|
* Reflects the pentagon over the x-axis (equivalent to negating y)
|
|
4641
|
+
* and reverses the winding order to maintain consistent orientation
|
|
4653
4642
|
* @returns The reflected pentagon
|
|
4654
4643
|
*/
|
|
4655
4644
|
reflectY() {
|
|
4656
4645
|
for (const vertex of this.vertices) {
|
|
4657
4646
|
vertex[1] = -vertex[1];
|
|
4658
4647
|
}
|
|
4648
|
+
this.vertices.reverse();
|
|
4659
4649
|
return this;
|
|
4660
4650
|
}
|
|
4661
4651
|
translate(translation2) {
|
|
@@ -4687,47 +4677,54 @@ var __exports__ = (() => {
|
|
|
4687
4677
|
);
|
|
4688
4678
|
}
|
|
4689
4679
|
/**
|
|
4690
|
-
* Tests if a point is inside the pentagon by checking if it's
|
|
4691
|
-
*
|
|
4680
|
+
* Tests if a point is inside the pentagon by checking if it's on the correct side of all edges.
|
|
4681
|
+
* Assumes consistent winding order (counter-clockwise).
|
|
4692
4682
|
* @param point The point to test
|
|
4693
|
-
* @returns
|
|
4683
|
+
* @returns -1 if point is inside, otherwise a value proportional to the distance from the point to the edge
|
|
4694
4684
|
*/
|
|
4695
4685
|
containsPoint(point) {
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4686
|
+
if (!this.isWindingCorrect()) {
|
|
4687
|
+
throw new Error("Pentagon is not counter-clockwise");
|
|
4688
|
+
}
|
|
4689
|
+
const N = this.vertices.length;
|
|
4690
|
+
for (let i3 = 0; i3 < N; i3++) {
|
|
4691
|
+
const v1 = this.vertices[i3];
|
|
4692
|
+
const v2 = this.vertices[(i3 + 1) % N];
|
|
4693
|
+
const dx = v2[0] - v1[0];
|
|
4694
|
+
const dy = v2[1] - v1[1];
|
|
4695
|
+
const px = point[0] - v1[0];
|
|
4696
|
+
const py = point[1] - v1[1];
|
|
4697
|
+
const crossProduct = dx * py - dy * px;
|
|
4698
|
+
if (crossProduct > 0) {
|
|
4699
|
+
const pLength = Math.sqrt(px * px + py * py);
|
|
4700
|
+
return crossProduct / pLength;
|
|
4708
4701
|
}
|
|
4709
4702
|
}
|
|
4710
|
-
return
|
|
4703
|
+
return -1;
|
|
4711
4704
|
}
|
|
4712
4705
|
/**
|
|
4713
|
-
*
|
|
4714
|
-
* @param
|
|
4715
|
-
* @returns
|
|
4706
|
+
* Splits each edge of the pentagon into the specified number of segments
|
|
4707
|
+
* @param segments Number of segments to split each edge into
|
|
4708
|
+
* @returns A new PentagonShape with more vertices, or the original PentagonShape if segments <= 1
|
|
4716
4709
|
*/
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
return
|
|
4720
|
-
}
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4710
|
+
splitEdges(segments) {
|
|
4711
|
+
if (segments <= 1) {
|
|
4712
|
+
return this;
|
|
4713
|
+
}
|
|
4714
|
+
const newVertices = [];
|
|
4715
|
+
const N = this.vertices.length;
|
|
4716
|
+
for (let i3 = 0; i3 < N; i3++) {
|
|
4717
|
+
const v1 = this.vertices[i3];
|
|
4718
|
+
const v2 = this.vertices[(i3 + 1) % N];
|
|
4719
|
+
newVertices.push(vec2_exports.clone(v1));
|
|
4720
|
+
for (let j = 1; j < segments; j++) {
|
|
4721
|
+
const t2 = j / segments;
|
|
4722
|
+
const interpolated = vec2_exports.create();
|
|
4723
|
+
vec2_exports.lerp(interpolated, v1, v2, t2);
|
|
4724
|
+
newVertices.push(interpolated);
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
return new _PentagonShape(newVertices);
|
|
4731
4728
|
}
|
|
4732
4729
|
};
|
|
4733
4730
|
common_exports.setMatrixArrayType(Float64Array);
|
|
@@ -4751,10 +4748,66 @@ var __exports__ = (() => {
|
|
|
4751
4748
|
var v = [L * Math.cos(V), L * Math.sin(V)];
|
|
4752
4749
|
var W = bisectorAngle - PI_OVER_5;
|
|
4753
4750
|
var w = [L * Math.cos(W), L * Math.sin(W)];
|
|
4754
|
-
var TRIANGLE = new PentagonShape([u, v, w
|
|
4751
|
+
var TRIANGLE = new PentagonShape([u, v, w]);
|
|
4755
4752
|
var BASIS = mat2_exports.fromValues(v[0], v[1], w[0], w[1]);
|
|
4756
4753
|
var BASIS_INVERSE = mat2_exports.invert(mat2_exports.create(), BASIS);
|
|
4754
|
+
var GEODETIC_TO_AUTHALIC = new Float64Array([
|
|
4755
|
+
-0.0022392098386786394,
|
|
4756
|
+
21308606513250217e-22,
|
|
4757
|
+
-2559257686421274e-24,
|
|
4758
|
+
33701965267802837e-28,
|
|
4759
|
+
-4667545312611249e-30,
|
|
4760
|
+
667492870384816e-32
|
|
4761
|
+
]);
|
|
4762
|
+
var AUTHALIC_TO_GEODETIC = new Float64Array([
|
|
4763
|
+
0.0022392089963541657,
|
|
4764
|
+
28831978048607556e-22,
|
|
4765
|
+
508622073997266e-23,
|
|
4766
|
+
102018123778161e-25,
|
|
4767
|
+
21912872306767718e-30,
|
|
4768
|
+
49284235482523806e-33
|
|
4769
|
+
]);
|
|
4770
|
+
var AuthalicProjection = class {
|
|
4771
|
+
/**
|
|
4772
|
+
* Applies coefficients using Clenshaw summation algorithm (order 6)
|
|
4773
|
+
* @param phi Angle in radians
|
|
4774
|
+
* @param C Array of coefficients
|
|
4775
|
+
* @returns Transformed angle in radians
|
|
4776
|
+
*/
|
|
4777
|
+
applyCoefficients(phi, C) {
|
|
4778
|
+
const sinPhi = Math.sin(phi);
|
|
4779
|
+
const cosPhi = Math.cos(phi);
|
|
4780
|
+
const X = 2 * (cosPhi - sinPhi) * (cosPhi + sinPhi);
|
|
4781
|
+
let u0, u1;
|
|
4782
|
+
u0 = X * C[5] + C[4];
|
|
4783
|
+
u1 = X * u0 + C[3];
|
|
4784
|
+
u0 = X * u1 - u0 + C[2];
|
|
4785
|
+
u1 = X * u0 - u1 + C[1];
|
|
4786
|
+
u0 = X * u1 - u0 + C[0];
|
|
4787
|
+
return phi + 2 * sinPhi * cosPhi * u0;
|
|
4788
|
+
}
|
|
4789
|
+
/**
|
|
4790
|
+
* Converts geodetic latitude to authalic latitude
|
|
4791
|
+
* @param phi Geodetic latitude in radians
|
|
4792
|
+
* @returns Authalic latitude in radians
|
|
4793
|
+
*/
|
|
4794
|
+
forward(phi) {
|
|
4795
|
+
return this.applyCoefficients(phi, GEODETIC_TO_AUTHALIC);
|
|
4796
|
+
}
|
|
4797
|
+
/**
|
|
4798
|
+
* Converts authalic latitude to geodetic latitude
|
|
4799
|
+
* @param phi Authalic latitude in radians
|
|
4800
|
+
* @returns Geodetic latitude in radians
|
|
4801
|
+
*/
|
|
4802
|
+
inverse(phi) {
|
|
4803
|
+
return this.applyCoefficients(phi, AUTHALIC_TO_GEODETIC);
|
|
4804
|
+
}
|
|
4805
|
+
};
|
|
4757
4806
|
common_exports.setMatrixArrayType(Float64Array);
|
|
4807
|
+
var authalic = new AuthalicProjection();
|
|
4808
|
+
function degToRad(deg) {
|
|
4809
|
+
return deg * (Math.PI / 180);
|
|
4810
|
+
}
|
|
4758
4811
|
function radToDeg(rad) {
|
|
4759
4812
|
return rad * (180 / Math.PI);
|
|
4760
4813
|
}
|
|
@@ -4763,6 +4816,27 @@ var __exports__ = (() => {
|
|
|
4763
4816
|
const gamma = Math.atan2(xy[1], xy[0]);
|
|
4764
4817
|
return [rho, gamma];
|
|
4765
4818
|
}
|
|
4819
|
+
function toFace([rho, gamma]) {
|
|
4820
|
+
const x2 = rho * Math.cos(gamma);
|
|
4821
|
+
const y2 = rho * Math.sin(gamma);
|
|
4822
|
+
return [x2, y2];
|
|
4823
|
+
}
|
|
4824
|
+
function faceToBarycentric(p2, [p1, p22, p3]) {
|
|
4825
|
+
const d31 = [p1[0] - p3[0], p1[1] - p3[1]];
|
|
4826
|
+
const d23 = [p3[0] - p22[0], p3[1] - p22[1]];
|
|
4827
|
+
const d3p = [p2[0] - p3[0], p2[1] - p3[1]];
|
|
4828
|
+
const det = d23[0] * d31[1] - d23[1] * d31[0];
|
|
4829
|
+
const b0 = (d23[0] * d3p[1] - d23[1] * d3p[0]) / det;
|
|
4830
|
+
const b1 = (d31[0] * d3p[1] - d31[1] * d3p[0]) / det;
|
|
4831
|
+
const b2 = 1 - (b0 + b1);
|
|
4832
|
+
return [b0, b1, b2];
|
|
4833
|
+
}
|
|
4834
|
+
function barycentricToFace(b2, [p1, p2, p3]) {
|
|
4835
|
+
return [
|
|
4836
|
+
b2[0] * p1[0] + b2[1] * p2[0] + b2[2] * p3[0],
|
|
4837
|
+
b2[0] * p1[1] + b2[1] * p2[1] + b2[2] * p3[1]
|
|
4838
|
+
];
|
|
4839
|
+
}
|
|
4766
4840
|
function toSpherical(xyz) {
|
|
4767
4841
|
const theta = Math.atan2(xyz[1], xyz[0]);
|
|
4768
4842
|
const r2 = Math.sqrt(xyz[0] * xyz[0] + xyz[1] * xyz[1] + xyz[2] * xyz[2]);
|
|
@@ -4770,15 +4844,25 @@ var __exports__ = (() => {
|
|
|
4770
4844
|
return [theta, phi];
|
|
4771
4845
|
}
|
|
4772
4846
|
function toCartesian([theta, phi]) {
|
|
4773
|
-
const
|
|
4774
|
-
const
|
|
4847
|
+
const sinPhi = Math.sin(phi);
|
|
4848
|
+
const x2 = sinPhi * Math.cos(theta);
|
|
4849
|
+
const y2 = sinPhi * Math.sin(theta);
|
|
4775
4850
|
const z = Math.cos(phi);
|
|
4776
4851
|
return [x2, y2, z];
|
|
4777
4852
|
}
|
|
4778
4853
|
var LONGITUDE_OFFSET = 93;
|
|
4854
|
+
function fromLonLat([longitude, latitude]) {
|
|
4855
|
+
const theta = degToRad(longitude + LONGITUDE_OFFSET);
|
|
4856
|
+
const geodeticLat = degToRad(latitude);
|
|
4857
|
+
const authalicLat = authalic.forward(geodeticLat);
|
|
4858
|
+
const phi = Math.PI / 2 - authalicLat;
|
|
4859
|
+
return [theta, phi];
|
|
4860
|
+
}
|
|
4779
4861
|
function toLonLat([theta, phi]) {
|
|
4780
4862
|
const longitude = radToDeg(theta) - LONGITUDE_OFFSET;
|
|
4781
|
-
const
|
|
4863
|
+
const authalicLat = Math.PI / 2 - phi;
|
|
4864
|
+
const geodeticLat = authalic.inverse(authalicLat);
|
|
4865
|
+
const latitude = radToDeg(geodeticLat);
|
|
4782
4866
|
return [longitude, latitude];
|
|
4783
4867
|
}
|
|
4784
4868
|
function quatFromSpherical(axis) {
|
|
@@ -4787,8 +4871,28 @@ var __exports__ = (() => {
|
|
|
4787
4871
|
quat_exports.rotationTo(Q, [0, 0, 1], cartesian);
|
|
4788
4872
|
return Q;
|
|
4789
4873
|
}
|
|
4874
|
+
function normalizeLongitudes(contour) {
|
|
4875
|
+
const points = contour.map((lonLat) => toCartesian(fromLonLat(lonLat)));
|
|
4876
|
+
const center2 = vec3_exports.create();
|
|
4877
|
+
for (const point of points) {
|
|
4878
|
+
vec3_exports.add(center2, center2, point);
|
|
4879
|
+
}
|
|
4880
|
+
vec3_exports.normalize(center2, center2);
|
|
4881
|
+
let [centerLon, centerLat] = toLonLat(toSpherical(center2));
|
|
4882
|
+
if (centerLat > 89.99 || centerLat < -89.99) {
|
|
4883
|
+
centerLon = contour[0][0];
|
|
4884
|
+
}
|
|
4885
|
+
centerLon = ((centerLon + 180) % 360 + 360) % 360 - 180;
|
|
4886
|
+
return contour.map((point) => {
|
|
4887
|
+
let [longitude, latitude] = point;
|
|
4888
|
+
while (longitude - centerLon > 180)
|
|
4889
|
+
longitude = longitude - 360;
|
|
4890
|
+
while (longitude - centerLon < -180)
|
|
4891
|
+
longitude = longitude + 360;
|
|
4892
|
+
return [longitude, latitude];
|
|
4893
|
+
});
|
|
4894
|
+
}
|
|
4790
4895
|
common_exports.setMatrixArrayType(Float64Array);
|
|
4791
|
-
var UP = [0, 0, 1];
|
|
4792
4896
|
var clockwiseFan = ["vu", "uw", "vw", "vw", "vw"];
|
|
4793
4897
|
var clockwiseStep = ["wu", "uw", "vw", "vu", "uw"];
|
|
4794
4898
|
var counterStep = ["wu", "uv", "wv", "wu", "uw"];
|
|
@@ -4834,6 +4938,9 @@ var __exports__ = (() => {
|
|
|
4834
4938
|
}
|
|
4835
4939
|
var originId = 0;
|
|
4836
4940
|
function addOrigin(axis, angle32) {
|
|
4941
|
+
if (originId > 11) {
|
|
4942
|
+
throw new Error(`Too many origins: ${originId}`);
|
|
4943
|
+
}
|
|
4837
4944
|
const origin = {
|
|
4838
4945
|
id: originId,
|
|
4839
4946
|
axis,
|
|
@@ -4846,7 +4953,7 @@ var __exports__ = (() => {
|
|
|
4846
4953
|
originId++;
|
|
4847
4954
|
}
|
|
4848
4955
|
generateOrigins();
|
|
4849
|
-
origins.sort((
|
|
4956
|
+
origins.sort((a22, b2) => ORIGIN_ORDER.indexOf(a22.id) - ORIGIN_ORDER.indexOf(b2.id));
|
|
4850
4957
|
origins.forEach((origin, i3) => origin.id = i3);
|
|
4851
4958
|
function segmentToQuintant(segment, origin) {
|
|
4852
4959
|
const layout = origin.orientation;
|
|
@@ -4856,91 +4963,297 @@ var __exports__ = (() => {
|
|
|
4856
4963
|
const quintant = (origin.firstQuintant + step * faceRelativeQuintant + 5) % 5;
|
|
4857
4964
|
return { quintant, orientation };
|
|
4858
4965
|
}
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
const [theta2, phi2] = axis;
|
|
4893
|
-
const dtheta = theta2 - theta;
|
|
4894
|
-
const dphi = phi2 - phi;
|
|
4895
|
-
const A1 = Math.sin(dphi / 2);
|
|
4896
|
-
const A2 = Math.sin(dtheta / 2);
|
|
4897
|
-
const angle32 = A1 * A1 + A2 * A2 * Math.sin(phi) * Math.sin(phi2);
|
|
4898
|
-
return angle32;
|
|
4899
|
-
}
|
|
4900
|
-
function normalizeGamma(gamma) {
|
|
4901
|
-
const segment = gamma / TWO_PI_OVER_5;
|
|
4902
|
-
const sCenter = Math.round(segment);
|
|
4903
|
-
const sOffset = segment - sCenter;
|
|
4904
|
-
const beta = sOffset * TWO_PI_OVER_5;
|
|
4905
|
-
return beta;
|
|
4906
|
-
}
|
|
4907
|
-
function _warpBeta(beta) {
|
|
4908
|
-
const shiftedBeta = beta * WARP_FACTOR;
|
|
4909
|
-
return Math.tan(shiftedBeta);
|
|
4910
|
-
}
|
|
4911
|
-
var betaMax = PI_OVER_5;
|
|
4912
|
-
var WARP_SCALER = _warpBeta(betaMax) / betaMax;
|
|
4913
|
-
function warpBeta(beta) {
|
|
4914
|
-
return _warpBeta(beta) / WARP_SCALER;
|
|
4915
|
-
}
|
|
4916
|
-
function warpRho(rho, beta) {
|
|
4917
|
-
const betaRatio = Math.abs(beta) / betaMax;
|
|
4918
|
-
const shiftedRho = rho * (0.95 - 0.05 * betaRatio);
|
|
4919
|
-
return Math.tan(shiftedRho);
|
|
4920
|
-
}
|
|
4921
|
-
function warpPolar([rho, gamma]) {
|
|
4922
|
-
const beta = normalizeGamma(gamma);
|
|
4923
|
-
const beta2 = warpBeta(normalizeGamma(gamma));
|
|
4924
|
-
const deltaBeta = beta2 - beta;
|
|
4925
|
-
const scale72 = Math.cos(beta) / Math.cos(beta2);
|
|
4926
|
-
const rhoOut = scale72 * rho;
|
|
4927
|
-
const rhoMax = distanceToEdge / Math.cos(beta2);
|
|
4928
|
-
const scaler2 = warpRho(rhoMax, beta2) / rhoMax;
|
|
4929
|
-
const rhoWarped = warpRho(rhoOut, beta2) / scaler2;
|
|
4930
|
-
return [rhoWarped, gamma + deltaBeta];
|
|
4931
|
-
}
|
|
4932
|
-
function projectGnomonic([rho, gamma]) {
|
|
4933
|
-
return [gamma, Math.atan(rho)];
|
|
4966
|
+
var GnomonicProjection = class {
|
|
4967
|
+
/**
|
|
4968
|
+
* Projects spherical coordinates to polar coordinates using gnomonic projection
|
|
4969
|
+
* @param spherical Spherical coordinates [theta, phi]
|
|
4970
|
+
* @returns Polar coordinates [rho, gamma]
|
|
4971
|
+
*/
|
|
4972
|
+
forward([theta, phi]) {
|
|
4973
|
+
return [Math.tan(phi), theta];
|
|
4974
|
+
}
|
|
4975
|
+
/**
|
|
4976
|
+
* Unprojects polar coordinates to spherical coordinates using gnomonic projection
|
|
4977
|
+
* @param polar Polar coordinates [rho, gamma]
|
|
4978
|
+
* @returns Spherical coordinates [theta, phi]
|
|
4979
|
+
*/
|
|
4980
|
+
inverse([rho, gamma]) {
|
|
4981
|
+
return [gamma, Math.atan(rho)];
|
|
4982
|
+
}
|
|
4983
|
+
};
|
|
4984
|
+
var midpointAB = vec3_exports.create();
|
|
4985
|
+
var crossCD = vec3_exports.create();
|
|
4986
|
+
var scaledA = vec3_exports.create();
|
|
4987
|
+
var scaledB = vec3_exports.create();
|
|
4988
|
+
function vectorDifference(A, B) {
|
|
4989
|
+
vec3_exports.lerp(midpointAB, A, B, 0.5);
|
|
4990
|
+
vec3_exports.normalize(midpointAB, midpointAB);
|
|
4991
|
+
vec3_exports.cross(midpointAB, A, midpointAB);
|
|
4992
|
+
const D = vec3_exports.length(midpointAB);
|
|
4993
|
+
if (D < 1e-8) {
|
|
4994
|
+
const AB = vec3_exports.subtract(vec3_exports.create(), A, B);
|
|
4995
|
+
const halfDistance = 0.5 * vec3_exports.length(AB);
|
|
4996
|
+
return halfDistance;
|
|
4997
|
+
}
|
|
4998
|
+
return D;
|
|
4934
4999
|
}
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
vec3_exports.
|
|
4942
|
-
|
|
5000
|
+
function tripleProduct(A, B, C) {
|
|
5001
|
+
vec3_exports.cross(crossCD, B, C);
|
|
5002
|
+
return vec3_exports.dot(A, crossCD);
|
|
5003
|
+
}
|
|
5004
|
+
function quadrupleProduct(out, A, B, C, D) {
|
|
5005
|
+
vec3_exports.cross(crossCD, C, D);
|
|
5006
|
+
const tripleProductACD = vec3_exports.dot(A, crossCD);
|
|
5007
|
+
const tripleProductBCD = vec3_exports.dot(B, crossCD);
|
|
5008
|
+
vec3_exports.scale(scaledA, A, tripleProductBCD);
|
|
5009
|
+
vec3_exports.scale(scaledB, B, tripleProductACD);
|
|
5010
|
+
return vec3_exports.sub(out, scaledB, scaledA);
|
|
4943
5011
|
}
|
|
5012
|
+
function slerp2(out, A, B, t2) {
|
|
5013
|
+
const gamma = vec3_exports.angle(A, B);
|
|
5014
|
+
if (gamma < 1e-12) {
|
|
5015
|
+
return vec3_exports.lerp(out, A, B, t2);
|
|
5016
|
+
}
|
|
5017
|
+
const weightA = Math.sin((1 - t2) * gamma) / Math.sin(gamma);
|
|
5018
|
+
const weightB = Math.sin(t2 * gamma) / Math.sin(gamma);
|
|
5019
|
+
const scaledA2 = vec3_exports.scale(vec3_exports.create(), A, weightA);
|
|
5020
|
+
const scaledB2 = vec3_exports.scale(vec3_exports.create(), B, weightB);
|
|
5021
|
+
return vec3_exports.add(out, scaledA2, scaledB2);
|
|
5022
|
+
}
|
|
5023
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
5024
|
+
var midA = vec3_exports.create();
|
|
5025
|
+
var midB = vec3_exports.create();
|
|
5026
|
+
var midC = vec3_exports.create();
|
|
5027
|
+
var center = vec3_exports.create();
|
|
5028
|
+
var SphericalPolygonShape = class {
|
|
5029
|
+
constructor(vertices) {
|
|
5030
|
+
this._area = null;
|
|
5031
|
+
this.vertices = vertices;
|
|
5032
|
+
Object.freeze(this.vertices);
|
|
5033
|
+
}
|
|
5034
|
+
/**
|
|
5035
|
+
*
|
|
5036
|
+
* @param nSegments Returns a closed boundary of the polygon, with nSegments points per edge
|
|
5037
|
+
* @returns SphericalPolygon
|
|
5038
|
+
*/
|
|
5039
|
+
getBoundary(nSegments = 1, closedRing = true) {
|
|
5040
|
+
const points = [];
|
|
5041
|
+
const N = this.vertices.length;
|
|
5042
|
+
for (let s2 = 0; s2 < N * nSegments; s2++) {
|
|
5043
|
+
const t2 = s2 / nSegments;
|
|
5044
|
+
points.push(this.slerp(t2));
|
|
5045
|
+
}
|
|
5046
|
+
if (closedRing) {
|
|
5047
|
+
points.push(points[0]);
|
|
5048
|
+
}
|
|
5049
|
+
return points;
|
|
5050
|
+
}
|
|
5051
|
+
/**
|
|
5052
|
+
* Interpolates along boundary of polygon. Pass t = 1.5 to get the midpoint between 2nd and 3rd vertices
|
|
5053
|
+
* @param t
|
|
5054
|
+
* @returns Cartesian coordinate
|
|
5055
|
+
*/
|
|
5056
|
+
slerp(t2) {
|
|
5057
|
+
const N = this.vertices.length;
|
|
5058
|
+
const f2 = t2 % 1;
|
|
5059
|
+
const i3 = Math.floor(t2 % N);
|
|
5060
|
+
const j = (i3 + 1) % N;
|
|
5061
|
+
return slerp2(vec3_exports.create(), this.vertices[i3], this.vertices[j], f2);
|
|
5062
|
+
}
|
|
5063
|
+
/**
|
|
5064
|
+
* Returns the vertex given by index t, along with the vectors:
|
|
5065
|
+
* - VA: Vector from vertex to point A
|
|
5066
|
+
* - VB: Vector from vertex to point B
|
|
5067
|
+
* @param t
|
|
5068
|
+
* @returns
|
|
5069
|
+
*/
|
|
5070
|
+
getTransformedVertices(t2) {
|
|
5071
|
+
const N = this.vertices.length;
|
|
5072
|
+
const i3 = Math.floor(t2 % N);
|
|
5073
|
+
const j = (i3 + 1) % N;
|
|
5074
|
+
const k = (i3 + N - 1) % N;
|
|
5075
|
+
const V2 = vec3_exports.clone(this.vertices[i3]);
|
|
5076
|
+
const VA = vec3_exports.clone(this.vertices[j]);
|
|
5077
|
+
const VB = vec3_exports.clone(this.vertices[k]);
|
|
5078
|
+
vec3_exports.sub(VA, VA, V2);
|
|
5079
|
+
vec3_exports.sub(VB, VB, V2);
|
|
5080
|
+
return [V2, VA, VB];
|
|
5081
|
+
}
|
|
5082
|
+
containsPoint(point) {
|
|
5083
|
+
const N = this.vertices.length;
|
|
5084
|
+
let thetaDeltaMin = Infinity;
|
|
5085
|
+
for (let i3 = 0; i3 < N; i3++) {
|
|
5086
|
+
const [V2, VA, VB] = this.getTransformedVertices(i3);
|
|
5087
|
+
const VP = vec3_exports.sub(vec3_exports.create(), point, V2);
|
|
5088
|
+
vec3_exports.normalize(VP, VP);
|
|
5089
|
+
vec3_exports.normalize(VA, VA);
|
|
5090
|
+
vec3_exports.normalize(VB, VB);
|
|
5091
|
+
const crossAP = vec3_exports.cross(vec3_exports.create(), VA, VP);
|
|
5092
|
+
const crossPB = vec3_exports.cross(vec3_exports.create(), VP, VB);
|
|
5093
|
+
const sinAP = vec3_exports.dot(V2, crossAP);
|
|
5094
|
+
const sinPB = vec3_exports.dot(V2, crossPB);
|
|
5095
|
+
thetaDeltaMin = Math.min(thetaDeltaMin, sinAP, sinPB);
|
|
5096
|
+
}
|
|
5097
|
+
return thetaDeltaMin;
|
|
5098
|
+
}
|
|
5099
|
+
/**
|
|
5100
|
+
* Calculate the area of a spherical triangle given three vertices
|
|
5101
|
+
* @param v1 First vertex
|
|
5102
|
+
* @param v2 Second vertex
|
|
5103
|
+
* @param v3 Third vertex
|
|
5104
|
+
* @returns Area of the spherical triangle in radians
|
|
5105
|
+
*/
|
|
5106
|
+
getTriangleArea(v1, v2, v3) {
|
|
5107
|
+
vec3_exports.lerp(midA, v2, v3, 0.5);
|
|
5108
|
+
vec3_exports.lerp(midB, v3, v1, 0.5);
|
|
5109
|
+
vec3_exports.lerp(midC, v1, v2, 0.5);
|
|
5110
|
+
vec3_exports.normalize(midA, midA);
|
|
5111
|
+
vec3_exports.normalize(midB, midB);
|
|
5112
|
+
vec3_exports.normalize(midC, midC);
|
|
5113
|
+
const S = tripleProduct(midA, midB, midC);
|
|
5114
|
+
const clamped = Math.max(-1, Math.min(1, S));
|
|
5115
|
+
if (Math.abs(clamped) < 1e-8) {
|
|
5116
|
+
return 2 * clamped;
|
|
5117
|
+
} else {
|
|
5118
|
+
return Math.asin(clamped) * 2;
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
/**
|
|
5122
|
+
* Calculate the area of the spherical polygon by decomposing it into a fan of triangles
|
|
5123
|
+
* @returns The area of the spherical polygon in radians
|
|
5124
|
+
*/
|
|
5125
|
+
getArea() {
|
|
5126
|
+
if (this._area === null) {
|
|
5127
|
+
this._area = this._getArea();
|
|
5128
|
+
}
|
|
5129
|
+
return this._area;
|
|
5130
|
+
}
|
|
5131
|
+
_getArea() {
|
|
5132
|
+
if (this.vertices.length < 3) {
|
|
5133
|
+
return 0;
|
|
5134
|
+
}
|
|
5135
|
+
if (this.vertices.length === 3) {
|
|
5136
|
+
this._area = this.getTriangleArea(this.vertices[0], this.vertices[1], this.vertices[2]);
|
|
5137
|
+
return this._area;
|
|
5138
|
+
}
|
|
5139
|
+
vec3_exports.set(center, 0, 0, 0);
|
|
5140
|
+
for (const vertex of this.vertices) {
|
|
5141
|
+
vec3_exports.add(center, center, vertex);
|
|
5142
|
+
}
|
|
5143
|
+
vec3_exports.normalize(center, center);
|
|
5144
|
+
let area2 = 0;
|
|
5145
|
+
for (let i3 = 0; i3 < this.vertices.length; i3++) {
|
|
5146
|
+
const v1 = this.vertices[i3];
|
|
5147
|
+
const v2 = this.vertices[(i3 + 1) % this.vertices.length];
|
|
5148
|
+
const triArea = this.getTriangleArea(center, v1, v2);
|
|
5149
|
+
if (!isNaN(triArea)) {
|
|
5150
|
+
area2 += triArea;
|
|
5151
|
+
}
|
|
5152
|
+
}
|
|
5153
|
+
this._area = area2;
|
|
5154
|
+
return this._area;
|
|
5155
|
+
}
|
|
5156
|
+
/**
|
|
5157
|
+
* For debugging purposes, check if the winding order is correct
|
|
5158
|
+
* In production, should always be correct
|
|
5159
|
+
*/
|
|
5160
|
+
isWindingCorrect() {
|
|
5161
|
+
const area2 = this.getArea();
|
|
5162
|
+
const isCorrect = area2 > 0;
|
|
5163
|
+
if (!isCorrect) {
|
|
5164
|
+
debugger;
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5167
|
+
};
|
|
5168
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
5169
|
+
var SphericalTriangleShape = class extends SphericalPolygonShape {
|
|
5170
|
+
constructor(vertices) {
|
|
5171
|
+
if (vertices.length !== 3) {
|
|
5172
|
+
throw new Error("SphericalTriangleShape requires exactly 3 vertices");
|
|
5173
|
+
}
|
|
5174
|
+
super(vertices);
|
|
5175
|
+
}
|
|
5176
|
+
};
|
|
5177
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
5178
|
+
var PolyhedralProjection = class {
|
|
5179
|
+
/**
|
|
5180
|
+
* Forward projection: converts a spherical point to face coordinates
|
|
5181
|
+
* @param v - The spherical point to project
|
|
5182
|
+
* @param sphericalTriangle - The spherical triangle vertices
|
|
5183
|
+
* @param faceTriangle - The face triangle vertices
|
|
5184
|
+
* @returns The face coordinates
|
|
5185
|
+
*/
|
|
5186
|
+
forward(v2, sphericalTriangle, faceTriangle) {
|
|
5187
|
+
const [A, B, C] = sphericalTriangle;
|
|
5188
|
+
const triangleShape = new SphericalTriangleShape([A, B, C]);
|
|
5189
|
+
const Z = vec3_exports.subtract(vec3_exports.create(), v2, A);
|
|
5190
|
+
vec3_exports.normalize(Z, Z);
|
|
5191
|
+
const p2 = quadrupleProduct(vec3_exports.create(), A, Z, B, C);
|
|
5192
|
+
vec3_exports.normalize(p2, p2);
|
|
5193
|
+
const h = vectorDifference(A, v2) / vectorDifference(A, p2);
|
|
5194
|
+
const Area_ABC = triangleShape.getArea();
|
|
5195
|
+
const scaledArea = h / Area_ABC;
|
|
5196
|
+
const b2 = [
|
|
5197
|
+
1 - h,
|
|
5198
|
+
scaledArea * new SphericalTriangleShape([A, p2, C]).getArea(),
|
|
5199
|
+
scaledArea * new SphericalTriangleShape([A, B, p2]).getArea()
|
|
5200
|
+
];
|
|
5201
|
+
return barycentricToFace(b2, faceTriangle);
|
|
5202
|
+
}
|
|
5203
|
+
/**
|
|
5204
|
+
* Inverse projection: converts face coordinates back to spherical coordinates
|
|
5205
|
+
* @param facePoint - The face coordinates
|
|
5206
|
+
* @param faceTriangle - The face triangle vertices
|
|
5207
|
+
* @param sphericalTriangle - The spherical triangle vertices
|
|
5208
|
+
* @returns The spherical coordinates
|
|
5209
|
+
*/
|
|
5210
|
+
inverse(facePoint, faceTriangle, sphericalTriangle) {
|
|
5211
|
+
const [A, B, C] = sphericalTriangle;
|
|
5212
|
+
const triangleShape = new SphericalTriangleShape([A, B, C]);
|
|
5213
|
+
const b2 = faceToBarycentric(facePoint, faceTriangle);
|
|
5214
|
+
const threshold = 1 - 1e-14;
|
|
5215
|
+
if (b2[0] > threshold)
|
|
5216
|
+
return A;
|
|
5217
|
+
if (b2[1] > threshold)
|
|
5218
|
+
return B;
|
|
5219
|
+
if (b2[2] > threshold)
|
|
5220
|
+
return C;
|
|
5221
|
+
const c1 = vec3_exports.create();
|
|
5222
|
+
vec3_exports.cross(c1, B, C);
|
|
5223
|
+
const Area_ABC = triangleShape.getArea();
|
|
5224
|
+
const h = 1 - b2[0];
|
|
5225
|
+
const R = b2[2] / h;
|
|
5226
|
+
const alpha = R * Area_ABC;
|
|
5227
|
+
const S = Math.sin(alpha);
|
|
5228
|
+
const halfC = Math.sin(alpha / 2);
|
|
5229
|
+
const CC = 2 * halfC * halfC;
|
|
5230
|
+
const c01 = vec3_exports.dot(A, B);
|
|
5231
|
+
const c12 = vec3_exports.dot(B, C);
|
|
5232
|
+
const c20 = vec3_exports.dot(C, A);
|
|
5233
|
+
const s12 = vec3_exports.length(c1);
|
|
5234
|
+
const V2 = vec3_exports.dot(A, c1);
|
|
5235
|
+
const f2 = S * V2 + CC * (c01 * c12 - c20);
|
|
5236
|
+
const g = CC * s12 * (1 + c01);
|
|
5237
|
+
const q = 2 / Math.acos(c12) * Math.atan2(g, f2);
|
|
5238
|
+
const P = slerp2(vec3_exports.create(), B, C, q);
|
|
5239
|
+
const K = vectorDifference(A, P);
|
|
5240
|
+
const t2 = this.safeAcos(h * K) / this.safeAcos(K);
|
|
5241
|
+
const out = slerp2([0, 0, 0], A, P, t2);
|
|
5242
|
+
return out;
|
|
5243
|
+
}
|
|
5244
|
+
/**
|
|
5245
|
+
* Computes acos(1 - 2 * x * x) without loss of precision for small x
|
|
5246
|
+
* @param x
|
|
5247
|
+
* @returns acos(1 - x)
|
|
5248
|
+
*/
|
|
5249
|
+
safeAcos(x2) {
|
|
5250
|
+
if (x2 < 1e-3) {
|
|
5251
|
+
return 2 * x2 + x2 * x2 * x2 / 3;
|
|
5252
|
+
} else {
|
|
5253
|
+
return Math.acos(1 - 2 * x2 * x2);
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
};
|
|
4944
5257
|
common_exports.setMatrixArrayType(Float64Array);
|
|
4945
5258
|
var YES = -1;
|
|
4946
5259
|
var NO = 1;
|
|
@@ -4985,6 +5298,35 @@ var __exports__ = (() => {
|
|
|
4985
5298
|
return [[NO, NO], [NO, YES], [NO, NO], [YES, NO]][n2];
|
|
4986
5299
|
};
|
|
4987
5300
|
var FLIP_SHIFT = vec2_exports.fromValues(-1, 1);
|
|
5301
|
+
function reversePattern(pattern) {
|
|
5302
|
+
return Array.from({ length: pattern.length }, (_, i3) => pattern.indexOf(i3));
|
|
5303
|
+
}
|
|
5304
|
+
var PATTERN = [0, 1, 3, 4, 5, 6, 7, 2];
|
|
5305
|
+
var PATTERN_FLIPPED = [0, 1, 2, 7, 3, 4, 5, 6];
|
|
5306
|
+
var PATTERN_REVERSED = reversePattern(PATTERN);
|
|
5307
|
+
var PATTERN_FLIPPED_REVERSED = reversePattern(PATTERN_FLIPPED);
|
|
5308
|
+
var _shiftDigits = (digits, i3, flips, invertJ, pattern) => {
|
|
5309
|
+
if (i3 <= 0)
|
|
5310
|
+
return;
|
|
5311
|
+
const parentK = digits[i3] || 0;
|
|
5312
|
+
const childK = digits[i3 - 1];
|
|
5313
|
+
const F = flips[0] + flips[1];
|
|
5314
|
+
let needsShift = true;
|
|
5315
|
+
let first = true;
|
|
5316
|
+
if (invertJ !== (F === 0)) {
|
|
5317
|
+
needsShift = parentK === 1 || parentK === 2;
|
|
5318
|
+
first = parentK === 1;
|
|
5319
|
+
} else {
|
|
5320
|
+
needsShift = parentK < 2;
|
|
5321
|
+
first = parentK === 0;
|
|
5322
|
+
}
|
|
5323
|
+
if (!needsShift)
|
|
5324
|
+
return;
|
|
5325
|
+
const src = first ? childK : childK + 4;
|
|
5326
|
+
const dst = pattern[src];
|
|
5327
|
+
digits[i3 - 1] = dst % 4;
|
|
5328
|
+
digits[i3] = (parentK + 4 + Math.floor(dst / 4) - Math.floor(src / 4)) % 4;
|
|
5329
|
+
};
|
|
4988
5330
|
var sToAnchor = (s2, resolution, orientation) => {
|
|
4989
5331
|
let input = BigInt(s2);
|
|
4990
5332
|
const reverse = orientation === "vu" || orientation === "wu" || orientation === "vw";
|
|
@@ -4993,7 +5335,7 @@ var __exports__ = (() => {
|
|
|
4993
5335
|
if (reverse) {
|
|
4994
5336
|
input = (1n << BigInt(2 * resolution)) - input - 1n;
|
|
4995
5337
|
}
|
|
4996
|
-
const anchor = _sToAnchor(input);
|
|
5338
|
+
const anchor = _sToAnchor(input, resolution, invertJ, flipIJ);
|
|
4997
5339
|
if (flipIJ) {
|
|
4998
5340
|
const { offset: [_i, _j], flips: [flipX, flipY] } = anchor;
|
|
4999
5341
|
anchor.offset = [_j, _i];
|
|
@@ -5011,22 +5353,29 @@ var __exports__ = (() => {
|
|
|
5011
5353
|
}
|
|
5012
5354
|
return anchor;
|
|
5013
5355
|
};
|
|
5014
|
-
var _sToAnchor = (s2) => {
|
|
5015
|
-
const k = Number(s2) % 4;
|
|
5356
|
+
var _sToAnchor = (s2, resolution, invertJ, flipIJ) => {
|
|
5016
5357
|
const offset = vec2_exports.create();
|
|
5017
5358
|
const flips = [NO, NO];
|
|
5018
5359
|
let input = BigInt(s2);
|
|
5019
5360
|
const digits = [];
|
|
5020
|
-
while (input > 0n) {
|
|
5361
|
+
while (input > 0n || digits.length < resolution) {
|
|
5021
5362
|
digits.push(Number(input % 4n));
|
|
5022
5363
|
input = input >> 2n;
|
|
5023
5364
|
}
|
|
5365
|
+
const pattern = flipIJ ? PATTERN_FLIPPED : PATTERN;
|
|
5366
|
+
for (let i3 = digits.length - 1; i3 >= 0; i3--) {
|
|
5367
|
+
_shiftDigits(digits, i3, flips, invertJ, pattern);
|
|
5368
|
+
vec2_exports.multiply(flips, flips, quaternaryToFlips(digits[i3]));
|
|
5369
|
+
}
|
|
5370
|
+
flips[0] = NO;
|
|
5371
|
+
flips[1] = NO;
|
|
5024
5372
|
for (let i3 = digits.length - 1; i3 >= 0; i3--) {
|
|
5025
5373
|
vec2_exports.scale(offset, offset, 2);
|
|
5026
5374
|
const childOffset = quaternaryToKJ(digits[i3], flips);
|
|
5027
5375
|
vec2_exports.add(offset, offset, childOffset);
|
|
5028
5376
|
vec2_exports.multiply(flips, flips, quaternaryToFlips(digits[i3]));
|
|
5029
5377
|
}
|
|
5378
|
+
const k = digits[0] || 0;
|
|
5030
5379
|
return { flips, k, offset: KJToIJ(offset) };
|
|
5031
5380
|
};
|
|
5032
5381
|
common_exports.setMatrixArrayType(Float64Array);
|
|
@@ -5034,9 +5383,9 @@ var __exports__ = (() => {
|
|
|
5034
5383
|
var shiftRight = vec2_exports.clone(w);
|
|
5035
5384
|
var shiftLeft = vec2_exports.negate(vec2_exports.create(), w);
|
|
5036
5385
|
var QUINTANT_ROTATIONS = [0, 1, 2, 3, 4].map((quintant) => {
|
|
5037
|
-
const
|
|
5038
|
-
mat2_exports.fromRotation(
|
|
5039
|
-
return
|
|
5386
|
+
const rotation2 = mat2_exports.create();
|
|
5387
|
+
mat2_exports.fromRotation(rotation2, TWO_PI_OVER_5 * quintant);
|
|
5388
|
+
return rotation2;
|
|
5040
5389
|
});
|
|
5041
5390
|
var translation = vec2_exports.create();
|
|
5042
5391
|
function getPentagonVertices(resolution, quintant, anchor) {
|
|
@@ -5073,48 +5422,211 @@ var __exports__ = (() => {
|
|
|
5073
5422
|
}
|
|
5074
5423
|
function getFaceVertices() {
|
|
5075
5424
|
const vertices = [];
|
|
5076
|
-
for (const
|
|
5077
|
-
vertices.push(vec2_exports.transformMat2(vec2_exports.create(), v,
|
|
5425
|
+
for (const rotation2 of QUINTANT_ROTATIONS) {
|
|
5426
|
+
vertices.push(vec2_exports.transformMat2(vec2_exports.create(), v, rotation2));
|
|
5078
5427
|
}
|
|
5428
|
+
vertices.reverse();
|
|
5079
5429
|
return new PentagonShape(vertices);
|
|
5080
5430
|
}
|
|
5081
5431
|
common_exports.setMatrixArrayType(Float64Array);
|
|
5082
|
-
var
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5432
|
+
var CRS = class {
|
|
5433
|
+
constructor() {
|
|
5434
|
+
this.vertices = [];
|
|
5435
|
+
this.invocations = 0;
|
|
5436
|
+
this.addFaceCenters();
|
|
5437
|
+
this.addVertices();
|
|
5438
|
+
this.addMidpoints();
|
|
5439
|
+
if (this.vertices.length !== 62) {
|
|
5440
|
+
throw new Error("Failed to construct CRS: vertices length is not 62");
|
|
5441
|
+
}
|
|
5442
|
+
Object.freeze(this.vertices);
|
|
5443
|
+
}
|
|
5444
|
+
getVertex(point) {
|
|
5445
|
+
this.invocations++;
|
|
5446
|
+
if (this.invocations === 1e4) {
|
|
5447
|
+
console.warn("Too many CRS invocations, results should be cached");
|
|
5448
|
+
}
|
|
5449
|
+
for (const vertex of this.vertices) {
|
|
5450
|
+
if (vec3_exports.distance(point, vertex) < 1e-5) {
|
|
5451
|
+
return vertex;
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5454
|
+
throw new Error("Failed to find vertex in CRS");
|
|
5455
|
+
}
|
|
5456
|
+
addFaceCenters() {
|
|
5457
|
+
origins.forEach((origin) => this.add(toCartesian(origin.axis)));
|
|
5458
|
+
}
|
|
5459
|
+
addVertices() {
|
|
5460
|
+
const phiVertex = Math.atan(distanceToVertex);
|
|
5461
|
+
for (const origin of origins) {
|
|
5462
|
+
for (let i3 = 0; i3 < 5; i3++) {
|
|
5463
|
+
const thetaVertex = (2 * i3 + 1) * Math.PI / 5;
|
|
5464
|
+
const vertex = toCartesian([thetaVertex + origin.angle, phiVertex]);
|
|
5465
|
+
vec3_exports.transformQuat(vertex, vertex, origin.quat);
|
|
5466
|
+
this.add(vertex);
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
addMidpoints() {
|
|
5471
|
+
const phiMidpoint = Math.atan(distanceToEdge);
|
|
5472
|
+
for (const origin of origins) {
|
|
5473
|
+
for (let i3 = 0; i3 < 5; i3++) {
|
|
5474
|
+
const thetaMidpoint = 2 * i3 * Math.PI / 5;
|
|
5475
|
+
const midpoint = toCartesian([thetaMidpoint + origin.angle, phiMidpoint]);
|
|
5476
|
+
vec3_exports.transformQuat(midpoint, midpoint, origin.quat);
|
|
5477
|
+
this.add(midpoint);
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
add(newVertex) {
|
|
5482
|
+
const normalized = vec3_exports.normalize(vec3_exports.create(), newVertex);
|
|
5483
|
+
const existingVertex = this.vertices.find((existingVertex2) => vec3_exports.distance(normalized, existingVertex2) < 1e-5);
|
|
5484
|
+
if (existingVertex) {
|
|
5485
|
+
return false;
|
|
5486
|
+
}
|
|
5487
|
+
this.vertices.push(normalized);
|
|
5488
|
+
return true;
|
|
5489
|
+
}
|
|
5490
|
+
};
|
|
5491
|
+
common_exports.setMatrixArrayType(Float64Array);
|
|
5492
|
+
var crs = new CRS();
|
|
5493
|
+
var DodecahedronProjection = class {
|
|
5494
|
+
constructor() {
|
|
5495
|
+
this.faceTriangles = [];
|
|
5496
|
+
this.sphericalTriangles = [];
|
|
5497
|
+
this.polyhedral = new PolyhedralProjection();
|
|
5498
|
+
this.gnomonic = new GnomonicProjection();
|
|
5499
|
+
}
|
|
5500
|
+
/**
|
|
5501
|
+
* Projects spherical coordinates to face coordinates using dodecahedron projection
|
|
5502
|
+
* @param spherical Spherical coordinates [theta, phi]
|
|
5503
|
+
* @param originId Origin ID
|
|
5504
|
+
* @returns Face coordinates [x, y]
|
|
5505
|
+
*/
|
|
5506
|
+
forward(spherical, originId2) {
|
|
5507
|
+
const origin = origins[originId2];
|
|
5508
|
+
const unprojected = toCartesian(spherical);
|
|
5509
|
+
const inverseQuat = quat_exports.create();
|
|
5510
|
+
quat_exports.invert(inverseQuat, origin.quat);
|
|
5511
|
+
const out = vec3_exports.create();
|
|
5512
|
+
vec3_exports.transformQuat(out, unprojected, inverseQuat);
|
|
5513
|
+
const projectedSpherical = toSpherical(out);
|
|
5514
|
+
const polar = this.gnomonic.forward(projectedSpherical);
|
|
5515
|
+
polar[1] = polar[1] - origin.angle;
|
|
5516
|
+
const faceTriangleIndex = this.getFaceTriangleIndex(polar);
|
|
5517
|
+
let faceTriangle = this.getFaceTriangle(faceTriangleIndex);
|
|
5518
|
+
let sphericalTriangle = this.getSphericalTriangle(faceTriangleIndex, originId2, false);
|
|
5519
|
+
return this.polyhedral.forward(unprojected, sphericalTriangle, faceTriangle);
|
|
5520
|
+
}
|
|
5521
|
+
/**
|
|
5522
|
+
* Unprojects face coordinates to spherical coordinates using dodecahedron projection
|
|
5523
|
+
* @param face Face coordinates [x, y]
|
|
5524
|
+
* @param originId Origin ID
|
|
5525
|
+
* @returns Spherical coordinates [theta, phi]
|
|
5526
|
+
*/
|
|
5527
|
+
inverse(face, originId2) {
|
|
5528
|
+
const polar = toPolar(face);
|
|
5529
|
+
const faceTriangleIndex = this.getFaceTriangleIndex(polar);
|
|
5530
|
+
const [rho, gamma] = polar;
|
|
5531
|
+
const D = toFace([rho, this.normalizeGamma(gamma)])[0];
|
|
5532
|
+
const reflect = D > distanceToEdge;
|
|
5533
|
+
const faceTriangle = this.getFaceTriangle(faceTriangleIndex, reflect, false);
|
|
5534
|
+
let sphericalTriangle = this.getSphericalTriangle(faceTriangleIndex, originId2, reflect);
|
|
5535
|
+
const unprojected = this.polyhedral.inverse(face, faceTriangle, sphericalTriangle);
|
|
5536
|
+
return toSpherical(unprojected);
|
|
5537
|
+
}
|
|
5538
|
+
/**
|
|
5539
|
+
* Given a polar coordinate, returns the index of the face triangle it belongs to
|
|
5540
|
+
* @param polar Polar coordinates
|
|
5541
|
+
* @returns Face triangle index, value from 0 to 9
|
|
5542
|
+
*/
|
|
5543
|
+
getFaceTriangleIndex([_, gamma]) {
|
|
5544
|
+
return (Math.floor(gamma / PI_OVER_5) + 10) % 10;
|
|
5545
|
+
}
|
|
5546
|
+
/**
|
|
5547
|
+
* Gets the face triangle for a given polar coordinate
|
|
5548
|
+
* @param faceTriangleIndex Face triangle index, value from 0 to 9
|
|
5549
|
+
* @returns FaceTriangle: 3 vertices in counter-clockwise order
|
|
5550
|
+
*/
|
|
5551
|
+
getFaceTriangle(faceTriangleIndex, reflected = false, squashed = false) {
|
|
5552
|
+
let index = faceTriangleIndex;
|
|
5553
|
+
if (reflected) {
|
|
5554
|
+
index += squashed ? 20 : 10;
|
|
5555
|
+
}
|
|
5556
|
+
if (this.faceTriangles[index]) {
|
|
5557
|
+
return this.faceTriangles[index];
|
|
5558
|
+
}
|
|
5559
|
+
this.faceTriangles[index] = reflected ? this._getReflectedFaceTriangle(faceTriangleIndex, squashed) : this._getFaceTriangle(faceTriangleIndex);
|
|
5560
|
+
Object.freeze(this.faceTriangles[index]);
|
|
5561
|
+
return this.faceTriangles[index];
|
|
5562
|
+
}
|
|
5563
|
+
_getFaceTriangle(faceTriangleIndex) {
|
|
5564
|
+
const quintant = Math.floor((faceTriangleIndex + 1) / 2) % 5;
|
|
5565
|
+
const [vCenter, vCorner1, vCorner2] = getQuintantVertices(quintant).getVertices();
|
|
5566
|
+
const vEdgeMidpoint = vec2_exports.create();
|
|
5567
|
+
vec2_exports.lerp(vEdgeMidpoint, vCorner1, vCorner2, 0.5);
|
|
5568
|
+
const even = faceTriangleIndex % 2 === 0;
|
|
5569
|
+
return even ? [vCenter, vEdgeMidpoint, vCorner1] : [vCenter, vCorner2, vEdgeMidpoint];
|
|
5570
|
+
}
|
|
5571
|
+
_getReflectedFaceTriangle(faceTriangleIndex, squashed = false) {
|
|
5572
|
+
let [A, B, C] = this._getFaceTriangle(faceTriangleIndex).map((face) => vec2_exports.clone(face));
|
|
5573
|
+
const even = faceTriangleIndex % 2 === 0;
|
|
5574
|
+
vec2_exports.negate(A, A);
|
|
5575
|
+
const midpoint = even ? B : C;
|
|
5576
|
+
vec2_exports.scaleAndAdd(A, A, midpoint, squashed ? 1 + 1 / Math.cos(interhedralAngle) : 2);
|
|
5577
|
+
return [A, C, B];
|
|
5578
|
+
}
|
|
5579
|
+
/**
|
|
5580
|
+
* Gets the spherical triangle for a given face triangle index and origin
|
|
5581
|
+
* @param faceTriangleIndex Face triangle index
|
|
5582
|
+
* @param originId Origin ID
|
|
5583
|
+
* @returns Spherical triangle
|
|
5584
|
+
*/
|
|
5585
|
+
getSphericalTriangle(faceTriangleIndex, originId2, reflected = false) {
|
|
5586
|
+
let index = 10 * originId2 + faceTriangleIndex;
|
|
5587
|
+
if (reflected) {
|
|
5588
|
+
index += 120;
|
|
5589
|
+
}
|
|
5590
|
+
if (this.sphericalTriangles[index]) {
|
|
5591
|
+
return this.sphericalTriangles[index];
|
|
5592
|
+
}
|
|
5593
|
+
this.sphericalTriangles[index] = this._getSphericalTriangle(faceTriangleIndex, originId2, reflected);
|
|
5594
|
+
Object.freeze(this.sphericalTriangles[index]);
|
|
5595
|
+
return this.sphericalTriangles[index];
|
|
5596
|
+
}
|
|
5597
|
+
_getSphericalTriangle(faceTriangleIndex, originId2, reflected = false) {
|
|
5598
|
+
const origin = origins[originId2];
|
|
5599
|
+
const faceTriangle = this.getFaceTriangle(faceTriangleIndex, reflected, true);
|
|
5600
|
+
const sphericalTriangle = faceTriangle.map((face) => {
|
|
5601
|
+
const [rho, gamma] = toPolar(face);
|
|
5602
|
+
const rotatedPolar = [rho, gamma + origin.angle];
|
|
5603
|
+
const rotated = toCartesian(this.gnomonic.inverse(rotatedPolar));
|
|
5604
|
+
vec3_exports.transformQuat(rotated, rotated, origin.quat);
|
|
5605
|
+
return crs.getVertex(rotated);
|
|
5606
|
+
});
|
|
5607
|
+
return sphericalTriangle;
|
|
5608
|
+
}
|
|
5609
|
+
/**
|
|
5610
|
+
* Normalizes gamma to the range [-PI_OVER_5, PI_OVER_5]
|
|
5611
|
+
* @param gamma The gamma value to normalize
|
|
5612
|
+
* @returns Normalized gamma value
|
|
5613
|
+
*/
|
|
5614
|
+
normalizeGamma(gamma) {
|
|
5615
|
+
const segment = gamma / TWO_PI_OVER_5;
|
|
5616
|
+
const sCenter = Math.round(segment);
|
|
5617
|
+
const sOffset = segment - sCenter;
|
|
5618
|
+
const beta = sOffset * TWO_PI_OVER_5;
|
|
5619
|
+
return beta;
|
|
5620
|
+
}
|
|
5621
|
+
};
|
|
5622
|
+
var FIRST_HILBERT_RESOLUTION = 2;
|
|
5623
|
+
var MAX_RESOLUTION = 30;
|
|
5112
5624
|
var HILBERT_START_BIT = 58n;
|
|
5113
5625
|
var REMOVAL_MASK = 0x3ffffffffffffffn;
|
|
5114
5626
|
function getResolution(index) {
|
|
5115
5627
|
let resolution = MAX_RESOLUTION - 1;
|
|
5116
5628
|
let shifted = index >> 1n;
|
|
5117
|
-
while (resolution >
|
|
5629
|
+
while (resolution > -1 && (shifted & 0b1n) === 0n) {
|
|
5118
5630
|
resolution -= 1;
|
|
5119
5631
|
shifted = shifted >> (resolution < FIRST_HILBERT_RESOLUTION ? 1n : 2n);
|
|
5120
5632
|
}
|
|
@@ -5122,12 +5634,12 @@ var __exports__ = (() => {
|
|
|
5122
5634
|
}
|
|
5123
5635
|
function deserialize(index) {
|
|
5124
5636
|
const resolution = getResolution(index);
|
|
5125
|
-
if (resolution ===
|
|
5637
|
+
if (resolution === -1) {
|
|
5126
5638
|
return { origin: origins[0], segment: 0, S: 0n, resolution };
|
|
5127
5639
|
}
|
|
5128
5640
|
const top6Bits = Number(index >> 58n);
|
|
5129
5641
|
let origin, segment;
|
|
5130
|
-
if (resolution ===
|
|
5642
|
+
if (resolution === 0) {
|
|
5131
5643
|
const originId2 = top6Bits;
|
|
5132
5644
|
origin = origins[originId2];
|
|
5133
5645
|
segment = 0;
|
|
@@ -5149,7 +5661,8 @@ var __exports__ = (() => {
|
|
|
5149
5661
|
return { origin, segment, S, resolution };
|
|
5150
5662
|
}
|
|
5151
5663
|
common_exports.setMatrixArrayType(Float64Array);
|
|
5152
|
-
var
|
|
5664
|
+
var rotation = mat2_exports.create();
|
|
5665
|
+
var dodecahedron = new DodecahedronProjection();
|
|
5153
5666
|
function _getPentagon({ S, segment, origin, resolution }) {
|
|
5154
5667
|
const { quintant, orientation } = segmentToQuintant(segment, origin);
|
|
5155
5668
|
if (resolution === FIRST_HILBERT_RESOLUTION - 1) {
|
|
@@ -5162,14 +5675,28 @@ var __exports__ = (() => {
|
|
|
5162
5675
|
const anchor = sToAnchor(S, hilbertResolution, orientation);
|
|
5163
5676
|
return getPentagonVertices(hilbertResolution, quintant, anchor);
|
|
5164
5677
|
}
|
|
5165
|
-
function cellToBoundary(cellId) {
|
|
5678
|
+
function cellToBoundary(cellId, { closedRing = true, segments = "auto" } = { closedRing: true, segments: "auto" }) {
|
|
5166
5679
|
const { S, segment, origin, resolution } = deserialize(cellId);
|
|
5680
|
+
if (segments === "auto") {
|
|
5681
|
+
segments = Math.max(1, Math.pow(2, 6 - resolution));
|
|
5682
|
+
}
|
|
5167
5683
|
const pentagon = _getPentagon({ S, segment, origin, resolution });
|
|
5168
|
-
|
|
5684
|
+
const splitPentagon = pentagon.splitEdges(segments);
|
|
5685
|
+
const vertices = splitPentagon.getVertices();
|
|
5686
|
+
const unprojectedVertices = vertices.map((vertex) => dodecahedron.inverse(vertex, origin.id));
|
|
5687
|
+
const boundary = unprojectedVertices.map((vertex) => toLonLat(vertex));
|
|
5688
|
+
const normalizedBoundary = normalizeLongitudes(boundary);
|
|
5689
|
+
if (closedRing) {
|
|
5690
|
+
normalizedBoundary.push(normalizedBoundary[0]);
|
|
5691
|
+
}
|
|
5692
|
+
normalizedBoundary.reverse();
|
|
5693
|
+
return normalizedBoundary;
|
|
5169
5694
|
}
|
|
5170
5695
|
function hexToBigInt(hex) {
|
|
5171
5696
|
return BigInt(`0x${hex}`);
|
|
5172
5697
|
}
|
|
5698
|
+
var AUTHALIC_RADIUS = 63710072e-1;
|
|
5699
|
+
var AUTHALIC_AREA = 4 * Math.PI * AUTHALIC_RADIUS * AUTHALIC_RADIUS;
|
|
5173
5700
|
common_exports.setMatrixArrayType(Float64Array);
|
|
5174
5701
|
|
|
5175
5702
|
// src/h3-layers/h3-utils.ts
|
|
@@ -7793,7 +8320,7 @@ var __exports__ = (() => {
|
|
|
7793
8320
|
out[15] = 1;
|
|
7794
8321
|
return out;
|
|
7795
8322
|
}
|
|
7796
|
-
function lookAt(out, eye,
|
|
8323
|
+
function lookAt(out, eye, center2, up) {
|
|
7797
8324
|
let len9;
|
|
7798
8325
|
let x0;
|
|
7799
8326
|
let x1;
|
|
@@ -7810,9 +8337,9 @@ var __exports__ = (() => {
|
|
|
7810
8337
|
const upx = up[0];
|
|
7811
8338
|
const upy = up[1];
|
|
7812
8339
|
const upz = up[2];
|
|
7813
|
-
const centerx =
|
|
7814
|
-
const centery =
|
|
7815
|
-
const centerz =
|
|
8340
|
+
const centerx = center2[0];
|
|
8341
|
+
const centery = center2[1];
|
|
8342
|
+
const centerz = center2[2];
|
|
7816
8343
|
if (Math.abs(eyex - centerx) < EPSILON2 && Math.abs(eyey - centery) < EPSILON2 && Math.abs(eyez - centerz) < EPSILON2) {
|
|
7817
8344
|
return identity3(out);
|
|
7818
8345
|
}
|
|
@@ -8344,8 +8871,8 @@ var __exports__ = (() => {
|
|
|
8344
8871
|
* @returns self
|
|
8345
8872
|
*/
|
|
8346
8873
|
lookAt(view) {
|
|
8347
|
-
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
8348
|
-
lookAt(this, eye,
|
|
8874
|
+
const { eye, center: center2 = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
8875
|
+
lookAt(this, eye, center2, up);
|
|
8349
8876
|
return this.check();
|
|
8350
8877
|
}
|
|
8351
8878
|
/**
|
|
@@ -8778,7 +9305,7 @@ var __exports__ = (() => {
|
|
|
8778
9305
|
out[3] = Math.sqrt(Math.abs(1 - x2 * x2 - y2 * y2 - z * z));
|
|
8779
9306
|
return out;
|
|
8780
9307
|
}
|
|
8781
|
-
function
|
|
9308
|
+
function slerp3(out, a3, b2, t2) {
|
|
8782
9309
|
const ax = a3[0];
|
|
8783
9310
|
const ay = a3[1];
|
|
8784
9311
|
const az = a3[2];
|
|
@@ -8901,9 +9428,9 @@ var __exports__ = (() => {
|
|
|
8901
9428
|
const temp1 = create12();
|
|
8902
9429
|
const temp2 = create12();
|
|
8903
9430
|
return function(out, a3, b2, c2, d2, t2) {
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
9431
|
+
slerp3(temp1, a3, d2, t2);
|
|
9432
|
+
slerp3(temp2, b2, c2, t2);
|
|
9433
|
+
slerp3(out, temp1, temp2, 2 * t2 * (1 - t2));
|
|
8907
9434
|
return out;
|
|
8908
9435
|
};
|
|
8909
9436
|
}();
|
|
@@ -9150,7 +9677,7 @@ var __exports__ = (() => {
|
|
|
9150
9677
|
target = arg1;
|
|
9151
9678
|
ratio = arg2;
|
|
9152
9679
|
}
|
|
9153
|
-
|
|
9680
|
+
slerp3(this, start, target, ratio);
|
|
9154
9681
|
return this.check();
|
|
9155
9682
|
}
|
|
9156
9683
|
transformVector4(vector, result = new Vector4()) {
|
|
@@ -9226,7 +9753,7 @@ var __exports__ = (() => {
|
|
|
9226
9753
|
var TWO_PI2 = Math.PI * 2;
|
|
9227
9754
|
|
|
9228
9755
|
// src/h3-layers/h3-utils.ts
|
|
9229
|
-
function
|
|
9756
|
+
function normalizeLongitudes2(vertices, refLng) {
|
|
9230
9757
|
refLng = refLng === void 0 ? vertices[0][0] : refLng;
|
|
9231
9758
|
for (const pt of vertices) {
|
|
9232
9759
|
const deltaLng = pt[0] - refLng;
|
|
@@ -9240,7 +9767,7 @@ var __exports__ = (() => {
|
|
|
9240
9767
|
function scalePolygon(hexId, vertices, factor) {
|
|
9241
9768
|
const [lat, lng] = (0, import_h3_js.cellToLatLng)(hexId);
|
|
9242
9769
|
const actualCount = vertices.length;
|
|
9243
|
-
|
|
9770
|
+
normalizeLongitudes2(vertices, lng);
|
|
9244
9771
|
const vertexCount = vertices[0] === vertices[actualCount - 1] ? actualCount - 1 : actualCount;
|
|
9245
9772
|
for (let i3 = 0; i3 < vertexCount; i3++) {
|
|
9246
9773
|
vertices[i3][0] = lerp5(lng, vertices[i3][0], factor);
|
|
@@ -9257,7 +9784,7 @@ var __exports__ = (() => {
|
|
|
9257
9784
|
if (coverage !== 1) {
|
|
9258
9785
|
scalePolygon(hexId, vertices, coverage);
|
|
9259
9786
|
} else {
|
|
9260
|
-
|
|
9787
|
+
normalizeLongitudes2(vertices);
|
|
9261
9788
|
}
|
|
9262
9789
|
return vertices;
|
|
9263
9790
|
}
|
|
@@ -9286,9 +9813,9 @@ var __exports__ = (() => {
|
|
|
9286
9813
|
getPolygon: (x2, objectInfo) => {
|
|
9287
9814
|
const pentagon = getPentagon(x2, objectInfo);
|
|
9288
9815
|
const boundary = cellToBoundary(
|
|
9289
|
-
typeof pentagon === "string" ? hexToBigInt(pentagon) : pentagon
|
|
9816
|
+
typeof pentagon === "string" ? hexToBigInt(pentagon) : pentagon,
|
|
9817
|
+
{ closedRing: true, segments: "auto" }
|
|
9290
9818
|
);
|
|
9291
|
-
boundary.push(boundary[0]);
|
|
9292
9819
|
return flattenPolygon(boundary);
|
|
9293
9820
|
}
|
|
9294
9821
|
};
|
|
@@ -10068,14 +10595,14 @@ var __exports__ = (() => {
|
|
|
10068
10595
|
assert3(padding > 0);
|
|
10069
10596
|
return byteLength + (padding - 1) & ~(padding - 1);
|
|
10070
10597
|
}
|
|
10071
|
-
function copyToArray(
|
|
10598
|
+
function copyToArray(source2, target, targetOffset) {
|
|
10072
10599
|
let sourceArray;
|
|
10073
|
-
if (
|
|
10074
|
-
sourceArray = new Uint8Array(
|
|
10600
|
+
if (source2 instanceof ArrayBuffer) {
|
|
10601
|
+
sourceArray = new Uint8Array(source2);
|
|
10075
10602
|
} else {
|
|
10076
|
-
const srcByteOffset =
|
|
10077
|
-
const srcByteLength =
|
|
10078
|
-
sourceArray = new Uint8Array(
|
|
10603
|
+
const srcByteOffset = source2.byteOffset;
|
|
10604
|
+
const srcByteLength = source2.byteLength;
|
|
10605
|
+
sourceArray = new Uint8Array(source2.buffer || source2.arrayBuffer, srcByteOffset, srcByteLength);
|
|
10079
10606
|
}
|
|
10080
10607
|
target.set(sourceArray, targetOffset);
|
|
10081
10608
|
return targetOffset + padToNBytes(sourceArray.byteLength, 4);
|
|
@@ -10769,9 +11296,9 @@ var __exports__ = (() => {
|
|
|
10769
11296
|
abstract: xmlLayer?.Name && String(xmlLayer?.Abstract),
|
|
10770
11297
|
keywords: getXMLStringArray(xmlLayer.KeywordList?.Keyword)
|
|
10771
11298
|
};
|
|
10772
|
-
const
|
|
10773
|
-
if (
|
|
10774
|
-
layer.crs =
|
|
11299
|
+
const crs2 = xmlLayer?.CRS || xmlLayer?.SRS;
|
|
11300
|
+
if (crs2 && Array.isArray(crs2) && crs2.every((_) => typeof _ === "string")) {
|
|
11301
|
+
layer.crs = crs2;
|
|
10775
11302
|
}
|
|
10776
11303
|
let geographicBoundingBox = xmlLayer?.EX_GeographicBoundingBox && extractEXBoundingBox(xmlLayer?.EX_GeographicBoundingBox);
|
|
10777
11304
|
if (geographicBoundingBox) {
|
|
@@ -10833,10 +11360,10 @@ var __exports__ = (() => {
|
|
|
10833
11360
|
return xmlBoxes.map((xmlBox) => extractWMSBoundingBox(xmlBox));
|
|
10834
11361
|
}
|
|
10835
11362
|
function extractWMSBoundingBox(xmlBoundingBox) {
|
|
10836
|
-
const { CRS, SRS, minx, miny, maxx, maxy, resx, resy } = xmlBoundingBox;
|
|
11363
|
+
const { CRS: CRS2, SRS, minx, miny, maxx, maxy, resx, resy } = xmlBoundingBox;
|
|
10837
11364
|
const boundingBox = {
|
|
10838
11365
|
// CRS in 1.3.0, SRS in 1.1.1
|
|
10839
|
-
crs:
|
|
11366
|
+
crs: CRS2 || SRS,
|
|
10840
11367
|
boundingBox: [
|
|
10841
11368
|
[getXMLFloat(minx), getXMLFloat(miny)],
|
|
10842
11369
|
[getXMLFloat(maxx), getXMLFloat(maxy)]
|
|
@@ -12454,9 +12981,9 @@ var __exports__ = (() => {
|
|
|
12454
12981
|
* @param maximum=[0, 0, 0] The maximum point along the x, y, and z axes.
|
|
12455
12982
|
* @param center The center of the box; automatically computed if not supplied.
|
|
12456
12983
|
*/
|
|
12457
|
-
constructor(minimum = [0, 0, 0], maximum = [0, 0, 0],
|
|
12458
|
-
|
|
12459
|
-
this.center = new Vector3(
|
|
12984
|
+
constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center2) {
|
|
12985
|
+
center2 = center2 || scratchVector.copy(minimum).add(maximum).scale(0.5);
|
|
12986
|
+
this.center = new Vector3(center2);
|
|
12460
12987
|
this.halfDiagonal = new Vector3(maximum).subtract(this.center);
|
|
12461
12988
|
this.minimum = new Vector3(minimum);
|
|
12462
12989
|
this.maximum = new Vector3(maximum);
|
|
@@ -12538,14 +13065,14 @@ var __exports__ = (() => {
|
|
|
12538
13065
|
var scratchVector22 = new Vector3();
|
|
12539
13066
|
var BoundingSphere = class {
|
|
12540
13067
|
/** Creates a bounding sphere */
|
|
12541
|
-
constructor(
|
|
13068
|
+
constructor(center2 = [0, 0, 0], radius = 0) {
|
|
12542
13069
|
this.radius = -0;
|
|
12543
13070
|
this.center = new Vector3();
|
|
12544
|
-
this.fromCenterRadius(
|
|
13071
|
+
this.fromCenterRadius(center2, radius);
|
|
12545
13072
|
}
|
|
12546
13073
|
/** Sets the bounding sphere from `center` and `radius`. */
|
|
12547
|
-
fromCenterRadius(
|
|
12548
|
-
this.center.from(
|
|
13074
|
+
fromCenterRadius(center2, radius) {
|
|
13075
|
+
this.center.from(center2);
|
|
12549
13076
|
this.radius = radius;
|
|
12550
13077
|
return this;
|
|
12551
13078
|
}
|
|
@@ -12622,10 +13149,10 @@ var __exports__ = (() => {
|
|
|
12622
13149
|
}
|
|
12623
13150
|
/** Determines which side of a plane a sphere is located. */
|
|
12624
13151
|
intersectPlane(plane) {
|
|
12625
|
-
const
|
|
13152
|
+
const center2 = this.center;
|
|
12626
13153
|
const radius = this.radius;
|
|
12627
13154
|
const normal = plane.normal;
|
|
12628
|
-
const distanceToPlane = normal.dot(
|
|
13155
|
+
const distanceToPlane = normal.dot(center2) + plane.distance;
|
|
12629
13156
|
if (distanceToPlane < -radius) {
|
|
12630
13157
|
return INTERSECTION.OUTSIDE;
|
|
12631
13158
|
}
|
|
@@ -12656,8 +13183,8 @@ var __exports__ = (() => {
|
|
|
12656
13183
|
COLUMN2ROW2: 8
|
|
12657
13184
|
};
|
|
12658
13185
|
var OrientedBoundingBox = class {
|
|
12659
|
-
constructor(
|
|
12660
|
-
this.center = new Vector3().from(
|
|
13186
|
+
constructor(center2 = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
|
|
13187
|
+
this.center = new Vector3().from(center2);
|
|
12661
13188
|
this.halfAxes = new Matrix3(halfAxes);
|
|
12662
13189
|
}
|
|
12663
13190
|
/** Returns an array with three halfSizes for the bounding box */
|
|
@@ -12680,7 +13207,7 @@ var __exports__ = (() => {
|
|
|
12680
13207
|
/**
|
|
12681
13208
|
* Create OrientedBoundingBox from quaternion based OBB,
|
|
12682
13209
|
*/
|
|
12683
|
-
fromCenterHalfSizeQuaternion(
|
|
13210
|
+
fromCenterHalfSizeQuaternion(center2, halfSize, quaternion) {
|
|
12684
13211
|
const quaternionObject = new Quaternion(quaternion);
|
|
12685
13212
|
const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);
|
|
12686
13213
|
directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
|
|
@@ -12692,7 +13219,7 @@ var __exports__ = (() => {
|
|
|
12692
13219
|
directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
|
|
12693
13220
|
directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
|
|
12694
13221
|
directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
|
|
12695
|
-
this.center = new Vector3().from(
|
|
13222
|
+
this.center = new Vector3().from(center2);
|
|
12696
13223
|
this.halfAxes = directionsMatrix;
|
|
12697
13224
|
return this;
|
|
12698
13225
|
}
|
|
@@ -12717,14 +13244,14 @@ var __exports__ = (() => {
|
|
|
12717
13244
|
}
|
|
12718
13245
|
/** Determines which side of a plane the oriented bounding box is located. */
|
|
12719
13246
|
intersectPlane(plane) {
|
|
12720
|
-
const
|
|
13247
|
+
const center2 = this.center;
|
|
12721
13248
|
const normal = plane.normal;
|
|
12722
13249
|
const halfAxes = this.halfAxes;
|
|
12723
13250
|
const normalX = normal.x;
|
|
12724
13251
|
const normalY = normal.y;
|
|
12725
13252
|
const normalZ = normal.z;
|
|
12726
13253
|
const radEffective = Math.abs(normalX * halfAxes[MATRIX3.COLUMN0ROW0] + normalY * halfAxes[MATRIX3.COLUMN0ROW1] + normalZ * halfAxes[MATRIX3.COLUMN0ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN1ROW0] + normalY * halfAxes[MATRIX3.COLUMN1ROW1] + normalZ * halfAxes[MATRIX3.COLUMN1ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN2ROW0] + normalY * halfAxes[MATRIX3.COLUMN2ROW1] + normalZ * halfAxes[MATRIX3.COLUMN2ROW2]);
|
|
12727
|
-
const distanceToPlane = normal.dot(
|
|
13254
|
+
const distanceToPlane = normal.dot(center2) + plane.distance;
|
|
12728
13255
|
if (distanceToPlane <= -radEffective) {
|
|
12729
13256
|
return INTERSECTION.OUTSIDE;
|
|
12730
13257
|
} else if (distanceToPlane >= radEffective) {
|
|
@@ -12787,47 +13314,47 @@ var __exports__ = (() => {
|
|
|
12787
13314
|
computePlaneDistances(position, direction, result = [-0, -0]) {
|
|
12788
13315
|
let minDist = Number.POSITIVE_INFINITY;
|
|
12789
13316
|
let maxDist = Number.NEGATIVE_INFINITY;
|
|
12790
|
-
const
|
|
13317
|
+
const center2 = this.center;
|
|
12791
13318
|
const halfAxes = this.halfAxes;
|
|
12792
13319
|
const u2 = halfAxes.getColumn(0, scratchVectorU);
|
|
12793
13320
|
const v2 = halfAxes.getColumn(1, scratchVectorV);
|
|
12794
13321
|
const w2 = halfAxes.getColumn(2, scratchVectorW);
|
|
12795
|
-
const corner = scratchCorner.copy(u2).add(v2).add(w2).add(
|
|
13322
|
+
const corner = scratchCorner.copy(u2).add(v2).add(w2).add(center2);
|
|
12796
13323
|
const toCenter = scratchToCenter.copy(corner).subtract(position);
|
|
12797
13324
|
let mag = direction.dot(toCenter);
|
|
12798
13325
|
minDist = Math.min(mag, minDist);
|
|
12799
13326
|
maxDist = Math.max(mag, maxDist);
|
|
12800
|
-
corner.copy(
|
|
13327
|
+
corner.copy(center2).add(u2).add(v2).subtract(w2);
|
|
12801
13328
|
toCenter.copy(corner).subtract(position);
|
|
12802
13329
|
mag = direction.dot(toCenter);
|
|
12803
13330
|
minDist = Math.min(mag, minDist);
|
|
12804
13331
|
maxDist = Math.max(mag, maxDist);
|
|
12805
|
-
corner.copy(
|
|
13332
|
+
corner.copy(center2).add(u2).subtract(v2).add(w2);
|
|
12806
13333
|
toCenter.copy(corner).subtract(position);
|
|
12807
13334
|
mag = direction.dot(toCenter);
|
|
12808
13335
|
minDist = Math.min(mag, minDist);
|
|
12809
13336
|
maxDist = Math.max(mag, maxDist);
|
|
12810
|
-
corner.copy(
|
|
13337
|
+
corner.copy(center2).add(u2).subtract(v2).subtract(w2);
|
|
12811
13338
|
toCenter.copy(corner).subtract(position);
|
|
12812
13339
|
mag = direction.dot(toCenter);
|
|
12813
13340
|
minDist = Math.min(mag, minDist);
|
|
12814
13341
|
maxDist = Math.max(mag, maxDist);
|
|
12815
|
-
|
|
13342
|
+
center2.copy(corner).subtract(u2).add(v2).add(w2);
|
|
12816
13343
|
toCenter.copy(corner).subtract(position);
|
|
12817
13344
|
mag = direction.dot(toCenter);
|
|
12818
13345
|
minDist = Math.min(mag, minDist);
|
|
12819
13346
|
maxDist = Math.max(mag, maxDist);
|
|
12820
|
-
|
|
13347
|
+
center2.copy(corner).subtract(u2).add(v2).subtract(w2);
|
|
12821
13348
|
toCenter.copy(corner).subtract(position);
|
|
12822
13349
|
mag = direction.dot(toCenter);
|
|
12823
13350
|
minDist = Math.min(mag, minDist);
|
|
12824
13351
|
maxDist = Math.max(mag, maxDist);
|
|
12825
|
-
|
|
13352
|
+
center2.copy(corner).subtract(u2).subtract(v2).add(w2);
|
|
12826
13353
|
toCenter.copy(corner).subtract(position);
|
|
12827
13354
|
mag = direction.dot(toCenter);
|
|
12828
13355
|
minDist = Math.min(mag, minDist);
|
|
12829
13356
|
maxDist = Math.max(mag, maxDist);
|
|
12830
|
-
|
|
13357
|
+
center2.copy(corner).subtract(u2).subtract(v2).subtract(w2);
|
|
12831
13358
|
toCenter.copy(corner).subtract(position);
|
|
12832
13359
|
mag = direction.dot(toCenter);
|
|
12833
13360
|
minDist = Math.min(mag, minDist);
|
|
@@ -12934,7 +13461,7 @@ var __exports__ = (() => {
|
|
|
12934
13461
|
*/
|
|
12935
13462
|
fromBoundingSphere(boundingSphere) {
|
|
12936
13463
|
this.planes.length = 2 * faces.length;
|
|
12937
|
-
const
|
|
13464
|
+
const center2 = boundingSphere.center;
|
|
12938
13465
|
const radius = boundingSphere.radius;
|
|
12939
13466
|
let planeIndex = 0;
|
|
12940
13467
|
for (const faceNormal of faces) {
|
|
@@ -12946,9 +13473,9 @@ var __exports__ = (() => {
|
|
|
12946
13473
|
if (!plane1) {
|
|
12947
13474
|
plane1 = this.planes[planeIndex + 1] = new Plane();
|
|
12948
13475
|
}
|
|
12949
|
-
const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(
|
|
13476
|
+
const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center2);
|
|
12950
13477
|
plane0.fromPointNormal(plane0Center, faceNormal);
|
|
12951
|
-
const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(
|
|
13478
|
+
const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center2);
|
|
12952
13479
|
const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();
|
|
12953
13480
|
plane1.fromPointNormal(plane1Center, negatedFaceNormal);
|
|
12954
13481
|
planeIndex += 2;
|
|
@@ -13168,10 +13695,10 @@ var __exports__ = (() => {
|
|
|
13168
13695
|
covarianceMatrix[7] = eyz;
|
|
13169
13696
|
covarianceMatrix[8] = ezz;
|
|
13170
13697
|
const { unitary } = computeEigenDecomposition(covarianceMatrix, scratchEigenResult);
|
|
13171
|
-
const
|
|
13172
|
-
let v1 =
|
|
13173
|
-
let v2 =
|
|
13174
|
-
let v3 =
|
|
13698
|
+
const rotation2 = result.halfAxes.copy(unitary);
|
|
13699
|
+
let v1 = rotation2.getColumn(0, scratchVector4);
|
|
13700
|
+
let v2 = rotation2.getColumn(1, scratchVector5);
|
|
13701
|
+
let v3 = rotation2.getColumn(2, scratchVector6);
|
|
13175
13702
|
let u1 = -Number.MAX_VALUE;
|
|
13176
13703
|
let u2 = -Number.MAX_VALUE;
|
|
13177
13704
|
let u3 = -Number.MAX_VALUE;
|
|
@@ -14536,7 +15063,7 @@ out float vTime;
|
|
|
14536
15063
|
const multiPolygon = (0, import_h3_js3.cellsToMultiPolygon)(hexagons, true);
|
|
14537
15064
|
for (const polygon of multiPolygon) {
|
|
14538
15065
|
for (const ring of polygon) {
|
|
14539
|
-
|
|
15066
|
+
normalizeLongitudes2(ring);
|
|
14540
15067
|
}
|
|
14541
15068
|
polygons.push(this.getSubLayerRow({ polygon }, object, objectInfo.index));
|
|
14542
15069
|
}
|
|
@@ -14565,151 +15092,6 @@ out float vTime;
|
|
|
14565
15092
|
var import_layers8 = __toESM(require_layers(), 1);
|
|
14566
15093
|
var import_mesh_layers2 = __toESM(require_mesh_layers(), 1);
|
|
14567
15094
|
|
|
14568
|
-
// ../../node_modules/@luma.gl/gltf/dist/pbr/parse-pbr-material.js
|
|
14569
|
-
var import_core18 = __toESM(require_core2(), 1);
|
|
14570
|
-
var GLEnum;
|
|
14571
|
-
(function(GLEnum2) {
|
|
14572
|
-
GLEnum2[GLEnum2["FUNC_ADD"] = 32774] = "FUNC_ADD";
|
|
14573
|
-
GLEnum2[GLEnum2["ONE"] = 1] = "ONE";
|
|
14574
|
-
GLEnum2[GLEnum2["SRC_ALPHA"] = 770] = "SRC_ALPHA";
|
|
14575
|
-
GLEnum2[GLEnum2["ONE_MINUS_SRC_ALPHA"] = 771] = "ONE_MINUS_SRC_ALPHA";
|
|
14576
|
-
GLEnum2[GLEnum2["TEXTURE_MIN_FILTER"] = 10241] = "TEXTURE_MIN_FILTER";
|
|
14577
|
-
GLEnum2[GLEnum2["LINEAR"] = 9729] = "LINEAR";
|
|
14578
|
-
GLEnum2[GLEnum2["LINEAR_MIPMAP_NEAREST"] = 9985] = "LINEAR_MIPMAP_NEAREST";
|
|
14579
|
-
GLEnum2[GLEnum2["UNPACK_FLIP_Y_WEBGL"] = 37440] = "UNPACK_FLIP_Y_WEBGL";
|
|
14580
|
-
})(GLEnum || (GLEnum = {}));
|
|
14581
|
-
function parsePBRMaterial(device, material, attributes, options) {
|
|
14582
|
-
const parsedMaterial = {
|
|
14583
|
-
defines: {
|
|
14584
|
-
// TODO: Use EXT_sRGB if available (Standard in WebGL 2.0)
|
|
14585
|
-
MANUAL_SRGB: 1,
|
|
14586
|
-
SRGB_FAST_APPROXIMATION: 1
|
|
14587
|
-
},
|
|
14588
|
-
bindings: {},
|
|
14589
|
-
uniforms: {
|
|
14590
|
-
// TODO: find better values?
|
|
14591
|
-
camera: [0, 0, 0],
|
|
14592
|
-
// Model should override
|
|
14593
|
-
metallicRoughnessValues: [1, 1]
|
|
14594
|
-
// Default is 1 and 1
|
|
14595
|
-
},
|
|
14596
|
-
parameters: {},
|
|
14597
|
-
glParameters: {},
|
|
14598
|
-
generatedTextures: []
|
|
14599
|
-
};
|
|
14600
|
-
parsedMaterial.defines.USE_TEX_LOD = 1;
|
|
14601
|
-
const { imageBasedLightingEnvironment } = options;
|
|
14602
|
-
if (imageBasedLightingEnvironment) {
|
|
14603
|
-
parsedMaterial.bindings.pbr_diffuseEnvSampler = imageBasedLightingEnvironment.diffuseEnvSampler.texture;
|
|
14604
|
-
parsedMaterial.bindings.pbr_specularEnvSampler = imageBasedLightingEnvironment.specularEnvSampler.texture;
|
|
14605
|
-
parsedMaterial.bindings.pbr_BrdfLUT = imageBasedLightingEnvironment.brdfLutTexture.texture;
|
|
14606
|
-
parsedMaterial.uniforms.scaleIBLAmbient = [1, 1];
|
|
14607
|
-
}
|
|
14608
|
-
if (options?.pbrDebug) {
|
|
14609
|
-
parsedMaterial.defines.PBR_DEBUG = 1;
|
|
14610
|
-
parsedMaterial.uniforms.scaleDiffBaseMR = [0, 0, 0, 0];
|
|
14611
|
-
parsedMaterial.uniforms.scaleFGDSpec = [0, 0, 0, 0];
|
|
14612
|
-
}
|
|
14613
|
-
if (attributes.NORMAL)
|
|
14614
|
-
parsedMaterial.defines.HAS_NORMALS = 1;
|
|
14615
|
-
if (attributes.TANGENT && options?.useTangents)
|
|
14616
|
-
parsedMaterial.defines.HAS_TANGENTS = 1;
|
|
14617
|
-
if (attributes.TEXCOORD_0)
|
|
14618
|
-
parsedMaterial.defines.HAS_UV = 1;
|
|
14619
|
-
if (options?.imageBasedLightingEnvironment)
|
|
14620
|
-
parsedMaterial.defines.USE_IBL = 1;
|
|
14621
|
-
if (options?.lights)
|
|
14622
|
-
parsedMaterial.defines.USE_LIGHTS = 1;
|
|
14623
|
-
if (material) {
|
|
14624
|
-
parseMaterial(device, material, parsedMaterial);
|
|
14625
|
-
}
|
|
14626
|
-
return parsedMaterial;
|
|
14627
|
-
}
|
|
14628
|
-
function parseMaterial(device, material, parsedMaterial) {
|
|
14629
|
-
parsedMaterial.uniforms.unlit = Boolean(material.unlit);
|
|
14630
|
-
if (material.pbrMetallicRoughness) {
|
|
14631
|
-
parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial);
|
|
14632
|
-
}
|
|
14633
|
-
if (material.normalTexture) {
|
|
14634
|
-
addTexture(device, material.normalTexture, "pbr_normalSampler", "HAS_NORMALMAP", parsedMaterial);
|
|
14635
|
-
const { scale: scale26 = 1 } = material.normalTexture;
|
|
14636
|
-
parsedMaterial.uniforms.normalScale = scale26;
|
|
14637
|
-
}
|
|
14638
|
-
if (material.occlusionTexture) {
|
|
14639
|
-
addTexture(device, material.occlusionTexture, "pbr_occlusionSampler", "HAS_OCCLUSIONMAP", parsedMaterial);
|
|
14640
|
-
const { strength = 1 } = material.occlusionTexture;
|
|
14641
|
-
parsedMaterial.uniforms.occlusionStrength = strength;
|
|
14642
|
-
}
|
|
14643
|
-
if (material.emissiveTexture) {
|
|
14644
|
-
addTexture(device, material.emissiveTexture, "pbr_emissiveSampler", "HAS_EMISSIVEMAP", parsedMaterial);
|
|
14645
|
-
parsedMaterial.uniforms.emissiveFactor = material.emissiveFactor || [0, 0, 0];
|
|
14646
|
-
}
|
|
14647
|
-
switch (material.alphaMode) {
|
|
14648
|
-
case "MASK":
|
|
14649
|
-
const { alphaCutoff = 0.5 } = material;
|
|
14650
|
-
parsedMaterial.defines.ALPHA_CUTOFF = 1;
|
|
14651
|
-
parsedMaterial.uniforms.alphaCutoff = alphaCutoff;
|
|
14652
|
-
break;
|
|
14653
|
-
case "BLEND":
|
|
14654
|
-
import_core18.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")();
|
|
14655
|
-
parsedMaterial.parameters.blendColorOperation = "add";
|
|
14656
|
-
parsedMaterial.parameters.blendColorSrcFactor = "src-alpha";
|
|
14657
|
-
parsedMaterial.parameters.blendColorDstFactor = "one-minus-src-alpha";
|
|
14658
|
-
parsedMaterial.parameters.blendAlphaOperation = "add";
|
|
14659
|
-
parsedMaterial.parameters.blendAlphaSrcFactor = "one";
|
|
14660
|
-
parsedMaterial.parameters.blendAlphaDstFactor = "one-minus-src-alpha";
|
|
14661
|
-
parsedMaterial.glParameters.blend = true;
|
|
14662
|
-
parsedMaterial.glParameters.blendEquation = GLEnum.FUNC_ADD;
|
|
14663
|
-
parsedMaterial.glParameters.blendFunc = [
|
|
14664
|
-
GLEnum.SRC_ALPHA,
|
|
14665
|
-
GLEnum.ONE_MINUS_SRC_ALPHA,
|
|
14666
|
-
GLEnum.ONE,
|
|
14667
|
-
GLEnum.ONE_MINUS_SRC_ALPHA
|
|
14668
|
-
];
|
|
14669
|
-
break;
|
|
14670
|
-
}
|
|
14671
|
-
}
|
|
14672
|
-
function parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial) {
|
|
14673
|
-
if (pbrMetallicRoughness.baseColorTexture) {
|
|
14674
|
-
addTexture(device, pbrMetallicRoughness.baseColorTexture, "pbr_baseColorSampler", "HAS_BASECOLORMAP", parsedMaterial);
|
|
14675
|
-
}
|
|
14676
|
-
parsedMaterial.uniforms.baseColorFactor = pbrMetallicRoughness.baseColorFactor || [1, 1, 1, 1];
|
|
14677
|
-
if (pbrMetallicRoughness.metallicRoughnessTexture) {
|
|
14678
|
-
addTexture(device, pbrMetallicRoughness.metallicRoughnessTexture, "pbr_metallicRoughnessSampler", "HAS_METALROUGHNESSMAP", parsedMaterial);
|
|
14679
|
-
}
|
|
14680
|
-
const { metallicFactor = 1, roughnessFactor = 1 } = pbrMetallicRoughness;
|
|
14681
|
-
parsedMaterial.uniforms.metallicRoughnessValues = [metallicFactor, roughnessFactor];
|
|
14682
|
-
}
|
|
14683
|
-
function addTexture(device, gltfTexture, uniformName, define2 = null, parsedMaterial) {
|
|
14684
|
-
const parameters = gltfTexture?.texture?.sampler?.parameters || {};
|
|
14685
|
-
const image = gltfTexture.texture.source.image;
|
|
14686
|
-
let textureOptions;
|
|
14687
|
-
let specialTextureParameters = {};
|
|
14688
|
-
if (image.compressed) {
|
|
14689
|
-
textureOptions = image;
|
|
14690
|
-
specialTextureParameters = {
|
|
14691
|
-
[GLEnum.TEXTURE_MIN_FILTER]: image.data.length > 1 ? GLEnum.LINEAR_MIPMAP_NEAREST : GLEnum.LINEAR
|
|
14692
|
-
};
|
|
14693
|
-
} else {
|
|
14694
|
-
textureOptions = { data: image };
|
|
14695
|
-
}
|
|
14696
|
-
const texture = device.createTexture({
|
|
14697
|
-
id: gltfTexture.uniformName || gltfTexture.id,
|
|
14698
|
-
parameters: {
|
|
14699
|
-
...parameters,
|
|
14700
|
-
...specialTextureParameters
|
|
14701
|
-
},
|
|
14702
|
-
pixelStore: {
|
|
14703
|
-
[GLEnum.UNPACK_FLIP_Y_WEBGL]: false
|
|
14704
|
-
},
|
|
14705
|
-
...textureOptions
|
|
14706
|
-
});
|
|
14707
|
-
parsedMaterial.bindings[uniformName] = texture;
|
|
14708
|
-
if (define2)
|
|
14709
|
-
parsedMaterial.defines[define2] = 1;
|
|
14710
|
-
parsedMaterial.generatedTextures.push(texture);
|
|
14711
|
-
}
|
|
14712
|
-
|
|
14713
15095
|
// ../../node_modules/@loaders.gl/textures/dist/lib/utils/version.js
|
|
14714
15096
|
var VERSION7 = true ? "4.2.1" : "latest";
|
|
14715
15097
|
|
|
@@ -15183,10 +15565,193 @@ out float vTime;
|
|
|
15183
15565
|
parse: parseBasis
|
|
15184
15566
|
};
|
|
15185
15567
|
|
|
15568
|
+
// ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
|
|
15569
|
+
var import_core18 = __toESM(require_core2(), 1);
|
|
15570
|
+
|
|
15571
|
+
// ../../node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/convert-webgl-sampler.js
|
|
15572
|
+
function convertSampler(gltfSampler) {
|
|
15573
|
+
return {
|
|
15574
|
+
addressModeU: convertSamplerWrapMode(gltfSampler.wrapS),
|
|
15575
|
+
addressModeV: convertSamplerWrapMode(gltfSampler.wrapT),
|
|
15576
|
+
magFilter: convertSamplerMagFilter(gltfSampler.magFilter),
|
|
15577
|
+
...convertSamplerMinFilter(gltfSampler.minFilter)
|
|
15578
|
+
};
|
|
15579
|
+
}
|
|
15580
|
+
function convertSamplerWrapMode(mode) {
|
|
15581
|
+
switch (mode) {
|
|
15582
|
+
case 33071:
|
|
15583
|
+
return "clamp-to-edge";
|
|
15584
|
+
case 10497:
|
|
15585
|
+
return "repeat";
|
|
15586
|
+
case 33648:
|
|
15587
|
+
return "mirror-repeat";
|
|
15588
|
+
default:
|
|
15589
|
+
return void 0;
|
|
15590
|
+
}
|
|
15591
|
+
}
|
|
15592
|
+
function convertSamplerMagFilter(mode) {
|
|
15593
|
+
switch (mode) {
|
|
15594
|
+
case 9728:
|
|
15595
|
+
return "nearest";
|
|
15596
|
+
case 9729:
|
|
15597
|
+
return "linear";
|
|
15598
|
+
default:
|
|
15599
|
+
return void 0;
|
|
15600
|
+
}
|
|
15601
|
+
}
|
|
15602
|
+
function convertSamplerMinFilter(mode) {
|
|
15603
|
+
switch (mode) {
|
|
15604
|
+
case 9728:
|
|
15605
|
+
return { minFilter: "nearest" };
|
|
15606
|
+
case 9729:
|
|
15607
|
+
return { minFilter: "linear" };
|
|
15608
|
+
case 9984:
|
|
15609
|
+
return { minFilter: "nearest", mipmapFilter: "nearest" };
|
|
15610
|
+
case 9985:
|
|
15611
|
+
return { minFilter: "linear", mipmapFilter: "nearest" };
|
|
15612
|
+
case 9986:
|
|
15613
|
+
return { minFilter: "nearest", mipmapFilter: "linear" };
|
|
15614
|
+
case 9987:
|
|
15615
|
+
return { minFilter: "linear", mipmapFilter: "linear" };
|
|
15616
|
+
default:
|
|
15617
|
+
return {};
|
|
15618
|
+
}
|
|
15619
|
+
}
|
|
15620
|
+
|
|
15621
|
+
// ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
|
|
15622
|
+
function parsePBRMaterial(device, material, attributes, options) {
|
|
15623
|
+
const parsedMaterial = {
|
|
15624
|
+
defines: {
|
|
15625
|
+
// TODO: Use EXT_sRGB if available (Standard in WebGL 2.0)
|
|
15626
|
+
MANUAL_SRGB: true,
|
|
15627
|
+
SRGB_FAST_APPROXIMATION: true
|
|
15628
|
+
},
|
|
15629
|
+
bindings: {},
|
|
15630
|
+
uniforms: {
|
|
15631
|
+
// TODO: find better values?
|
|
15632
|
+
camera: [0, 0, 0],
|
|
15633
|
+
// Model should override
|
|
15634
|
+
metallicRoughnessValues: [1, 1]
|
|
15635
|
+
// Default is 1 and 1
|
|
15636
|
+
},
|
|
15637
|
+
parameters: {},
|
|
15638
|
+
glParameters: {},
|
|
15639
|
+
generatedTextures: []
|
|
15640
|
+
};
|
|
15641
|
+
parsedMaterial.defines["USE_TEX_LOD"] = true;
|
|
15642
|
+
const { imageBasedLightingEnvironment } = options;
|
|
15643
|
+
if (imageBasedLightingEnvironment) {
|
|
15644
|
+
parsedMaterial.bindings.pbr_diffuseEnvSampler = imageBasedLightingEnvironment.diffuseEnvSampler.texture;
|
|
15645
|
+
parsedMaterial.bindings.pbr_specularEnvSampler = imageBasedLightingEnvironment.specularEnvSampler.texture;
|
|
15646
|
+
parsedMaterial.bindings.pbr_BrdfLUT = imageBasedLightingEnvironment.brdfLutTexture.texture;
|
|
15647
|
+
parsedMaterial.uniforms.scaleIBLAmbient = [1, 1];
|
|
15648
|
+
}
|
|
15649
|
+
if (options?.pbrDebug) {
|
|
15650
|
+
parsedMaterial.defines["PBR_DEBUG"] = true;
|
|
15651
|
+
parsedMaterial.uniforms.scaleDiffBaseMR = [0, 0, 0, 0];
|
|
15652
|
+
parsedMaterial.uniforms.scaleFGDSpec = [0, 0, 0, 0];
|
|
15653
|
+
}
|
|
15654
|
+
if (attributes["NORMAL"])
|
|
15655
|
+
parsedMaterial.defines["HAS_NORMALS"] = true;
|
|
15656
|
+
if (attributes["TANGENT"] && options?.useTangents)
|
|
15657
|
+
parsedMaterial.defines["HAS_TANGENTS"] = true;
|
|
15658
|
+
if (attributes["TEXCOORD_0"])
|
|
15659
|
+
parsedMaterial.defines["HAS_UV"] = true;
|
|
15660
|
+
if (options?.imageBasedLightingEnvironment)
|
|
15661
|
+
parsedMaterial.defines["USE_IBL"] = true;
|
|
15662
|
+
if (options?.lights)
|
|
15663
|
+
parsedMaterial.defines["USE_LIGHTS"] = true;
|
|
15664
|
+
if (material) {
|
|
15665
|
+
parseMaterial(device, material, parsedMaterial);
|
|
15666
|
+
}
|
|
15667
|
+
return parsedMaterial;
|
|
15668
|
+
}
|
|
15669
|
+
function parseMaterial(device, material, parsedMaterial) {
|
|
15670
|
+
parsedMaterial.uniforms.unlit = Boolean(material.unlit);
|
|
15671
|
+
if (material.pbrMetallicRoughness) {
|
|
15672
|
+
parsePbrMetallicRoughness(device, material.pbrMetallicRoughness, parsedMaterial);
|
|
15673
|
+
}
|
|
15674
|
+
if (material.normalTexture) {
|
|
15675
|
+
addTexture(device, material.normalTexture, "pbr_normalSampler", "HAS_NORMALMAP", parsedMaterial);
|
|
15676
|
+
const { scale: scale26 = 1 } = material.normalTexture;
|
|
15677
|
+
parsedMaterial.uniforms.normalScale = scale26;
|
|
15678
|
+
}
|
|
15679
|
+
if (material.occlusionTexture) {
|
|
15680
|
+
addTexture(device, material.occlusionTexture, "pbr_occlusionSampler", "HAS_OCCLUSIONMAP", parsedMaterial);
|
|
15681
|
+
const { strength = 1 } = material.occlusionTexture;
|
|
15682
|
+
parsedMaterial.uniforms.occlusionStrength = strength;
|
|
15683
|
+
}
|
|
15684
|
+
if (material.emissiveTexture) {
|
|
15685
|
+
addTexture(device, material.emissiveTexture, "pbr_emissiveSampler", "HAS_EMISSIVEMAP", parsedMaterial);
|
|
15686
|
+
parsedMaterial.uniforms.emissiveFactor = material.emissiveFactor || [0, 0, 0];
|
|
15687
|
+
}
|
|
15688
|
+
switch (material.alphaMode || "MASK") {
|
|
15689
|
+
case "MASK":
|
|
15690
|
+
const { alphaCutoff = 0.5 } = material;
|
|
15691
|
+
parsedMaterial.defines["ALPHA_CUTOFF"] = true;
|
|
15692
|
+
parsedMaterial.uniforms.alphaCutoff = alphaCutoff;
|
|
15693
|
+
break;
|
|
15694
|
+
case "BLEND":
|
|
15695
|
+
import_core18.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")();
|
|
15696
|
+
parsedMaterial.parameters.blend = true;
|
|
15697
|
+
parsedMaterial.parameters.blendColorOperation = "add";
|
|
15698
|
+
parsedMaterial.parameters.blendColorSrcFactor = "src-alpha";
|
|
15699
|
+
parsedMaterial.parameters.blendColorDstFactor = "one-minus-src-alpha";
|
|
15700
|
+
parsedMaterial.parameters.blendAlphaOperation = "add";
|
|
15701
|
+
parsedMaterial.parameters.blendAlphaSrcFactor = "one";
|
|
15702
|
+
parsedMaterial.parameters.blendAlphaDstFactor = "one-minus-src-alpha";
|
|
15703
|
+
parsedMaterial.glParameters["blend"] = true;
|
|
15704
|
+
parsedMaterial.glParameters["blendEquation"] = 32774;
|
|
15705
|
+
parsedMaterial.glParameters["blendFunc"] = [
|
|
15706
|
+
770,
|
|
15707
|
+
771,
|
|
15708
|
+
1,
|
|
15709
|
+
771
|
|
15710
|
+
];
|
|
15711
|
+
break;
|
|
15712
|
+
}
|
|
15713
|
+
}
|
|
15714
|
+
function parsePbrMetallicRoughness(device, pbrMetallicRoughness, parsedMaterial) {
|
|
15715
|
+
if (pbrMetallicRoughness.baseColorTexture) {
|
|
15716
|
+
addTexture(device, pbrMetallicRoughness.baseColorTexture, "pbr_baseColorSampler", "HAS_BASECOLORMAP", parsedMaterial);
|
|
15717
|
+
}
|
|
15718
|
+
parsedMaterial.uniforms.baseColorFactor = pbrMetallicRoughness.baseColorFactor || [1, 1, 1, 1];
|
|
15719
|
+
if (pbrMetallicRoughness.metallicRoughnessTexture) {
|
|
15720
|
+
addTexture(device, pbrMetallicRoughness.metallicRoughnessTexture, "pbr_metallicRoughnessSampler", "HAS_METALROUGHNESSMAP", parsedMaterial);
|
|
15721
|
+
}
|
|
15722
|
+
const { metallicFactor = 1, roughnessFactor = 1 } = pbrMetallicRoughness;
|
|
15723
|
+
parsedMaterial.uniforms.metallicRoughnessValues = [metallicFactor, roughnessFactor];
|
|
15724
|
+
}
|
|
15725
|
+
function addTexture(device, gltfTexture, uniformName, define2, parsedMaterial) {
|
|
15726
|
+
const image = gltfTexture.texture.source.image;
|
|
15727
|
+
let textureOptions;
|
|
15728
|
+
if (image.compressed) {
|
|
15729
|
+
textureOptions = image;
|
|
15730
|
+
} else {
|
|
15731
|
+
textureOptions = { data: image };
|
|
15732
|
+
}
|
|
15733
|
+
const gltfSampler = {
|
|
15734
|
+
wrapS: 10497,
|
|
15735
|
+
// default REPEAT S (U) wrapping mode.
|
|
15736
|
+
wrapT: 10497,
|
|
15737
|
+
// default REPEAT T (V) wrapping mode.
|
|
15738
|
+
...gltfTexture?.texture?.sampler
|
|
15739
|
+
};
|
|
15740
|
+
const texture = device.createTexture({
|
|
15741
|
+
id: gltfTexture.uniformName || gltfTexture.id,
|
|
15742
|
+
sampler: convertSampler(gltfSampler),
|
|
15743
|
+
...textureOptions
|
|
15744
|
+
});
|
|
15745
|
+
parsedMaterial.bindings[uniformName] = texture;
|
|
15746
|
+
if (define2)
|
|
15747
|
+
parsedMaterial.defines[define2] = true;
|
|
15748
|
+
parsedMaterial.generatedTextures.push(texture);
|
|
15749
|
+
}
|
|
15750
|
+
|
|
15186
15751
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
|
|
15187
15752
|
var import_core19 = __toESM(require_core2(), 1);
|
|
15188
15753
|
|
|
15189
|
-
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-
|
|
15754
|
+
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-glsl.js
|
|
15190
15755
|
var lightingUniformsGLSL = (
|
|
15191
15756
|
/* glsl */
|
|
15192
15757
|
`precision highp int;
|
|
@@ -15266,7 +15831,7 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
|
|
|
15266
15831
|
`
|
|
15267
15832
|
);
|
|
15268
15833
|
|
|
15269
|
-
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-
|
|
15834
|
+
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-wgsl.js
|
|
15270
15835
|
var lightingUniformsWGSL = (
|
|
15271
15836
|
/* wgsl */
|
|
15272
15837
|
`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
@@ -15324,7 +15889,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
15324
15889
|
);
|
|
15325
15890
|
|
|
15326
15891
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
|
|
15327
|
-
var MAX_LIGHTS =
|
|
15892
|
+
var MAX_LIGHTS = 5;
|
|
15328
15893
|
var COLOR_FACTOR = 255;
|
|
15329
15894
|
var LIGHT_TYPE;
|
|
15330
15895
|
(function(LIGHT_TYPE2) {
|
|
@@ -15336,14 +15901,14 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
15336
15901
|
uniforms: {},
|
|
15337
15902
|
name: "lighting",
|
|
15338
15903
|
defines: {
|
|
15339
|
-
MAX_LIGHTS
|
|
15904
|
+
// MAX_LIGHTS
|
|
15340
15905
|
},
|
|
15341
15906
|
uniformTypes: {
|
|
15342
15907
|
enabled: "i32",
|
|
15343
15908
|
lightType: "i32",
|
|
15344
15909
|
directionalLightCount: "i32",
|
|
15345
15910
|
pointLightCount: "i32",
|
|
15346
|
-
|
|
15911
|
+
ambientColor: "vec3<f32>",
|
|
15347
15912
|
// TODO define as arrays once we have appropriate uniformTypes
|
|
15348
15913
|
lightColor0: "vec3<f32>",
|
|
15349
15914
|
lightPosition0: "vec3<f32>",
|
|
@@ -15364,7 +15929,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
15364
15929
|
lightType: LIGHT_TYPE.POINT,
|
|
15365
15930
|
directionalLightCount: 0,
|
|
15366
15931
|
pointLightCount: 0,
|
|
15367
|
-
|
|
15932
|
+
ambientColor: [0.1, 0.1, 0.1],
|
|
15368
15933
|
lightColor0: [1, 1, 1],
|
|
15369
15934
|
lightPosition0: [1, 1, 2],
|
|
15370
15935
|
// TODO - could combine direction and attenuation
|
|
@@ -15409,7 +15974,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
15409
15974
|
}
|
|
15410
15975
|
function getLightSourceUniforms({ ambientLight, pointLights = [], directionalLights = [] }) {
|
|
15411
15976
|
const lightSourceUniforms = {};
|
|
15412
|
-
lightSourceUniforms.
|
|
15977
|
+
lightSourceUniforms.ambientColor = convertColor(ambientLight);
|
|
15413
15978
|
let currentLight = 0;
|
|
15414
15979
|
for (const pointLight of pointLights) {
|
|
15415
15980
|
lightSourceUniforms.lightType = LIGHT_TYPE.POINT;
|
|
@@ -15456,7 +16021,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
15456
16021
|
return color.map((component) => component * intensity / COLOR_FACTOR);
|
|
15457
16022
|
}
|
|
15458
16023
|
|
|
15459
|
-
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-
|
|
16024
|
+
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-material-glsl.js
|
|
15460
16025
|
var vs = (
|
|
15461
16026
|
/* glsl */
|
|
15462
16027
|
`out vec3 pbr_vPosition;
|
|
@@ -15494,8 +16059,6 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
|
|
|
15494
16059
|
}
|
|
15495
16060
|
`
|
|
15496
16061
|
);
|
|
15497
|
-
|
|
15498
|
-
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-fragment-glsl.js
|
|
15499
16062
|
var fs = (
|
|
15500
16063
|
/* glsl */
|
|
15501
16064
|
`precision highp float;
|
|
@@ -15902,6 +16465,425 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
15902
16465
|
`
|
|
15903
16466
|
);
|
|
15904
16467
|
|
|
16468
|
+
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-material-wgsl.js
|
|
16469
|
+
var source = (
|
|
16470
|
+
/* wgsl */
|
|
16471
|
+
`struct PBRFragmentInputs {
|
|
16472
|
+
pbr_vPosition: vec3f,
|
|
16473
|
+
pbr_vUV: vec2f,
|
|
16474
|
+
pbr_vTBN: mat3f,
|
|
16475
|
+
pbr_vNormal: vec3f
|
|
16476
|
+
};
|
|
16477
|
+
|
|
16478
|
+
var fragmentInputs: PBRFragmentInputs;
|
|
16479
|
+
|
|
16480
|
+
fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f, uv: vec2f)
|
|
16481
|
+
{
|
|
16482
|
+
var pos: vec4f = pbrProjection.modelMatrix * position;
|
|
16483
|
+
pbr_vPosition = vec3(pos.xyz) / pos.w;
|
|
16484
|
+
|
|
16485
|
+
#ifdef HAS_NORMALS
|
|
16486
|
+
#ifdef HAS_TANGENTS
|
|
16487
|
+
let normalW: vec3f = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));
|
|
16488
|
+
let tangentW: vec3f = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));
|
|
16489
|
+
let bitangentW: vec3f = cross(normalW, tangentW) * tangent.w;
|
|
16490
|
+
fragmentInputs,pbr_vTBN = mat3(tangentW, bitangentW, normalW);
|
|
16491
|
+
#else // HAS_TANGENTS != 1
|
|
16492
|
+
fragmentInputs.pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));
|
|
16493
|
+
#endif
|
|
16494
|
+
#endif
|
|
16495
|
+
|
|
16496
|
+
#ifdef HAS_UV
|
|
16497
|
+
pbr_vUV = uv;
|
|
16498
|
+
#else
|
|
16499
|
+
pbr_vUV = vec2(0.,0.);
|
|
16500
|
+
#endif
|
|
16501
|
+
}
|
|
16502
|
+
|
|
16503
|
+
struct pbrMaterialUniforms {
|
|
16504
|
+
// Material is unlit
|
|
16505
|
+
unlit: uint32,
|
|
16506
|
+
|
|
16507
|
+
// Base color map
|
|
16508
|
+
baseColorMapEnabled: uint32,
|
|
16509
|
+
baseColorFactor: vec4f,
|
|
16510
|
+
|
|
16511
|
+
normalMapEnabled : uint32,
|
|
16512
|
+
normalScale: f32, // #ifdef HAS_NORMALMAP
|
|
16513
|
+
|
|
16514
|
+
emissiveMapEnabled: uint32,
|
|
16515
|
+
emissiveFactor: vec3f, // #ifdef HAS_EMISSIVEMAP
|
|
16516
|
+
|
|
16517
|
+
metallicRoughnessValues: vec2f,
|
|
16518
|
+
metallicRoughnessMapEnabled: uint32,
|
|
16519
|
+
|
|
16520
|
+
occlusionMapEnabled: i32,
|
|
16521
|
+
occlusionStrength: f32, // #ifdef HAS_OCCLUSIONMAP
|
|
16522
|
+
|
|
16523
|
+
alphaCutoffEnabled: i32,
|
|
16524
|
+
alphaCutoff: f32, // #ifdef ALPHA_CUTOFF
|
|
16525
|
+
|
|
16526
|
+
// IBL
|
|
16527
|
+
IBLenabled: i32,
|
|
16528
|
+
scaleIBLAmbient: vec2f, // #ifdef USE_IBL
|
|
16529
|
+
|
|
16530
|
+
// debugging flags used for shader output of intermediate PBR variables
|
|
16531
|
+
// #ifdef PBR_DEBUG
|
|
16532
|
+
scaleDiffBaseMR: vec4f,
|
|
16533
|
+
scaleFGDSpec: vec4f
|
|
16534
|
+
// #endif
|
|
16535
|
+
}
|
|
16536
|
+
|
|
16537
|
+
@binding(2) @group(0) var<uniform> material : pbrMaterialUniforms;
|
|
16538
|
+
|
|
16539
|
+
// Samplers
|
|
16540
|
+
#ifdef HAS_BASECOLORMAP
|
|
16541
|
+
uniform sampler2D pbr_baseColorSampler;
|
|
16542
|
+
#endif
|
|
16543
|
+
#ifdef HAS_NORMALMAP
|
|
16544
|
+
uniform sampler2D pbr_normalSampler;
|
|
16545
|
+
#endif
|
|
16546
|
+
#ifdef HAS_EMISSIVEMAP
|
|
16547
|
+
uniform sampler2D pbr_emissiveSampler;
|
|
16548
|
+
#endif
|
|
16549
|
+
#ifdef HAS_METALROUGHNESSMAP
|
|
16550
|
+
uniform sampler2D pbr_metallicRoughnessSampler;
|
|
16551
|
+
#endif
|
|
16552
|
+
#ifdef HAS_OCCLUSIONMAP
|
|
16553
|
+
uniform sampler2D pbr_occlusionSampler;
|
|
16554
|
+
#endif
|
|
16555
|
+
#ifdef USE_IBL
|
|
16556
|
+
uniform samplerCube pbr_diffuseEnvSampler;
|
|
16557
|
+
uniform samplerCube pbr_specularEnvSampler;
|
|
16558
|
+
uniform sampler2D pbr_brdfLUT;
|
|
16559
|
+
#endif
|
|
16560
|
+
|
|
16561
|
+
// Encapsulate the various inputs used by the various functions in the shading equation
|
|
16562
|
+
// We store values in this struct to simplify the integration of alternative implementations
|
|
16563
|
+
// of the shading terms, outlined in the Readme.MD Appendix.
|
|
16564
|
+
struct PBRInfo {
|
|
16565
|
+
NdotL: f32, // cos angle between normal and light direction
|
|
16566
|
+
NdotV: f32, // cos angle between normal and view direction
|
|
16567
|
+
NdotH: f32, // cos angle between normal and half vector
|
|
16568
|
+
LdotH: f32, // cos angle between light direction and half vector
|
|
16569
|
+
VdotH: f32, // cos angle between view direction and half vector
|
|
16570
|
+
perceptualRoughness: f32, // roughness value, as authored by the model creator (input to shader)
|
|
16571
|
+
metalness: f32, // metallic value at the surface
|
|
16572
|
+
reflectance0: vec3f, // full reflectance color (normal incidence angle)
|
|
16573
|
+
reflectance90: vec3f, // reflectance color at grazing angle
|
|
16574
|
+
alphaRoughness: f32, // roughness mapped to a more linear change in the roughness (proposed by [2])
|
|
16575
|
+
diffuseColor: vec3f, // color contribution from diffuse lighting
|
|
16576
|
+
specularColor: vec3f, // color contribution from specular lighting
|
|
16577
|
+
n: vec3f, // normal at surface point
|
|
16578
|
+
v: vec3f, // vector from surface point to camera
|
|
16579
|
+
};
|
|
16580
|
+
|
|
16581
|
+
const M_PI = 3.141592653589793;
|
|
16582
|
+
const c_MinRoughness = 0.04;
|
|
16583
|
+
|
|
16584
|
+
fn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f
|
|
16585
|
+
{
|
|
16586
|
+
#ifdef MANUAL_SRGB
|
|
16587
|
+
#ifdef SRGB_FAST_APPROXIMATION
|
|
16588
|
+
var linOut: vec3f = pow(srgbIn.xyz,vec3(2.2));
|
|
16589
|
+
#else // SRGB_FAST_APPROXIMATION
|
|
16590
|
+
var bLess: vec3f = step(vec3(0.04045),srgbIn.xyz);
|
|
16591
|
+
var linOut: vec3f = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
|
|
16592
|
+
#endif //SRGB_FAST_APPROXIMATION
|
|
16593
|
+
return vec4f(linOut,srgbIn.w);;
|
|
16594
|
+
#else //MANUAL_SRGB
|
|
16595
|
+
return srgbIn;
|
|
16596
|
+
#endif //MANUAL_SRGB
|
|
16597
|
+
}
|
|
16598
|
+
|
|
16599
|
+
// Find the normal for this fragment, pulling either from a predefined normal map
|
|
16600
|
+
// or from the interpolated mesh normal and tangent attributes.
|
|
16601
|
+
fn getNormal() -> vec3f
|
|
16602
|
+
{
|
|
16603
|
+
// Retrieve the tangent space matrix
|
|
16604
|
+
#ifndef HAS_TANGENTS
|
|
16605
|
+
var pos_dx: vec3f = dFdx(pbr_vPosition);
|
|
16606
|
+
var pos_dy: vec3f = dFdy(pbr_vPosition);
|
|
16607
|
+
var tex_dx: vec3f = dFdx(vec3(pbr_vUV, 0.0));
|
|
16608
|
+
var tex_dy: vec3f = dFdy(vec3(pbr_vUV, 0.0));
|
|
16609
|
+
var t: vec3f = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
|
|
16610
|
+
|
|
16611
|
+
#ifdef HAS_NORMALS
|
|
16612
|
+
var ng: vec3f = normalize(pbr_vNormal);
|
|
16613
|
+
#else
|
|
16614
|
+
var ng: vec3f = cross(pos_dx, pos_dy);
|
|
16615
|
+
#endif
|
|
16616
|
+
|
|
16617
|
+
t = normalize(t - ng * dot(ng, t));
|
|
16618
|
+
var b: vec3f = normalize(cross(ng, t));
|
|
16619
|
+
var tbn: mat3f = mat3f(t, b, ng);
|
|
16620
|
+
#else // HAS_TANGENTS
|
|
16621
|
+
var tbn: mat3f = pbr_vTBN;
|
|
16622
|
+
#endif
|
|
16623
|
+
|
|
16624
|
+
#ifdef HAS_NORMALMAP
|
|
16625
|
+
vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;
|
|
16626
|
+
n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));
|
|
16627
|
+
#else
|
|
16628
|
+
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
16629
|
+
vec3 n = normalize(tbn[2].xyz);
|
|
16630
|
+
#endif
|
|
16631
|
+
|
|
16632
|
+
return n;
|
|
16633
|
+
}
|
|
16634
|
+
|
|
16635
|
+
// Calculation of the lighting contribution from an optional Image Based Light source.
|
|
16636
|
+
// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
|
|
16637
|
+
// See our README.md on Environment Maps [3] for additional discussion.
|
|
16638
|
+
#ifdef USE_IBL
|
|
16639
|
+
fn getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection) -> vec3f
|
|
16640
|
+
{
|
|
16641
|
+
float mipCount = 9.0; // resolution of 512x512
|
|
16642
|
+
float lod = (pbrInfo.perceptualRoughness * mipCount);
|
|
16643
|
+
// retrieve a scale and bias to F0. See [1], Figure 3
|
|
16644
|
+
vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,
|
|
16645
|
+
vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;
|
|
16646
|
+
vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;
|
|
16647
|
+
|
|
16648
|
+
#ifdef USE_TEX_LOD
|
|
16649
|
+
vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;
|
|
16650
|
+
#else
|
|
16651
|
+
vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;
|
|
16652
|
+
#endif
|
|
16653
|
+
|
|
16654
|
+
vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;
|
|
16655
|
+
vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);
|
|
16656
|
+
|
|
16657
|
+
// For presentation, this allows us to disable IBL terms
|
|
16658
|
+
diffuse *= pbrMaterial.scaleIBLAmbient.x;
|
|
16659
|
+
specular *= pbrMaterial.scaleIBLAmbient.y;
|
|
16660
|
+
|
|
16661
|
+
return diffuse + specular;
|
|
16662
|
+
}
|
|
16663
|
+
#endif
|
|
16664
|
+
|
|
16665
|
+
// Basic Lambertian diffuse
|
|
16666
|
+
// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
|
|
16667
|
+
// See also [1], Equation 1
|
|
16668
|
+
fn diffuse(pbrInfo: PBRInfo) -> vec3<f32> {
|
|
16669
|
+
return pbrInfo.diffuseColor / PI;
|
|
16670
|
+
}
|
|
16671
|
+
|
|
16672
|
+
// The following equation models the Fresnel reflectance term of the spec equation (aka F())
|
|
16673
|
+
// Implementation of fresnel from [4], Equation 15
|
|
16674
|
+
fn specularReflection(pbrInfo: PBRInfo) -> vec3<f32> {
|
|
16675
|
+
return pbrInfo.reflectance0 +
|
|
16676
|
+
(pbrInfo.reflectance90 - pbrInfo.reflectance0) *
|
|
16677
|
+
pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);
|
|
16678
|
+
}
|
|
16679
|
+
|
|
16680
|
+
// This calculates the specular geometric attenuation (aka G()),
|
|
16681
|
+
// where rougher material will reflect less light back to the viewer.
|
|
16682
|
+
// This implementation is based on [1] Equation 4, and we adopt their modifications to
|
|
16683
|
+
// alphaRoughness as input as originally proposed in [2].
|
|
16684
|
+
fn geometricOcclusion(pbrInfo: PBRInfo) -> f32 {
|
|
16685
|
+
let NdotL: f32 = pbrInfo.NdotL;
|
|
16686
|
+
let NdotV: f32 = pbrInfo.NdotV;
|
|
16687
|
+
let r: f32 = pbrInfo.alphaRoughness;
|
|
16688
|
+
|
|
16689
|
+
let attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
|
|
16690
|
+
let attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
|
|
16691
|
+
return attenuationL * attenuationV;
|
|
16692
|
+
}
|
|
16693
|
+
|
|
16694
|
+
// The following equation(s) model the distribution of microfacet normals across
|
|
16695
|
+
// the area being drawn (aka D())
|
|
16696
|
+
// Implementation from "Average Irregularity Representation of a Roughened Surface
|
|
16697
|
+
// for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
|
|
16698
|
+
// Follows the distribution function recommended in the SIGGRAPH 2013 course notes
|
|
16699
|
+
// from EPIC Games [1], Equation 3.
|
|
16700
|
+
fn microfacetDistribution(pbrInfo: PBRInfo) -> f32 {
|
|
16701
|
+
let roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;
|
|
16702
|
+
let f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;
|
|
16703
|
+
return roughnessSq / (PI * f * f);
|
|
16704
|
+
}
|
|
16705
|
+
|
|
16706
|
+
fn PBRInfo_setAmbientLight(pbrInfo: ptr<function, PBRInfo>) {
|
|
16707
|
+
(*pbrInfo).NdotL = 1.0;
|
|
16708
|
+
(*pbrInfo).NdotH = 0.0;
|
|
16709
|
+
(*pbrInfo).LdotH = 0.0;
|
|
16710
|
+
(*pbrInfo).VdotH = 1.0;
|
|
16711
|
+
}
|
|
16712
|
+
|
|
16713
|
+
fn PBRInfo_setDirectionalLight(pbrInfo: ptr<function, PBRInfo>, lightDirection: vec3<f32>) {
|
|
16714
|
+
let n = (*pbrInfo).n;
|
|
16715
|
+
let v = (*pbrInfo).v;
|
|
16716
|
+
let l = normalize(lightDirection); // Vector from surface point to light
|
|
16717
|
+
let h = normalize(l + v); // Half vector between both l and v
|
|
16718
|
+
|
|
16719
|
+
(*pbrInfo).NdotL = clamp(dot(n, l), 0.001, 1.0);
|
|
16720
|
+
(*pbrInfo).NdotH = clamp(dot(n, h), 0.0, 1.0);
|
|
16721
|
+
(*pbrInfo).LdotH = clamp(dot(l, h), 0.0, 1.0);
|
|
16722
|
+
(*pbrInfo).VdotH = clamp(dot(v, h), 0.0, 1.0);
|
|
16723
|
+
}
|
|
16724
|
+
|
|
16725
|
+
fn PBRInfo_setPointLight(pbrInfo: ptr<function, PBRInfo>, pointLight: PointLight) {
|
|
16726
|
+
let light_direction = normalize(pointLight.position - pbr_vPosition);
|
|
16727
|
+
PBRInfo_setDirectionalLight(pbrInfo, light_direction);
|
|
16728
|
+
}
|
|
16729
|
+
|
|
16730
|
+
fn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {
|
|
16731
|
+
// Calculate the shading terms for the microfacet specular shading model
|
|
16732
|
+
let F = specularReflection(pbrInfo);
|
|
16733
|
+
let G = geometricOcclusion(pbrInfo);
|
|
16734
|
+
let D = microfacetDistribution(pbrInfo);
|
|
16735
|
+
|
|
16736
|
+
// Calculation of analytical lighting contribution
|
|
16737
|
+
let diffuseContrib = (1.0 - F) * diffuse(pbrInfo);
|
|
16738
|
+
let specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);
|
|
16739
|
+
// Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
|
|
16740
|
+
return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);
|
|
16741
|
+
}
|
|
16742
|
+
|
|
16743
|
+
fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
16744
|
+
// The albedo may be defined from a base texture or a flat color
|
|
16745
|
+
var baseColor: vec4<f32>;
|
|
16746
|
+
#ifdef HAS_BASECOLORMAP
|
|
16747
|
+
baseColor = SRGBtoLINEAR(textureSample(pbr_baseColorSampler, pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;
|
|
16748
|
+
#else
|
|
16749
|
+
baseColor = pbrMaterial.baseColorFactor;
|
|
16750
|
+
#endif
|
|
16751
|
+
|
|
16752
|
+
#ifdef ALPHA_CUTOFF
|
|
16753
|
+
if (baseColor.a < pbrMaterial.alphaCutoff) {
|
|
16754
|
+
discard;
|
|
16755
|
+
}
|
|
16756
|
+
#endif
|
|
16757
|
+
|
|
16758
|
+
var color = vec3<f32>(0.0, 0.0, 0.0);
|
|
16759
|
+
|
|
16760
|
+
if (pbrMaterial.unlit) {
|
|
16761
|
+
color = baseColor.rgb;
|
|
16762
|
+
} else {
|
|
16763
|
+
// Metallic and Roughness material properties are packed together
|
|
16764
|
+
// In glTF, these factors can be specified by fixed scalar values
|
|
16765
|
+
// or from a metallic-roughness map
|
|
16766
|
+
var perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;
|
|
16767
|
+
var metallic = pbrMaterial.metallicRoughnessValues.x;
|
|
16768
|
+
#ifdef HAS_METALROUGHNESSMAP
|
|
16769
|
+
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
|
|
16770
|
+
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data
|
|
16771
|
+
let mrSample = textureSample(pbr_metallicRoughnessSampler, pbr_metallicRoughnessSampler, pbr_vUV);
|
|
16772
|
+
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
16773
|
+
metallic = mrSample.b * metallic;
|
|
16774
|
+
#endif
|
|
16775
|
+
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
|
|
16776
|
+
metallic = clamp(metallic, 0.0, 1.0);
|
|
16777
|
+
// Roughness is authored as perceptual roughness; as is convention,
|
|
16778
|
+
// convert to material roughness by squaring the perceptual roughness [2].
|
|
16779
|
+
let alphaRoughness = perceptualRoughness * perceptualRoughness;
|
|
16780
|
+
|
|
16781
|
+
let f0 = vec3<f32>(0.04);
|
|
16782
|
+
var diffuseColor = baseColor.rgb * (vec3<f32>(1.0) - f0);
|
|
16783
|
+
diffuseColor *= 1.0 - metallic;
|
|
16784
|
+
let specularColor = mix(f0, baseColor.rgb, metallic);
|
|
16785
|
+
|
|
16786
|
+
// Compute reflectance.
|
|
16787
|
+
let reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
|
|
16788
|
+
|
|
16789
|
+
// For typical incident reflectance range (between 4% to 100%) set the grazing
|
|
16790
|
+
// reflectance to 100% for typical fresnel effect.
|
|
16791
|
+
// For very low reflectance range on highly diffuse objects (below 4%),
|
|
16792
|
+
// incrementally reduce grazing reflectance to 0%.
|
|
16793
|
+
let reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
|
|
16794
|
+
let specularEnvironmentR0 = specularColor;
|
|
16795
|
+
let specularEnvironmentR90 = vec3<f32>(1.0, 1.0, 1.0) * reflectance90;
|
|
16796
|
+
|
|
16797
|
+
let n = getNormal(); // normal at surface point
|
|
16798
|
+
let v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera
|
|
16799
|
+
|
|
16800
|
+
let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
16801
|
+
let reflection = -normalize(reflect(v, n));
|
|
16802
|
+
|
|
16803
|
+
var pbrInfo = PBRInfo(
|
|
16804
|
+
0.0, // NdotL
|
|
16805
|
+
NdotV,
|
|
16806
|
+
0.0, // NdotH
|
|
16807
|
+
0.0, // LdotH
|
|
16808
|
+
0.0, // VdotH
|
|
16809
|
+
perceptualRoughness,
|
|
16810
|
+
metallic,
|
|
16811
|
+
specularEnvironmentR0,
|
|
16812
|
+
specularEnvironmentR90,
|
|
16813
|
+
alphaRoughness,
|
|
16814
|
+
diffuseColor,
|
|
16815
|
+
specularColor,
|
|
16816
|
+
n,
|
|
16817
|
+
v
|
|
16818
|
+
);
|
|
16819
|
+
|
|
16820
|
+
#ifdef USE_LIGHTS
|
|
16821
|
+
// Apply ambient light
|
|
16822
|
+
PBRInfo_setAmbientLight(&pbrInfo);
|
|
16823
|
+
color += calculateFinalColor(pbrInfo, lighting.ambientColor);
|
|
16824
|
+
|
|
16825
|
+
// Apply directional light
|
|
16826
|
+
for (var i = 0; i < lighting.directionalLightCount; i++) {
|
|
16827
|
+
if (i < lighting.directionalLightCount) {
|
|
16828
|
+
PBRInfo_setDirectionalLight(&pbrInfo, lighting_getDirectionalLight(i).direction);
|
|
16829
|
+
color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);
|
|
16830
|
+
}
|
|
16831
|
+
}
|
|
16832
|
+
|
|
16833
|
+
// Apply point light
|
|
16834
|
+
for (var i = 0; i < lighting.pointLightCount; i++) {
|
|
16835
|
+
if (i < lighting.pointLightCount) {
|
|
16836
|
+
PBRInfo_setPointLight(&pbrInfo, lighting_getPointLight(i));
|
|
16837
|
+
let attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));
|
|
16838
|
+
color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);
|
|
16839
|
+
}
|
|
16840
|
+
}
|
|
16841
|
+
#endif
|
|
16842
|
+
|
|
16843
|
+
// Calculate lighting contribution from image based lighting source (IBL)
|
|
16844
|
+
#ifdef USE_IBL
|
|
16845
|
+
if (pbrMaterial.IBLenabled) {
|
|
16846
|
+
color += getIBLContribution(pbrInfo, n, reflection);
|
|
16847
|
+
}
|
|
16848
|
+
#endif
|
|
16849
|
+
|
|
16850
|
+
// Apply optional PBR terms for additional (optional) shading
|
|
16851
|
+
#ifdef HAS_OCCLUSIONMAP
|
|
16852
|
+
if (pbrMaterial.occlusionMapEnabled) {
|
|
16853
|
+
let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSampler, pbr_vUV).r;
|
|
16854
|
+
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
16855
|
+
}
|
|
16856
|
+
#endif
|
|
16857
|
+
|
|
16858
|
+
#ifdef HAS_EMISSIVEMAP
|
|
16859
|
+
if (pbrMaterial.emissiveMapEnabled) {
|
|
16860
|
+
let emissive = SRGBtoLINEAR(textureSample(pbr_emissiveSampler, pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;
|
|
16861
|
+
color += emissive;
|
|
16862
|
+
}
|
|
16863
|
+
#endif
|
|
16864
|
+
|
|
16865
|
+
// This section uses mix to override final color for reference app visualization
|
|
16866
|
+
// of various parameters in the lighting equation.
|
|
16867
|
+
#ifdef PBR_DEBUG
|
|
16868
|
+
// TODO: Figure out how to debug multiple lights
|
|
16869
|
+
|
|
16870
|
+
// color = mix(color, F, pbr_scaleFGDSpec.x);
|
|
16871
|
+
// color = mix(color, vec3(G), pbr_scaleFGDSpec.y);
|
|
16872
|
+
// color = mix(color, vec3(D), pbr_scaleFGDSpec.z);
|
|
16873
|
+
// color = mix(color, specContrib, pbr_scaleFGDSpec.w);
|
|
16874
|
+
|
|
16875
|
+
// color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);
|
|
16876
|
+
color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);
|
|
16877
|
+
color = mix(color, vec3<f32>(metallic), pbrMaterial.scaleDiffBaseMR.z);
|
|
16878
|
+
color = mix(color, vec3<f32>(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);
|
|
16879
|
+
#endif
|
|
16880
|
+
}
|
|
16881
|
+
|
|
16882
|
+
return vec4<f32>(pow(color, vec3<f32>(1.0 / 2.2)), baseColor.a);
|
|
16883
|
+
}
|
|
16884
|
+
`
|
|
16885
|
+
);
|
|
16886
|
+
|
|
15905
16887
|
// ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/pbr-material/pbr-projection.js
|
|
15906
16888
|
var uniformBlock2 = (
|
|
15907
16889
|
/* glsl */
|
|
@@ -15933,19 +16915,19 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
15933
16915
|
uniforms: {},
|
|
15934
16916
|
name: "pbrMaterial",
|
|
15935
16917
|
dependencies: [lighting, pbrProjection],
|
|
16918
|
+
source,
|
|
15936
16919
|
vs,
|
|
15937
16920
|
fs,
|
|
15938
16921
|
defines: {
|
|
15939
|
-
LIGHTING_FRAGMENT:
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15948
|
-
// PBR_DEBUG: 0
|
|
16922
|
+
LIGHTING_FRAGMENT: true,
|
|
16923
|
+
HAS_NORMALMAP: false,
|
|
16924
|
+
HAS_EMISSIVEMAP: false,
|
|
16925
|
+
HAS_OCCLUSIONMAP: false,
|
|
16926
|
+
HAS_BASECOLORMAP: false,
|
|
16927
|
+
HAS_METALROUGHNESSMAP: false,
|
|
16928
|
+
ALPHA_CUTOFF: false,
|
|
16929
|
+
USE_IBL: false,
|
|
16930
|
+
PBR_DEBUG: false
|
|
15949
16931
|
},
|
|
15950
16932
|
getUniforms: (props) => props,
|
|
15951
16933
|
uniformTypes: {
|
|
@@ -16181,8 +17163,7 @@ void main(void) {
|
|
|
16181
17163
|
pickFeatureIds: Boolean(featureIds)
|
|
16182
17164
|
};
|
|
16183
17165
|
const pbrProjectionProps = {
|
|
16184
|
-
|
|
16185
|
-
camera: model.uniforms.cameraPosition
|
|
17166
|
+
camera: this.context.viewport.cameraPosition
|
|
16186
17167
|
};
|
|
16187
17168
|
model.shaderInputs.setProps({
|
|
16188
17169
|
pbrProjection: pbrProjectionProps,
|
|
@@ -18219,7 +19200,7 @@ void main(void) {
|
|
|
18219
19200
|
return out;
|
|
18220
19201
|
}
|
|
18221
19202
|
var ortho2 = orthoNO2;
|
|
18222
|
-
function lookAt2(out, eye,
|
|
19203
|
+
function lookAt2(out, eye, center2, up) {
|
|
18223
19204
|
let len9;
|
|
18224
19205
|
let x0;
|
|
18225
19206
|
let x1;
|
|
@@ -18236,9 +19217,9 @@ void main(void) {
|
|
|
18236
19217
|
const upx = up[0];
|
|
18237
19218
|
const upy = up[1];
|
|
18238
19219
|
const upz = up[2];
|
|
18239
|
-
const centerx =
|
|
18240
|
-
const centery =
|
|
18241
|
-
const centerz =
|
|
19220
|
+
const centerx = center2[0];
|
|
19221
|
+
const centery = center2[1];
|
|
19222
|
+
const centerz = center2[2];
|
|
18242
19223
|
if (Math.abs(eyex - centerx) < EPSILON21 && Math.abs(eyey - centery) < EPSILON21 && Math.abs(eyez - centerz) < EPSILON21) {
|
|
18243
19224
|
return identity5(out);
|
|
18244
19225
|
}
|
|
@@ -18603,8 +19584,8 @@ void main(void) {
|
|
|
18603
19584
|
* @returns self
|
|
18604
19585
|
*/
|
|
18605
19586
|
lookAt(view) {
|
|
18606
|
-
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
18607
|
-
lookAt2(this, eye,
|
|
19587
|
+
const { eye, center: center2 = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
19588
|
+
lookAt2(this, eye, center2, up);
|
|
18608
19589
|
return this.check();
|
|
18609
19590
|
}
|
|
18610
19591
|
/**
|
|
@@ -19037,7 +20018,7 @@ void main(void) {
|
|
|
19037
20018
|
out[3] = Math.sqrt(Math.abs(1 - x2 * x2 - y2 * y2 - z * z));
|
|
19038
20019
|
return out;
|
|
19039
20020
|
}
|
|
19040
|
-
function
|
|
20021
|
+
function slerp4(out, a3, b2, t2) {
|
|
19041
20022
|
const ax = a3[0];
|
|
19042
20023
|
const ay = a3[1];
|
|
19043
20024
|
const az = a3[2];
|
|
@@ -19160,9 +20141,9 @@ void main(void) {
|
|
|
19160
20141
|
const temp1 = create17();
|
|
19161
20142
|
const temp2 = create17();
|
|
19162
20143
|
return function(out, a3, b2, c2, d2, t2) {
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
20144
|
+
slerp4(temp1, a3, d2, t2);
|
|
20145
|
+
slerp4(temp2, b2, c2, t2);
|
|
20146
|
+
slerp4(out, temp1, temp2, 2 * t2 * (1 - t2));
|
|
19166
20147
|
return out;
|
|
19167
20148
|
};
|
|
19168
20149
|
}();
|
|
@@ -19409,7 +20390,7 @@ void main(void) {
|
|
|
19409
20390
|
target = arg1;
|
|
19410
20391
|
ratio = arg2;
|
|
19411
20392
|
}
|
|
19412
|
-
|
|
20393
|
+
slerp4(this, start, target, ratio);
|
|
19413
20394
|
return this.check();
|
|
19414
20395
|
}
|
|
19415
20396
|
transformVector4(vector, result = new Vector42()) {
|
|
@@ -20011,7 +20992,7 @@ void main(void) {
|
|
|
20011
20992
|
scale: () => scale15,
|
|
20012
20993
|
scaleAndAdd: () => scaleAndAdd3,
|
|
20013
20994
|
set: () => set9,
|
|
20014
|
-
slerp: () =>
|
|
20995
|
+
slerp: () => slerp5,
|
|
20015
20996
|
sqrDist: () => sqrDist3,
|
|
20016
20997
|
sqrLen: () => sqrLen4,
|
|
20017
20998
|
squaredDistance: () => squaredDistance3,
|
|
@@ -20198,7 +21179,7 @@ void main(void) {
|
|
|
20198
21179
|
out[2] = az + t2 * (b2[2] - az);
|
|
20199
21180
|
return out;
|
|
20200
21181
|
}
|
|
20201
|
-
function
|
|
21182
|
+
function slerp5(out, a3, b2, t2) {
|
|
20202
21183
|
const angle10 = Math.acos(Math.min(Math.max(dot11(a3, b2), -1), 1));
|
|
20203
21184
|
const sinTotal = Math.sin(angle10);
|
|
20204
21185
|
const ratioA = Math.sin((1 - t2) * angle10) / sinTotal;
|
|
@@ -21124,7 +22105,7 @@ void main(void) {
|
|
|
21124
22105
|
return out;
|
|
21125
22106
|
}
|
|
21126
22107
|
var ortho3 = orthoNO3;
|
|
21127
|
-
function lookAt3(out, eye,
|
|
22108
|
+
function lookAt3(out, eye, center2, up) {
|
|
21128
22109
|
let len9;
|
|
21129
22110
|
let x0;
|
|
21130
22111
|
let x1;
|
|
@@ -21141,9 +22122,9 @@ void main(void) {
|
|
|
21141
22122
|
const upx = up[0];
|
|
21142
22123
|
const upy = up[1];
|
|
21143
22124
|
const upz = up[2];
|
|
21144
|
-
const centerx =
|
|
21145
|
-
const centery =
|
|
21146
|
-
const centerz =
|
|
22125
|
+
const centerx = center2[0];
|
|
22126
|
+
const centery = center2[1];
|
|
22127
|
+
const centerz = center2[2];
|
|
21147
22128
|
if (Math.abs(eyex - centerx) < EPSILON23 && Math.abs(eyey - centery) < EPSILON23 && Math.abs(eyez - centerz) < EPSILON23) {
|
|
21148
22129
|
return identity7(out);
|
|
21149
22130
|
}
|
|
@@ -21433,8 +22414,8 @@ void main(void) {
|
|
|
21433
22414
|
* @returns self
|
|
21434
22415
|
*/
|
|
21435
22416
|
lookAt(view) {
|
|
21436
|
-
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
21437
|
-
lookAt3(this, eye,
|
|
22417
|
+
const { eye, center: center2 = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
22418
|
+
lookAt3(this, eye, center2, up);
|
|
21438
22419
|
return this.check();
|
|
21439
22420
|
}
|
|
21440
22421
|
/**
|
|
@@ -22333,7 +23314,7 @@ void main(void) {
|
|
|
22333
23314
|
assert3(tileHeader);
|
|
22334
23315
|
assert3(tile);
|
|
22335
23316
|
const { rtcCenter, gltfUpAxis } = tile;
|
|
22336
|
-
const { computedTransform, boundingVolume: { center } } = tileHeader;
|
|
23317
|
+
const { computedTransform, boundingVolume: { center: center2 } } = tileHeader;
|
|
22337
23318
|
let modelMatrix = new Matrix42(computedTransform);
|
|
22338
23319
|
if (rtcCenter) {
|
|
22339
23320
|
modelMatrix.translate(rtcCenter);
|
|
@@ -22355,7 +23336,7 @@ void main(void) {
|
|
|
22355
23336
|
if (tile.isQuantized) {
|
|
22356
23337
|
modelMatrix.translate(tile.quantizedVolumeOffset).scale(tile.quantizedVolumeScale);
|
|
22357
23338
|
}
|
|
22358
|
-
const cartesianOrigin = new Vector32(
|
|
23339
|
+
const cartesianOrigin = new Vector32(center2);
|
|
22359
23340
|
tile.cartesianModelMatrix = modelMatrix;
|
|
22360
23341
|
tile.cartesianOrigin = cartesianOrigin;
|
|
22361
23342
|
const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new Vector32());
|
|
@@ -24975,7 +25956,7 @@ void main(void) {
|
|
|
24975
25956
|
out[15] = 1;
|
|
24976
25957
|
return out;
|
|
24977
25958
|
}
|
|
24978
|
-
function lookAt4(out, eye,
|
|
25959
|
+
function lookAt4(out, eye, center2, up) {
|
|
24979
25960
|
let len9;
|
|
24980
25961
|
let x0;
|
|
24981
25962
|
let x1;
|
|
@@ -24992,9 +25973,9 @@ void main(void) {
|
|
|
24992
25973
|
const upx = up[0];
|
|
24993
25974
|
const upy = up[1];
|
|
24994
25975
|
const upz = up[2];
|
|
24995
|
-
const centerx =
|
|
24996
|
-
const centery =
|
|
24997
|
-
const centerz =
|
|
25976
|
+
const centerx = center2[0];
|
|
25977
|
+
const centery = center2[1];
|
|
25978
|
+
const centerz = center2[2];
|
|
24998
25979
|
if (Math.abs(eyex - centerx) < EPSILON25 && Math.abs(eyey - centery) < EPSILON25 && Math.abs(eyez - centerz) < EPSILON25) {
|
|
24999
25980
|
return identity9(out);
|
|
25000
25981
|
}
|
|
@@ -25430,7 +26411,7 @@ void main(void) {
|
|
|
25430
26411
|
out[3] = Math.sqrt(Math.abs(1 - x2 * x2 - y2 * y2 - z * z));
|
|
25431
26412
|
return out;
|
|
25432
26413
|
}
|
|
25433
|
-
function
|
|
26414
|
+
function slerp6(out, a3, b2, t2) {
|
|
25434
26415
|
const ax = a3[0];
|
|
25435
26416
|
const ay = a3[1];
|
|
25436
26417
|
const az = a3[2];
|
|
@@ -25553,9 +26534,9 @@ void main(void) {
|
|
|
25553
26534
|
const temp1 = create26();
|
|
25554
26535
|
const temp2 = create26();
|
|
25555
26536
|
return function(out, a3, b2, c2, d2, t2) {
|
|
25556
|
-
|
|
25557
|
-
|
|
25558
|
-
|
|
26537
|
+
slerp6(temp1, a3, d2, t2);
|
|
26538
|
+
slerp6(temp2, b2, c2, t2);
|
|
26539
|
+
slerp6(out, temp1, temp2, 2 * t2 * (1 - t2));
|
|
25559
26540
|
return out;
|
|
25560
26541
|
};
|
|
25561
26542
|
}();
|
|
@@ -25802,7 +26783,7 @@ void main(void) {
|
|
|
25802
26783
|
target = arg1;
|
|
25803
26784
|
ratio = arg2;
|
|
25804
26785
|
}
|
|
25805
|
-
|
|
26786
|
+
slerp6(this, start, target, ratio);
|
|
25806
26787
|
return this.check();
|
|
25807
26788
|
}
|
|
25808
26789
|
transformVector4(vector, result = new Vector43()) {
|
|
@@ -25886,14 +26867,14 @@ void main(void) {
|
|
|
25886
26867
|
var scratchVector25 = new Vector34();
|
|
25887
26868
|
var BoundingSphere2 = class {
|
|
25888
26869
|
/** Creates a bounding sphere */
|
|
25889
|
-
constructor(
|
|
26870
|
+
constructor(center2 = [0, 0, 0], radius = 0) {
|
|
25890
26871
|
this.radius = -0;
|
|
25891
26872
|
this.center = new Vector34();
|
|
25892
|
-
this.fromCenterRadius(
|
|
26873
|
+
this.fromCenterRadius(center2, radius);
|
|
25893
26874
|
}
|
|
25894
26875
|
/** Sets the bounding sphere from `center` and `radius`. */
|
|
25895
|
-
fromCenterRadius(
|
|
25896
|
-
this.center.from(
|
|
26876
|
+
fromCenterRadius(center2, radius) {
|
|
26877
|
+
this.center.from(center2);
|
|
25897
26878
|
this.radius = radius;
|
|
25898
26879
|
return this;
|
|
25899
26880
|
}
|
|
@@ -25970,10 +26951,10 @@ void main(void) {
|
|
|
25970
26951
|
}
|
|
25971
26952
|
/** Determines which side of a plane a sphere is located. */
|
|
25972
26953
|
intersectPlane(plane) {
|
|
25973
|
-
const
|
|
26954
|
+
const center2 = this.center;
|
|
25974
26955
|
const radius = this.radius;
|
|
25975
26956
|
const normal = plane.normal;
|
|
25976
|
-
const distanceToPlane = normal.dot(
|
|
26957
|
+
const distanceToPlane = normal.dot(center2) + plane.distance;
|
|
25977
26958
|
if (distanceToPlane < -radius) {
|
|
25978
26959
|
return INTERSECTION2.OUTSIDE;
|
|
25979
26960
|
}
|
|
@@ -26004,8 +26985,8 @@ void main(void) {
|
|
|
26004
26985
|
COLUMN2ROW2: 8
|
|
26005
26986
|
};
|
|
26006
26987
|
var OrientedBoundingBox2 = class {
|
|
26007
|
-
constructor(
|
|
26008
|
-
this.center = new Vector34().from(
|
|
26988
|
+
constructor(center2 = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
|
|
26989
|
+
this.center = new Vector34().from(center2);
|
|
26009
26990
|
this.halfAxes = new Matrix33(halfAxes);
|
|
26010
26991
|
}
|
|
26011
26992
|
/** Returns an array with three halfSizes for the bounding box */
|
|
@@ -26028,7 +27009,7 @@ void main(void) {
|
|
|
26028
27009
|
/**
|
|
26029
27010
|
* Create OrientedBoundingBox from quaternion based OBB,
|
|
26030
27011
|
*/
|
|
26031
|
-
fromCenterHalfSizeQuaternion(
|
|
27012
|
+
fromCenterHalfSizeQuaternion(center2, halfSize, quaternion) {
|
|
26032
27013
|
const quaternionObject = new Quaternion3(quaternion);
|
|
26033
27014
|
const directionsMatrix = new Matrix33().fromQuaternion(quaternionObject);
|
|
26034
27015
|
directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
|
|
@@ -26040,7 +27021,7 @@ void main(void) {
|
|
|
26040
27021
|
directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
|
|
26041
27022
|
directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
|
|
26042
27023
|
directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
|
|
26043
|
-
this.center = new Vector34().from(
|
|
27024
|
+
this.center = new Vector34().from(center2);
|
|
26044
27025
|
this.halfAxes = directionsMatrix;
|
|
26045
27026
|
return this;
|
|
26046
27027
|
}
|
|
@@ -26065,14 +27046,14 @@ void main(void) {
|
|
|
26065
27046
|
}
|
|
26066
27047
|
/** Determines which side of a plane the oriented bounding box is located. */
|
|
26067
27048
|
intersectPlane(plane) {
|
|
26068
|
-
const
|
|
27049
|
+
const center2 = this.center;
|
|
26069
27050
|
const normal = plane.normal;
|
|
26070
27051
|
const halfAxes = this.halfAxes;
|
|
26071
27052
|
const normalX = normal.x;
|
|
26072
27053
|
const normalY = normal.y;
|
|
26073
27054
|
const normalZ = normal.z;
|
|
26074
27055
|
const radEffective = Math.abs(normalX * halfAxes[MATRIX32.COLUMN0ROW0] + normalY * halfAxes[MATRIX32.COLUMN0ROW1] + normalZ * halfAxes[MATRIX32.COLUMN0ROW2]) + Math.abs(normalX * halfAxes[MATRIX32.COLUMN1ROW0] + normalY * halfAxes[MATRIX32.COLUMN1ROW1] + normalZ * halfAxes[MATRIX32.COLUMN1ROW2]) + Math.abs(normalX * halfAxes[MATRIX32.COLUMN2ROW0] + normalY * halfAxes[MATRIX32.COLUMN2ROW1] + normalZ * halfAxes[MATRIX32.COLUMN2ROW2]);
|
|
26075
|
-
const distanceToPlane = normal.dot(
|
|
27056
|
+
const distanceToPlane = normal.dot(center2) + plane.distance;
|
|
26076
27057
|
if (distanceToPlane <= -radEffective) {
|
|
26077
27058
|
return INTERSECTION2.OUTSIDE;
|
|
26078
27059
|
} else if (distanceToPlane >= radEffective) {
|
|
@@ -26135,47 +27116,47 @@ void main(void) {
|
|
|
26135
27116
|
computePlaneDistances(position, direction, result = [-0, -0]) {
|
|
26136
27117
|
let minDist = Number.POSITIVE_INFINITY;
|
|
26137
27118
|
let maxDist = Number.NEGATIVE_INFINITY;
|
|
26138
|
-
const
|
|
27119
|
+
const center2 = this.center;
|
|
26139
27120
|
const halfAxes = this.halfAxes;
|
|
26140
27121
|
const u2 = halfAxes.getColumn(0, scratchVectorU2);
|
|
26141
27122
|
const v2 = halfAxes.getColumn(1, scratchVectorV2);
|
|
26142
27123
|
const w2 = halfAxes.getColumn(2, scratchVectorW2);
|
|
26143
|
-
const corner = scratchCorner2.copy(u2).add(v2).add(w2).add(
|
|
27124
|
+
const corner = scratchCorner2.copy(u2).add(v2).add(w2).add(center2);
|
|
26144
27125
|
const toCenter = scratchToCenter2.copy(corner).subtract(position);
|
|
26145
27126
|
let mag = direction.dot(toCenter);
|
|
26146
27127
|
minDist = Math.min(mag, minDist);
|
|
26147
27128
|
maxDist = Math.max(mag, maxDist);
|
|
26148
|
-
corner.copy(
|
|
27129
|
+
corner.copy(center2).add(u2).add(v2).subtract(w2);
|
|
26149
27130
|
toCenter.copy(corner).subtract(position);
|
|
26150
27131
|
mag = direction.dot(toCenter);
|
|
26151
27132
|
minDist = Math.min(mag, minDist);
|
|
26152
27133
|
maxDist = Math.max(mag, maxDist);
|
|
26153
|
-
corner.copy(
|
|
27134
|
+
corner.copy(center2).add(u2).subtract(v2).add(w2);
|
|
26154
27135
|
toCenter.copy(corner).subtract(position);
|
|
26155
27136
|
mag = direction.dot(toCenter);
|
|
26156
27137
|
minDist = Math.min(mag, minDist);
|
|
26157
27138
|
maxDist = Math.max(mag, maxDist);
|
|
26158
|
-
corner.copy(
|
|
27139
|
+
corner.copy(center2).add(u2).subtract(v2).subtract(w2);
|
|
26159
27140
|
toCenter.copy(corner).subtract(position);
|
|
26160
27141
|
mag = direction.dot(toCenter);
|
|
26161
27142
|
minDist = Math.min(mag, minDist);
|
|
26162
27143
|
maxDist = Math.max(mag, maxDist);
|
|
26163
|
-
|
|
27144
|
+
center2.copy(corner).subtract(u2).add(v2).add(w2);
|
|
26164
27145
|
toCenter.copy(corner).subtract(position);
|
|
26165
27146
|
mag = direction.dot(toCenter);
|
|
26166
27147
|
minDist = Math.min(mag, minDist);
|
|
26167
27148
|
maxDist = Math.max(mag, maxDist);
|
|
26168
|
-
|
|
27149
|
+
center2.copy(corner).subtract(u2).add(v2).subtract(w2);
|
|
26169
27150
|
toCenter.copy(corner).subtract(position);
|
|
26170
27151
|
mag = direction.dot(toCenter);
|
|
26171
27152
|
minDist = Math.min(mag, minDist);
|
|
26172
27153
|
maxDist = Math.max(mag, maxDist);
|
|
26173
|
-
|
|
27154
|
+
center2.copy(corner).subtract(u2).subtract(v2).add(w2);
|
|
26174
27155
|
toCenter.copy(corner).subtract(position);
|
|
26175
27156
|
mag = direction.dot(toCenter);
|
|
26176
27157
|
minDist = Math.min(mag, minDist);
|
|
26177
27158
|
maxDist = Math.max(mag, maxDist);
|
|
26178
|
-
|
|
27159
|
+
center2.copy(corner).subtract(u2).subtract(v2).subtract(w2);
|
|
26179
27160
|
toCenter.copy(corner).subtract(position);
|
|
26180
27161
|
mag = direction.dot(toCenter);
|
|
26181
27162
|
minDist = Math.min(mag, minDist);
|
|
@@ -26282,7 +27263,7 @@ void main(void) {
|
|
|
26282
27263
|
*/
|
|
26283
27264
|
fromBoundingSphere(boundingSphere) {
|
|
26284
27265
|
this.planes.length = 2 * faces2.length;
|
|
26285
|
-
const
|
|
27266
|
+
const center2 = boundingSphere.center;
|
|
26286
27267
|
const radius = boundingSphere.radius;
|
|
26287
27268
|
let planeIndex = 0;
|
|
26288
27269
|
for (const faceNormal of faces2) {
|
|
@@ -26294,9 +27275,9 @@ void main(void) {
|
|
|
26294
27275
|
if (!plane1) {
|
|
26295
27276
|
plane1 = this.planes[planeIndex + 1] = new Plane2();
|
|
26296
27277
|
}
|
|
26297
|
-
const plane0Center = scratchPlaneCenter2.copy(faceNormal).scale(-radius).add(
|
|
27278
|
+
const plane0Center = scratchPlaneCenter2.copy(faceNormal).scale(-radius).add(center2);
|
|
26298
27279
|
plane0.fromPointNormal(plane0Center, faceNormal);
|
|
26299
|
-
const plane1Center = scratchPlaneCenter2.copy(faceNormal).scale(radius).add(
|
|
27280
|
+
const plane1Center = scratchPlaneCenter2.copy(faceNormal).scale(radius).add(center2);
|
|
26300
27281
|
const negatedFaceNormal = scratchPlaneNormal3.copy(faceNormal).negate();
|
|
26301
27282
|
plane1.fromPointNormal(plane1Center, negatedFaceNormal);
|
|
26302
27283
|
planeIndex += 2;
|
|
@@ -26516,10 +27497,10 @@ void main(void) {
|
|
|
26516
27497
|
covarianceMatrix[7] = eyz;
|
|
26517
27498
|
covarianceMatrix[8] = ezz;
|
|
26518
27499
|
const { unitary } = computeEigenDecomposition2(covarianceMatrix, scratchEigenResult2);
|
|
26519
|
-
const
|
|
26520
|
-
let v1 =
|
|
26521
|
-
let v2 =
|
|
26522
|
-
let v3 =
|
|
27500
|
+
const rotation2 = result.halfAxes.copy(unitary);
|
|
27501
|
+
let v1 = rotation2.getColumn(0, scratchVector42);
|
|
27502
|
+
let v2 = rotation2.getColumn(1, scratchVector52);
|
|
27503
|
+
let v3 = rotation2.getColumn(2, scratchVector62);
|
|
26523
27504
|
let u1 = -Number.MAX_VALUE;
|
|
26524
27505
|
let u2 = -Number.MAX_VALUE;
|
|
26525
27506
|
let u3 = -Number.MAX_VALUE;
|
|
@@ -26781,8 +27762,8 @@ void main(void) {
|
|
|
26781
27762
|
throw new Error("Unkown boundingVolume type");
|
|
26782
27763
|
}
|
|
26783
27764
|
function createBox(box, transform2, result) {
|
|
26784
|
-
const
|
|
26785
|
-
transform2.transform(
|
|
27765
|
+
const center2 = new Vector32(box[0], box[1], box[2]);
|
|
27766
|
+
transform2.transform(center2, center2);
|
|
26786
27767
|
let origin = [];
|
|
26787
27768
|
if (box.length === 10) {
|
|
26788
27769
|
const halfSize = box.slice(3, 6);
|
|
@@ -26816,24 +27797,24 @@ void main(void) {
|
|
|
26816
27797
|
zAxis[2]
|
|
26817
27798
|
]);
|
|
26818
27799
|
if (defined(result)) {
|
|
26819
|
-
result.center =
|
|
27800
|
+
result.center = center2;
|
|
26820
27801
|
result.halfAxes = halfAxes;
|
|
26821
27802
|
return result;
|
|
26822
27803
|
}
|
|
26823
|
-
return new OrientedBoundingBox2(
|
|
27804
|
+
return new OrientedBoundingBox2(center2, halfAxes);
|
|
26824
27805
|
}
|
|
26825
27806
|
function createSphere(sphere, transform2, result) {
|
|
26826
|
-
const
|
|
26827
|
-
transform2.transform(
|
|
27807
|
+
const center2 = new Vector32(sphere[0], sphere[1], sphere[2]);
|
|
27808
|
+
transform2.transform(center2, center2);
|
|
26828
27809
|
const scale26 = transform2.getScale(scratchScale);
|
|
26829
27810
|
const uniformScale = Math.max(Math.max(scale26[0], scale26[1]), scale26[2]);
|
|
26830
27811
|
const radius = sphere[3] * uniformScale;
|
|
26831
27812
|
if (defined(result)) {
|
|
26832
|
-
result.center =
|
|
27813
|
+
result.center = center2;
|
|
26833
27814
|
result.radius = radius;
|
|
26834
27815
|
return result;
|
|
26835
27816
|
}
|
|
26836
|
-
return new BoundingSphere2(
|
|
27817
|
+
return new BoundingSphere2(center2, radius);
|
|
26837
27818
|
}
|
|
26838
27819
|
function createObbFromRegion(region) {
|
|
26839
27820
|
const [west, south, east, north, minHeight, maxHeight] = region;
|
|
@@ -26875,8 +27856,8 @@ void main(void) {
|
|
|
26875
27856
|
}
|
|
26876
27857
|
function boundingSphereToCartographicBounds(boundingVolume) {
|
|
26877
27858
|
const result = emptyCartographicBounds();
|
|
26878
|
-
const { center, radius } = boundingVolume;
|
|
26879
|
-
const point = Ellipsoid.WGS84.scaleToGeodeticSurface(
|
|
27859
|
+
const { center: center2, radius } = boundingVolume;
|
|
27860
|
+
const point = Ellipsoid.WGS84.scaleToGeodeticSurface(center2, scratchPoint);
|
|
26880
27861
|
let zAxis;
|
|
26881
27862
|
if (point) {
|
|
26882
27863
|
zAxis = Ellipsoid.WGS84.geodeticSurfaceNormal(point);
|
|
@@ -26893,7 +27874,7 @@ void main(void) {
|
|
|
26893
27874
|
for (const axis of [xAxis, yAxis, zAxis]) {
|
|
26894
27875
|
scratchScale.copy(axis).scale(radius);
|
|
26895
27876
|
for (let dir = 0; dir < 2; dir++) {
|
|
26896
|
-
scratchPoint.copy(
|
|
27877
|
+
scratchPoint.copy(center2);
|
|
26897
27878
|
scratchPoint.add(scratchScale);
|
|
26898
27879
|
addToCartographicBounds(result, scratchPoint);
|
|
26899
27880
|
scratchScale.negate();
|
|
@@ -28554,20 +29535,20 @@ void main(void) {
|
|
|
28554
29535
|
*/
|
|
28555
29536
|
calculateViewPropsTiles3D() {
|
|
28556
29537
|
const root = this.root;
|
|
28557
|
-
const { center } = root.boundingVolume;
|
|
28558
|
-
if (!
|
|
29538
|
+
const { center: center2 } = root.boundingVolume;
|
|
29539
|
+
if (!center2) {
|
|
28559
29540
|
console.warn("center was not pre-calculated for the root tile");
|
|
28560
29541
|
this.cartographicCenter = new Vector32();
|
|
28561
29542
|
this.zoom = 1;
|
|
28562
29543
|
return;
|
|
28563
29544
|
}
|
|
28564
|
-
if (
|
|
29545
|
+
if (center2[0] !== 0 || center2[1] !== 0 || center2[2] !== 0) {
|
|
28565
29546
|
this.cartographicCenter = new Vector32();
|
|
28566
|
-
Ellipsoid.WGS84.cartesianToCartographic(
|
|
29547
|
+
Ellipsoid.WGS84.cartesianToCartographic(center2, this.cartographicCenter);
|
|
28567
29548
|
} else {
|
|
28568
29549
|
this.cartographicCenter = new Vector32(0, 0, -Ellipsoid.WGS84.radii[0]);
|
|
28569
29550
|
}
|
|
28570
|
-
this.cartesianCenter =
|
|
29551
|
+
this.cartesianCenter = center2;
|
|
28571
29552
|
this.zoom = getZoomFromBoundingVolume(root.boundingVolume, this.cartographicCenter);
|
|
28572
29553
|
}
|
|
28573
29554
|
_initializeStats() {
|
|
@@ -32509,7 +33490,7 @@ void main(void) {
|
|
|
32509
33490
|
return out;
|
|
32510
33491
|
}
|
|
32511
33492
|
var ortho5 = orthoNO5;
|
|
32512
|
-
function lookAt5(out, eye,
|
|
33493
|
+
function lookAt5(out, eye, center2, up) {
|
|
32513
33494
|
let len9;
|
|
32514
33495
|
let x0;
|
|
32515
33496
|
let x1;
|
|
@@ -32526,9 +33507,9 @@ void main(void) {
|
|
|
32526
33507
|
const upx = up[0];
|
|
32527
33508
|
const upy = up[1];
|
|
32528
33509
|
const upz = up[2];
|
|
32529
|
-
const centerx =
|
|
32530
|
-
const centery =
|
|
32531
|
-
const centerz =
|
|
33510
|
+
const centerx = center2[0];
|
|
33511
|
+
const centery = center2[1];
|
|
33512
|
+
const centerz = center2[2];
|
|
32532
33513
|
if (Math.abs(eyex - centerx) < EPSILON28 && Math.abs(eyey - centery) < EPSILON28 && Math.abs(eyez - centerz) < EPSILON28) {
|
|
32533
33514
|
return identity11(out);
|
|
32534
33515
|
}
|
|
@@ -32893,8 +33874,8 @@ void main(void) {
|
|
|
32893
33874
|
* @returns self
|
|
32894
33875
|
*/
|
|
32895
33876
|
lookAt(view) {
|
|
32896
|
-
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
32897
|
-
lookAt5(this, eye,
|
|
33877
|
+
const { eye, center: center2 = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
33878
|
+
lookAt5(this, eye, center2, up);
|
|
32898
33879
|
return this.check();
|
|
32899
33880
|
}
|
|
32900
33881
|
/**
|
|
@@ -33327,7 +34308,7 @@ void main(void) {
|
|
|
33327
34308
|
out[3] = Math.sqrt(Math.abs(1 - x2 * x2 - y2 * y2 - z * z));
|
|
33328
34309
|
return out;
|
|
33329
34310
|
}
|
|
33330
|
-
function
|
|
34311
|
+
function slerp7(out, a3, b2, t2) {
|
|
33331
34312
|
const ax = a3[0];
|
|
33332
34313
|
const ay = a3[1];
|
|
33333
34314
|
const az = a3[2];
|
|
@@ -33450,9 +34431,9 @@ void main(void) {
|
|
|
33450
34431
|
const temp1 = create33();
|
|
33451
34432
|
const temp2 = create33();
|
|
33452
34433
|
return function(out, a3, b2, c2, d2, t2) {
|
|
33453
|
-
|
|
33454
|
-
|
|
33455
|
-
|
|
34434
|
+
slerp7(temp1, a3, d2, t2);
|
|
34435
|
+
slerp7(temp2, b2, c2, t2);
|
|
34436
|
+
slerp7(out, temp1, temp2, 2 * t2 * (1 - t2));
|
|
33456
34437
|
return out;
|
|
33457
34438
|
};
|
|
33458
34439
|
}();
|
|
@@ -33699,7 +34680,7 @@ void main(void) {
|
|
|
33699
34680
|
target = arg1;
|
|
33700
34681
|
ratio = arg2;
|
|
33701
34682
|
}
|
|
33702
|
-
|
|
34683
|
+
slerp7(this, start, target, ratio);
|
|
33703
34684
|
return this.check();
|
|
33704
34685
|
}
|
|
33705
34686
|
transformVector4(vector, result = new Vector44()) {
|
|
@@ -36397,9 +37378,9 @@ void main(void) {
|
|
|
36397
37378
|
TRIANGLES: "meshopt_decodeIndexBuffer",
|
|
36398
37379
|
INDICES: "meshopt_decodeIndexSequence"
|
|
36399
37380
|
};
|
|
36400
|
-
async function meshoptDecodeGltfBuffer(target, count, size,
|
|
37381
|
+
async function meshoptDecodeGltfBuffer(target, count, size, source2, mode, filter = "NONE") {
|
|
36401
37382
|
const instance = await loadWasmInstance();
|
|
36402
|
-
decode4(instance, instance.exports[DECODERS[mode]], target, count, size,
|
|
37383
|
+
decode4(instance, instance.exports[DECODERS[mode]], target, count, size, source2, instance.exports[FILTERS[filter || "NONE"]]);
|
|
36403
37384
|
}
|
|
36404
37385
|
var wasmPromise;
|
|
36405
37386
|
async function loadWasmInstance() {
|
|
@@ -36430,14 +37411,14 @@ void main(void) {
|
|
|
36430
37411
|
}
|
|
36431
37412
|
return result.buffer.slice(0, write);
|
|
36432
37413
|
}
|
|
36433
|
-
function decode4(instance, fun, target, count, size,
|
|
37414
|
+
function decode4(instance, fun, target, count, size, source2, filter) {
|
|
36434
37415
|
const sbrk = instance.exports.sbrk;
|
|
36435
37416
|
const count4 = count + 3 & ~3;
|
|
36436
37417
|
const tp = sbrk(count4 * size);
|
|
36437
|
-
const sp = sbrk(
|
|
37418
|
+
const sp = sbrk(source2.length);
|
|
36438
37419
|
const heap = new Uint8Array(instance.exports.memory.buffer);
|
|
36439
|
-
heap.set(
|
|
36440
|
-
const res = fun(tp, count, size, sp,
|
|
37420
|
+
heap.set(source2, sp);
|
|
37421
|
+
const res = fun(tp, count, size, sp, source2.length);
|
|
36441
37422
|
if (res === 0 && filter) {
|
|
36442
37423
|
filter(tp, count4, size);
|
|
36443
37424
|
}
|
|
@@ -36468,9 +37449,9 @@ void main(void) {
|
|
|
36468
37449
|
if (meshoptExtension) {
|
|
36469
37450
|
const { byteOffset = 0, byteLength = 0, byteStride, count, mode, filter = "NONE", buffer: bufferIndex } = meshoptExtension;
|
|
36470
37451
|
const buffer = scenegraph.gltf.buffers[bufferIndex];
|
|
36471
|
-
const
|
|
37452
|
+
const source2 = new Uint8Array(buffer.arrayBuffer, buffer.byteOffset + byteOffset, byteLength);
|
|
36472
37453
|
const result = new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer, bufferView.byteOffset, bufferView.byteLength);
|
|
36473
|
-
await meshoptDecodeGltfBuffer(result, count, byteStride,
|
|
37454
|
+
await meshoptDecodeGltfBuffer(result, count, byteStride, source2, mode, filter);
|
|
36474
37455
|
scenegraph.removeObjectExtension(bufferView, EXT_MESHOPT_COMPRESSION);
|
|
36475
37456
|
}
|
|
36476
37457
|
}
|
|
@@ -38048,9 +39029,9 @@ void main(void) {
|
|
|
38048
39029
|
primitive.attributes[`TEXCOORD_${newTexCoord}`] = accessors.length - 1;
|
|
38049
39030
|
}
|
|
38050
39031
|
function makeTransformationMatrix(extensionData) {
|
|
38051
|
-
const { offset = [0, 0], rotation:
|
|
39032
|
+
const { offset = [0, 0], rotation: rotation2 = 0, scale: scale26 = [1, 1] } = extensionData;
|
|
38052
39033
|
const translationMatrix = new Matrix35().set(1, 0, 0, 0, 1, 0, offset[0], offset[1], 1);
|
|
38053
|
-
const rotationMatrix = scratchRotationMatrix.set(Math.cos(
|
|
39034
|
+
const rotationMatrix = scratchRotationMatrix.set(Math.cos(rotation2), Math.sin(rotation2), 0, -Math.sin(rotation2), Math.cos(rotation2), 0, 0, 0, 1);
|
|
38054
39035
|
const scaleMatrix = scratchScaleMatrix.set(scale26[0], 0, 0, 0, scale26[1], 0, 0, 0, 1);
|
|
38055
39036
|
return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);
|
|
38056
39037
|
}
|
|
@@ -40563,9 +41544,9 @@ void main(void) {
|
|
|
40563
41544
|
maximumHeight: s2VolumeInfo.maximumHeight
|
|
40564
41545
|
};
|
|
40565
41546
|
const corners = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);
|
|
40566
|
-
const
|
|
40567
|
-
const centerLng =
|
|
40568
|
-
const centerLat =
|
|
41547
|
+
const center2 = getS2LngLat(token);
|
|
41548
|
+
const centerLng = center2[0];
|
|
41549
|
+
const centerLat = center2[1];
|
|
40569
41550
|
const point = Ellipsoid.WGS84.cartographicToCartesian([
|
|
40570
41551
|
centerLng,
|
|
40571
41552
|
centerLat,
|
|
@@ -42391,7 +43372,7 @@ void main(void) {
|
|
|
42391
43372
|
const elevationDataChanged = props.elevationData !== oldProps.elevationData;
|
|
42392
43373
|
if (elevationDataChanged) {
|
|
42393
43374
|
const { elevationData } = props;
|
|
42394
|
-
const isTiled = elevationData && (Array.isArray(elevationData) ||
|
|
43375
|
+
const isTiled = elevationData && (Array.isArray(elevationData) || isTileSetURL(elevationData));
|
|
42395
43376
|
this.setState({ isTiled });
|
|
42396
43377
|
}
|
|
42397
43378
|
const shouldReload = elevationDataChanged || props.meshMaxError !== oldProps.meshMaxError || props.elevationDecoder !== oldProps.elevationDecoder || props.bounds !== oldProps.bounds;
|
|
@@ -42573,6 +43554,7 @@ void main(void) {
|
|
|
42573
43554
|
};
|
|
42574
43555
|
TerrainLayer.defaultProps = defaultProps13;
|
|
42575
43556
|
TerrainLayer.layerName = "TerrainLayer";
|
|
43557
|
+
var isTileSetURL = (url) => url.includes("{x}") && (url.includes("{y}") || url.includes("{-y}"));
|
|
42576
43558
|
|
|
42577
43559
|
// src/mvt-layer/mvt-layer.ts
|
|
42578
43560
|
var import_core58 = __toESM(require_core(), 1);
|