@loaders.gl/3d-tiles 3.3.2 → 3.4.0-alpha.2
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/cesium-ion-loader.d.ts.map +1 -1
- package/dist/cesium-ion-loader.js +1 -0
- package/dist/dist.min.js +2244 -184
- package/dist/es5/cesium-ion-loader.js.map +1 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +61 -18
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +17 -6
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +32 -0
- package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +47 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +32 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-region.js +54 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -0
- package/dist/es5/lib/utils/s2/index.js +90 -0
- package/dist/es5/lib/utils/s2/index.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2-geometry-functions.js +21 -0
- package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2-token-functions.js +46 -0
- package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +24 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +217 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/esm/cesium-ion-loader.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +55 -11
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +14 -2
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +25 -0
- package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +43 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +26 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-region.js +45 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -0
- package/dist/esm/lib/utils/s2/index.js +9 -0
- package/dist/esm/lib/utils/s2/index.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2-geometry-functions.js +16 -0
- package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2-token-functions.js +38 -0
- package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +18 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +198 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +11 -0
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +60 -11
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +13 -1
- package/dist/lib/utils/obb/s2-corners-to-obb.d.ts +15 -0
- package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -0
- package/dist/lib/utils/obb/s2-corners-to-obb.js +37 -0
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +9 -0
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -0
- package/dist/lib/utils/s2/converters/s2-to-boundary.js +61 -0
- package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts +15 -0
- package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts.map +1 -0
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js +36 -0
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts +13 -0
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -0
- package/dist/lib/utils/s2/converters/s2-to-region.js +59 -0
- package/dist/lib/utils/s2/index.d.ts +8 -0
- package/dist/lib/utils/s2/index.d.ts.map +1 -0
- package/dist/lib/utils/s2/index.js +23 -0
- package/dist/lib/utils/s2/s2-geometry-functions.d.ts +14 -0
- package/dist/lib/utils/s2/s2-geometry-functions.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2-geometry-functions.js +29 -0
- package/dist/lib/utils/s2/s2-token-functions.d.ts +23 -0
- package/dist/lib/utils/s2/s2-token-functions.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2-token-functions.js +68 -0
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +14 -0
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +32 -0
- package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts +52 -0
- package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js +260 -0
- package/package.json +9 -8
- package/src/cesium-ion-loader.ts +1 -0
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +102 -13
- package/src/lib/parsers/parse-3d-tile-header.ts +17 -1
- package/src/lib/utils/obb/s2-corners-to-obb.ts +51 -0
- package/src/lib/utils/s2/converters/s2-to-boundary.ts +67 -0
- package/src/lib/utils/s2/converters/s2-to-obb-points.ts +46 -0
- package/src/lib/utils/s2/converters/s2-to-region.ts +69 -0
- package/src/lib/utils/s2/index.ts +17 -0
- package/src/lib/utils/s2/s2-geometry-functions.ts +28 -0
- package/src/lib/utils/s2/s2-token-functions.ts +67 -0
- package/src/lib/utils/s2/s2geometry/s2-cell-utils.ts +33 -0
- package/src/lib/utils/s2/s2geometry/s2-geometry.ts +296 -0
package/dist/dist.min.js
CHANGED
|
@@ -538,7 +538,7 @@
|
|
|
538
538
|
var init_get_worker_url = __esm({
|
|
539
539
|
"../worker-utils/src/lib/worker-api/get-worker-url.ts"() {
|
|
540
540
|
init_assert2();
|
|
541
|
-
NPM_TAG = "
|
|
541
|
+
NPM_TAG = "beta";
|
|
542
542
|
}
|
|
543
543
|
});
|
|
544
544
|
|
|
@@ -636,7 +636,7 @@
|
|
|
636
636
|
node = __toModule(require_require_utils());
|
|
637
637
|
init_assert2();
|
|
638
638
|
init_version();
|
|
639
|
-
LATEST = "
|
|
639
|
+
LATEST = "beta";
|
|
640
640
|
VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
|
|
641
641
|
loadLibraryPromises = {};
|
|
642
642
|
}
|
|
@@ -918,9 +918,12 @@
|
|
|
918
918
|
}
|
|
919
919
|
});
|
|
920
920
|
|
|
921
|
-
//
|
|
922
|
-
|
|
923
|
-
|
|
921
|
+
// ../loader-utils/src/lib/node/buffer.browser.ts
|
|
922
|
+
function toArrayBuffer(buffer) {
|
|
923
|
+
return buffer;
|
|
924
|
+
}
|
|
925
|
+
var init_buffer_browser = __esm({
|
|
926
|
+
"../loader-utils/src/lib/node/buffer.browser.ts"() {
|
|
924
927
|
}
|
|
925
928
|
});
|
|
926
929
|
|
|
@@ -930,7 +933,7 @@
|
|
|
930
933
|
}
|
|
931
934
|
function toArrayBuffer2(data) {
|
|
932
935
|
if (isBuffer(data)) {
|
|
933
|
-
return
|
|
936
|
+
return toArrayBuffer(data);
|
|
934
937
|
}
|
|
935
938
|
if (data instanceof ArrayBuffer) {
|
|
936
939
|
return data;
|
|
@@ -953,7 +956,7 @@
|
|
|
953
956
|
}
|
|
954
957
|
var init_memory_conversion_utils = __esm({
|
|
955
958
|
"../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
|
|
956
|
-
|
|
959
|
+
init_buffer_browser();
|
|
957
960
|
}
|
|
958
961
|
});
|
|
959
962
|
|
|
@@ -2823,6 +2826,21 @@
|
|
|
2823
2826
|
out[7] = a13 * c - a03 * s2;
|
|
2824
2827
|
return out;
|
|
2825
2828
|
}
|
|
2829
|
+
function getScaling(out, mat) {
|
|
2830
|
+
var m11 = mat[0];
|
|
2831
|
+
var m12 = mat[1];
|
|
2832
|
+
var m13 = mat[2];
|
|
2833
|
+
var m21 = mat[4];
|
|
2834
|
+
var m22 = mat[5];
|
|
2835
|
+
var m23 = mat[6];
|
|
2836
|
+
var m31 = mat[8];
|
|
2837
|
+
var m32 = mat[9];
|
|
2838
|
+
var m33 = mat[10];
|
|
2839
|
+
out[0] = Math.hypot(m11, m12, m13);
|
|
2840
|
+
out[1] = Math.hypot(m21, m22, m23);
|
|
2841
|
+
out[2] = Math.hypot(m31, m32, m33);
|
|
2842
|
+
return out;
|
|
2843
|
+
}
|
|
2826
2844
|
function fromQuat2(out, q) {
|
|
2827
2845
|
var x = q[0], y = q[1], z = q[2], w = q[3];
|
|
2828
2846
|
var x2 = x + x;
|
|
@@ -4406,6 +4424,716 @@
|
|
|
4406
4424
|
}
|
|
4407
4425
|
});
|
|
4408
4426
|
|
|
4427
|
+
// ../../node_modules/@math.gl/culling/dist/esm/constants.js
|
|
4428
|
+
var INTERSECTION;
|
|
4429
|
+
var init_constants2 = __esm({
|
|
4430
|
+
"../../node_modules/@math.gl/culling/dist/esm/constants.js"() {
|
|
4431
|
+
INTERSECTION = {
|
|
4432
|
+
OUTSIDE: -1,
|
|
4433
|
+
INTERSECTING: 0,
|
|
4434
|
+
INSIDE: 1
|
|
4435
|
+
};
|
|
4436
|
+
}
|
|
4437
|
+
});
|
|
4438
|
+
|
|
4439
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js
|
|
4440
|
+
var scratchVector5, scratchNormal2;
|
|
4441
|
+
var init_axis_aligned_bounding_box = __esm({
|
|
4442
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js"() {
|
|
4443
|
+
init_defineProperty();
|
|
4444
|
+
init_esm();
|
|
4445
|
+
init_constants2();
|
|
4446
|
+
scratchVector5 = new Vector3();
|
|
4447
|
+
scratchNormal2 = new Vector3();
|
|
4448
|
+
}
|
|
4449
|
+
});
|
|
4450
|
+
|
|
4451
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js
|
|
4452
|
+
var scratchVector6, scratchVector23, BoundingSphere;
|
|
4453
|
+
var init_bounding_sphere = __esm({
|
|
4454
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js"() {
|
|
4455
|
+
init_defineProperty();
|
|
4456
|
+
init_esm();
|
|
4457
|
+
init_mat4();
|
|
4458
|
+
init_constants2();
|
|
4459
|
+
scratchVector6 = new Vector3();
|
|
4460
|
+
scratchVector23 = new Vector3();
|
|
4461
|
+
BoundingSphere = class {
|
|
4462
|
+
constructor(center = [0, 0, 0], radius = 0) {
|
|
4463
|
+
_defineProperty(this, "center", void 0);
|
|
4464
|
+
_defineProperty(this, "radius", void 0);
|
|
4465
|
+
this.radius = -0;
|
|
4466
|
+
this.center = new Vector3();
|
|
4467
|
+
this.fromCenterRadius(center, radius);
|
|
4468
|
+
}
|
|
4469
|
+
fromCenterRadius(center, radius) {
|
|
4470
|
+
this.center.from(center);
|
|
4471
|
+
this.radius = radius;
|
|
4472
|
+
return this;
|
|
4473
|
+
}
|
|
4474
|
+
fromCornerPoints(corner, oppositeCorner) {
|
|
4475
|
+
oppositeCorner = scratchVector6.from(oppositeCorner);
|
|
4476
|
+
this.center = new Vector3().from(corner).add(oppositeCorner).scale(0.5);
|
|
4477
|
+
this.radius = this.center.distance(oppositeCorner);
|
|
4478
|
+
return this;
|
|
4479
|
+
}
|
|
4480
|
+
equals(right) {
|
|
4481
|
+
return this === right || Boolean(right) && this.center.equals(right.center) && this.radius === right.radius;
|
|
4482
|
+
}
|
|
4483
|
+
clone() {
|
|
4484
|
+
return new BoundingSphere(this.center, this.radius);
|
|
4485
|
+
}
|
|
4486
|
+
union(boundingSphere) {
|
|
4487
|
+
const leftCenter = this.center;
|
|
4488
|
+
const leftRadius = this.radius;
|
|
4489
|
+
const rightCenter = boundingSphere.center;
|
|
4490
|
+
const rightRadius = boundingSphere.radius;
|
|
4491
|
+
const toRightCenter = scratchVector6.copy(rightCenter).subtract(leftCenter);
|
|
4492
|
+
const centerSeparation = toRightCenter.magnitude();
|
|
4493
|
+
if (leftRadius >= centerSeparation + rightRadius) {
|
|
4494
|
+
return this.clone();
|
|
4495
|
+
}
|
|
4496
|
+
if (rightRadius >= centerSeparation + leftRadius) {
|
|
4497
|
+
return boundingSphere.clone();
|
|
4498
|
+
}
|
|
4499
|
+
const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
|
|
4500
|
+
scratchVector23.copy(toRightCenter).scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation).add(leftCenter);
|
|
4501
|
+
this.center.copy(scratchVector23);
|
|
4502
|
+
this.radius = halfDistanceBetweenTangentPoints;
|
|
4503
|
+
return this;
|
|
4504
|
+
}
|
|
4505
|
+
expand(point) {
|
|
4506
|
+
const scratchPoint = scratchVector6.from(point);
|
|
4507
|
+
const radius = scratchPoint.subtract(this.center).magnitude();
|
|
4508
|
+
if (radius > this.radius) {
|
|
4509
|
+
this.radius = radius;
|
|
4510
|
+
}
|
|
4511
|
+
return this;
|
|
4512
|
+
}
|
|
4513
|
+
transform(transform) {
|
|
4514
|
+
this.center.transform(transform);
|
|
4515
|
+
const scale5 = getScaling(scratchVector6, transform);
|
|
4516
|
+
this.radius = Math.max(scale5[0], Math.max(scale5[1], scale5[2])) * this.radius;
|
|
4517
|
+
return this;
|
|
4518
|
+
}
|
|
4519
|
+
distanceSquaredTo(point) {
|
|
4520
|
+
const d = this.distanceTo(point);
|
|
4521
|
+
return d * d;
|
|
4522
|
+
}
|
|
4523
|
+
distanceTo(point) {
|
|
4524
|
+
const scratchPoint = scratchVector6.from(point);
|
|
4525
|
+
const delta = scratchPoint.subtract(this.center);
|
|
4526
|
+
return Math.max(0, delta.len() - this.radius);
|
|
4527
|
+
}
|
|
4528
|
+
intersectPlane(plane) {
|
|
4529
|
+
const center = this.center;
|
|
4530
|
+
const radius = this.radius;
|
|
4531
|
+
const normal = plane.normal;
|
|
4532
|
+
const distanceToPlane = normal.dot(center) + plane.distance;
|
|
4533
|
+
if (distanceToPlane < -radius) {
|
|
4534
|
+
return INTERSECTION.OUTSIDE;
|
|
4535
|
+
}
|
|
4536
|
+
if (distanceToPlane < radius) {
|
|
4537
|
+
return INTERSECTION.INTERSECTING;
|
|
4538
|
+
}
|
|
4539
|
+
return INTERSECTION.INSIDE;
|
|
4540
|
+
}
|
|
4541
|
+
};
|
|
4542
|
+
}
|
|
4543
|
+
});
|
|
4544
|
+
|
|
4545
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js
|
|
4546
|
+
var scratchVector32, scratchOffset, scratchVectorU, scratchVectorV, scratchVectorW, scratchCorner, scratchToCenter, MATRIX3, OrientedBoundingBox;
|
|
4547
|
+
var init_oriented_bounding_box = __esm({
|
|
4548
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js"() {
|
|
4549
|
+
init_defineProperty();
|
|
4550
|
+
init_esm();
|
|
4551
|
+
init_bounding_sphere();
|
|
4552
|
+
init_constants2();
|
|
4553
|
+
scratchVector32 = new Vector3();
|
|
4554
|
+
scratchOffset = new Vector3();
|
|
4555
|
+
scratchVectorU = new Vector3();
|
|
4556
|
+
scratchVectorV = new Vector3();
|
|
4557
|
+
scratchVectorW = new Vector3();
|
|
4558
|
+
scratchCorner = new Vector3();
|
|
4559
|
+
scratchToCenter = new Vector3();
|
|
4560
|
+
MATRIX3 = {
|
|
4561
|
+
COLUMN0ROW0: 0,
|
|
4562
|
+
COLUMN0ROW1: 1,
|
|
4563
|
+
COLUMN0ROW2: 2,
|
|
4564
|
+
COLUMN1ROW0: 3,
|
|
4565
|
+
COLUMN1ROW1: 4,
|
|
4566
|
+
COLUMN1ROW2: 5,
|
|
4567
|
+
COLUMN2ROW0: 6,
|
|
4568
|
+
COLUMN2ROW1: 7,
|
|
4569
|
+
COLUMN2ROW2: 8
|
|
4570
|
+
};
|
|
4571
|
+
OrientedBoundingBox = class {
|
|
4572
|
+
constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
|
|
4573
|
+
_defineProperty(this, "center", void 0);
|
|
4574
|
+
_defineProperty(this, "halfAxes", void 0);
|
|
4575
|
+
this.center = new Vector3().from(center);
|
|
4576
|
+
this.halfAxes = new Matrix3(halfAxes);
|
|
4577
|
+
}
|
|
4578
|
+
get halfSize() {
|
|
4579
|
+
const xAxis = this.halfAxes.getColumn(0);
|
|
4580
|
+
const yAxis = this.halfAxes.getColumn(1);
|
|
4581
|
+
const zAxis = this.halfAxes.getColumn(2);
|
|
4582
|
+
return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];
|
|
4583
|
+
}
|
|
4584
|
+
get quaternion() {
|
|
4585
|
+
const xAxis = this.halfAxes.getColumn(0);
|
|
4586
|
+
const yAxis = this.halfAxes.getColumn(1);
|
|
4587
|
+
const zAxis = this.halfAxes.getColumn(2);
|
|
4588
|
+
const normXAxis = new Vector3(xAxis).normalize();
|
|
4589
|
+
const normYAxis = new Vector3(yAxis).normalize();
|
|
4590
|
+
const normZAxis = new Vector3(zAxis).normalize();
|
|
4591
|
+
return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));
|
|
4592
|
+
}
|
|
4593
|
+
fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
|
|
4594
|
+
const quaternionObject = new Quaternion(quaternion);
|
|
4595
|
+
const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);
|
|
4596
|
+
directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
|
|
4597
|
+
directionsMatrix[1] = directionsMatrix[1] * halfSize[0];
|
|
4598
|
+
directionsMatrix[2] = directionsMatrix[2] * halfSize[0];
|
|
4599
|
+
directionsMatrix[3] = directionsMatrix[3] * halfSize[1];
|
|
4600
|
+
directionsMatrix[4] = directionsMatrix[4] * halfSize[1];
|
|
4601
|
+
directionsMatrix[5] = directionsMatrix[5] * halfSize[1];
|
|
4602
|
+
directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
|
|
4603
|
+
directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
|
|
4604
|
+
directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
|
|
4605
|
+
this.center = new Vector3().from(center);
|
|
4606
|
+
this.halfAxes = directionsMatrix;
|
|
4607
|
+
return this;
|
|
4608
|
+
}
|
|
4609
|
+
clone() {
|
|
4610
|
+
return new OrientedBoundingBox(this.center, this.halfAxes);
|
|
4611
|
+
}
|
|
4612
|
+
equals(right) {
|
|
4613
|
+
return this === right || Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes);
|
|
4614
|
+
}
|
|
4615
|
+
getBoundingSphere(result = new BoundingSphere()) {
|
|
4616
|
+
const halfAxes = this.halfAxes;
|
|
4617
|
+
const u = halfAxes.getColumn(0, scratchVectorU);
|
|
4618
|
+
const v = halfAxes.getColumn(1, scratchVectorV);
|
|
4619
|
+
const w = halfAxes.getColumn(2, scratchVectorW);
|
|
4620
|
+
const cornerVector = scratchVector32.copy(u).add(v).add(w);
|
|
4621
|
+
result.center.copy(this.center);
|
|
4622
|
+
result.radius = cornerVector.magnitude();
|
|
4623
|
+
return result;
|
|
4624
|
+
}
|
|
4625
|
+
intersectPlane(plane) {
|
|
4626
|
+
const center = this.center;
|
|
4627
|
+
const normal = plane.normal;
|
|
4628
|
+
const halfAxes = this.halfAxes;
|
|
4629
|
+
const normalX = normal.x;
|
|
4630
|
+
const normalY = normal.y;
|
|
4631
|
+
const normalZ = normal.z;
|
|
4632
|
+
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]);
|
|
4633
|
+
const distanceToPlane = normal.dot(center) + plane.distance;
|
|
4634
|
+
if (distanceToPlane <= -radEffective) {
|
|
4635
|
+
return INTERSECTION.OUTSIDE;
|
|
4636
|
+
} else if (distanceToPlane >= radEffective) {
|
|
4637
|
+
return INTERSECTION.INSIDE;
|
|
4638
|
+
}
|
|
4639
|
+
return INTERSECTION.INTERSECTING;
|
|
4640
|
+
}
|
|
4641
|
+
distanceTo(point) {
|
|
4642
|
+
return Math.sqrt(this.distanceSquaredTo(point));
|
|
4643
|
+
}
|
|
4644
|
+
distanceSquaredTo(point) {
|
|
4645
|
+
const offset = scratchOffset.from(point).subtract(this.center);
|
|
4646
|
+
const halfAxes = this.halfAxes;
|
|
4647
|
+
const u = halfAxes.getColumn(0, scratchVectorU);
|
|
4648
|
+
const v = halfAxes.getColumn(1, scratchVectorV);
|
|
4649
|
+
const w = halfAxes.getColumn(2, scratchVectorW);
|
|
4650
|
+
const uHalf = u.magnitude();
|
|
4651
|
+
const vHalf = v.magnitude();
|
|
4652
|
+
const wHalf = w.magnitude();
|
|
4653
|
+
u.normalize();
|
|
4654
|
+
v.normalize();
|
|
4655
|
+
w.normalize();
|
|
4656
|
+
let distanceSquared = 0;
|
|
4657
|
+
let d;
|
|
4658
|
+
d = Math.abs(offset.dot(u)) - uHalf;
|
|
4659
|
+
if (d > 0) {
|
|
4660
|
+
distanceSquared += d * d;
|
|
4661
|
+
}
|
|
4662
|
+
d = Math.abs(offset.dot(v)) - vHalf;
|
|
4663
|
+
if (d > 0) {
|
|
4664
|
+
distanceSquared += d * d;
|
|
4665
|
+
}
|
|
4666
|
+
d = Math.abs(offset.dot(w)) - wHalf;
|
|
4667
|
+
if (d > 0) {
|
|
4668
|
+
distanceSquared += d * d;
|
|
4669
|
+
}
|
|
4670
|
+
return distanceSquared;
|
|
4671
|
+
}
|
|
4672
|
+
computePlaneDistances(position, direction, result = [-0, -0]) {
|
|
4673
|
+
let minDist = Number.POSITIVE_INFINITY;
|
|
4674
|
+
let maxDist = Number.NEGATIVE_INFINITY;
|
|
4675
|
+
const center = this.center;
|
|
4676
|
+
const halfAxes = this.halfAxes;
|
|
4677
|
+
const u = halfAxes.getColumn(0, scratchVectorU);
|
|
4678
|
+
const v = halfAxes.getColumn(1, scratchVectorV);
|
|
4679
|
+
const w = halfAxes.getColumn(2, scratchVectorW);
|
|
4680
|
+
const corner = scratchCorner.copy(u).add(v).add(w).add(center);
|
|
4681
|
+
const toCenter = scratchToCenter.copy(corner).subtract(position);
|
|
4682
|
+
let mag = direction.dot(toCenter);
|
|
4683
|
+
minDist = Math.min(mag, minDist);
|
|
4684
|
+
maxDist = Math.max(mag, maxDist);
|
|
4685
|
+
corner.copy(center).add(u).add(v).subtract(w);
|
|
4686
|
+
toCenter.copy(corner).subtract(position);
|
|
4687
|
+
mag = direction.dot(toCenter);
|
|
4688
|
+
minDist = Math.min(mag, minDist);
|
|
4689
|
+
maxDist = Math.max(mag, maxDist);
|
|
4690
|
+
corner.copy(center).add(u).subtract(v).add(w);
|
|
4691
|
+
toCenter.copy(corner).subtract(position);
|
|
4692
|
+
mag = direction.dot(toCenter);
|
|
4693
|
+
minDist = Math.min(mag, minDist);
|
|
4694
|
+
maxDist = Math.max(mag, maxDist);
|
|
4695
|
+
corner.copy(center).add(u).subtract(v).subtract(w);
|
|
4696
|
+
toCenter.copy(corner).subtract(position);
|
|
4697
|
+
mag = direction.dot(toCenter);
|
|
4698
|
+
minDist = Math.min(mag, minDist);
|
|
4699
|
+
maxDist = Math.max(mag, maxDist);
|
|
4700
|
+
center.copy(corner).subtract(u).add(v).add(w);
|
|
4701
|
+
toCenter.copy(corner).subtract(position);
|
|
4702
|
+
mag = direction.dot(toCenter);
|
|
4703
|
+
minDist = Math.min(mag, minDist);
|
|
4704
|
+
maxDist = Math.max(mag, maxDist);
|
|
4705
|
+
center.copy(corner).subtract(u).add(v).subtract(w);
|
|
4706
|
+
toCenter.copy(corner).subtract(position);
|
|
4707
|
+
mag = direction.dot(toCenter);
|
|
4708
|
+
minDist = Math.min(mag, minDist);
|
|
4709
|
+
maxDist = Math.max(mag, maxDist);
|
|
4710
|
+
center.copy(corner).subtract(u).subtract(v).add(w);
|
|
4711
|
+
toCenter.copy(corner).subtract(position);
|
|
4712
|
+
mag = direction.dot(toCenter);
|
|
4713
|
+
minDist = Math.min(mag, minDist);
|
|
4714
|
+
maxDist = Math.max(mag, maxDist);
|
|
4715
|
+
center.copy(corner).subtract(u).subtract(v).subtract(w);
|
|
4716
|
+
toCenter.copy(corner).subtract(position);
|
|
4717
|
+
mag = direction.dot(toCenter);
|
|
4718
|
+
minDist = Math.min(mag, minDist);
|
|
4719
|
+
maxDist = Math.max(mag, maxDist);
|
|
4720
|
+
result[0] = minDist;
|
|
4721
|
+
result[1] = maxDist;
|
|
4722
|
+
return result;
|
|
4723
|
+
}
|
|
4724
|
+
transform(transformation) {
|
|
4725
|
+
this.center.transformAsPoint(transformation);
|
|
4726
|
+
const xAxis = this.halfAxes.getColumn(0, scratchVectorU);
|
|
4727
|
+
xAxis.transformAsPoint(transformation);
|
|
4728
|
+
const yAxis = this.halfAxes.getColumn(1, scratchVectorV);
|
|
4729
|
+
yAxis.transformAsPoint(transformation);
|
|
4730
|
+
const zAxis = this.halfAxes.getColumn(2, scratchVectorW);
|
|
4731
|
+
zAxis.transformAsPoint(transformation);
|
|
4732
|
+
this.halfAxes = new Matrix3([...xAxis, ...yAxis, ...zAxis]);
|
|
4733
|
+
return this;
|
|
4734
|
+
}
|
|
4735
|
+
getTransform() {
|
|
4736
|
+
throw new Error("not implemented");
|
|
4737
|
+
}
|
|
4738
|
+
};
|
|
4739
|
+
}
|
|
4740
|
+
});
|
|
4741
|
+
|
|
4742
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/plane.js
|
|
4743
|
+
var scratchPosition2, scratchNormal3, Plane;
|
|
4744
|
+
var init_plane = __esm({
|
|
4745
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/plane.js"() {
|
|
4746
|
+
init_defineProperty();
|
|
4747
|
+
init_esm();
|
|
4748
|
+
scratchPosition2 = new Vector3();
|
|
4749
|
+
scratchNormal3 = new Vector3();
|
|
4750
|
+
Plane = class {
|
|
4751
|
+
constructor(normal = [0, 0, 1], distance = 0) {
|
|
4752
|
+
_defineProperty(this, "normal", void 0);
|
|
4753
|
+
_defineProperty(this, "distance", void 0);
|
|
4754
|
+
this.normal = new Vector3();
|
|
4755
|
+
this.distance = -0;
|
|
4756
|
+
this.fromNormalDistance(normal, distance);
|
|
4757
|
+
}
|
|
4758
|
+
fromNormalDistance(normal, distance) {
|
|
4759
|
+
assert4(Number.isFinite(distance));
|
|
4760
|
+
this.normal.from(normal).normalize();
|
|
4761
|
+
this.distance = distance;
|
|
4762
|
+
return this;
|
|
4763
|
+
}
|
|
4764
|
+
fromPointNormal(point, normal) {
|
|
4765
|
+
point = scratchPosition2.from(point);
|
|
4766
|
+
this.normal.from(normal).normalize();
|
|
4767
|
+
const distance = -this.normal.dot(point);
|
|
4768
|
+
this.distance = distance;
|
|
4769
|
+
return this;
|
|
4770
|
+
}
|
|
4771
|
+
fromCoefficients(a2, b, c, d) {
|
|
4772
|
+
this.normal.set(a2, b, c);
|
|
4773
|
+
assert4(equals(this.normal.len(), 1));
|
|
4774
|
+
this.distance = d;
|
|
4775
|
+
return this;
|
|
4776
|
+
}
|
|
4777
|
+
clone() {
|
|
4778
|
+
return new Plane(this.normal, this.distance);
|
|
4779
|
+
}
|
|
4780
|
+
equals(right) {
|
|
4781
|
+
return equals(this.distance, right.distance) && equals(this.normal, right.normal);
|
|
4782
|
+
}
|
|
4783
|
+
getPointDistance(point) {
|
|
4784
|
+
return this.normal.dot(point) + this.distance;
|
|
4785
|
+
}
|
|
4786
|
+
transform(matrix4) {
|
|
4787
|
+
const normal = scratchNormal3.copy(this.normal).transformAsVector(matrix4).normalize();
|
|
4788
|
+
const point = this.normal.scale(-this.distance).transform(matrix4);
|
|
4789
|
+
return this.fromPointNormal(point, normal);
|
|
4790
|
+
}
|
|
4791
|
+
projectPointOntoPlane(point, result = [0, 0, 0]) {
|
|
4792
|
+
point = scratchPosition2.from(point);
|
|
4793
|
+
const pointDistance = this.getPointDistance(point);
|
|
4794
|
+
const scaledNormal = scratchNormal3.copy(this.normal).scale(pointDistance);
|
|
4795
|
+
return point.subtract(scaledNormal).to(result);
|
|
4796
|
+
}
|
|
4797
|
+
};
|
|
4798
|
+
}
|
|
4799
|
+
});
|
|
4800
|
+
|
|
4801
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js
|
|
4802
|
+
var faces, scratchPlaneCenter, scratchPlaneNormal, scratchPlane, CullingVolume;
|
|
4803
|
+
var init_culling_volume = __esm({
|
|
4804
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js"() {
|
|
4805
|
+
init_defineProperty();
|
|
4806
|
+
init_esm();
|
|
4807
|
+
init_constants2();
|
|
4808
|
+
init_plane();
|
|
4809
|
+
faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];
|
|
4810
|
+
scratchPlaneCenter = new Vector3();
|
|
4811
|
+
scratchPlaneNormal = new Vector3();
|
|
4812
|
+
scratchPlane = new Plane(new Vector3(1, 0, 0), 0);
|
|
4813
|
+
CullingVolume = class {
|
|
4814
|
+
constructor(planes = []) {
|
|
4815
|
+
_defineProperty(this, "planes", void 0);
|
|
4816
|
+
this.planes = planes;
|
|
4817
|
+
}
|
|
4818
|
+
fromBoundingSphere(boundingSphere) {
|
|
4819
|
+
this.planes.length = 2 * faces.length;
|
|
4820
|
+
const center = boundingSphere.center;
|
|
4821
|
+
const radius = boundingSphere.radius;
|
|
4822
|
+
let planeIndex = 0;
|
|
4823
|
+
for (const faceNormal of faces) {
|
|
4824
|
+
let plane0 = this.planes[planeIndex];
|
|
4825
|
+
let plane1 = this.planes[planeIndex + 1];
|
|
4826
|
+
if (!plane0) {
|
|
4827
|
+
plane0 = this.planes[planeIndex] = new Plane();
|
|
4828
|
+
}
|
|
4829
|
+
if (!plane1) {
|
|
4830
|
+
plane1 = this.planes[planeIndex + 1] = new Plane();
|
|
4831
|
+
}
|
|
4832
|
+
const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
|
|
4833
|
+
const plane0Distance = -faceNormal.dot(plane0Center);
|
|
4834
|
+
plane0.fromPointNormal(plane0Center, faceNormal);
|
|
4835
|
+
const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
|
|
4836
|
+
const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();
|
|
4837
|
+
const plane1Distance = -negatedFaceNormal.dot(plane1Center);
|
|
4838
|
+
plane1.fromPointNormal(plane1Center, negatedFaceNormal);
|
|
4839
|
+
planeIndex += 2;
|
|
4840
|
+
}
|
|
4841
|
+
return this;
|
|
4842
|
+
}
|
|
4843
|
+
computeVisibility(boundingVolume) {
|
|
4844
|
+
let intersect = INTERSECTION.INSIDE;
|
|
4845
|
+
for (const plane of this.planes) {
|
|
4846
|
+
const result = boundingVolume.intersectPlane(plane);
|
|
4847
|
+
switch (result) {
|
|
4848
|
+
case INTERSECTION.OUTSIDE:
|
|
4849
|
+
return INTERSECTION.OUTSIDE;
|
|
4850
|
+
case INTERSECTION.INTERSECTING:
|
|
4851
|
+
intersect = INTERSECTION.INTERSECTING;
|
|
4852
|
+
break;
|
|
4853
|
+
default:
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
return intersect;
|
|
4857
|
+
}
|
|
4858
|
+
computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
|
|
4859
|
+
assert4(Number.isFinite(parentPlaneMask), "parentPlaneMask is required.");
|
|
4860
|
+
if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
|
|
4861
|
+
return parentPlaneMask;
|
|
4862
|
+
}
|
|
4863
|
+
let mask = CullingVolume.MASK_INSIDE;
|
|
4864
|
+
const planes = this.planes;
|
|
4865
|
+
for (let k = 0; k < this.planes.length; ++k) {
|
|
4866
|
+
const flag = k < 31 ? 1 << k : 0;
|
|
4867
|
+
if (k < 31 && (parentPlaneMask & flag) === 0) {
|
|
4868
|
+
continue;
|
|
4869
|
+
}
|
|
4870
|
+
const plane = planes[k];
|
|
4871
|
+
const result = boundingVolume.intersectPlane(plane);
|
|
4872
|
+
if (result === INTERSECTION.OUTSIDE) {
|
|
4873
|
+
return CullingVolume.MASK_OUTSIDE;
|
|
4874
|
+
} else if (result === INTERSECTION.INTERSECTING) {
|
|
4875
|
+
mask |= flag;
|
|
4876
|
+
}
|
|
4877
|
+
}
|
|
4878
|
+
return mask;
|
|
4879
|
+
}
|
|
4880
|
+
};
|
|
4881
|
+
_defineProperty(CullingVolume, "MASK_OUTSIDE", 4294967295);
|
|
4882
|
+
_defineProperty(CullingVolume, "MASK_INSIDE", 0);
|
|
4883
|
+
_defineProperty(CullingVolume, "MASK_INDETERMINATE", 2147483647);
|
|
4884
|
+
}
|
|
4885
|
+
});
|
|
4886
|
+
|
|
4887
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js
|
|
4888
|
+
var scratchPlaneUpVector, scratchPlaneRightVector, scratchPlaneNearCenter, scratchPlaneFarCenter, scratchPlaneNormal2;
|
|
4889
|
+
var init_perspective_off_center_frustum = __esm({
|
|
4890
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js"() {
|
|
4891
|
+
init_defineProperty();
|
|
4892
|
+
init_esm();
|
|
4893
|
+
init_culling_volume();
|
|
4894
|
+
init_plane();
|
|
4895
|
+
scratchPlaneUpVector = new Vector3();
|
|
4896
|
+
scratchPlaneRightVector = new Vector3();
|
|
4897
|
+
scratchPlaneNearCenter = new Vector3();
|
|
4898
|
+
scratchPlaneFarCenter = new Vector3();
|
|
4899
|
+
scratchPlaneNormal2 = new Vector3();
|
|
4900
|
+
}
|
|
4901
|
+
});
|
|
4902
|
+
|
|
4903
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js
|
|
4904
|
+
var init_perspective_frustum = __esm({
|
|
4905
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js"() {
|
|
4906
|
+
init_defineProperty();
|
|
4907
|
+
init_perspective_off_center_frustum();
|
|
4908
|
+
}
|
|
4909
|
+
});
|
|
4910
|
+
|
|
4911
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js
|
|
4912
|
+
var fromPointsXMin, fromPointsYMin, fromPointsZMin, fromPointsXMax, fromPointsYMax, fromPointsZMax, fromPointsCurrentPos, fromPointsScratch, fromPointsRitterCenter, fromPointsMinBoxPt, fromPointsMaxBoxPt, fromPointsNaiveCenterScratch, volumeConstant;
|
|
4913
|
+
var init_bounding_sphere_from_points = __esm({
|
|
4914
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js"() {
|
|
4915
|
+
init_esm();
|
|
4916
|
+
init_bounding_sphere();
|
|
4917
|
+
fromPointsXMin = new Vector3();
|
|
4918
|
+
fromPointsYMin = new Vector3();
|
|
4919
|
+
fromPointsZMin = new Vector3();
|
|
4920
|
+
fromPointsXMax = new Vector3();
|
|
4921
|
+
fromPointsYMax = new Vector3();
|
|
4922
|
+
fromPointsZMax = new Vector3();
|
|
4923
|
+
fromPointsCurrentPos = new Vector3();
|
|
4924
|
+
fromPointsScratch = new Vector3();
|
|
4925
|
+
fromPointsRitterCenter = new Vector3();
|
|
4926
|
+
fromPointsMinBoxPt = new Vector3();
|
|
4927
|
+
fromPointsMaxBoxPt = new Vector3();
|
|
4928
|
+
fromPointsNaiveCenterScratch = new Vector3();
|
|
4929
|
+
volumeConstant = 4 / 3 * Math.PI;
|
|
4930
|
+
}
|
|
4931
|
+
});
|
|
4932
|
+
|
|
4933
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js
|
|
4934
|
+
function computeEigenDecomposition(matrix, result = {}) {
|
|
4935
|
+
const EIGEN_TOLERANCE = math_utils_default.EPSILON20;
|
|
4936
|
+
const EIGEN_MAX_SWEEPS = 10;
|
|
4937
|
+
let count = 0;
|
|
4938
|
+
let sweep = 0;
|
|
4939
|
+
const unitaryMatrix = scratchUnitary;
|
|
4940
|
+
const diagonalMatrix = scratchDiagonal;
|
|
4941
|
+
unitaryMatrix.identity();
|
|
4942
|
+
diagonalMatrix.copy(matrix);
|
|
4943
|
+
const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);
|
|
4944
|
+
while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {
|
|
4945
|
+
shurDecomposition(diagonalMatrix, jMatrix);
|
|
4946
|
+
jMatrixTranspose.copy(jMatrix).transpose();
|
|
4947
|
+
diagonalMatrix.multiplyRight(jMatrix);
|
|
4948
|
+
diagonalMatrix.multiplyLeft(jMatrixTranspose);
|
|
4949
|
+
unitaryMatrix.multiplyRight(jMatrix);
|
|
4950
|
+
if (++count > 2) {
|
|
4951
|
+
++sweep;
|
|
4952
|
+
count = 0;
|
|
4953
|
+
}
|
|
4954
|
+
}
|
|
4955
|
+
result.unitary = unitaryMatrix.toTarget(result.unitary);
|
|
4956
|
+
result.diagonal = diagonalMatrix.toTarget(result.diagonal);
|
|
4957
|
+
return result;
|
|
4958
|
+
}
|
|
4959
|
+
function computeFrobeniusNorm(matrix) {
|
|
4960
|
+
let norm = 0;
|
|
4961
|
+
for (let i2 = 0; i2 < 9; ++i2) {
|
|
4962
|
+
const temp = matrix[i2];
|
|
4963
|
+
norm += temp * temp;
|
|
4964
|
+
}
|
|
4965
|
+
return Math.sqrt(norm);
|
|
4966
|
+
}
|
|
4967
|
+
function offDiagonalFrobeniusNorm(matrix) {
|
|
4968
|
+
let norm = 0;
|
|
4969
|
+
for (let i2 = 0; i2 < 3; ++i2) {
|
|
4970
|
+
const temp = matrix[scratchMatrix.getElementIndex(colVal[i2], rowVal[i2])];
|
|
4971
|
+
norm += 2 * temp * temp;
|
|
4972
|
+
}
|
|
4973
|
+
return Math.sqrt(norm);
|
|
4974
|
+
}
|
|
4975
|
+
function shurDecomposition(matrix, result) {
|
|
4976
|
+
const tolerance = math_utils_default.EPSILON15;
|
|
4977
|
+
let maxDiagonal = 0;
|
|
4978
|
+
let rotAxis = 1;
|
|
4979
|
+
for (let i2 = 0; i2 < 3; ++i2) {
|
|
4980
|
+
const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i2], rowVal[i2])]);
|
|
4981
|
+
if (temp > maxDiagonal) {
|
|
4982
|
+
rotAxis = i2;
|
|
4983
|
+
maxDiagonal = temp;
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
const p2 = rowVal[rotAxis];
|
|
4987
|
+
const q = colVal[rotAxis];
|
|
4988
|
+
let c = 1;
|
|
4989
|
+
let s2 = 0;
|
|
4990
|
+
if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p2)]) > tolerance) {
|
|
4991
|
+
const qq = matrix[scratchMatrix.getElementIndex(q, q)];
|
|
4992
|
+
const pp = matrix[scratchMatrix.getElementIndex(p2, p2)];
|
|
4993
|
+
const qp = matrix[scratchMatrix.getElementIndex(q, p2)];
|
|
4994
|
+
const tau = (qq - pp) / 2 / qp;
|
|
4995
|
+
let t2;
|
|
4996
|
+
if (tau < 0) {
|
|
4997
|
+
t2 = -1 / (-tau + Math.sqrt(1 + tau * tau));
|
|
4998
|
+
} else {
|
|
4999
|
+
t2 = 1 / (tau + Math.sqrt(1 + tau * tau));
|
|
5000
|
+
}
|
|
5001
|
+
c = 1 / Math.sqrt(1 + t2 * t2);
|
|
5002
|
+
s2 = t2 * c;
|
|
5003
|
+
}
|
|
5004
|
+
Matrix3.IDENTITY.to(result);
|
|
5005
|
+
result[scratchMatrix.getElementIndex(p2, p2)] = result[scratchMatrix.getElementIndex(q, q)] = c;
|
|
5006
|
+
result[scratchMatrix.getElementIndex(q, p2)] = s2;
|
|
5007
|
+
result[scratchMatrix.getElementIndex(p2, q)] = -s2;
|
|
5008
|
+
return result;
|
|
5009
|
+
}
|
|
5010
|
+
var scratchMatrix, scratchUnitary, scratchDiagonal, jMatrix, jMatrixTranspose, rowVal, colVal;
|
|
5011
|
+
var init_compute_eigen_decomposition = __esm({
|
|
5012
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js"() {
|
|
5013
|
+
init_esm();
|
|
5014
|
+
scratchMatrix = new Matrix3();
|
|
5015
|
+
scratchUnitary = new Matrix3();
|
|
5016
|
+
scratchDiagonal = new Matrix3();
|
|
5017
|
+
jMatrix = new Matrix3();
|
|
5018
|
+
jMatrixTranspose = new Matrix3();
|
|
5019
|
+
rowVal = [1, 0, 0];
|
|
5020
|
+
colVal = [2, 2, 1];
|
|
5021
|
+
}
|
|
5022
|
+
});
|
|
5023
|
+
|
|
5024
|
+
// ../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js
|
|
5025
|
+
function makeOrientedBoundingBoxFromPoints(positions, result = new OrientedBoundingBox()) {
|
|
5026
|
+
if (!positions || positions.length === 0) {
|
|
5027
|
+
result.halfAxes = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
5028
|
+
result.center = new Vector3();
|
|
5029
|
+
return result;
|
|
5030
|
+
}
|
|
5031
|
+
const length4 = positions.length;
|
|
5032
|
+
const meanPoint = new Vector3(0, 0, 0);
|
|
5033
|
+
for (const position of positions) {
|
|
5034
|
+
meanPoint.add(position);
|
|
5035
|
+
}
|
|
5036
|
+
const invLength = 1 / length4;
|
|
5037
|
+
meanPoint.multiplyByScalar(invLength);
|
|
5038
|
+
let exx = 0;
|
|
5039
|
+
let exy = 0;
|
|
5040
|
+
let exz = 0;
|
|
5041
|
+
let eyy = 0;
|
|
5042
|
+
let eyz = 0;
|
|
5043
|
+
let ezz = 0;
|
|
5044
|
+
for (const position of positions) {
|
|
5045
|
+
const p2 = scratchVector24.copy(position).subtract(meanPoint);
|
|
5046
|
+
exx += p2.x * p2.x;
|
|
5047
|
+
exy += p2.x * p2.y;
|
|
5048
|
+
exz += p2.x * p2.z;
|
|
5049
|
+
eyy += p2.y * p2.y;
|
|
5050
|
+
eyz += p2.y * p2.z;
|
|
5051
|
+
ezz += p2.z * p2.z;
|
|
5052
|
+
}
|
|
5053
|
+
exx *= invLength;
|
|
5054
|
+
exy *= invLength;
|
|
5055
|
+
exz *= invLength;
|
|
5056
|
+
eyy *= invLength;
|
|
5057
|
+
eyz *= invLength;
|
|
5058
|
+
ezz *= invLength;
|
|
5059
|
+
const covarianceMatrix = scratchCovarianceResult;
|
|
5060
|
+
covarianceMatrix[0] = exx;
|
|
5061
|
+
covarianceMatrix[1] = exy;
|
|
5062
|
+
covarianceMatrix[2] = exz;
|
|
5063
|
+
covarianceMatrix[3] = exy;
|
|
5064
|
+
covarianceMatrix[4] = eyy;
|
|
5065
|
+
covarianceMatrix[5] = eyz;
|
|
5066
|
+
covarianceMatrix[6] = exz;
|
|
5067
|
+
covarianceMatrix[7] = eyz;
|
|
5068
|
+
covarianceMatrix[8] = ezz;
|
|
5069
|
+
const {
|
|
5070
|
+
unitary
|
|
5071
|
+
} = computeEigenDecomposition(covarianceMatrix, scratchEigenResult);
|
|
5072
|
+
const rotation = result.halfAxes.copy(unitary);
|
|
5073
|
+
let v1 = rotation.getColumn(0, scratchVector42);
|
|
5074
|
+
let v2 = rotation.getColumn(1, scratchVector52);
|
|
5075
|
+
let v3 = rotation.getColumn(2, scratchVector62);
|
|
5076
|
+
let u1 = -Number.MAX_VALUE;
|
|
5077
|
+
let u2 = -Number.MAX_VALUE;
|
|
5078
|
+
let u3 = -Number.MAX_VALUE;
|
|
5079
|
+
let l1 = Number.MAX_VALUE;
|
|
5080
|
+
let l2 = Number.MAX_VALUE;
|
|
5081
|
+
let l3 = Number.MAX_VALUE;
|
|
5082
|
+
for (const position of positions) {
|
|
5083
|
+
scratchVector24.copy(position);
|
|
5084
|
+
u1 = Math.max(scratchVector24.dot(v1), u1);
|
|
5085
|
+
u2 = Math.max(scratchVector24.dot(v2), u2);
|
|
5086
|
+
u3 = Math.max(scratchVector24.dot(v3), u3);
|
|
5087
|
+
l1 = Math.min(scratchVector24.dot(v1), l1);
|
|
5088
|
+
l2 = Math.min(scratchVector24.dot(v2), l2);
|
|
5089
|
+
l3 = Math.min(scratchVector24.dot(v3), l3);
|
|
5090
|
+
}
|
|
5091
|
+
v1 = v1.multiplyByScalar(0.5 * (l1 + u1));
|
|
5092
|
+
v2 = v2.multiplyByScalar(0.5 * (l2 + u2));
|
|
5093
|
+
v3 = v3.multiplyByScalar(0.5 * (l3 + u3));
|
|
5094
|
+
result.center.copy(v1).add(v2).add(v3);
|
|
5095
|
+
const scale5 = scratchVector33.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);
|
|
5096
|
+
const scaleMatrix = new Matrix3([scale5[0], 0, 0, 0, scale5[1], 0, 0, 0, scale5[2]]);
|
|
5097
|
+
result.halfAxes.multiplyRight(scaleMatrix);
|
|
5098
|
+
return result;
|
|
5099
|
+
}
|
|
5100
|
+
var scratchVector24, scratchVector33, scratchVector42, scratchVector52, scratchVector62, scratchCovarianceResult, scratchEigenResult;
|
|
5101
|
+
var init_bounding_box_from_points = __esm({
|
|
5102
|
+
"../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js"() {
|
|
5103
|
+
init_esm();
|
|
5104
|
+
init_compute_eigen_decomposition();
|
|
5105
|
+
init_oriented_bounding_box();
|
|
5106
|
+
init_axis_aligned_bounding_box();
|
|
5107
|
+
scratchVector24 = new Vector3();
|
|
5108
|
+
scratchVector33 = new Vector3();
|
|
5109
|
+
scratchVector42 = new Vector3();
|
|
5110
|
+
scratchVector52 = new Vector3();
|
|
5111
|
+
scratchVector62 = new Vector3();
|
|
5112
|
+
scratchCovarianceResult = new Matrix3();
|
|
5113
|
+
scratchEigenResult = {
|
|
5114
|
+
diagonal: new Matrix3(),
|
|
5115
|
+
unitary: new Matrix3()
|
|
5116
|
+
};
|
|
5117
|
+
}
|
|
5118
|
+
});
|
|
5119
|
+
|
|
5120
|
+
// ../../node_modules/@math.gl/culling/dist/esm/index.js
|
|
5121
|
+
var init_esm3 = __esm({
|
|
5122
|
+
"../../node_modules/@math.gl/culling/dist/esm/index.js"() {
|
|
5123
|
+
init_constants2();
|
|
5124
|
+
init_axis_aligned_bounding_box();
|
|
5125
|
+
init_bounding_sphere();
|
|
5126
|
+
init_oriented_bounding_box();
|
|
5127
|
+
init_culling_volume();
|
|
5128
|
+
init_plane();
|
|
5129
|
+
init_perspective_off_center_frustum();
|
|
5130
|
+
init_perspective_frustum();
|
|
5131
|
+
init_bounding_sphere_from_points();
|
|
5132
|
+
init_bounding_box_from_points();
|
|
5133
|
+
init_compute_eigen_decomposition();
|
|
5134
|
+
}
|
|
5135
|
+
});
|
|
5136
|
+
|
|
4409
5137
|
// ../core/src/javascript-utils/is-type.ts
|
|
4410
5138
|
var isBoolean, isFunction, isObject, isPureObject, isIterable, isAsyncIterable, isResponse, isBlob, isBuffer2, isReadableDOMStream, isReadableNodeStream, isReadableStream;
|
|
4411
5139
|
var init_is_type = __esm({
|
|
@@ -4604,12 +5332,12 @@
|
|
|
4604
5332
|
}
|
|
4605
5333
|
});
|
|
4606
5334
|
|
|
4607
|
-
//
|
|
5335
|
+
// ../core/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
4608
5336
|
function isElectron(mockUserAgent) {
|
|
4609
5337
|
if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
|
|
4610
5338
|
return true;
|
|
4611
5339
|
}
|
|
4612
|
-
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions
|
|
5340
|
+
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
|
|
4613
5341
|
return true;
|
|
4614
5342
|
}
|
|
4615
5343
|
const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
|
|
@@ -4620,59 +5348,54 @@
|
|
|
4620
5348
|
return false;
|
|
4621
5349
|
}
|
|
4622
5350
|
var init_is_electron = __esm({
|
|
4623
|
-
"
|
|
5351
|
+
"../core/node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
|
|
4624
5352
|
}
|
|
4625
5353
|
});
|
|
4626
5354
|
|
|
4627
|
-
//
|
|
5355
|
+
// ../core/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
4628
5356
|
function isBrowser3() {
|
|
4629
5357
|
const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
|
|
4630
5358
|
return !isNode || isElectron();
|
|
4631
5359
|
}
|
|
4632
5360
|
var init_is_browser = __esm({
|
|
4633
|
-
"
|
|
5361
|
+
"../core/node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
|
|
4634
5362
|
init_is_electron();
|
|
4635
5363
|
}
|
|
4636
5364
|
});
|
|
4637
5365
|
|
|
4638
|
-
//
|
|
4639
|
-
var
|
|
5366
|
+
// ../core/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
5367
|
+
var self2, window2, document2, process2, console2, navigator2;
|
|
4640
5368
|
var init_globals3 = __esm({
|
|
4641
|
-
"
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
};
|
|
4649
|
-
self_3 = globals3.self || globals3.window || globals3.global;
|
|
4650
|
-
window_3 = globals3.window || globals3.self || globals3.global;
|
|
4651
|
-
document_3 = globals3.document || {};
|
|
4652
|
-
process_ = globals3.process || {};
|
|
5369
|
+
"../core/node_modules/@probe.gl/env/dist/lib/globals.js"() {
|
|
5370
|
+
self2 = globalThis.self || globalThis.window || globalThis.global;
|
|
5371
|
+
window2 = globalThis.window || globalThis.self || globalThis.global;
|
|
5372
|
+
document2 = globalThis.document || {};
|
|
5373
|
+
process2 = globalThis.process || {};
|
|
5374
|
+
console2 = globalThis.console;
|
|
5375
|
+
navigator2 = globalThis.navigator || {};
|
|
4653
5376
|
}
|
|
4654
5377
|
});
|
|
4655
5378
|
|
|
4656
|
-
//
|
|
5379
|
+
// ../core/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
4657
5380
|
var VERSION3, isBrowser4;
|
|
4658
5381
|
var init_globals4 = __esm({
|
|
4659
|
-
"
|
|
5382
|
+
"../core/node_modules/@probe.gl/env/dist/utils/globals.js"() {
|
|
4660
5383
|
init_is_browser();
|
|
4661
5384
|
VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
4662
5385
|
isBrowser4 = isBrowser3();
|
|
4663
5386
|
}
|
|
4664
5387
|
});
|
|
4665
5388
|
|
|
4666
|
-
//
|
|
4667
|
-
var
|
|
4668
|
-
"
|
|
5389
|
+
// ../core/node_modules/@probe.gl/env/dist/index.js
|
|
5390
|
+
var init_dist = __esm({
|
|
5391
|
+
"../core/node_modules/@probe.gl/env/dist/index.js"() {
|
|
4669
5392
|
init_globals4();
|
|
4670
5393
|
init_globals3();
|
|
4671
5394
|
init_is_browser();
|
|
4672
5395
|
}
|
|
4673
5396
|
});
|
|
4674
5397
|
|
|
4675
|
-
//
|
|
5398
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
4676
5399
|
function getStorage(type) {
|
|
4677
5400
|
try {
|
|
4678
5401
|
const storage = window[type];
|
|
@@ -4686,35 +5409,28 @@
|
|
|
4686
5409
|
}
|
|
4687
5410
|
var LocalStorage;
|
|
4688
5411
|
var init_local_storage = __esm({
|
|
4689
|
-
"
|
|
5412
|
+
"../core/node_modules/@probe.gl/log/dist/utils/local-storage.js"() {
|
|
4690
5413
|
init_defineProperty();
|
|
4691
5414
|
LocalStorage = class {
|
|
4692
|
-
constructor(id) {
|
|
4693
|
-
let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
5415
|
+
constructor(id, defaultConfig) {
|
|
4694
5416
|
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
4695
5417
|
_defineProperty(this, "storage", void 0);
|
|
4696
5418
|
_defineProperty(this, "id", void 0);
|
|
4697
|
-
_defineProperty(this, "config",
|
|
5419
|
+
_defineProperty(this, "config", void 0);
|
|
4698
5420
|
this.storage = getStorage(type);
|
|
4699
5421
|
this.id = id;
|
|
4700
|
-
this.config =
|
|
4701
|
-
Object.assign(this.config, defaultSettings);
|
|
5422
|
+
this.config = defaultConfig;
|
|
4702
5423
|
this._loadConfiguration();
|
|
4703
5424
|
}
|
|
4704
5425
|
getConfiguration() {
|
|
4705
5426
|
return this.config;
|
|
4706
5427
|
}
|
|
4707
5428
|
setConfiguration(configuration) {
|
|
4708
|
-
this.config = {};
|
|
4709
|
-
return this.updateConfiguration(configuration);
|
|
4710
|
-
}
|
|
4711
|
-
updateConfiguration(configuration) {
|
|
4712
5429
|
Object.assign(this.config, configuration);
|
|
4713
5430
|
if (this.storage) {
|
|
4714
5431
|
const serialized = JSON.stringify(this.config);
|
|
4715
5432
|
this.storage.setItem(this.id, serialized);
|
|
4716
5433
|
}
|
|
4717
|
-
return this;
|
|
4718
5434
|
}
|
|
4719
5435
|
_loadConfiguration() {
|
|
4720
5436
|
let configuration = {};
|
|
@@ -4729,7 +5445,7 @@
|
|
|
4729
5445
|
}
|
|
4730
5446
|
});
|
|
4731
5447
|
|
|
4732
|
-
//
|
|
5448
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/formatters.js
|
|
4733
5449
|
function formatTime(ms) {
|
|
4734
5450
|
let formatted;
|
|
4735
5451
|
if (ms < 10) {
|
|
@@ -4760,31 +5476,35 @@
|
|
|
4760
5476
|
return ["".concat(message, " %c+"), style];
|
|
4761
5477
|
}
|
|
4762
5478
|
var init_formatters = __esm({
|
|
4763
|
-
"
|
|
5479
|
+
"../core/node_modules/@probe.gl/log/dist/utils/formatters.js"() {
|
|
4764
5480
|
}
|
|
4765
5481
|
});
|
|
4766
5482
|
|
|
4767
|
-
//
|
|
5483
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/color.js
|
|
4768
5484
|
function getColor(color) {
|
|
4769
|
-
|
|
5485
|
+
if (typeof color !== "string") {
|
|
5486
|
+
return color;
|
|
5487
|
+
}
|
|
5488
|
+
color = color.toUpperCase();
|
|
5489
|
+
return COLOR[color] || COLOR.WHITE;
|
|
4770
5490
|
}
|
|
4771
5491
|
function addColor(string, color, background) {
|
|
4772
5492
|
if (!isBrowser3 && typeof string === "string") {
|
|
4773
5493
|
if (color) {
|
|
4774
|
-
|
|
4775
|
-
string = "[".concat(
|
|
5494
|
+
const colorCode = getColor(color);
|
|
5495
|
+
string = "[".concat(colorCode, "m").concat(string, "[39m");
|
|
4776
5496
|
}
|
|
4777
5497
|
if (background) {
|
|
4778
|
-
|
|
4779
|
-
string = "[".concat(
|
|
5498
|
+
const colorCode = getColor(background);
|
|
5499
|
+
string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "[49m");
|
|
4780
5500
|
}
|
|
4781
5501
|
}
|
|
4782
5502
|
return string;
|
|
4783
5503
|
}
|
|
4784
|
-
var COLOR;
|
|
5504
|
+
var COLOR, BACKGROUND_INCREMENT;
|
|
4785
5505
|
var init_color = __esm({
|
|
4786
|
-
"
|
|
4787
|
-
|
|
5506
|
+
"../core/node_modules/@probe.gl/log/dist/utils/color.js"() {
|
|
5507
|
+
init_dist();
|
|
4788
5508
|
(function(COLOR2) {
|
|
4789
5509
|
COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
|
|
4790
5510
|
COLOR2[COLOR2["RED"] = 31] = "RED";
|
|
@@ -4803,47 +5523,50 @@
|
|
|
4803
5523
|
COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
|
|
4804
5524
|
COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
|
|
4805
5525
|
})(COLOR || (COLOR = {}));
|
|
5526
|
+
BACKGROUND_INCREMENT = 10;
|
|
4806
5527
|
}
|
|
4807
5528
|
});
|
|
4808
5529
|
|
|
4809
|
-
//
|
|
5530
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
4810
5531
|
function autobind(obj) {
|
|
4811
5532
|
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
4812
5533
|
const proto = Object.getPrototypeOf(obj);
|
|
4813
5534
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
5535
|
+
const object = obj;
|
|
4814
5536
|
for (const key of propNames) {
|
|
4815
|
-
|
|
5537
|
+
const value = object[key];
|
|
5538
|
+
if (typeof value === "function") {
|
|
4816
5539
|
if (!predefined.find((name10) => key === name10)) {
|
|
4817
|
-
|
|
5540
|
+
object[key] = value.bind(obj);
|
|
4818
5541
|
}
|
|
4819
5542
|
}
|
|
4820
5543
|
}
|
|
4821
5544
|
}
|
|
4822
5545
|
var init_autobind = __esm({
|
|
4823
|
-
"
|
|
5546
|
+
"../core/node_modules/@probe.gl/log/dist/utils/autobind.js"() {
|
|
4824
5547
|
}
|
|
4825
5548
|
});
|
|
4826
5549
|
|
|
4827
|
-
//
|
|
5550
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/assert.js
|
|
4828
5551
|
function assert5(condition, message) {
|
|
4829
5552
|
if (!condition) {
|
|
4830
5553
|
throw new Error(message || "Assertion failed");
|
|
4831
5554
|
}
|
|
4832
5555
|
}
|
|
4833
5556
|
var init_assert4 = __esm({
|
|
4834
|
-
"
|
|
5557
|
+
"../core/node_modules/@probe.gl/log/dist/utils/assert.js"() {
|
|
4835
5558
|
}
|
|
4836
5559
|
});
|
|
4837
5560
|
|
|
4838
|
-
//
|
|
5561
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
|
|
4839
5562
|
function getHiResTimestamp() {
|
|
4840
5563
|
let timestamp;
|
|
4841
|
-
if (isBrowser3 &&
|
|
5564
|
+
if (isBrowser3() && window2.performance) {
|
|
4842
5565
|
var _window$performance, _window$performance$n;
|
|
4843
|
-
timestamp =
|
|
4844
|
-
} else if ("hrtime" in
|
|
5566
|
+
timestamp = window2 === null || window2 === void 0 ? void 0 : (_window$performance = window2.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
5567
|
+
} else if ("hrtime" in process2) {
|
|
4845
5568
|
var _process$hrtime;
|
|
4846
|
-
const timeParts =
|
|
5569
|
+
const timeParts = process2 === null || process2 === void 0 ? void 0 : (_process$hrtime = process2.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process2);
|
|
4847
5570
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
4848
5571
|
} else {
|
|
4849
5572
|
timestamp = Date.now();
|
|
@@ -4851,18 +5574,12 @@
|
|
|
4851
5574
|
return timestamp;
|
|
4852
5575
|
}
|
|
4853
5576
|
var init_hi_res_timestamp = __esm({
|
|
4854
|
-
"
|
|
4855
|
-
|
|
4856
|
-
}
|
|
4857
|
-
});
|
|
4858
|
-
|
|
4859
|
-
// (disabled):../../node_modules/@probe.gl/log/dist/esm/node/node-asciify-image
|
|
4860
|
-
var init_node_asciify_image = __esm({
|
|
4861
|
-
"(disabled):../../node_modules/@probe.gl/log/dist/esm/node/node-asciify-image"() {
|
|
5577
|
+
"../core/node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
|
|
5578
|
+
init_dist();
|
|
4862
5579
|
}
|
|
4863
5580
|
});
|
|
4864
5581
|
|
|
4865
|
-
//
|
|
5582
|
+
// ../core/node_modules/@probe.gl/log/dist/log.js
|
|
4866
5583
|
function noop() {
|
|
4867
5584
|
}
|
|
4868
5585
|
function normalizeLogLevel(logLevel) {
|
|
@@ -4928,11 +5645,7 @@
|
|
|
4928
5645
|
message = "",
|
|
4929
5646
|
scale: scale5 = 1
|
|
4930
5647
|
} = _ref2;
|
|
4931
|
-
|
|
4932
|
-
image,
|
|
4933
|
-
message,
|
|
4934
|
-
scale: scale5
|
|
4935
|
-
});
|
|
5648
|
+
console.warn("removed");
|
|
4936
5649
|
return noop;
|
|
4937
5650
|
}
|
|
4938
5651
|
function logImageInBrowser(_ref3) {
|
|
@@ -4971,26 +5684,25 @@
|
|
|
4971
5684
|
}
|
|
4972
5685
|
return "empty";
|
|
4973
5686
|
}
|
|
4974
|
-
var originalConsole,
|
|
5687
|
+
var originalConsole, DEFAULT_LOG_CONFIGURATION, cache, ONCE, Log;
|
|
4975
5688
|
var init_log = __esm({
|
|
4976
|
-
"
|
|
5689
|
+
"../core/node_modules/@probe.gl/log/dist/log.js"() {
|
|
4977
5690
|
init_defineProperty();
|
|
4978
|
-
|
|
5691
|
+
init_dist();
|
|
4979
5692
|
init_local_storage();
|
|
4980
5693
|
init_formatters();
|
|
4981
5694
|
init_color();
|
|
4982
5695
|
init_autobind();
|
|
4983
5696
|
init_assert4();
|
|
4984
5697
|
init_hi_res_timestamp();
|
|
4985
|
-
init_node_asciify_image();
|
|
4986
5698
|
originalConsole = {
|
|
4987
|
-
debug: isBrowser3 ? console.debug || console.log : console.log,
|
|
5699
|
+
debug: isBrowser3() ? console.debug || console.log : console.log,
|
|
4988
5700
|
log: console.log,
|
|
4989
5701
|
info: console.info,
|
|
4990
5702
|
warn: console.warn,
|
|
4991
5703
|
error: console.error
|
|
4992
5704
|
};
|
|
4993
|
-
|
|
5705
|
+
DEFAULT_LOG_CONFIGURATION = {
|
|
4994
5706
|
enabled: true,
|
|
4995
5707
|
level: 0
|
|
4996
5708
|
};
|
|
@@ -5013,8 +5725,8 @@
|
|
|
5013
5725
|
_defineProperty(this, "userData", {});
|
|
5014
5726
|
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
5015
5727
|
this.id = id;
|
|
5016
|
-
this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
|
|
5017
5728
|
this.userData = {};
|
|
5729
|
+
this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
|
|
5018
5730
|
this.timeStamp("".concat(this.id, " started"));
|
|
5019
5731
|
autobind(this);
|
|
5020
5732
|
Object.seal(this);
|
|
@@ -5048,13 +5760,13 @@
|
|
|
5048
5760
|
}
|
|
5049
5761
|
enable() {
|
|
5050
5762
|
let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
5051
|
-
this._storage.
|
|
5763
|
+
this._storage.setConfiguration({
|
|
5052
5764
|
enabled
|
|
5053
5765
|
});
|
|
5054
5766
|
return this;
|
|
5055
5767
|
}
|
|
5056
5768
|
setLevel(level) {
|
|
5057
|
-
this._storage.
|
|
5769
|
+
this._storage.setConfiguration({
|
|
5058
5770
|
level
|
|
5059
5771
|
});
|
|
5060
5772
|
return this;
|
|
@@ -5063,7 +5775,7 @@
|
|
|
5063
5775
|
return this._storage.config[setting];
|
|
5064
5776
|
}
|
|
5065
5777
|
set(setting, value) {
|
|
5066
|
-
this._storage.
|
|
5778
|
+
this._storage.setConfiguration({
|
|
5067
5779
|
[setting]: value
|
|
5068
5780
|
});
|
|
5069
5781
|
}
|
|
@@ -5102,9 +5814,6 @@
|
|
|
5102
5814
|
return this._getLogFunction(logLevel, message, console.info, arguments);
|
|
5103
5815
|
}
|
|
5104
5816
|
once(logLevel, message) {
|
|
5105
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
5106
|
-
args[_key - 2] = arguments[_key];
|
|
5107
|
-
}
|
|
5108
5817
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
5109
5818
|
}
|
|
5110
5819
|
table(logLevel, table, columns) {
|
|
@@ -5126,7 +5835,7 @@
|
|
|
5126
5835
|
if (!this._shouldLog(logLevel || priority)) {
|
|
5127
5836
|
return noop;
|
|
5128
5837
|
}
|
|
5129
|
-
return isBrowser3 ? logImageInBrowser({
|
|
5838
|
+
return isBrowser3() ? logImageInBrowser({
|
|
5130
5839
|
image,
|
|
5131
5840
|
message,
|
|
5132
5841
|
scale: scale5
|
|
@@ -5199,7 +5908,7 @@
|
|
|
5199
5908
|
opts.delta = this.getDelta();
|
|
5200
5909
|
this._deltaTs = getHiResTimestamp();
|
|
5201
5910
|
const tag = opts.tag || opts.message;
|
|
5202
|
-
if (opts.once) {
|
|
5911
|
+
if (opts.once && tag) {
|
|
5203
5912
|
if (!cache[tag]) {
|
|
5204
5913
|
cache[tag] = getHiResTimestamp();
|
|
5205
5914
|
} else {
|
|
@@ -5216,13 +5925,13 @@
|
|
|
5216
5925
|
}
|
|
5217
5926
|
});
|
|
5218
5927
|
|
|
5219
|
-
//
|
|
5220
|
-
var
|
|
5221
|
-
var
|
|
5222
|
-
"
|
|
5928
|
+
// ../core/node_modules/@probe.gl/log/dist/index.js
|
|
5929
|
+
var dist_default;
|
|
5930
|
+
var init_dist2 = __esm({
|
|
5931
|
+
"../core/node_modules/@probe.gl/log/dist/index.js"() {
|
|
5223
5932
|
init_log();
|
|
5224
5933
|
init_log();
|
|
5225
|
-
|
|
5934
|
+
dist_default = new Log({
|
|
5226
5935
|
id: "@probe.gl/log"
|
|
5227
5936
|
});
|
|
5228
5937
|
}
|
|
@@ -5232,7 +5941,7 @@
|
|
|
5232
5941
|
var probeLog, NullLog, ConsoleLog;
|
|
5233
5942
|
var init_loggers = __esm({
|
|
5234
5943
|
"../core/src/lib/loader-utils/loggers.ts"() {
|
|
5235
|
-
|
|
5944
|
+
init_dist2();
|
|
5236
5945
|
probeLog = new Log({ id: "loaders.gl" });
|
|
5237
5946
|
NullLog = class {
|
|
5238
5947
|
log() {
|
|
@@ -5330,20 +6039,6 @@
|
|
|
5330
6039
|
validateOptions(options, loaders);
|
|
5331
6040
|
return normalizeOptionsInternal(loader, options, url);
|
|
5332
6041
|
}
|
|
5333
|
-
function getFetchFunction(options, context) {
|
|
5334
|
-
const globalOptions = getGlobalLoaderOptions();
|
|
5335
|
-
const fetchOptions = options || globalOptions;
|
|
5336
|
-
if (typeof fetchOptions.fetch === "function") {
|
|
5337
|
-
return fetchOptions.fetch;
|
|
5338
|
-
}
|
|
5339
|
-
if (isObject(fetchOptions.fetch)) {
|
|
5340
|
-
return (url) => fetchFile(url, fetchOptions);
|
|
5341
|
-
}
|
|
5342
|
-
if (context?.fetch) {
|
|
5343
|
-
return context?.fetch;
|
|
5344
|
-
}
|
|
5345
|
-
return fetchFile;
|
|
5346
|
-
}
|
|
5347
6042
|
function validateOptions(options, loaders) {
|
|
5348
6043
|
validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
|
|
5349
6044
|
for (const loader of loaders) {
|
|
@@ -5422,7 +6117,6 @@
|
|
|
5422
6117
|
var init_option_utils = __esm({
|
|
5423
6118
|
"../core/src/lib/loader-utils/option-utils.ts"() {
|
|
5424
6119
|
init_is_type();
|
|
5425
|
-
init_fetch_file();
|
|
5426
6120
|
init_loggers();
|
|
5427
6121
|
init_option_defaults();
|
|
5428
6122
|
getGlobalLoaderOptions = () => {
|
|
@@ -5490,7 +6184,7 @@
|
|
|
5490
6184
|
var log;
|
|
5491
6185
|
var init_log2 = __esm({
|
|
5492
6186
|
"../core/src/lib/utils/log.ts"() {
|
|
5493
|
-
|
|
6187
|
+
init_dist2();
|
|
5494
6188
|
log = new Log({ id: "loaders.gl" });
|
|
5495
6189
|
}
|
|
5496
6190
|
});
|
|
@@ -5872,6 +6566,29 @@
|
|
|
5872
6566
|
}
|
|
5873
6567
|
});
|
|
5874
6568
|
|
|
6569
|
+
// ../core/src/lib/loader-utils/get-fetch-function.ts
|
|
6570
|
+
function getFetchFunction(options, context) {
|
|
6571
|
+
const globalOptions = getGlobalLoaderOptions();
|
|
6572
|
+
const fetchOptions = options || globalOptions;
|
|
6573
|
+
if (typeof fetchOptions.fetch === "function") {
|
|
6574
|
+
return fetchOptions.fetch;
|
|
6575
|
+
}
|
|
6576
|
+
if (isObject(fetchOptions.fetch)) {
|
|
6577
|
+
return (url) => fetchFile(url, fetchOptions);
|
|
6578
|
+
}
|
|
6579
|
+
if (context?.fetch) {
|
|
6580
|
+
return context?.fetch;
|
|
6581
|
+
}
|
|
6582
|
+
return fetchFile;
|
|
6583
|
+
}
|
|
6584
|
+
var init_get_fetch_function = __esm({
|
|
6585
|
+
"../core/src/lib/loader-utils/get-fetch-function.ts"() {
|
|
6586
|
+
init_is_type();
|
|
6587
|
+
init_fetch_file();
|
|
6588
|
+
init_option_utils();
|
|
6589
|
+
}
|
|
6590
|
+
});
|
|
6591
|
+
|
|
5875
6592
|
// ../core/src/lib/loader-utils/loader-context.ts
|
|
5876
6593
|
function getLoaderContext(context, options, previousContext = null) {
|
|
5877
6594
|
if (previousContext) {
|
|
@@ -5902,7 +6619,7 @@
|
|
|
5902
6619
|
}
|
|
5903
6620
|
var init_loader_context = __esm({
|
|
5904
6621
|
"../core/src/lib/loader-utils/loader-context.ts"() {
|
|
5905
|
-
|
|
6622
|
+
init_get_fetch_function();
|
|
5906
6623
|
}
|
|
5907
6624
|
});
|
|
5908
6625
|
|
|
@@ -5987,7 +6704,7 @@
|
|
|
5987
6704
|
"../core/src/lib/api/load.ts"() {
|
|
5988
6705
|
init_is_type();
|
|
5989
6706
|
init_normalize_loader();
|
|
5990
|
-
|
|
6707
|
+
init_get_fetch_function();
|
|
5991
6708
|
init_parse();
|
|
5992
6709
|
}
|
|
5993
6710
|
});
|
|
@@ -6002,7 +6719,7 @@
|
|
|
6002
6719
|
|
|
6003
6720
|
// ../tiles/src/constants.ts
|
|
6004
6721
|
var TILE_REFINEMENT, TILE_TYPE, TILESET_TYPE, LOD_METRIC_TYPE;
|
|
6005
|
-
var
|
|
6722
|
+
var init_constants3 = __esm({
|
|
6006
6723
|
"../tiles/src/constants.ts"() {
|
|
6007
6724
|
TILE_REFINEMENT = {
|
|
6008
6725
|
ADD: 1,
|
|
@@ -6028,7 +6745,7 @@
|
|
|
6028
6745
|
// ../tiles/src/index.ts
|
|
6029
6746
|
var init_src4 = __esm({
|
|
6030
6747
|
"../tiles/src/index.ts"() {
|
|
6031
|
-
|
|
6748
|
+
init_constants3();
|
|
6032
6749
|
}
|
|
6033
6750
|
});
|
|
6034
6751
|
|
|
@@ -6042,7 +6759,7 @@
|
|
|
6042
6759
|
|
|
6043
6760
|
// src/lib/constants.ts
|
|
6044
6761
|
var TILE3D_TYPE, TILE3D_TYPES, MAGIC_ARRAY;
|
|
6045
|
-
var
|
|
6762
|
+
var init_constants4 = __esm({
|
|
6046
6763
|
"src/lib/constants.ts"() {
|
|
6047
6764
|
TILE3D_TYPE = {
|
|
6048
6765
|
COMPOSITE: "cmpt",
|
|
@@ -7165,7 +7882,7 @@
|
|
|
7165
7882
|
|
|
7166
7883
|
// ../math/src/geometry/constants.ts
|
|
7167
7884
|
var GL_PRIMITIVE_MODE, GL_TYPE, GL2;
|
|
7168
|
-
var
|
|
7885
|
+
var init_constants5 = __esm({
|
|
7169
7886
|
"../math/src/geometry/constants.ts"() {
|
|
7170
7887
|
GL_PRIMITIVE_MODE = {
|
|
7171
7888
|
POINTS: 0,
|
|
@@ -7197,7 +7914,7 @@
|
|
|
7197
7914
|
var GL_TYPE_TO_ARRAY_TYPE, NAME_TO_GL_TYPE, ERR_TYPE_CONVERSION, GLType;
|
|
7198
7915
|
var init_gl_type = __esm({
|
|
7199
7916
|
"../math/src/geometry/gl/gl-type.ts"() {
|
|
7200
|
-
|
|
7917
|
+
init_constants5();
|
|
7201
7918
|
GL_TYPE_TO_ARRAY_TYPE = {
|
|
7202
7919
|
[GL_TYPE.DOUBLE]: Float64Array,
|
|
7203
7920
|
[GL_TYPE.FLOAT]: Float32Array,
|
|
@@ -7320,14 +8037,14 @@
|
|
|
7320
8037
|
function octDecode(x, y, result) {
|
|
7321
8038
|
return octDecodeInRange(x, y, 255, result);
|
|
7322
8039
|
}
|
|
7323
|
-
var RIGHT_SHIFT,
|
|
8040
|
+
var RIGHT_SHIFT, scratchVector25, scratchVector34, scratchEncodeVector2, octEncodeScratch, uint8ForceArray;
|
|
7324
8041
|
var init_attribute_compression = __esm({
|
|
7325
8042
|
"../math/src/geometry/compression/attribute-compression.ts"() {
|
|
7326
8043
|
init_esm();
|
|
7327
8044
|
init_assert6();
|
|
7328
8045
|
RIGHT_SHIFT = 1 / 256;
|
|
7329
|
-
|
|
7330
|
-
|
|
8046
|
+
scratchVector25 = new Vector2();
|
|
8047
|
+
scratchVector34 = new Vector3();
|
|
7331
8048
|
scratchEncodeVector2 = new Vector2();
|
|
7332
8049
|
octEncodeScratch = new Vector2();
|
|
7333
8050
|
uint8ForceArray = new Uint8Array(1);
|
|
@@ -7337,7 +8054,7 @@
|
|
|
7337
8054
|
// ../math/src/index.ts
|
|
7338
8055
|
var init_src7 = __esm({
|
|
7339
8056
|
"../math/src/index.ts"() {
|
|
7340
|
-
|
|
8057
|
+
init_constants5();
|
|
7341
8058
|
init_gl_type();
|
|
7342
8059
|
init_rgb565();
|
|
7343
8060
|
init_attribute_compression();
|
|
@@ -8118,8 +8835,8 @@
|
|
|
8118
8835
|
if (tile.isOctEncoded16P) {
|
|
8119
8836
|
const decodedArray = new Float32Array(tile.pointsLength * 3);
|
|
8120
8837
|
for (let i2 = 0; i2 < tile.pointsLength; i2++) {
|
|
8121
|
-
octDecode(normals[i2 * 2], normals[i2 * 2 + 1],
|
|
8122
|
-
|
|
8838
|
+
octDecode(normals[i2 * 2], normals[i2 * 2 + 1], scratchNormal4);
|
|
8839
|
+
scratchNormal4.toArray(decodedArray, i2 * 3);
|
|
8123
8840
|
}
|
|
8124
8841
|
return {
|
|
8125
8842
|
type: GL2.FLOAT,
|
|
@@ -8133,12 +8850,12 @@
|
|
|
8133
8850
|
value: normals
|
|
8134
8851
|
};
|
|
8135
8852
|
}
|
|
8136
|
-
var
|
|
8853
|
+
var scratchNormal4;
|
|
8137
8854
|
var init_normalize_3d_tile_normals = __esm({
|
|
8138
8855
|
"src/lib/parsers/helpers/normalize-3d-tile-normals.ts"() {
|
|
8139
8856
|
init_esm();
|
|
8140
8857
|
init_src7();
|
|
8141
|
-
|
|
8858
|
+
scratchNormal4 = new Vector3();
|
|
8142
8859
|
}
|
|
8143
8860
|
});
|
|
8144
8861
|
|
|
@@ -8159,10 +8876,10 @@
|
|
|
8159
8876
|
};
|
|
8160
8877
|
}
|
|
8161
8878
|
function decodeQuantizedPositions(tile, positions) {
|
|
8162
|
-
const
|
|
8879
|
+
const scratchPosition3 = new Vector3();
|
|
8163
8880
|
const decodedArray = new Float32Array(tile.pointCount * 3);
|
|
8164
8881
|
for (let i2 = 0; i2 < tile.pointCount; i2++) {
|
|
8165
|
-
|
|
8882
|
+
scratchPosition3.set(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2]).scale(1 / tile.quantizedRange).multiply(tile.quantizedVolumeScale).add(tile.quantizedVolumeOffset).toArray(decodedArray, i2 * 3);
|
|
8166
8883
|
}
|
|
8167
8884
|
return decodedArray;
|
|
8168
8885
|
}
|
|
@@ -9048,10 +9765,62 @@
|
|
|
9048
9765
|
}
|
|
9049
9766
|
});
|
|
9050
9767
|
|
|
9768
|
+
// ../images/src/lib/category-api/parse-isobmff-binary.ts
|
|
9769
|
+
function getISOBMFFMediaType(buffer) {
|
|
9770
|
+
if (!checkString(buffer, "ftyp", 4)) {
|
|
9771
|
+
return null;
|
|
9772
|
+
}
|
|
9773
|
+
if ((buffer[8] & 96) === 0) {
|
|
9774
|
+
return null;
|
|
9775
|
+
}
|
|
9776
|
+
return decodeMajorBrand(buffer);
|
|
9777
|
+
}
|
|
9778
|
+
function decodeMajorBrand(buffer) {
|
|
9779
|
+
const brandMajor = getUTF8String(buffer, 8, 12).replace("\0", " ").trim();
|
|
9780
|
+
switch (brandMajor) {
|
|
9781
|
+
case "avif":
|
|
9782
|
+
case "avis":
|
|
9783
|
+
return { extension: "avif", mimeType: "image/avif" };
|
|
9784
|
+
default:
|
|
9785
|
+
return null;
|
|
9786
|
+
}
|
|
9787
|
+
}
|
|
9788
|
+
function getUTF8String(array, start, end) {
|
|
9789
|
+
return String.fromCharCode(...array.slice(start, end));
|
|
9790
|
+
}
|
|
9791
|
+
function stringToBytes(string) {
|
|
9792
|
+
return [...string].map((character) => character.charCodeAt(0));
|
|
9793
|
+
}
|
|
9794
|
+
function checkString(buffer, header, offset = 0) {
|
|
9795
|
+
const headerBytes = stringToBytes(header);
|
|
9796
|
+
for (let i2 = 0; i2 < headerBytes.length; ++i2) {
|
|
9797
|
+
if (headerBytes[i2] !== buffer[i2 + offset]) {
|
|
9798
|
+
return false;
|
|
9799
|
+
}
|
|
9800
|
+
}
|
|
9801
|
+
return true;
|
|
9802
|
+
}
|
|
9803
|
+
var init_parse_isobmff_binary = __esm({
|
|
9804
|
+
"../images/src/lib/category-api/parse-isobmff-binary.ts"() {
|
|
9805
|
+
}
|
|
9806
|
+
});
|
|
9807
|
+
|
|
9051
9808
|
// ../images/src/lib/category-api/binary-image-api.ts
|
|
9052
9809
|
function getBinaryImageMetadata(binaryData) {
|
|
9053
9810
|
const dataView = toDataView(binaryData);
|
|
9054
|
-
return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
|
|
9811
|
+
return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView) || getISOBMFFMetadata(dataView);
|
|
9812
|
+
}
|
|
9813
|
+
function getISOBMFFMetadata(binaryData) {
|
|
9814
|
+
const buffer = new Uint8Array(binaryData instanceof DataView ? binaryData.buffer : binaryData);
|
|
9815
|
+
const mediaType = getISOBMFFMediaType(buffer);
|
|
9816
|
+
if (!mediaType) {
|
|
9817
|
+
return null;
|
|
9818
|
+
}
|
|
9819
|
+
return {
|
|
9820
|
+
mimeType: mediaType.mimeType,
|
|
9821
|
+
width: 0,
|
|
9822
|
+
height: 0
|
|
9823
|
+
};
|
|
9055
9824
|
}
|
|
9056
9825
|
function getPngMetadata(binaryData) {
|
|
9057
9826
|
const dataView = toDataView(binaryData);
|
|
@@ -9152,6 +9921,7 @@
|
|
|
9152
9921
|
var BIG_ENDIAN, LITTLE_ENDIAN;
|
|
9153
9922
|
var init_binary_image_api = __esm({
|
|
9154
9923
|
"../images/src/lib/category-api/binary-image-api.ts"() {
|
|
9924
|
+
init_parse_isobmff_binary();
|
|
9155
9925
|
BIG_ENDIAN = false;
|
|
9156
9926
|
LITTLE_ENDIAN = true;
|
|
9157
9927
|
}
|
|
@@ -9225,12 +9995,13 @@
|
|
|
9225
9995
|
init_version6();
|
|
9226
9996
|
init_parse_image();
|
|
9227
9997
|
init_binary_image_api();
|
|
9228
|
-
EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
|
|
9998
|
+
EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
|
|
9229
9999
|
MIME_TYPES = [
|
|
9230
10000
|
"image/png",
|
|
9231
10001
|
"image/jpeg",
|
|
9232
10002
|
"image/gif",
|
|
9233
10003
|
"image/webp",
|
|
10004
|
+
"image/avif",
|
|
9234
10005
|
"image/bmp",
|
|
9235
10006
|
"image/vnd.microsoft.icon",
|
|
9236
10007
|
"image/svg+xml"
|
|
@@ -9256,43 +10027,41 @@
|
|
|
9256
10027
|
});
|
|
9257
10028
|
|
|
9258
10029
|
// ../images/src/lib/category-api/image-format.ts
|
|
9259
|
-
function
|
|
9260
|
-
if (
|
|
9261
|
-
|
|
10030
|
+
function isImageFormatSupported(mimeType) {
|
|
10031
|
+
if (mimeTypeSupportedSync[mimeType] === void 0) {
|
|
10032
|
+
const supported = isBrowser ? checkBrowserImageFormatSupport(mimeType) : checkNodeImageFormatSupport(mimeType);
|
|
10033
|
+
mimeTypeSupportedSync[mimeType] = supported;
|
|
9262
10034
|
}
|
|
9263
|
-
return
|
|
10035
|
+
return mimeTypeSupportedSync[mimeType];
|
|
10036
|
+
}
|
|
10037
|
+
function checkNodeImageFormatSupport(mimeType) {
|
|
10038
|
+
const NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
|
|
10039
|
+
const { _parseImageNode: _parseImageNode2, _imageFormatsNode = NODE_FORMAT_SUPPORT } = globalThis;
|
|
10040
|
+
return Boolean(_parseImageNode2) && _imageFormatsNode.includes(mimeType);
|
|
9264
10041
|
}
|
|
9265
|
-
function
|
|
10042
|
+
function checkBrowserImageFormatSupport(mimeType) {
|
|
9266
10043
|
switch (mimeType) {
|
|
10044
|
+
case "image/avif":
|
|
9267
10045
|
case "image/webp":
|
|
9268
|
-
return
|
|
9269
|
-
case "image/svg":
|
|
9270
|
-
return isBrowser;
|
|
10046
|
+
return testBrowserImageFormatSupport(mimeType);
|
|
9271
10047
|
default:
|
|
9272
|
-
if (!isBrowser) {
|
|
9273
|
-
const { _parseImageNode: _parseImageNode2 } = globalThis;
|
|
9274
|
-
return Boolean(_parseImageNode2) && NODE_FORMAT_SUPPORT.includes(mimeType);
|
|
9275
|
-
}
|
|
9276
10048
|
return true;
|
|
9277
10049
|
}
|
|
9278
10050
|
}
|
|
9279
|
-
function
|
|
9280
|
-
if (!isBrowser) {
|
|
9281
|
-
return false;
|
|
9282
|
-
}
|
|
10051
|
+
function testBrowserImageFormatSupport(mimeType) {
|
|
9283
10052
|
try {
|
|
9284
10053
|
const element = document.createElement("canvas");
|
|
9285
|
-
|
|
10054
|
+
const dataURL = element.toDataURL(mimeType);
|
|
10055
|
+
return dataURL.indexOf(`data:${mimeType}`) === 0;
|
|
9286
10056
|
} catch {
|
|
9287
10057
|
return false;
|
|
9288
10058
|
}
|
|
9289
10059
|
}
|
|
9290
|
-
var
|
|
10060
|
+
var mimeTypeSupportedSync;
|
|
9291
10061
|
var init_image_format = __esm({
|
|
9292
10062
|
"../images/src/lib/category-api/image-format.ts"() {
|
|
9293
10063
|
init_src2();
|
|
9294
|
-
|
|
9295
|
-
mimeTypeSupported = {};
|
|
10064
|
+
mimeTypeSupportedSync = {};
|
|
9296
10065
|
}
|
|
9297
10066
|
});
|
|
9298
10067
|
|
|
@@ -9842,12 +10611,12 @@
|
|
|
9842
10611
|
return wasmPromise;
|
|
9843
10612
|
}
|
|
9844
10613
|
async function loadWasmModule() {
|
|
9845
|
-
let
|
|
10614
|
+
let wasm2 = wasm_base;
|
|
9846
10615
|
if (WebAssembly.validate(detector)) {
|
|
9847
|
-
|
|
10616
|
+
wasm2 = wasm_simd;
|
|
9848
10617
|
console.log("Warning: meshopt_decoder is using experimental SIMD support");
|
|
9849
10618
|
}
|
|
9850
|
-
const result = await WebAssembly.instantiate(unpack(
|
|
10619
|
+
const result = await WebAssembly.instantiate(unpack(wasm2), {});
|
|
9851
10620
|
await result.instance.exports.__wasm_call_ctors();
|
|
9852
10621
|
return result.instance;
|
|
9853
10622
|
}
|
|
@@ -10077,7 +10846,7 @@
|
|
|
10077
10846
|
});
|
|
10078
10847
|
function preprocess(gltfData, options) {
|
|
10079
10848
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
10080
|
-
if (!
|
|
10849
|
+
if (!isImageFormatSupported("image/webp")) {
|
|
10081
10850
|
if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {
|
|
10082
10851
|
throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);
|
|
10083
10852
|
}
|
|
@@ -10412,9 +11181,9 @@
|
|
|
10412
11181
|
const result = new Float32Array(length4);
|
|
10413
11182
|
for (let i2 = 0; i2 < accessor.count; i2++) {
|
|
10414
11183
|
const uv = new ArrayType(arrayBuffer, byteOffset + i2 * elementAddressScale, 2);
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
result.set([
|
|
11184
|
+
scratchVector7.set(uv[0], uv[1], 1);
|
|
11185
|
+
scratchVector7.transformByMatrix3(matrix);
|
|
11186
|
+
result.set([scratchVector7[0], scratchVector7[1]], i2 * components);
|
|
10418
11187
|
}
|
|
10419
11188
|
if (originalTexCoord === texCoord) {
|
|
10420
11189
|
updateGltf(accessor, bufferView, gltfData.buffers, result);
|
|
@@ -10472,7 +11241,7 @@
|
|
|
10472
11241
|
const scaleMatrix = scratchScaleMatrix.set(scale5[0], 0, 0, 0, scale5[1], 0, 0, 0, 1);
|
|
10473
11242
|
return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);
|
|
10474
11243
|
}
|
|
10475
|
-
var EXT_MESHOPT_TRANSFORM, name5,
|
|
11244
|
+
var EXT_MESHOPT_TRANSFORM, name5, scratchVector7, scratchRotationMatrix, scratchScaleMatrix;
|
|
10476
11245
|
var init_KHR_texture_transform = __esm({
|
|
10477
11246
|
"../gltf/src/lib/extensions/KHR_texture_transform.ts"() {
|
|
10478
11247
|
init_esm();
|
|
@@ -10481,7 +11250,7 @@
|
|
|
10481
11250
|
init_gltf_scenegraph();
|
|
10482
11251
|
EXT_MESHOPT_TRANSFORM = "KHR_texture_transform";
|
|
10483
11252
|
name5 = EXT_MESHOPT_TRANSFORM;
|
|
10484
|
-
|
|
11253
|
+
scratchVector7 = new Vector3();
|
|
10485
11254
|
scratchRotationMatrix = new Matrix3();
|
|
10486
11255
|
scratchScaleMatrix = new Matrix3();
|
|
10487
11256
|
}
|
|
@@ -11774,7 +12543,7 @@
|
|
|
11774
12543
|
const scratch1 = [];
|
|
11775
12544
|
const scratch2 = [];
|
|
11776
12545
|
const scratchVector12 = new Vector3();
|
|
11777
|
-
const
|
|
12546
|
+
const scratchVector26 = new Vector3();
|
|
11778
12547
|
for (let i2 = 0; i2 < instancesLength; i2++) {
|
|
11779
12548
|
let position;
|
|
11780
12549
|
if (featureTable.hasProperty("POSITION")) {
|
|
@@ -11785,7 +12554,7 @@
|
|
|
11785
12554
|
if (!quantizedVolumeOffset) {
|
|
11786
12555
|
throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
|
|
11787
12556
|
}
|
|
11788
|
-
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3,
|
|
12557
|
+
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3, scratchVector26);
|
|
11789
12558
|
if (!quantizedVolumeScale) {
|
|
11790
12559
|
throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
|
|
11791
12560
|
}
|
|
@@ -11924,7 +12693,7 @@
|
|
|
11924
12693
|
}
|
|
11925
12694
|
var init_parse_3d_tile = __esm({
|
|
11926
12695
|
"src/lib/parsers/parse-3d-tile.ts"() {
|
|
11927
|
-
|
|
12696
|
+
init_constants4();
|
|
11928
12697
|
init_parse_utils();
|
|
11929
12698
|
init_parse_3d_tile_point_cloud();
|
|
11930
12699
|
init_parse_3d_tile_batched_model();
|
|
@@ -12027,7 +12796,1260 @@
|
|
|
12027
12796
|
}
|
|
12028
12797
|
});
|
|
12029
12798
|
|
|
12799
|
+
// ../../node_modules/long/index.js
|
|
12800
|
+
function Long(low, high, unsigned) {
|
|
12801
|
+
this.low = low | 0;
|
|
12802
|
+
this.high = high | 0;
|
|
12803
|
+
this.unsigned = !!unsigned;
|
|
12804
|
+
}
|
|
12805
|
+
function isLong(obj) {
|
|
12806
|
+
return (obj && obj["__isLong__"]) === true;
|
|
12807
|
+
}
|
|
12808
|
+
function ctz32(value) {
|
|
12809
|
+
var c = Math.clz32(value & -value);
|
|
12810
|
+
return value ? 31 - c : c;
|
|
12811
|
+
}
|
|
12812
|
+
function fromInt(value, unsigned) {
|
|
12813
|
+
var obj, cachedObj, cache2;
|
|
12814
|
+
if (unsigned) {
|
|
12815
|
+
value >>>= 0;
|
|
12816
|
+
if (cache2 = 0 <= value && value < 256) {
|
|
12817
|
+
cachedObj = UINT_CACHE[value];
|
|
12818
|
+
if (cachedObj)
|
|
12819
|
+
return cachedObj;
|
|
12820
|
+
}
|
|
12821
|
+
obj = fromBits(value, 0, true);
|
|
12822
|
+
if (cache2)
|
|
12823
|
+
UINT_CACHE[value] = obj;
|
|
12824
|
+
return obj;
|
|
12825
|
+
} else {
|
|
12826
|
+
value |= 0;
|
|
12827
|
+
if (cache2 = -128 <= value && value < 128) {
|
|
12828
|
+
cachedObj = INT_CACHE[value];
|
|
12829
|
+
if (cachedObj)
|
|
12830
|
+
return cachedObj;
|
|
12831
|
+
}
|
|
12832
|
+
obj = fromBits(value, value < 0 ? -1 : 0, false);
|
|
12833
|
+
if (cache2)
|
|
12834
|
+
INT_CACHE[value] = obj;
|
|
12835
|
+
return obj;
|
|
12836
|
+
}
|
|
12837
|
+
}
|
|
12838
|
+
function fromNumber(value, unsigned) {
|
|
12839
|
+
if (isNaN(value))
|
|
12840
|
+
return unsigned ? UZERO : ZERO4;
|
|
12841
|
+
if (unsigned) {
|
|
12842
|
+
if (value < 0)
|
|
12843
|
+
return UZERO;
|
|
12844
|
+
if (value >= TWO_PWR_64_DBL)
|
|
12845
|
+
return MAX_UNSIGNED_VALUE;
|
|
12846
|
+
} else {
|
|
12847
|
+
if (value <= -TWO_PWR_63_DBL)
|
|
12848
|
+
return MIN_VALUE;
|
|
12849
|
+
if (value + 1 >= TWO_PWR_63_DBL)
|
|
12850
|
+
return MAX_VALUE;
|
|
12851
|
+
}
|
|
12852
|
+
if (value < 0)
|
|
12853
|
+
return fromNumber(-value, unsigned).neg();
|
|
12854
|
+
return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
|
|
12855
|
+
}
|
|
12856
|
+
function fromBits(lowBits, highBits, unsigned) {
|
|
12857
|
+
return new Long(lowBits, highBits, unsigned);
|
|
12858
|
+
}
|
|
12859
|
+
function fromString(str, unsigned, radix) {
|
|
12860
|
+
if (str.length === 0)
|
|
12861
|
+
throw Error("empty string");
|
|
12862
|
+
if (typeof unsigned === "number") {
|
|
12863
|
+
radix = unsigned;
|
|
12864
|
+
unsigned = false;
|
|
12865
|
+
} else {
|
|
12866
|
+
unsigned = !!unsigned;
|
|
12867
|
+
}
|
|
12868
|
+
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
|
12869
|
+
return unsigned ? UZERO : ZERO4;
|
|
12870
|
+
radix = radix || 10;
|
|
12871
|
+
if (radix < 2 || 36 < radix)
|
|
12872
|
+
throw RangeError("radix");
|
|
12873
|
+
var p2;
|
|
12874
|
+
if ((p2 = str.indexOf("-")) > 0)
|
|
12875
|
+
throw Error("interior hyphen");
|
|
12876
|
+
else if (p2 === 0) {
|
|
12877
|
+
return fromString(str.substring(1), unsigned, radix).neg();
|
|
12878
|
+
}
|
|
12879
|
+
var radixToPower = fromNumber(pow_dbl(radix, 8));
|
|
12880
|
+
var result = ZERO4;
|
|
12881
|
+
for (var i2 = 0; i2 < str.length; i2 += 8) {
|
|
12882
|
+
var size = Math.min(8, str.length - i2), value = parseInt(str.substring(i2, i2 + size), radix);
|
|
12883
|
+
if (size < 8) {
|
|
12884
|
+
var power = fromNumber(pow_dbl(radix, size));
|
|
12885
|
+
result = result.mul(power).add(fromNumber(value));
|
|
12886
|
+
} else {
|
|
12887
|
+
result = result.mul(radixToPower);
|
|
12888
|
+
result = result.add(fromNumber(value));
|
|
12889
|
+
}
|
|
12890
|
+
}
|
|
12891
|
+
result.unsigned = unsigned;
|
|
12892
|
+
return result;
|
|
12893
|
+
}
|
|
12894
|
+
function fromValue(val, unsigned) {
|
|
12895
|
+
if (typeof val === "number")
|
|
12896
|
+
return fromNumber(val, unsigned);
|
|
12897
|
+
if (typeof val === "string")
|
|
12898
|
+
return fromString(val, unsigned);
|
|
12899
|
+
return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned);
|
|
12900
|
+
}
|
|
12901
|
+
var wasm, INT_CACHE, UINT_CACHE, pow_dbl, TWO_PWR_16_DBL, TWO_PWR_24_DBL, TWO_PWR_32_DBL, TWO_PWR_64_DBL, TWO_PWR_63_DBL, TWO_PWR_24, ZERO4, UZERO, ONE, UONE, NEG_ONE, MAX_VALUE, MAX_UNSIGNED_VALUE, MIN_VALUE, LongPrototype, long_default;
|
|
12902
|
+
var init_long = __esm({
|
|
12903
|
+
"../../node_modules/long/index.js"() {
|
|
12904
|
+
wasm = null;
|
|
12905
|
+
try {
|
|
12906
|
+
wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
|
|
12907
|
+
0,
|
|
12908
|
+
97,
|
|
12909
|
+
115,
|
|
12910
|
+
109,
|
|
12911
|
+
1,
|
|
12912
|
+
0,
|
|
12913
|
+
0,
|
|
12914
|
+
0,
|
|
12915
|
+
1,
|
|
12916
|
+
13,
|
|
12917
|
+
2,
|
|
12918
|
+
96,
|
|
12919
|
+
0,
|
|
12920
|
+
1,
|
|
12921
|
+
127,
|
|
12922
|
+
96,
|
|
12923
|
+
4,
|
|
12924
|
+
127,
|
|
12925
|
+
127,
|
|
12926
|
+
127,
|
|
12927
|
+
127,
|
|
12928
|
+
1,
|
|
12929
|
+
127,
|
|
12930
|
+
3,
|
|
12931
|
+
7,
|
|
12932
|
+
6,
|
|
12933
|
+
0,
|
|
12934
|
+
1,
|
|
12935
|
+
1,
|
|
12936
|
+
1,
|
|
12937
|
+
1,
|
|
12938
|
+
1,
|
|
12939
|
+
6,
|
|
12940
|
+
6,
|
|
12941
|
+
1,
|
|
12942
|
+
127,
|
|
12943
|
+
1,
|
|
12944
|
+
65,
|
|
12945
|
+
0,
|
|
12946
|
+
11,
|
|
12947
|
+
7,
|
|
12948
|
+
50,
|
|
12949
|
+
6,
|
|
12950
|
+
3,
|
|
12951
|
+
109,
|
|
12952
|
+
117,
|
|
12953
|
+
108,
|
|
12954
|
+
0,
|
|
12955
|
+
1,
|
|
12956
|
+
5,
|
|
12957
|
+
100,
|
|
12958
|
+
105,
|
|
12959
|
+
118,
|
|
12960
|
+
95,
|
|
12961
|
+
115,
|
|
12962
|
+
0,
|
|
12963
|
+
2,
|
|
12964
|
+
5,
|
|
12965
|
+
100,
|
|
12966
|
+
105,
|
|
12967
|
+
118,
|
|
12968
|
+
95,
|
|
12969
|
+
117,
|
|
12970
|
+
0,
|
|
12971
|
+
3,
|
|
12972
|
+
5,
|
|
12973
|
+
114,
|
|
12974
|
+
101,
|
|
12975
|
+
109,
|
|
12976
|
+
95,
|
|
12977
|
+
115,
|
|
12978
|
+
0,
|
|
12979
|
+
4,
|
|
12980
|
+
5,
|
|
12981
|
+
114,
|
|
12982
|
+
101,
|
|
12983
|
+
109,
|
|
12984
|
+
95,
|
|
12985
|
+
117,
|
|
12986
|
+
0,
|
|
12987
|
+
5,
|
|
12988
|
+
8,
|
|
12989
|
+
103,
|
|
12990
|
+
101,
|
|
12991
|
+
116,
|
|
12992
|
+
95,
|
|
12993
|
+
104,
|
|
12994
|
+
105,
|
|
12995
|
+
103,
|
|
12996
|
+
104,
|
|
12997
|
+
0,
|
|
12998
|
+
0,
|
|
12999
|
+
10,
|
|
13000
|
+
191,
|
|
13001
|
+
1,
|
|
13002
|
+
6,
|
|
13003
|
+
4,
|
|
13004
|
+
0,
|
|
13005
|
+
35,
|
|
13006
|
+
0,
|
|
13007
|
+
11,
|
|
13008
|
+
36,
|
|
13009
|
+
1,
|
|
13010
|
+
1,
|
|
13011
|
+
126,
|
|
13012
|
+
32,
|
|
13013
|
+
0,
|
|
13014
|
+
173,
|
|
13015
|
+
32,
|
|
13016
|
+
1,
|
|
13017
|
+
173,
|
|
13018
|
+
66,
|
|
13019
|
+
32,
|
|
13020
|
+
134,
|
|
13021
|
+
132,
|
|
13022
|
+
32,
|
|
13023
|
+
2,
|
|
13024
|
+
173,
|
|
13025
|
+
32,
|
|
13026
|
+
3,
|
|
13027
|
+
173,
|
|
13028
|
+
66,
|
|
13029
|
+
32,
|
|
13030
|
+
134,
|
|
13031
|
+
132,
|
|
13032
|
+
126,
|
|
13033
|
+
34,
|
|
13034
|
+
4,
|
|
13035
|
+
66,
|
|
13036
|
+
32,
|
|
13037
|
+
135,
|
|
13038
|
+
167,
|
|
13039
|
+
36,
|
|
13040
|
+
0,
|
|
13041
|
+
32,
|
|
13042
|
+
4,
|
|
13043
|
+
167,
|
|
13044
|
+
11,
|
|
13045
|
+
36,
|
|
13046
|
+
1,
|
|
13047
|
+
1,
|
|
13048
|
+
126,
|
|
13049
|
+
32,
|
|
13050
|
+
0,
|
|
13051
|
+
173,
|
|
13052
|
+
32,
|
|
13053
|
+
1,
|
|
13054
|
+
173,
|
|
13055
|
+
66,
|
|
13056
|
+
32,
|
|
13057
|
+
134,
|
|
13058
|
+
132,
|
|
13059
|
+
32,
|
|
13060
|
+
2,
|
|
13061
|
+
173,
|
|
13062
|
+
32,
|
|
13063
|
+
3,
|
|
13064
|
+
173,
|
|
13065
|
+
66,
|
|
13066
|
+
32,
|
|
13067
|
+
134,
|
|
13068
|
+
132,
|
|
13069
|
+
127,
|
|
13070
|
+
34,
|
|
13071
|
+
4,
|
|
13072
|
+
66,
|
|
13073
|
+
32,
|
|
13074
|
+
135,
|
|
13075
|
+
167,
|
|
13076
|
+
36,
|
|
13077
|
+
0,
|
|
13078
|
+
32,
|
|
13079
|
+
4,
|
|
13080
|
+
167,
|
|
13081
|
+
11,
|
|
13082
|
+
36,
|
|
13083
|
+
1,
|
|
13084
|
+
1,
|
|
13085
|
+
126,
|
|
13086
|
+
32,
|
|
13087
|
+
0,
|
|
13088
|
+
173,
|
|
13089
|
+
32,
|
|
13090
|
+
1,
|
|
13091
|
+
173,
|
|
13092
|
+
66,
|
|
13093
|
+
32,
|
|
13094
|
+
134,
|
|
13095
|
+
132,
|
|
13096
|
+
32,
|
|
13097
|
+
2,
|
|
13098
|
+
173,
|
|
13099
|
+
32,
|
|
13100
|
+
3,
|
|
13101
|
+
173,
|
|
13102
|
+
66,
|
|
13103
|
+
32,
|
|
13104
|
+
134,
|
|
13105
|
+
132,
|
|
13106
|
+
128,
|
|
13107
|
+
34,
|
|
13108
|
+
4,
|
|
13109
|
+
66,
|
|
13110
|
+
32,
|
|
13111
|
+
135,
|
|
13112
|
+
167,
|
|
13113
|
+
36,
|
|
13114
|
+
0,
|
|
13115
|
+
32,
|
|
13116
|
+
4,
|
|
13117
|
+
167,
|
|
13118
|
+
11,
|
|
13119
|
+
36,
|
|
13120
|
+
1,
|
|
13121
|
+
1,
|
|
13122
|
+
126,
|
|
13123
|
+
32,
|
|
13124
|
+
0,
|
|
13125
|
+
173,
|
|
13126
|
+
32,
|
|
13127
|
+
1,
|
|
13128
|
+
173,
|
|
13129
|
+
66,
|
|
13130
|
+
32,
|
|
13131
|
+
134,
|
|
13132
|
+
132,
|
|
13133
|
+
32,
|
|
13134
|
+
2,
|
|
13135
|
+
173,
|
|
13136
|
+
32,
|
|
13137
|
+
3,
|
|
13138
|
+
173,
|
|
13139
|
+
66,
|
|
13140
|
+
32,
|
|
13141
|
+
134,
|
|
13142
|
+
132,
|
|
13143
|
+
129,
|
|
13144
|
+
34,
|
|
13145
|
+
4,
|
|
13146
|
+
66,
|
|
13147
|
+
32,
|
|
13148
|
+
135,
|
|
13149
|
+
167,
|
|
13150
|
+
36,
|
|
13151
|
+
0,
|
|
13152
|
+
32,
|
|
13153
|
+
4,
|
|
13154
|
+
167,
|
|
13155
|
+
11,
|
|
13156
|
+
36,
|
|
13157
|
+
1,
|
|
13158
|
+
1,
|
|
13159
|
+
126,
|
|
13160
|
+
32,
|
|
13161
|
+
0,
|
|
13162
|
+
173,
|
|
13163
|
+
32,
|
|
13164
|
+
1,
|
|
13165
|
+
173,
|
|
13166
|
+
66,
|
|
13167
|
+
32,
|
|
13168
|
+
134,
|
|
13169
|
+
132,
|
|
13170
|
+
32,
|
|
13171
|
+
2,
|
|
13172
|
+
173,
|
|
13173
|
+
32,
|
|
13174
|
+
3,
|
|
13175
|
+
173,
|
|
13176
|
+
66,
|
|
13177
|
+
32,
|
|
13178
|
+
134,
|
|
13179
|
+
132,
|
|
13180
|
+
130,
|
|
13181
|
+
34,
|
|
13182
|
+
4,
|
|
13183
|
+
66,
|
|
13184
|
+
32,
|
|
13185
|
+
135,
|
|
13186
|
+
167,
|
|
13187
|
+
36,
|
|
13188
|
+
0,
|
|
13189
|
+
32,
|
|
13190
|
+
4,
|
|
13191
|
+
167,
|
|
13192
|
+
11
|
|
13193
|
+
])), {}).exports;
|
|
13194
|
+
} catch (e) {
|
|
13195
|
+
}
|
|
13196
|
+
Long.prototype.__isLong__;
|
|
13197
|
+
Object.defineProperty(Long.prototype, "__isLong__", { value: true });
|
|
13198
|
+
Long.isLong = isLong;
|
|
13199
|
+
INT_CACHE = {};
|
|
13200
|
+
UINT_CACHE = {};
|
|
13201
|
+
Long.fromInt = fromInt;
|
|
13202
|
+
Long.fromNumber = fromNumber;
|
|
13203
|
+
Long.fromBits = fromBits;
|
|
13204
|
+
pow_dbl = Math.pow;
|
|
13205
|
+
Long.fromString = fromString;
|
|
13206
|
+
Long.fromValue = fromValue;
|
|
13207
|
+
TWO_PWR_16_DBL = 1 << 16;
|
|
13208
|
+
TWO_PWR_24_DBL = 1 << 24;
|
|
13209
|
+
TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
|
13210
|
+
TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
|
13211
|
+
TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
|
13212
|
+
TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
|
|
13213
|
+
ZERO4 = fromInt(0);
|
|
13214
|
+
Long.ZERO = ZERO4;
|
|
13215
|
+
UZERO = fromInt(0, true);
|
|
13216
|
+
Long.UZERO = UZERO;
|
|
13217
|
+
ONE = fromInt(1);
|
|
13218
|
+
Long.ONE = ONE;
|
|
13219
|
+
UONE = fromInt(1, true);
|
|
13220
|
+
Long.UONE = UONE;
|
|
13221
|
+
NEG_ONE = fromInt(-1);
|
|
13222
|
+
Long.NEG_ONE = NEG_ONE;
|
|
13223
|
+
MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false);
|
|
13224
|
+
Long.MAX_VALUE = MAX_VALUE;
|
|
13225
|
+
MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true);
|
|
13226
|
+
Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
|
|
13227
|
+
MIN_VALUE = fromBits(0, 2147483648 | 0, false);
|
|
13228
|
+
Long.MIN_VALUE = MIN_VALUE;
|
|
13229
|
+
LongPrototype = Long.prototype;
|
|
13230
|
+
LongPrototype.toInt = function toInt() {
|
|
13231
|
+
return this.unsigned ? this.low >>> 0 : this.low;
|
|
13232
|
+
};
|
|
13233
|
+
LongPrototype.toNumber = function toNumber() {
|
|
13234
|
+
if (this.unsigned)
|
|
13235
|
+
return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
13236
|
+
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
13237
|
+
};
|
|
13238
|
+
LongPrototype.toString = function toString(radix) {
|
|
13239
|
+
radix = radix || 10;
|
|
13240
|
+
if (radix < 2 || 36 < radix)
|
|
13241
|
+
throw RangeError("radix");
|
|
13242
|
+
if (this.isZero())
|
|
13243
|
+
return "0";
|
|
13244
|
+
if (this.isNegative()) {
|
|
13245
|
+
if (this.eq(MIN_VALUE)) {
|
|
13246
|
+
var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
|
|
13247
|
+
return div.toString(radix) + rem1.toInt().toString(radix);
|
|
13248
|
+
} else
|
|
13249
|
+
return "-" + this.neg().toString(radix);
|
|
13250
|
+
}
|
|
13251
|
+
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
|
|
13252
|
+
var result = "";
|
|
13253
|
+
while (true) {
|
|
13254
|
+
var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
|
|
13255
|
+
rem = remDiv;
|
|
13256
|
+
if (rem.isZero())
|
|
13257
|
+
return digits + result;
|
|
13258
|
+
else {
|
|
13259
|
+
while (digits.length < 6)
|
|
13260
|
+
digits = "0" + digits;
|
|
13261
|
+
result = "" + digits + result;
|
|
13262
|
+
}
|
|
13263
|
+
}
|
|
13264
|
+
};
|
|
13265
|
+
LongPrototype.getHighBits = function getHighBits() {
|
|
13266
|
+
return this.high;
|
|
13267
|
+
};
|
|
13268
|
+
LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
|
|
13269
|
+
return this.high >>> 0;
|
|
13270
|
+
};
|
|
13271
|
+
LongPrototype.getLowBits = function getLowBits() {
|
|
13272
|
+
return this.low;
|
|
13273
|
+
};
|
|
13274
|
+
LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
|
|
13275
|
+
return this.low >>> 0;
|
|
13276
|
+
};
|
|
13277
|
+
LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
|
|
13278
|
+
if (this.isNegative())
|
|
13279
|
+
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
|
|
13280
|
+
var val = this.high != 0 ? this.high : this.low;
|
|
13281
|
+
for (var bit = 31; bit > 0; bit--)
|
|
13282
|
+
if ((val & 1 << bit) != 0)
|
|
13283
|
+
break;
|
|
13284
|
+
return this.high != 0 ? bit + 33 : bit + 1;
|
|
13285
|
+
};
|
|
13286
|
+
LongPrototype.isZero = function isZero() {
|
|
13287
|
+
return this.high === 0 && this.low === 0;
|
|
13288
|
+
};
|
|
13289
|
+
LongPrototype.eqz = LongPrototype.isZero;
|
|
13290
|
+
LongPrototype.isNegative = function isNegative() {
|
|
13291
|
+
return !this.unsigned && this.high < 0;
|
|
13292
|
+
};
|
|
13293
|
+
LongPrototype.isPositive = function isPositive() {
|
|
13294
|
+
return this.unsigned || this.high >= 0;
|
|
13295
|
+
};
|
|
13296
|
+
LongPrototype.isOdd = function isOdd() {
|
|
13297
|
+
return (this.low & 1) === 1;
|
|
13298
|
+
};
|
|
13299
|
+
LongPrototype.isEven = function isEven() {
|
|
13300
|
+
return (this.low & 1) === 0;
|
|
13301
|
+
};
|
|
13302
|
+
LongPrototype.equals = function equals3(other) {
|
|
13303
|
+
if (!isLong(other))
|
|
13304
|
+
other = fromValue(other);
|
|
13305
|
+
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
|
|
13306
|
+
return false;
|
|
13307
|
+
return this.high === other.high && this.low === other.low;
|
|
13308
|
+
};
|
|
13309
|
+
LongPrototype.eq = LongPrototype.equals;
|
|
13310
|
+
LongPrototype.notEquals = function notEquals(other) {
|
|
13311
|
+
return !this.eq(other);
|
|
13312
|
+
};
|
|
13313
|
+
LongPrototype.neq = LongPrototype.notEquals;
|
|
13314
|
+
LongPrototype.ne = LongPrototype.notEquals;
|
|
13315
|
+
LongPrototype.lessThan = function lessThan(other) {
|
|
13316
|
+
return this.comp(other) < 0;
|
|
13317
|
+
};
|
|
13318
|
+
LongPrototype.lt = LongPrototype.lessThan;
|
|
13319
|
+
LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
|
|
13320
|
+
return this.comp(other) <= 0;
|
|
13321
|
+
};
|
|
13322
|
+
LongPrototype.lte = LongPrototype.lessThanOrEqual;
|
|
13323
|
+
LongPrototype.le = LongPrototype.lessThanOrEqual;
|
|
13324
|
+
LongPrototype.greaterThan = function greaterThan(other) {
|
|
13325
|
+
return this.comp(other) > 0;
|
|
13326
|
+
};
|
|
13327
|
+
LongPrototype.gt = LongPrototype.greaterThan;
|
|
13328
|
+
LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
13329
|
+
return this.comp(other) >= 0;
|
|
13330
|
+
};
|
|
13331
|
+
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
13332
|
+
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
13333
|
+
LongPrototype.compare = function compare(other) {
|
|
13334
|
+
if (!isLong(other))
|
|
13335
|
+
other = fromValue(other);
|
|
13336
|
+
if (this.eq(other))
|
|
13337
|
+
return 0;
|
|
13338
|
+
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
|
|
13339
|
+
if (thisNeg && !otherNeg)
|
|
13340
|
+
return -1;
|
|
13341
|
+
if (!thisNeg && otherNeg)
|
|
13342
|
+
return 1;
|
|
13343
|
+
if (!this.unsigned)
|
|
13344
|
+
return this.sub(other).isNegative() ? -1 : 1;
|
|
13345
|
+
return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
|
|
13346
|
+
};
|
|
13347
|
+
LongPrototype.comp = LongPrototype.compare;
|
|
13348
|
+
LongPrototype.negate = function negate() {
|
|
13349
|
+
if (!this.unsigned && this.eq(MIN_VALUE))
|
|
13350
|
+
return MIN_VALUE;
|
|
13351
|
+
return this.not().add(ONE);
|
|
13352
|
+
};
|
|
13353
|
+
LongPrototype.neg = LongPrototype.negate;
|
|
13354
|
+
LongPrototype.add = function add3(addend) {
|
|
13355
|
+
if (!isLong(addend))
|
|
13356
|
+
addend = fromValue(addend);
|
|
13357
|
+
var a48 = this.high >>> 16;
|
|
13358
|
+
var a32 = this.high & 65535;
|
|
13359
|
+
var a16 = this.low >>> 16;
|
|
13360
|
+
var a00 = this.low & 65535;
|
|
13361
|
+
var b48 = addend.high >>> 16;
|
|
13362
|
+
var b32 = addend.high & 65535;
|
|
13363
|
+
var b16 = addend.low >>> 16;
|
|
13364
|
+
var b00 = addend.low & 65535;
|
|
13365
|
+
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
13366
|
+
c00 += a00 + b00;
|
|
13367
|
+
c16 += c00 >>> 16;
|
|
13368
|
+
c00 &= 65535;
|
|
13369
|
+
c16 += a16 + b16;
|
|
13370
|
+
c32 += c16 >>> 16;
|
|
13371
|
+
c16 &= 65535;
|
|
13372
|
+
c32 += a32 + b32;
|
|
13373
|
+
c48 += c32 >>> 16;
|
|
13374
|
+
c32 &= 65535;
|
|
13375
|
+
c48 += a48 + b48;
|
|
13376
|
+
c48 &= 65535;
|
|
13377
|
+
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
13378
|
+
};
|
|
13379
|
+
LongPrototype.subtract = function subtract(subtrahend) {
|
|
13380
|
+
if (!isLong(subtrahend))
|
|
13381
|
+
subtrahend = fromValue(subtrahend);
|
|
13382
|
+
return this.add(subtrahend.neg());
|
|
13383
|
+
};
|
|
13384
|
+
LongPrototype.sub = LongPrototype.subtract;
|
|
13385
|
+
LongPrototype.multiply = function multiply4(multiplier) {
|
|
13386
|
+
if (this.isZero())
|
|
13387
|
+
return this;
|
|
13388
|
+
if (!isLong(multiplier))
|
|
13389
|
+
multiplier = fromValue(multiplier);
|
|
13390
|
+
if (wasm) {
|
|
13391
|
+
var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
|
|
13392
|
+
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
13393
|
+
}
|
|
13394
|
+
if (multiplier.isZero())
|
|
13395
|
+
return this.unsigned ? UZERO : ZERO4;
|
|
13396
|
+
if (this.eq(MIN_VALUE))
|
|
13397
|
+
return multiplier.isOdd() ? MIN_VALUE : ZERO4;
|
|
13398
|
+
if (multiplier.eq(MIN_VALUE))
|
|
13399
|
+
return this.isOdd() ? MIN_VALUE : ZERO4;
|
|
13400
|
+
if (this.isNegative()) {
|
|
13401
|
+
if (multiplier.isNegative())
|
|
13402
|
+
return this.neg().mul(multiplier.neg());
|
|
13403
|
+
else
|
|
13404
|
+
return this.neg().mul(multiplier).neg();
|
|
13405
|
+
} else if (multiplier.isNegative())
|
|
13406
|
+
return this.mul(multiplier.neg()).neg();
|
|
13407
|
+
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
|
|
13408
|
+
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
|
13409
|
+
var a48 = this.high >>> 16;
|
|
13410
|
+
var a32 = this.high & 65535;
|
|
13411
|
+
var a16 = this.low >>> 16;
|
|
13412
|
+
var a00 = this.low & 65535;
|
|
13413
|
+
var b48 = multiplier.high >>> 16;
|
|
13414
|
+
var b32 = multiplier.high & 65535;
|
|
13415
|
+
var b16 = multiplier.low >>> 16;
|
|
13416
|
+
var b00 = multiplier.low & 65535;
|
|
13417
|
+
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
13418
|
+
c00 += a00 * b00;
|
|
13419
|
+
c16 += c00 >>> 16;
|
|
13420
|
+
c00 &= 65535;
|
|
13421
|
+
c16 += a16 * b00;
|
|
13422
|
+
c32 += c16 >>> 16;
|
|
13423
|
+
c16 &= 65535;
|
|
13424
|
+
c16 += a00 * b16;
|
|
13425
|
+
c32 += c16 >>> 16;
|
|
13426
|
+
c16 &= 65535;
|
|
13427
|
+
c32 += a32 * b00;
|
|
13428
|
+
c48 += c32 >>> 16;
|
|
13429
|
+
c32 &= 65535;
|
|
13430
|
+
c32 += a16 * b16;
|
|
13431
|
+
c48 += c32 >>> 16;
|
|
13432
|
+
c32 &= 65535;
|
|
13433
|
+
c32 += a00 * b32;
|
|
13434
|
+
c48 += c32 >>> 16;
|
|
13435
|
+
c32 &= 65535;
|
|
13436
|
+
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
|
13437
|
+
c48 &= 65535;
|
|
13438
|
+
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
13439
|
+
};
|
|
13440
|
+
LongPrototype.mul = LongPrototype.multiply;
|
|
13441
|
+
LongPrototype.divide = function divide(divisor) {
|
|
13442
|
+
if (!isLong(divisor))
|
|
13443
|
+
divisor = fromValue(divisor);
|
|
13444
|
+
if (divisor.isZero())
|
|
13445
|
+
throw Error("division by zero");
|
|
13446
|
+
if (wasm) {
|
|
13447
|
+
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
|
|
13448
|
+
return this;
|
|
13449
|
+
}
|
|
13450
|
+
var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(this.low, this.high, divisor.low, divisor.high);
|
|
13451
|
+
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
13452
|
+
}
|
|
13453
|
+
if (this.isZero())
|
|
13454
|
+
return this.unsigned ? UZERO : ZERO4;
|
|
13455
|
+
var approx, rem, res;
|
|
13456
|
+
if (!this.unsigned) {
|
|
13457
|
+
if (this.eq(MIN_VALUE)) {
|
|
13458
|
+
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
|
|
13459
|
+
return MIN_VALUE;
|
|
13460
|
+
else if (divisor.eq(MIN_VALUE))
|
|
13461
|
+
return ONE;
|
|
13462
|
+
else {
|
|
13463
|
+
var halfThis = this.shr(1);
|
|
13464
|
+
approx = halfThis.div(divisor).shl(1);
|
|
13465
|
+
if (approx.eq(ZERO4)) {
|
|
13466
|
+
return divisor.isNegative() ? ONE : NEG_ONE;
|
|
13467
|
+
} else {
|
|
13468
|
+
rem = this.sub(divisor.mul(approx));
|
|
13469
|
+
res = approx.add(rem.div(divisor));
|
|
13470
|
+
return res;
|
|
13471
|
+
}
|
|
13472
|
+
}
|
|
13473
|
+
} else if (divisor.eq(MIN_VALUE))
|
|
13474
|
+
return this.unsigned ? UZERO : ZERO4;
|
|
13475
|
+
if (this.isNegative()) {
|
|
13476
|
+
if (divisor.isNegative())
|
|
13477
|
+
return this.neg().div(divisor.neg());
|
|
13478
|
+
return this.neg().div(divisor).neg();
|
|
13479
|
+
} else if (divisor.isNegative())
|
|
13480
|
+
return this.div(divisor.neg()).neg();
|
|
13481
|
+
res = ZERO4;
|
|
13482
|
+
} else {
|
|
13483
|
+
if (!divisor.unsigned)
|
|
13484
|
+
divisor = divisor.toUnsigned();
|
|
13485
|
+
if (divisor.gt(this))
|
|
13486
|
+
return UZERO;
|
|
13487
|
+
if (divisor.gt(this.shru(1)))
|
|
13488
|
+
return UONE;
|
|
13489
|
+
res = UZERO;
|
|
13490
|
+
}
|
|
13491
|
+
rem = this;
|
|
13492
|
+
while (rem.gte(divisor)) {
|
|
13493
|
+
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
|
13494
|
+
var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor);
|
|
13495
|
+
while (approxRem.isNegative() || approxRem.gt(rem)) {
|
|
13496
|
+
approx -= delta;
|
|
13497
|
+
approxRes = fromNumber(approx, this.unsigned);
|
|
13498
|
+
approxRem = approxRes.mul(divisor);
|
|
13499
|
+
}
|
|
13500
|
+
if (approxRes.isZero())
|
|
13501
|
+
approxRes = ONE;
|
|
13502
|
+
res = res.add(approxRes);
|
|
13503
|
+
rem = rem.sub(approxRem);
|
|
13504
|
+
}
|
|
13505
|
+
return res;
|
|
13506
|
+
};
|
|
13507
|
+
LongPrototype.div = LongPrototype.divide;
|
|
13508
|
+
LongPrototype.modulo = function modulo(divisor) {
|
|
13509
|
+
if (!isLong(divisor))
|
|
13510
|
+
divisor = fromValue(divisor);
|
|
13511
|
+
if (wasm) {
|
|
13512
|
+
var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(this.low, this.high, divisor.low, divisor.high);
|
|
13513
|
+
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
13514
|
+
}
|
|
13515
|
+
return this.sub(this.div(divisor).mul(divisor));
|
|
13516
|
+
};
|
|
13517
|
+
LongPrototype.mod = LongPrototype.modulo;
|
|
13518
|
+
LongPrototype.rem = LongPrototype.modulo;
|
|
13519
|
+
LongPrototype.not = function not() {
|
|
13520
|
+
return fromBits(~this.low, ~this.high, this.unsigned);
|
|
13521
|
+
};
|
|
13522
|
+
LongPrototype.countLeadingZeros = function countLeadingZeros() {
|
|
13523
|
+
return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
|
|
13524
|
+
};
|
|
13525
|
+
LongPrototype.clz = LongPrototype.countLeadingZeros;
|
|
13526
|
+
LongPrototype.countTrailingZeros = function countTrailingZeros() {
|
|
13527
|
+
return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
|
|
13528
|
+
};
|
|
13529
|
+
LongPrototype.ctz = LongPrototype.countTrailingZeros;
|
|
13530
|
+
LongPrototype.and = function and(other) {
|
|
13531
|
+
if (!isLong(other))
|
|
13532
|
+
other = fromValue(other);
|
|
13533
|
+
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
13534
|
+
};
|
|
13535
|
+
LongPrototype.or = function or(other) {
|
|
13536
|
+
if (!isLong(other))
|
|
13537
|
+
other = fromValue(other);
|
|
13538
|
+
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
13539
|
+
};
|
|
13540
|
+
LongPrototype.xor = function xor(other) {
|
|
13541
|
+
if (!isLong(other))
|
|
13542
|
+
other = fromValue(other);
|
|
13543
|
+
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
13544
|
+
};
|
|
13545
|
+
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
13546
|
+
if (isLong(numBits))
|
|
13547
|
+
numBits = numBits.toInt();
|
|
13548
|
+
if ((numBits &= 63) === 0)
|
|
13549
|
+
return this;
|
|
13550
|
+
else if (numBits < 32)
|
|
13551
|
+
return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);
|
|
13552
|
+
else
|
|
13553
|
+
return fromBits(0, this.low << numBits - 32, this.unsigned);
|
|
13554
|
+
};
|
|
13555
|
+
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
13556
|
+
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
13557
|
+
if (isLong(numBits))
|
|
13558
|
+
numBits = numBits.toInt();
|
|
13559
|
+
if ((numBits &= 63) === 0)
|
|
13560
|
+
return this;
|
|
13561
|
+
else if (numBits < 32)
|
|
13562
|
+
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);
|
|
13563
|
+
else
|
|
13564
|
+
return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
|
|
13565
|
+
};
|
|
13566
|
+
LongPrototype.shr = LongPrototype.shiftRight;
|
|
13567
|
+
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
13568
|
+
if (isLong(numBits))
|
|
13569
|
+
numBits = numBits.toInt();
|
|
13570
|
+
if ((numBits &= 63) === 0)
|
|
13571
|
+
return this;
|
|
13572
|
+
if (numBits < 32)
|
|
13573
|
+
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
|
|
13574
|
+
if (numBits === 32)
|
|
13575
|
+
return fromBits(this.high, 0, this.unsigned);
|
|
13576
|
+
return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
|
|
13577
|
+
};
|
|
13578
|
+
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
13579
|
+
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
13580
|
+
LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
13581
|
+
var b;
|
|
13582
|
+
if (isLong(numBits))
|
|
13583
|
+
numBits = numBits.toInt();
|
|
13584
|
+
if ((numBits &= 63) === 0)
|
|
13585
|
+
return this;
|
|
13586
|
+
if (numBits === 32)
|
|
13587
|
+
return fromBits(this.high, this.low, this.unsigned);
|
|
13588
|
+
if (numBits < 32) {
|
|
13589
|
+
b = 32 - numBits;
|
|
13590
|
+
return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
|
|
13591
|
+
}
|
|
13592
|
+
numBits -= 32;
|
|
13593
|
+
b = 32 - numBits;
|
|
13594
|
+
return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
|
|
13595
|
+
};
|
|
13596
|
+
LongPrototype.rotl = LongPrototype.rotateLeft;
|
|
13597
|
+
LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
13598
|
+
var b;
|
|
13599
|
+
if (isLong(numBits))
|
|
13600
|
+
numBits = numBits.toInt();
|
|
13601
|
+
if ((numBits &= 63) === 0)
|
|
13602
|
+
return this;
|
|
13603
|
+
if (numBits === 32)
|
|
13604
|
+
return fromBits(this.high, this.low, this.unsigned);
|
|
13605
|
+
if (numBits < 32) {
|
|
13606
|
+
b = 32 - numBits;
|
|
13607
|
+
return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
|
|
13608
|
+
}
|
|
13609
|
+
numBits -= 32;
|
|
13610
|
+
b = 32 - numBits;
|
|
13611
|
+
return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
|
|
13612
|
+
};
|
|
13613
|
+
LongPrototype.rotr = LongPrototype.rotateRight;
|
|
13614
|
+
LongPrototype.toSigned = function toSigned() {
|
|
13615
|
+
if (!this.unsigned)
|
|
13616
|
+
return this;
|
|
13617
|
+
return fromBits(this.low, this.high, false);
|
|
13618
|
+
};
|
|
13619
|
+
LongPrototype.toUnsigned = function toUnsigned() {
|
|
13620
|
+
if (this.unsigned)
|
|
13621
|
+
return this;
|
|
13622
|
+
return fromBits(this.low, this.high, true);
|
|
13623
|
+
};
|
|
13624
|
+
LongPrototype.toBytes = function toBytes(le) {
|
|
13625
|
+
return le ? this.toBytesLE() : this.toBytesBE();
|
|
13626
|
+
};
|
|
13627
|
+
LongPrototype.toBytesLE = function toBytesLE() {
|
|
13628
|
+
var hi = this.high, lo = this.low;
|
|
13629
|
+
return [
|
|
13630
|
+
lo & 255,
|
|
13631
|
+
lo >>> 8 & 255,
|
|
13632
|
+
lo >>> 16 & 255,
|
|
13633
|
+
lo >>> 24,
|
|
13634
|
+
hi & 255,
|
|
13635
|
+
hi >>> 8 & 255,
|
|
13636
|
+
hi >>> 16 & 255,
|
|
13637
|
+
hi >>> 24
|
|
13638
|
+
];
|
|
13639
|
+
};
|
|
13640
|
+
LongPrototype.toBytesBE = function toBytesBE() {
|
|
13641
|
+
var hi = this.high, lo = this.low;
|
|
13642
|
+
return [
|
|
13643
|
+
hi >>> 24,
|
|
13644
|
+
hi >>> 16 & 255,
|
|
13645
|
+
hi >>> 8 & 255,
|
|
13646
|
+
hi & 255,
|
|
13647
|
+
lo >>> 24,
|
|
13648
|
+
lo >>> 16 & 255,
|
|
13649
|
+
lo >>> 8 & 255,
|
|
13650
|
+
lo & 255
|
|
13651
|
+
];
|
|
13652
|
+
};
|
|
13653
|
+
Long.fromBytes = function fromBytes(bytes, unsigned, le) {
|
|
13654
|
+
return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
|
|
13655
|
+
};
|
|
13656
|
+
Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
|
|
13657
|
+
return new Long(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned);
|
|
13658
|
+
};
|
|
13659
|
+
Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
13660
|
+
return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
|
|
13661
|
+
};
|
|
13662
|
+
long_default = Long;
|
|
13663
|
+
}
|
|
13664
|
+
});
|
|
13665
|
+
|
|
13666
|
+
// src/lib/utils/s2/s2-token-functions.ts
|
|
13667
|
+
function getS2CellIdFromToken(token) {
|
|
13668
|
+
if (token === "X") {
|
|
13669
|
+
token = "";
|
|
13670
|
+
}
|
|
13671
|
+
const paddedToken = token.padEnd(MAXIMUM_TOKEN_LENGTH, "0");
|
|
13672
|
+
return long_default.fromString(paddedToken, true, 16);
|
|
13673
|
+
}
|
|
13674
|
+
function getS2TokenFromCellId(cellId) {
|
|
13675
|
+
if (cellId.isZero()) {
|
|
13676
|
+
return "X";
|
|
13677
|
+
}
|
|
13678
|
+
let numZeroDigits = cellId.countTrailingZeros();
|
|
13679
|
+
const remainder = numZeroDigits % 4;
|
|
13680
|
+
numZeroDigits = (numZeroDigits - remainder) / 4;
|
|
13681
|
+
const trailingZeroHexChars = numZeroDigits;
|
|
13682
|
+
numZeroDigits *= 4;
|
|
13683
|
+
const x = cellId.shiftRightUnsigned(numZeroDigits);
|
|
13684
|
+
const hexString = x.toString(16).replace(/0+$/, "");
|
|
13685
|
+
const zeroString = Array(17 - trailingZeroHexChars - hexString.length).join("0");
|
|
13686
|
+
return zeroString + hexString;
|
|
13687
|
+
}
|
|
13688
|
+
function getS2ChildCellId(cellId, index) {
|
|
13689
|
+
const newLsb = lsb(cellId).shiftRightUnsigned(2);
|
|
13690
|
+
const childCellId = cellId.add(long_default.fromNumber(2 * index + 1 - 4).multiply(newLsb));
|
|
13691
|
+
return childCellId;
|
|
13692
|
+
}
|
|
13693
|
+
function lsb(cellId) {
|
|
13694
|
+
return cellId.and(cellId.not().add(1));
|
|
13695
|
+
}
|
|
13696
|
+
var MAXIMUM_TOKEN_LENGTH;
|
|
13697
|
+
var init_s2_token_functions = __esm({
|
|
13698
|
+
"src/lib/utils/s2/s2-token-functions.ts"() {
|
|
13699
|
+
init_long();
|
|
13700
|
+
MAXIMUM_TOKEN_LENGTH = 16;
|
|
13701
|
+
}
|
|
13702
|
+
});
|
|
13703
|
+
|
|
13704
|
+
// src/lib/utils/s2/s2geometry/s2-geometry.ts
|
|
13705
|
+
function getS2CellFromQuadKey(hilbertQuadkey) {
|
|
13706
|
+
if (hilbertQuadkey.length === 0) {
|
|
13707
|
+
throw new Error(`Invalid Hilbert quad key ${hilbertQuadkey}`);
|
|
13708
|
+
}
|
|
13709
|
+
const parts = hilbertQuadkey.split("/");
|
|
13710
|
+
const face = parseInt(parts[0], 10);
|
|
13711
|
+
const position = parts[1];
|
|
13712
|
+
const maxLevel = position.length;
|
|
13713
|
+
let level = 0;
|
|
13714
|
+
const point = [0, 0];
|
|
13715
|
+
for (let i2 = maxLevel - 1; i2 >= 0; i2--) {
|
|
13716
|
+
level = maxLevel - i2;
|
|
13717
|
+
const bit = position[i2];
|
|
13718
|
+
let rx = 0;
|
|
13719
|
+
let ry = 0;
|
|
13720
|
+
if (bit === "1") {
|
|
13721
|
+
ry = 1;
|
|
13722
|
+
} else if (bit === "2") {
|
|
13723
|
+
rx = 1;
|
|
13724
|
+
ry = 1;
|
|
13725
|
+
} else if (bit === "3") {
|
|
13726
|
+
rx = 1;
|
|
13727
|
+
}
|
|
13728
|
+
const val = Math.pow(2, level - 1);
|
|
13729
|
+
rotateAndFlipQuadrant(val, point, rx, ry);
|
|
13730
|
+
point[0] += val * rx;
|
|
13731
|
+
point[1] += val * ry;
|
|
13732
|
+
}
|
|
13733
|
+
if (face % 2 === 1) {
|
|
13734
|
+
const t2 = point[0];
|
|
13735
|
+
point[0] = point[1];
|
|
13736
|
+
point[1] = t2;
|
|
13737
|
+
}
|
|
13738
|
+
return { face, ij: point, level };
|
|
13739
|
+
}
|
|
13740
|
+
function getS2QuadkeyFromCellId(cellId) {
|
|
13741
|
+
if (cellId.isZero()) {
|
|
13742
|
+
return "";
|
|
13743
|
+
}
|
|
13744
|
+
let bin = cellId.toString(2);
|
|
13745
|
+
while (bin.length < FACE_BITS + POS_BITS) {
|
|
13746
|
+
bin = "0" + bin;
|
|
13747
|
+
}
|
|
13748
|
+
const lsbIndex = bin.lastIndexOf("1");
|
|
13749
|
+
const faceB = bin.substring(0, 3);
|
|
13750
|
+
const posB = bin.substring(3, lsbIndex);
|
|
13751
|
+
const levelN = posB.length / 2;
|
|
13752
|
+
const faceS = long_default.fromString(faceB, true, 2).toString(10);
|
|
13753
|
+
let posS = "";
|
|
13754
|
+
if (levelN !== 0) {
|
|
13755
|
+
posS = long_default.fromString(posB, true, 2).toString(4);
|
|
13756
|
+
while (posS.length < levelN) {
|
|
13757
|
+
posS = "0" + posS;
|
|
13758
|
+
}
|
|
13759
|
+
}
|
|
13760
|
+
return `${faceS}/${posS}`;
|
|
13761
|
+
}
|
|
13762
|
+
function IJToST(ij, level, offsets) {
|
|
13763
|
+
const maxSize = 1 << level;
|
|
13764
|
+
return [(ij[0] + offsets[0]) / maxSize, (ij[1] + offsets[1]) / maxSize];
|
|
13765
|
+
}
|
|
13766
|
+
function singleSTtoUV(st) {
|
|
13767
|
+
if (st >= 0.5) {
|
|
13768
|
+
return 1 / 3 * (4 * st * st - 1);
|
|
13769
|
+
}
|
|
13770
|
+
return 1 / 3 * (1 - 4 * (1 - st) * (1 - st));
|
|
13771
|
+
}
|
|
13772
|
+
function STToUV(st) {
|
|
13773
|
+
return [singleSTtoUV(st[0]), singleSTtoUV(st[1])];
|
|
13774
|
+
}
|
|
13775
|
+
function FaceUVToXYZ(face, [u, v]) {
|
|
13776
|
+
switch (face) {
|
|
13777
|
+
case 0:
|
|
13778
|
+
return [1, u, v];
|
|
13779
|
+
case 1:
|
|
13780
|
+
return [-u, 1, v];
|
|
13781
|
+
case 2:
|
|
13782
|
+
return [-u, -v, 1];
|
|
13783
|
+
case 3:
|
|
13784
|
+
return [-1, -v, -u];
|
|
13785
|
+
case 4:
|
|
13786
|
+
return [v, -1, -u];
|
|
13787
|
+
case 5:
|
|
13788
|
+
return [v, u, -1];
|
|
13789
|
+
default:
|
|
13790
|
+
throw new Error("Invalid face");
|
|
13791
|
+
}
|
|
13792
|
+
}
|
|
13793
|
+
function XYZToLngLat([x, y, z]) {
|
|
13794
|
+
const lat = Math.atan2(z, Math.sqrt(x * x + y * y));
|
|
13795
|
+
const lng = Math.atan2(y, x);
|
|
13796
|
+
return [lng * RADIAN_TO_DEGREE, lat * RADIAN_TO_DEGREE];
|
|
13797
|
+
}
|
|
13798
|
+
function rotateAndFlipQuadrant(n2, point, rx, ry) {
|
|
13799
|
+
if (ry === 0) {
|
|
13800
|
+
if (rx === 1) {
|
|
13801
|
+
point[0] = n2 - 1 - point[0];
|
|
13802
|
+
point[1] = n2 - 1 - point[1];
|
|
13803
|
+
}
|
|
13804
|
+
const x = point[0];
|
|
13805
|
+
point[0] = point[1];
|
|
13806
|
+
point[1] = x;
|
|
13807
|
+
}
|
|
13808
|
+
}
|
|
13809
|
+
function getS2LngLatFromS2Cell(s2Cell) {
|
|
13810
|
+
const st = IJToST(s2Cell.ij, s2Cell.level, [0.5, 0.5]);
|
|
13811
|
+
const uv = STToUV(st);
|
|
13812
|
+
const xyz = FaceUVToXYZ(s2Cell.face, uv);
|
|
13813
|
+
return XYZToLngLat(xyz);
|
|
13814
|
+
}
|
|
13815
|
+
var FACE_BITS, MAX_LEVEL, POS_BITS, RADIAN_TO_DEGREE;
|
|
13816
|
+
var init_s2_geometry = __esm({
|
|
13817
|
+
"src/lib/utils/s2/s2geometry/s2-geometry.ts"() {
|
|
13818
|
+
init_long();
|
|
13819
|
+
FACE_BITS = 3;
|
|
13820
|
+
MAX_LEVEL = 30;
|
|
13821
|
+
POS_BITS = 2 * MAX_LEVEL + 1;
|
|
13822
|
+
RADIAN_TO_DEGREE = 180 / Math.PI;
|
|
13823
|
+
}
|
|
13824
|
+
});
|
|
13825
|
+
|
|
13826
|
+
// src/lib/utils/s2/converters/s2-to-boundary.ts
|
|
13827
|
+
function getS2BoundaryFlatFromS2Cell(s2cell) {
|
|
13828
|
+
const { face, ij, level } = s2cell;
|
|
13829
|
+
const offsets = [
|
|
13830
|
+
[0, 0],
|
|
13831
|
+
[0, 1],
|
|
13832
|
+
[1, 1],
|
|
13833
|
+
[1, 0],
|
|
13834
|
+
[0, 0]
|
|
13835
|
+
];
|
|
13836
|
+
const resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));
|
|
13837
|
+
const result = new Float64Array(4 * resolution * 2 + 2);
|
|
13838
|
+
let ptIndex = 0;
|
|
13839
|
+
let prevLng = 0;
|
|
13840
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
13841
|
+
const offset = offsets[i2].slice(0);
|
|
13842
|
+
const nextOffset = offsets[i2 + 1];
|
|
13843
|
+
const stepI = (nextOffset[0] - offset[0]) / resolution;
|
|
13844
|
+
const stepJ = (nextOffset[1] - offset[1]) / resolution;
|
|
13845
|
+
for (let j = 0; j < resolution; j++) {
|
|
13846
|
+
offset[0] += stepI;
|
|
13847
|
+
offset[1] += stepJ;
|
|
13848
|
+
const st = IJToST(ij, level, offset);
|
|
13849
|
+
const uv = STToUV(st);
|
|
13850
|
+
const xyz = FaceUVToXYZ(face, uv);
|
|
13851
|
+
const lngLat = XYZToLngLat(xyz);
|
|
13852
|
+
if (Math.abs(lngLat[1]) > 89.999) {
|
|
13853
|
+
lngLat[0] = prevLng;
|
|
13854
|
+
}
|
|
13855
|
+
const deltaLng = lngLat[0] - prevLng;
|
|
13856
|
+
lngLat[0] += deltaLng > 180 ? -360 : deltaLng < -180 ? 360 : 0;
|
|
13857
|
+
result[ptIndex++] = lngLat[0];
|
|
13858
|
+
result[ptIndex++] = lngLat[1];
|
|
13859
|
+
prevLng = lngLat[0];
|
|
13860
|
+
}
|
|
13861
|
+
}
|
|
13862
|
+
result[ptIndex++] = result[0];
|
|
13863
|
+
result[ptIndex++] = result[1];
|
|
13864
|
+
return result;
|
|
13865
|
+
}
|
|
13866
|
+
var MAX_RESOLUTION;
|
|
13867
|
+
var init_s2_to_boundary = __esm({
|
|
13868
|
+
"src/lib/utils/s2/converters/s2-to-boundary.ts"() {
|
|
13869
|
+
init_s2_geometry();
|
|
13870
|
+
MAX_RESOLUTION = 100;
|
|
13871
|
+
}
|
|
13872
|
+
});
|
|
13873
|
+
|
|
13874
|
+
// src/lib/utils/s2/s2geometry/s2-cell-utils.ts
|
|
13875
|
+
function getS2Cell(tokenOrKey) {
|
|
13876
|
+
const key = getS2QuadKey(tokenOrKey);
|
|
13877
|
+
const s2cell = getS2CellFromQuadKey(key);
|
|
13878
|
+
return s2cell;
|
|
13879
|
+
}
|
|
13880
|
+
function getS2QuadKey(tokenOrKey) {
|
|
13881
|
+
if (tokenOrKey.indexOf("/") > 0) {
|
|
13882
|
+
return tokenOrKey;
|
|
13883
|
+
}
|
|
13884
|
+
const id = getS2CellIdFromToken(tokenOrKey);
|
|
13885
|
+
return getS2QuadkeyFromCellId(id);
|
|
13886
|
+
}
|
|
13887
|
+
var init_s2_cell_utils = __esm({
|
|
13888
|
+
"src/lib/utils/s2/s2geometry/s2-cell-utils.ts"() {
|
|
13889
|
+
init_s2_geometry();
|
|
13890
|
+
init_s2_token_functions();
|
|
13891
|
+
}
|
|
13892
|
+
});
|
|
13893
|
+
|
|
13894
|
+
// src/lib/utils/s2/s2-geometry-functions.ts
|
|
13895
|
+
function getS2LngLat(s2Token) {
|
|
13896
|
+
const s2cell = getS2Cell(s2Token);
|
|
13897
|
+
return getS2LngLatFromS2Cell(s2cell);
|
|
13898
|
+
}
|
|
13899
|
+
var init_s2_geometry_functions = __esm({
|
|
13900
|
+
"src/lib/utils/s2/s2-geometry-functions.ts"() {
|
|
13901
|
+
init_s2_geometry();
|
|
13902
|
+
init_s2_cell_utils();
|
|
13903
|
+
}
|
|
13904
|
+
});
|
|
13905
|
+
|
|
13906
|
+
// src/lib/utils/s2/converters/s2-to-region.ts
|
|
13907
|
+
function getS2Region(s2cell) {
|
|
13908
|
+
let region;
|
|
13909
|
+
if (s2cell.face === 2 || s2cell.face === 5) {
|
|
13910
|
+
let corners = null;
|
|
13911
|
+
let len2 = 0;
|
|
13912
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
13913
|
+
const key = `${s2cell.face}/${i2}`;
|
|
13914
|
+
const cell = getS2Cell(key);
|
|
13915
|
+
const corns = getS2BoundaryFlatFromS2Cell(cell);
|
|
13916
|
+
if (typeof corners === "undefined" || corners === null)
|
|
13917
|
+
corners = new Float64Array(4 * corns.length);
|
|
13918
|
+
corners.set(corns, len2);
|
|
13919
|
+
len2 += corns.length;
|
|
13920
|
+
}
|
|
13921
|
+
region = get2DRegionFromS2Corners(corners);
|
|
13922
|
+
} else {
|
|
13923
|
+
const corners = getS2BoundaryFlatFromS2Cell(s2cell);
|
|
13924
|
+
region = get2DRegionFromS2Corners(corners);
|
|
13925
|
+
}
|
|
13926
|
+
return region;
|
|
13927
|
+
}
|
|
13928
|
+
function get2DRegionFromS2Corners(corners) {
|
|
13929
|
+
if (corners.length % 2 !== 0) {
|
|
13930
|
+
throw new Error("Invalid corners");
|
|
13931
|
+
}
|
|
13932
|
+
const longitudes = [];
|
|
13933
|
+
const latitudes = [];
|
|
13934
|
+
for (let i2 = 0; i2 < corners.length; i2 += 2) {
|
|
13935
|
+
longitudes.push(corners[i2]);
|
|
13936
|
+
latitudes.push(corners[i2 + 1]);
|
|
13937
|
+
}
|
|
13938
|
+
longitudes.sort((a2, b) => a2 - b);
|
|
13939
|
+
latitudes.sort((a2, b) => a2 - b);
|
|
13940
|
+
return {
|
|
13941
|
+
west: longitudes[0],
|
|
13942
|
+
east: longitudes[longitudes.length - 1],
|
|
13943
|
+
north: latitudes[latitudes.length - 1],
|
|
13944
|
+
south: latitudes[0]
|
|
13945
|
+
};
|
|
13946
|
+
}
|
|
13947
|
+
var init_s2_to_region = __esm({
|
|
13948
|
+
"src/lib/utils/s2/converters/s2-to-region.ts"() {
|
|
13949
|
+
init_s2_to_boundary();
|
|
13950
|
+
init_s2_cell_utils();
|
|
13951
|
+
}
|
|
13952
|
+
});
|
|
13953
|
+
|
|
13954
|
+
// src/lib/utils/s2/converters/s2-to-obb-points.ts
|
|
13955
|
+
function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, heightInfo) {
|
|
13956
|
+
const min = heightInfo?.minimumHeight || 0;
|
|
13957
|
+
const max = heightInfo?.maximumHeight || 0;
|
|
13958
|
+
const s2cell = getS2Cell(tokenOrKey);
|
|
13959
|
+
const region = getS2Region(s2cell);
|
|
13960
|
+
const W = region.west;
|
|
13961
|
+
const S = region.south;
|
|
13962
|
+
const E = region.east;
|
|
13963
|
+
const N = region.north;
|
|
13964
|
+
const points = [];
|
|
13965
|
+
points.push(new Vector3(W, N, min));
|
|
13966
|
+
points.push(new Vector3(E, N, min));
|
|
13967
|
+
points.push(new Vector3(E, S, min));
|
|
13968
|
+
points.push(new Vector3(W, S, min));
|
|
13969
|
+
points.push(new Vector3(W, N, max));
|
|
13970
|
+
points.push(new Vector3(E, N, max));
|
|
13971
|
+
points.push(new Vector3(E, S, max));
|
|
13972
|
+
points.push(new Vector3(W, S, max));
|
|
13973
|
+
return points;
|
|
13974
|
+
}
|
|
13975
|
+
var init_s2_to_obb_points = __esm({
|
|
13976
|
+
"src/lib/utils/s2/converters/s2-to-obb-points.ts"() {
|
|
13977
|
+
init_s2_cell_utils();
|
|
13978
|
+
init_s2_to_region();
|
|
13979
|
+
init_esm();
|
|
13980
|
+
}
|
|
13981
|
+
});
|
|
13982
|
+
|
|
13983
|
+
// src/lib/utils/s2/index.ts
|
|
13984
|
+
var init_s2 = __esm({
|
|
13985
|
+
"src/lib/utils/s2/index.ts"() {
|
|
13986
|
+
init_s2_token_functions();
|
|
13987
|
+
init_s2_geometry_functions();
|
|
13988
|
+
init_s2_to_obb_points();
|
|
13989
|
+
}
|
|
13990
|
+
});
|
|
13991
|
+
|
|
13992
|
+
// src/lib/utils/obb/s2-corners-to-obb.ts
|
|
13993
|
+
function convertS2BoundingVolumetoOBB(s2VolumeInfo) {
|
|
13994
|
+
const token = s2VolumeInfo.token;
|
|
13995
|
+
const heightInfo = {
|
|
13996
|
+
minimumHeight: s2VolumeInfo.minimumHeight,
|
|
13997
|
+
maximumHeight: s2VolumeInfo.maximumHeight
|
|
13998
|
+
};
|
|
13999
|
+
const corners = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);
|
|
14000
|
+
const center = getS2LngLat(token);
|
|
14001
|
+
const centerLng = center[0];
|
|
14002
|
+
const centerLat = center[1];
|
|
14003
|
+
const point = Ellipsoid.WGS84.cartographicToCartesian([
|
|
14004
|
+
centerLng,
|
|
14005
|
+
centerLat,
|
|
14006
|
+
heightInfo.maximumHeight
|
|
14007
|
+
]);
|
|
14008
|
+
const centerPointAdditional = new Vector3(point[0], point[1], point[2]);
|
|
14009
|
+
corners.push(centerPointAdditional);
|
|
14010
|
+
const obb = makeOrientedBoundingBoxFromPoints(corners);
|
|
14011
|
+
const box = [...obb.center, ...obb.halfAxes];
|
|
14012
|
+
return box;
|
|
14013
|
+
}
|
|
14014
|
+
var init_s2_corners_to_obb = __esm({
|
|
14015
|
+
"src/lib/utils/obb/s2-corners-to-obb.ts"() {
|
|
14016
|
+
init_esm();
|
|
14017
|
+
init_esm3();
|
|
14018
|
+
init_s2();
|
|
14019
|
+
init_s2();
|
|
14020
|
+
init_esm2();
|
|
14021
|
+
}
|
|
14022
|
+
});
|
|
14023
|
+
|
|
12030
14024
|
// src/lib/parsers/helpers/parse-3d-implicit-tiles.ts
|
|
14025
|
+
function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
|
|
14026
|
+
if (s2VolumeBox?.box) {
|
|
14027
|
+
const cellId = getS2CellIdFromToken(s2VolumeBox.s2VolumeInfo.token);
|
|
14028
|
+
const childCellId = getS2ChildCellId(cellId, index);
|
|
14029
|
+
const childToken = getS2TokenFromCellId(childCellId);
|
|
14030
|
+
const s2ChildVolumeInfo = { ...s2VolumeBox.s2VolumeInfo };
|
|
14031
|
+
s2ChildVolumeInfo.token = childToken;
|
|
14032
|
+
switch (subdivisionScheme) {
|
|
14033
|
+
case "OCTREE":
|
|
14034
|
+
const s2VolumeInfo = s2VolumeBox.s2VolumeInfo;
|
|
14035
|
+
const delta = s2VolumeInfo.maximumHeight - s2VolumeInfo.minimumHeight;
|
|
14036
|
+
const sizeZ = delta / 2;
|
|
14037
|
+
const midZ = s2VolumeInfo.minimumHeight + delta / 2;
|
|
14038
|
+
s2VolumeInfo.minimumHeight = midZ - sizeZ;
|
|
14039
|
+
s2VolumeInfo.maximumHeight = midZ + sizeZ;
|
|
14040
|
+
break;
|
|
14041
|
+
default:
|
|
14042
|
+
break;
|
|
14043
|
+
}
|
|
14044
|
+
const box = convertS2BoundingVolumetoOBB(s2ChildVolumeInfo);
|
|
14045
|
+
const childS2VolumeBox = {
|
|
14046
|
+
box,
|
|
14047
|
+
s2VolumeInfo: s2ChildVolumeInfo
|
|
14048
|
+
};
|
|
14049
|
+
return childS2VolumeBox;
|
|
14050
|
+
}
|
|
14051
|
+
return void 0;
|
|
14052
|
+
}
|
|
12031
14053
|
async function parseImplicitTiles(params) {
|
|
12032
14054
|
const {
|
|
12033
14055
|
options,
|
|
@@ -12044,7 +14066,8 @@
|
|
|
12044
14066
|
x: 0,
|
|
12045
14067
|
y: 0,
|
|
12046
14068
|
z: 0
|
|
12047
|
-
}
|
|
14069
|
+
},
|
|
14070
|
+
s2VolumeBox
|
|
12048
14071
|
} = params;
|
|
12049
14072
|
let { subtree, level = 0 } = params;
|
|
12050
14073
|
const {
|
|
@@ -12102,18 +14125,20 @@
|
|
|
12102
14125
|
const childTileLevel = level + 1;
|
|
12103
14126
|
const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
|
|
12104
14127
|
for (let index = 0; index < childrenPerTile; index++) {
|
|
12105
|
-
const
|
|
14128
|
+
const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
|
|
14129
|
+
const childTileParsed = await parseImplicitTiles({
|
|
12106
14130
|
subtree,
|
|
12107
14131
|
options,
|
|
12108
14132
|
parentData: pData,
|
|
12109
14133
|
childIndex: index,
|
|
12110
14134
|
level: childTileLevel,
|
|
12111
|
-
globalData
|
|
14135
|
+
globalData,
|
|
14136
|
+
s2VolumeBox: childS2VolumeBox
|
|
12112
14137
|
});
|
|
12113
|
-
if (
|
|
14138
|
+
if (childTileParsed.contentUrl || childTileParsed.children.length) {
|
|
12114
14139
|
const globalLevel = lev + 1;
|
|
12115
14140
|
const childCoordinates = { childTileX, childTileY, childTileZ };
|
|
12116
|
-
const formattedTile = formatTileData(
|
|
14141
|
+
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, options, s2VolumeBox);
|
|
12117
14142
|
tile.children.push(formattedTile);
|
|
12118
14143
|
}
|
|
12119
14144
|
}
|
|
@@ -12128,7 +14153,7 @@
|
|
|
12128
14153
|
}
|
|
12129
14154
|
return false;
|
|
12130
14155
|
}
|
|
12131
|
-
function formatTileData(tile, level, childCoordinates, options) {
|
|
14156
|
+
function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
|
|
12132
14157
|
const {
|
|
12133
14158
|
basePath,
|
|
12134
14159
|
refine,
|
|
@@ -12140,7 +14165,8 @@
|
|
|
12140
14165
|
} = options;
|
|
12141
14166
|
const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
|
|
12142
14167
|
const lodMetricValue = rootLodMetricValue / 2 ** level;
|
|
12143
|
-
const boundingVolume =
|
|
14168
|
+
const boundingVolume = s2VolumeBox?.box ? { box: s2VolumeBox.box } : rootBoundingVolume;
|
|
14169
|
+
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(level, boundingVolume, childCoordinates);
|
|
12144
14170
|
return {
|
|
12145
14171
|
children: tile.children,
|
|
12146
14172
|
contentUrl: tile.contentUrl,
|
|
@@ -12152,7 +14178,7 @@
|
|
|
12152
14178
|
lodMetricValue,
|
|
12153
14179
|
geometricError: lodMetricValue,
|
|
12154
14180
|
transform: tile.transform,
|
|
12155
|
-
boundingVolume
|
|
14181
|
+
boundingVolume: boundingVolumeForChildTile
|
|
12156
14182
|
};
|
|
12157
14183
|
}
|
|
12158
14184
|
function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoordinates) {
|
|
@@ -12173,8 +14199,10 @@
|
|
|
12173
14199
|
region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
|
|
12174
14200
|
};
|
|
12175
14201
|
}
|
|
12176
|
-
|
|
12177
|
-
|
|
14202
|
+
if (rootBoundingVolume.box) {
|
|
14203
|
+
return rootBoundingVolume;
|
|
14204
|
+
}
|
|
14205
|
+
throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
|
|
12178
14206
|
}
|
|
12179
14207
|
function concatBits(first, second) {
|
|
12180
14208
|
return parseInt(first.toString(2) + second.toString(2), 2);
|
|
@@ -12201,6 +14229,8 @@
|
|
|
12201
14229
|
"src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"() {
|
|
12202
14230
|
init_tile_3d_subtree_loader();
|
|
12203
14231
|
init_src3();
|
|
14232
|
+
init_s2();
|
|
14233
|
+
init_s2_corners_to_obb();
|
|
12204
14234
|
QUADTREE_DEVISION_COUNT = 4;
|
|
12205
14235
|
OCTREE_DEVISION_COUNT = 8;
|
|
12206
14236
|
SUBDIVISION_COUNT_MAP = {
|
|
@@ -12307,6 +14337,12 @@
|
|
|
12307
14337
|
const contentUrlTemplate = resolveUri(tile.content.uri, basePath);
|
|
12308
14338
|
const refine = tileset?.root?.refine;
|
|
12309
14339
|
const rootLodMetricValue = tile.geometricError;
|
|
14340
|
+
const s2VolumeInfo = tile.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];
|
|
14341
|
+
if (s2VolumeInfo) {
|
|
14342
|
+
const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);
|
|
14343
|
+
const s2VolumeBox = { box, s2VolumeInfo };
|
|
14344
|
+
tile.boundingVolume = s2VolumeBox;
|
|
14345
|
+
}
|
|
12310
14346
|
const rootBoundingVolume = tile.boundingVolume;
|
|
12311
14347
|
const implicitOptions = {
|
|
12312
14348
|
contentUrlTemplate,
|
|
@@ -12331,7 +14367,11 @@
|
|
|
12331
14367
|
tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
12332
14368
|
tile.lodMetricValue = tile.geometricError;
|
|
12333
14369
|
tile.transformMatrix = tile.transform;
|
|
12334
|
-
const { children, contentUrl } = await parseImplicitTiles({
|
|
14370
|
+
const { children, contentUrl } = await parseImplicitTiles({
|
|
14371
|
+
subtree: rootSubtree,
|
|
14372
|
+
options,
|
|
14373
|
+
s2VolumeBox: tile
|
|
14374
|
+
});
|
|
12335
14375
|
if (contentUrl) {
|
|
12336
14376
|
tile.contentUrl = contentUrl;
|
|
12337
14377
|
tile.content = { uri: contentUrl.replace(`${options.basePath}/`, "") };
|
|
@@ -12351,6 +14391,7 @@
|
|
|
12351
14391
|
init_src3();
|
|
12352
14392
|
init_src4();
|
|
12353
14393
|
init_parse_3d_implicit_tiles();
|
|
14394
|
+
init_s2_corners_to_obb();
|
|
12354
14395
|
}
|
|
12355
14396
|
});
|
|
12356
14397
|
|
|
@@ -12563,7 +14604,7 @@
|
|
|
12563
14604
|
}
|
|
12564
14605
|
var init_encode_3d_tile_composite = __esm({
|
|
12565
14606
|
"src/lib/encoders/encode-3d-tile-composite.ts"() {
|
|
12566
|
-
|
|
14607
|
+
init_constants4();
|
|
12567
14608
|
init_encode_3d_tile_header();
|
|
12568
14609
|
}
|
|
12569
14610
|
});
|
|
@@ -12602,7 +14643,7 @@
|
|
|
12602
14643
|
var init_encode_3d_tile_batched_model = __esm({
|
|
12603
14644
|
"src/lib/encoders/encode-3d-tile-batched-model.ts"() {
|
|
12604
14645
|
init_src2();
|
|
12605
|
-
|
|
14646
|
+
init_constants4();
|
|
12606
14647
|
init_encode_3d_tile_header();
|
|
12607
14648
|
}
|
|
12608
14649
|
});
|
|
@@ -12636,7 +14677,7 @@
|
|
|
12636
14677
|
var init_encode_3d_tile_instanced_model = __esm({
|
|
12637
14678
|
"src/lib/encoders/encode-3d-tile-instanced-model.ts"() {
|
|
12638
14679
|
init_src2();
|
|
12639
|
-
|
|
14680
|
+
init_constants4();
|
|
12640
14681
|
init_encode_3d_tile_header();
|
|
12641
14682
|
}
|
|
12642
14683
|
});
|
|
@@ -12667,7 +14708,7 @@
|
|
|
12667
14708
|
var DEFAULT_FEATURE_TABLE_JSON;
|
|
12668
14709
|
var init_encode_3d_tile_point_cloud = __esm({
|
|
12669
14710
|
"src/lib/encoders/encode-3d-tile-point-cloud.ts"() {
|
|
12670
|
-
|
|
14711
|
+
init_constants4();
|
|
12671
14712
|
init_encode_3d_tile_header();
|
|
12672
14713
|
init_src2();
|
|
12673
14714
|
DEFAULT_FEATURE_TABLE_JSON = {
|
|
@@ -12704,7 +14745,7 @@
|
|
|
12704
14745
|
}
|
|
12705
14746
|
var init_encode_3d_tile = __esm({
|
|
12706
14747
|
"src/lib/encoders/encode-3d-tile.ts"() {
|
|
12707
|
-
|
|
14748
|
+
init_constants4();
|
|
12708
14749
|
init_src2();
|
|
12709
14750
|
init_encode_3d_tile_composite();
|
|
12710
14751
|
init_encode_3d_tile_batched_model();
|
|
@@ -12758,7 +14799,7 @@
|
|
|
12758
14799
|
init_tile_3d_writer();
|
|
12759
14800
|
init_tile_3d_feature_table();
|
|
12760
14801
|
init_tile_3d_batch_table();
|
|
12761
|
-
|
|
14802
|
+
init_constants4();
|
|
12762
14803
|
init_ion();
|
|
12763
14804
|
}
|
|
12764
14805
|
});
|
|
@@ -12773,3 +14814,22 @@
|
|
|
12773
14814
|
});
|
|
12774
14815
|
require_bundle();
|
|
12775
14816
|
})();
|
|
14817
|
+
/**
|
|
14818
|
+
* @license
|
|
14819
|
+
* Copyright 2009 The Closure Library Authors
|
|
14820
|
+
* Copyright 2020 Daniel Wirtz / The long.js Authors.
|
|
14821
|
+
*
|
|
14822
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14823
|
+
* you may not use this file except in compliance with the License.
|
|
14824
|
+
* You may obtain a copy of the License at
|
|
14825
|
+
*
|
|
14826
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14827
|
+
*
|
|
14828
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14829
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14830
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14831
|
+
* See the License for the specific language governing permissions and
|
|
14832
|
+
* limitations under the License.
|
|
14833
|
+
*
|
|
14834
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14835
|
+
*/
|