@loaders.gl/3d-tiles 3.4.0-alpha.1 → 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 +2337 -284
- 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/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/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
|
@@ -751,46 +751,7 @@
|
|
|
751
751
|
}
|
|
752
752
|
});
|
|
753
753
|
|
|
754
|
-
// ../loader-utils/src/lib/binary-utils/buffer-utils.ts
|
|
755
|
-
function isBuffer(value) {
|
|
756
|
-
return value && typeof value === "object" && value.isBuffer;
|
|
757
|
-
}
|
|
758
|
-
function bufferToArrayBuffer(buffer) {
|
|
759
|
-
if (isBuffer(buffer)) {
|
|
760
|
-
const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
|
|
761
|
-
return typedArray.slice().buffer;
|
|
762
|
-
}
|
|
763
|
-
return buffer;
|
|
764
|
-
}
|
|
765
|
-
var init_buffer_utils = __esm({
|
|
766
|
-
"../loader-utils/src/lib/binary-utils/buffer-utils.ts"() {
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
|
|
770
754
|
// ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
|
|
771
|
-
function toArrayBuffer(data) {
|
|
772
|
-
if (isBuffer(data)) {
|
|
773
|
-
return bufferToArrayBuffer(data);
|
|
774
|
-
}
|
|
775
|
-
if (data instanceof ArrayBuffer) {
|
|
776
|
-
return data;
|
|
777
|
-
}
|
|
778
|
-
if (ArrayBuffer.isView(data)) {
|
|
779
|
-
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
780
|
-
return data.buffer;
|
|
781
|
-
}
|
|
782
|
-
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
783
|
-
}
|
|
784
|
-
if (typeof data === "string") {
|
|
785
|
-
const text = data;
|
|
786
|
-
const uint8Array = new TextEncoder().encode(text);
|
|
787
|
-
return uint8Array.buffer;
|
|
788
|
-
}
|
|
789
|
-
if (data && typeof data === "object" && data._toArrayBuffer) {
|
|
790
|
-
return data._toArrayBuffer();
|
|
791
|
-
}
|
|
792
|
-
throw new Error("toArrayBuffer");
|
|
793
|
-
}
|
|
794
755
|
function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
795
756
|
byteLength = byteLength || arrayBuffer1.byteLength;
|
|
796
757
|
if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
|
|
@@ -823,7 +784,6 @@
|
|
|
823
784
|
}
|
|
824
785
|
var init_array_buffer_utils = __esm({
|
|
825
786
|
"../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
|
|
826
|
-
init_buffer_utils();
|
|
827
787
|
}
|
|
828
788
|
});
|
|
829
789
|
|
|
@@ -851,34 +811,7 @@
|
|
|
851
811
|
}
|
|
852
812
|
});
|
|
853
813
|
|
|
854
|
-
// ../loader-utils/src/lib/binary-utils/
|
|
855
|
-
function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
|
|
856
|
-
const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
|
|
857
|
-
const padLength = paddedLength - sourceBuffer.byteLength;
|
|
858
|
-
if (dataView) {
|
|
859
|
-
const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
|
|
860
|
-
const sourceArray = new Uint8Array(sourceBuffer);
|
|
861
|
-
targetArray.set(sourceArray);
|
|
862
|
-
for (let i2 = 0; i2 < padLength; ++i2) {
|
|
863
|
-
dataView.setUint8(byteOffset + sourceBuffer.byteLength + i2, 32);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
byteOffset += paddedLength;
|
|
867
|
-
return byteOffset;
|
|
868
|
-
}
|
|
869
|
-
function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
|
|
870
|
-
const textEncoder = new TextEncoder();
|
|
871
|
-
const stringBuffer = textEncoder.encode(string);
|
|
872
|
-
byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
|
|
873
|
-
return byteOffset;
|
|
874
|
-
}
|
|
875
|
-
var init_binary_copy_utils = __esm({
|
|
876
|
-
"../loader-utils/src/lib/binary-utils/binary-copy-utils.ts"() {
|
|
877
|
-
init_memory_copy_utils();
|
|
878
|
-
}
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
// ../loader-utils/src/lib/binary-utils/encode-utils.ts
|
|
814
|
+
// ../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts
|
|
882
815
|
function padStringToByteAlignment(string, byteAlignment) {
|
|
883
816
|
const length4 = string.length;
|
|
884
817
|
const paddedLength = Math.ceil(length4 / byteAlignment) * byteAlignment;
|
|
@@ -905,8 +838,29 @@
|
|
|
905
838
|
}
|
|
906
839
|
return byteOffset + byteLength;
|
|
907
840
|
}
|
|
908
|
-
|
|
909
|
-
|
|
841
|
+
function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
|
|
842
|
+
const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
|
|
843
|
+
const padLength = paddedLength - sourceBuffer.byteLength;
|
|
844
|
+
if (dataView) {
|
|
845
|
+
const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
|
|
846
|
+
const sourceArray = new Uint8Array(sourceBuffer);
|
|
847
|
+
targetArray.set(sourceArray);
|
|
848
|
+
for (let i2 = 0; i2 < padLength; ++i2) {
|
|
849
|
+
dataView.setUint8(byteOffset + sourceBuffer.byteLength + i2, 32);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
byteOffset += paddedLength;
|
|
853
|
+
return byteOffset;
|
|
854
|
+
}
|
|
855
|
+
function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
|
|
856
|
+
const textEncoder = new TextEncoder();
|
|
857
|
+
const stringBuffer = textEncoder.encode(string);
|
|
858
|
+
byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
|
|
859
|
+
return byteOffset;
|
|
860
|
+
}
|
|
861
|
+
var init_dataview_copy_utils = __esm({
|
|
862
|
+
"../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts"() {
|
|
863
|
+
init_memory_copy_utils();
|
|
910
864
|
}
|
|
911
865
|
});
|
|
912
866
|
|
|
@@ -964,6 +918,48 @@
|
|
|
964
918
|
}
|
|
965
919
|
});
|
|
966
920
|
|
|
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"() {
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
|
|
930
|
+
// ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
|
|
931
|
+
function isBuffer(value) {
|
|
932
|
+
return value && typeof value === "object" && value.isBuffer;
|
|
933
|
+
}
|
|
934
|
+
function toArrayBuffer2(data) {
|
|
935
|
+
if (isBuffer(data)) {
|
|
936
|
+
return toArrayBuffer(data);
|
|
937
|
+
}
|
|
938
|
+
if (data instanceof ArrayBuffer) {
|
|
939
|
+
return data;
|
|
940
|
+
}
|
|
941
|
+
if (ArrayBuffer.isView(data)) {
|
|
942
|
+
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
943
|
+
return data.buffer;
|
|
944
|
+
}
|
|
945
|
+
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
946
|
+
}
|
|
947
|
+
if (typeof data === "string") {
|
|
948
|
+
const text = data;
|
|
949
|
+
const uint8Array = new TextEncoder().encode(text);
|
|
950
|
+
return uint8Array.buffer;
|
|
951
|
+
}
|
|
952
|
+
if (data && typeof data === "object" && data._toArrayBuffer) {
|
|
953
|
+
return data._toArrayBuffer();
|
|
954
|
+
}
|
|
955
|
+
throw new Error("toArrayBuffer");
|
|
956
|
+
}
|
|
957
|
+
var init_memory_conversion_utils = __esm({
|
|
958
|
+
"../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
|
|
959
|
+
init_buffer_browser();
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
|
|
967
963
|
// ../loader-utils/src/lib/path-utils/path.ts
|
|
968
964
|
var path_exports = {};
|
|
969
965
|
__export(path_exports, {
|
|
@@ -1006,10 +1002,10 @@
|
|
|
1006
1002
|
init_parse_json();
|
|
1007
1003
|
init_array_buffer_utils();
|
|
1008
1004
|
init_memory_copy_utils();
|
|
1009
|
-
|
|
1010
|
-
init_encode_utils();
|
|
1005
|
+
init_dataview_copy_utils();
|
|
1011
1006
|
init_async_iteration();
|
|
1012
1007
|
init_file_aliases();
|
|
1008
|
+
init_memory_conversion_utils();
|
|
1013
1009
|
init_path();
|
|
1014
1010
|
}
|
|
1015
1011
|
});
|
|
@@ -2830,6 +2826,21 @@
|
|
|
2830
2826
|
out[7] = a13 * c - a03 * s2;
|
|
2831
2827
|
return out;
|
|
2832
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
|
+
}
|
|
2833
2844
|
function fromQuat2(out, q) {
|
|
2834
2845
|
var x = q[0], y = q[1], z = q[2], w = q[3];
|
|
2835
2846
|
var x2 = x + x;
|
|
@@ -4413,6 +4424,716 @@
|
|
|
4413
4424
|
}
|
|
4414
4425
|
});
|
|
4415
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
|
+
|
|
4416
5137
|
// ../core/src/javascript-utils/is-type.ts
|
|
4417
5138
|
var isBoolean, isFunction, isObject, isPureObject, isIterable, isAsyncIterable, isResponse, isBlob, isBuffer2, isReadableDOMStream, isReadableNodeStream, isReadableStream;
|
|
4418
5139
|
var init_is_type = __esm({
|
|
@@ -4611,12 +5332,12 @@
|
|
|
4611
5332
|
}
|
|
4612
5333
|
});
|
|
4613
5334
|
|
|
4614
|
-
//
|
|
5335
|
+
// ../core/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
4615
5336
|
function isElectron(mockUserAgent) {
|
|
4616
5337
|
if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
|
|
4617
5338
|
return true;
|
|
4618
5339
|
}
|
|
4619
|
-
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions
|
|
5340
|
+
if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
|
|
4620
5341
|
return true;
|
|
4621
5342
|
}
|
|
4622
5343
|
const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
|
|
@@ -4627,59 +5348,54 @@
|
|
|
4627
5348
|
return false;
|
|
4628
5349
|
}
|
|
4629
5350
|
var init_is_electron = __esm({
|
|
4630
|
-
"
|
|
5351
|
+
"../core/node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
|
|
4631
5352
|
}
|
|
4632
5353
|
});
|
|
4633
5354
|
|
|
4634
|
-
//
|
|
5355
|
+
// ../core/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
4635
5356
|
function isBrowser3() {
|
|
4636
5357
|
const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
|
|
4637
5358
|
return !isNode || isElectron();
|
|
4638
5359
|
}
|
|
4639
5360
|
var init_is_browser = __esm({
|
|
4640
|
-
"
|
|
5361
|
+
"../core/node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
|
|
4641
5362
|
init_is_electron();
|
|
4642
5363
|
}
|
|
4643
5364
|
});
|
|
4644
5365
|
|
|
4645
|
-
//
|
|
4646
|
-
var
|
|
5366
|
+
// ../core/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
5367
|
+
var self2, window2, document2, process2, console2, navigator2;
|
|
4647
5368
|
var init_globals3 = __esm({
|
|
4648
|
-
"
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
};
|
|
4656
|
-
self_3 = globals3.self || globals3.window || globals3.global;
|
|
4657
|
-
window_3 = globals3.window || globals3.self || globals3.global;
|
|
4658
|
-
document_3 = globals3.document || {};
|
|
4659
|
-
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 || {};
|
|
4660
5376
|
}
|
|
4661
5377
|
});
|
|
4662
5378
|
|
|
4663
|
-
//
|
|
5379
|
+
// ../core/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
4664
5380
|
var VERSION3, isBrowser4;
|
|
4665
5381
|
var init_globals4 = __esm({
|
|
4666
|
-
"
|
|
5382
|
+
"../core/node_modules/@probe.gl/env/dist/utils/globals.js"() {
|
|
4667
5383
|
init_is_browser();
|
|
4668
5384
|
VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
4669
5385
|
isBrowser4 = isBrowser3();
|
|
4670
5386
|
}
|
|
4671
5387
|
});
|
|
4672
5388
|
|
|
4673
|
-
//
|
|
4674
|
-
var
|
|
4675
|
-
"
|
|
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"() {
|
|
4676
5392
|
init_globals4();
|
|
4677
5393
|
init_globals3();
|
|
4678
5394
|
init_is_browser();
|
|
4679
5395
|
}
|
|
4680
5396
|
});
|
|
4681
5397
|
|
|
4682
|
-
//
|
|
5398
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
4683
5399
|
function getStorage(type) {
|
|
4684
5400
|
try {
|
|
4685
5401
|
const storage = window[type];
|
|
@@ -4693,35 +5409,28 @@
|
|
|
4693
5409
|
}
|
|
4694
5410
|
var LocalStorage;
|
|
4695
5411
|
var init_local_storage = __esm({
|
|
4696
|
-
"
|
|
5412
|
+
"../core/node_modules/@probe.gl/log/dist/utils/local-storage.js"() {
|
|
4697
5413
|
init_defineProperty();
|
|
4698
5414
|
LocalStorage = class {
|
|
4699
|
-
constructor(id) {
|
|
4700
|
-
let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
5415
|
+
constructor(id, defaultConfig) {
|
|
4701
5416
|
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
4702
5417
|
_defineProperty(this, "storage", void 0);
|
|
4703
5418
|
_defineProperty(this, "id", void 0);
|
|
4704
|
-
_defineProperty(this, "config",
|
|
5419
|
+
_defineProperty(this, "config", void 0);
|
|
4705
5420
|
this.storage = getStorage(type);
|
|
4706
5421
|
this.id = id;
|
|
4707
|
-
this.config =
|
|
4708
|
-
Object.assign(this.config, defaultSettings);
|
|
5422
|
+
this.config = defaultConfig;
|
|
4709
5423
|
this._loadConfiguration();
|
|
4710
5424
|
}
|
|
4711
5425
|
getConfiguration() {
|
|
4712
5426
|
return this.config;
|
|
4713
5427
|
}
|
|
4714
5428
|
setConfiguration(configuration) {
|
|
4715
|
-
this.config = {};
|
|
4716
|
-
return this.updateConfiguration(configuration);
|
|
4717
|
-
}
|
|
4718
|
-
updateConfiguration(configuration) {
|
|
4719
5429
|
Object.assign(this.config, configuration);
|
|
4720
5430
|
if (this.storage) {
|
|
4721
5431
|
const serialized = JSON.stringify(this.config);
|
|
4722
5432
|
this.storage.setItem(this.id, serialized);
|
|
4723
5433
|
}
|
|
4724
|
-
return this;
|
|
4725
5434
|
}
|
|
4726
5435
|
_loadConfiguration() {
|
|
4727
5436
|
let configuration = {};
|
|
@@ -4736,7 +5445,7 @@
|
|
|
4736
5445
|
}
|
|
4737
5446
|
});
|
|
4738
5447
|
|
|
4739
|
-
//
|
|
5448
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/formatters.js
|
|
4740
5449
|
function formatTime(ms) {
|
|
4741
5450
|
let formatted;
|
|
4742
5451
|
if (ms < 10) {
|
|
@@ -4767,31 +5476,35 @@
|
|
|
4767
5476
|
return ["".concat(message, " %c+"), style];
|
|
4768
5477
|
}
|
|
4769
5478
|
var init_formatters = __esm({
|
|
4770
|
-
"
|
|
5479
|
+
"../core/node_modules/@probe.gl/log/dist/utils/formatters.js"() {
|
|
4771
5480
|
}
|
|
4772
5481
|
});
|
|
4773
5482
|
|
|
4774
|
-
//
|
|
5483
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/color.js
|
|
4775
5484
|
function getColor(color) {
|
|
4776
|
-
|
|
5485
|
+
if (typeof color !== "string") {
|
|
5486
|
+
return color;
|
|
5487
|
+
}
|
|
5488
|
+
color = color.toUpperCase();
|
|
5489
|
+
return COLOR[color] || COLOR.WHITE;
|
|
4777
5490
|
}
|
|
4778
5491
|
function addColor(string, color, background) {
|
|
4779
5492
|
if (!isBrowser3 && typeof string === "string") {
|
|
4780
5493
|
if (color) {
|
|
4781
|
-
|
|
4782
|
-
string = "[".concat(
|
|
5494
|
+
const colorCode = getColor(color);
|
|
5495
|
+
string = "[".concat(colorCode, "m").concat(string, "[39m");
|
|
4783
5496
|
}
|
|
4784
5497
|
if (background) {
|
|
4785
|
-
|
|
4786
|
-
string = "[".concat(
|
|
5498
|
+
const colorCode = getColor(background);
|
|
5499
|
+
string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "[49m");
|
|
4787
5500
|
}
|
|
4788
5501
|
}
|
|
4789
5502
|
return string;
|
|
4790
5503
|
}
|
|
4791
|
-
var COLOR;
|
|
5504
|
+
var COLOR, BACKGROUND_INCREMENT;
|
|
4792
5505
|
var init_color = __esm({
|
|
4793
|
-
"
|
|
4794
|
-
|
|
5506
|
+
"../core/node_modules/@probe.gl/log/dist/utils/color.js"() {
|
|
5507
|
+
init_dist();
|
|
4795
5508
|
(function(COLOR2) {
|
|
4796
5509
|
COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
|
|
4797
5510
|
COLOR2[COLOR2["RED"] = 31] = "RED";
|
|
@@ -4810,47 +5523,50 @@
|
|
|
4810
5523
|
COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
|
|
4811
5524
|
COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
|
|
4812
5525
|
})(COLOR || (COLOR = {}));
|
|
5526
|
+
BACKGROUND_INCREMENT = 10;
|
|
4813
5527
|
}
|
|
4814
5528
|
});
|
|
4815
5529
|
|
|
4816
|
-
//
|
|
5530
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
4817
5531
|
function autobind(obj) {
|
|
4818
5532
|
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
4819
5533
|
const proto = Object.getPrototypeOf(obj);
|
|
4820
5534
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
5535
|
+
const object = obj;
|
|
4821
5536
|
for (const key of propNames) {
|
|
4822
|
-
|
|
5537
|
+
const value = object[key];
|
|
5538
|
+
if (typeof value === "function") {
|
|
4823
5539
|
if (!predefined.find((name10) => key === name10)) {
|
|
4824
|
-
|
|
5540
|
+
object[key] = value.bind(obj);
|
|
4825
5541
|
}
|
|
4826
5542
|
}
|
|
4827
5543
|
}
|
|
4828
5544
|
}
|
|
4829
5545
|
var init_autobind = __esm({
|
|
4830
|
-
"
|
|
5546
|
+
"../core/node_modules/@probe.gl/log/dist/utils/autobind.js"() {
|
|
4831
5547
|
}
|
|
4832
5548
|
});
|
|
4833
5549
|
|
|
4834
|
-
//
|
|
5550
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/assert.js
|
|
4835
5551
|
function assert5(condition, message) {
|
|
4836
5552
|
if (!condition) {
|
|
4837
5553
|
throw new Error(message || "Assertion failed");
|
|
4838
5554
|
}
|
|
4839
5555
|
}
|
|
4840
5556
|
var init_assert4 = __esm({
|
|
4841
|
-
"
|
|
5557
|
+
"../core/node_modules/@probe.gl/log/dist/utils/assert.js"() {
|
|
4842
5558
|
}
|
|
4843
5559
|
});
|
|
4844
5560
|
|
|
4845
|
-
//
|
|
5561
|
+
// ../core/node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
|
|
4846
5562
|
function getHiResTimestamp() {
|
|
4847
5563
|
let timestamp;
|
|
4848
|
-
if (isBrowser3 &&
|
|
5564
|
+
if (isBrowser3() && window2.performance) {
|
|
4849
5565
|
var _window$performance, _window$performance$n;
|
|
4850
|
-
timestamp =
|
|
4851
|
-
} 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) {
|
|
4852
5568
|
var _process$hrtime;
|
|
4853
|
-
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);
|
|
4854
5570
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
4855
5571
|
} else {
|
|
4856
5572
|
timestamp = Date.now();
|
|
@@ -4858,18 +5574,12 @@
|
|
|
4858
5574
|
return timestamp;
|
|
4859
5575
|
}
|
|
4860
5576
|
var init_hi_res_timestamp = __esm({
|
|
4861
|
-
"
|
|
4862
|
-
|
|
5577
|
+
"../core/node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
|
|
5578
|
+
init_dist();
|
|
4863
5579
|
}
|
|
4864
5580
|
});
|
|
4865
5581
|
|
|
4866
|
-
//
|
|
4867
|
-
var init_node_asciify_image = __esm({
|
|
4868
|
-
"(disabled):../../node_modules/@probe.gl/log/dist/esm/node/node-asciify-image"() {
|
|
4869
|
-
}
|
|
4870
|
-
});
|
|
4871
|
-
|
|
4872
|
-
// ../../node_modules/@probe.gl/log/dist/esm/log.js
|
|
5582
|
+
// ../core/node_modules/@probe.gl/log/dist/log.js
|
|
4873
5583
|
function noop() {
|
|
4874
5584
|
}
|
|
4875
5585
|
function normalizeLogLevel(logLevel) {
|
|
@@ -4935,11 +5645,7 @@
|
|
|
4935
5645
|
message = "",
|
|
4936
5646
|
scale: scale5 = 1
|
|
4937
5647
|
} = _ref2;
|
|
4938
|
-
|
|
4939
|
-
image,
|
|
4940
|
-
message,
|
|
4941
|
-
scale: scale5
|
|
4942
|
-
});
|
|
5648
|
+
console.warn("removed");
|
|
4943
5649
|
return noop;
|
|
4944
5650
|
}
|
|
4945
5651
|
function logImageInBrowser(_ref3) {
|
|
@@ -4978,26 +5684,25 @@
|
|
|
4978
5684
|
}
|
|
4979
5685
|
return "empty";
|
|
4980
5686
|
}
|
|
4981
|
-
var originalConsole,
|
|
5687
|
+
var originalConsole, DEFAULT_LOG_CONFIGURATION, cache, ONCE, Log;
|
|
4982
5688
|
var init_log = __esm({
|
|
4983
|
-
"
|
|
5689
|
+
"../core/node_modules/@probe.gl/log/dist/log.js"() {
|
|
4984
5690
|
init_defineProperty();
|
|
4985
|
-
|
|
5691
|
+
init_dist();
|
|
4986
5692
|
init_local_storage();
|
|
4987
5693
|
init_formatters();
|
|
4988
5694
|
init_color();
|
|
4989
5695
|
init_autobind();
|
|
4990
5696
|
init_assert4();
|
|
4991
5697
|
init_hi_res_timestamp();
|
|
4992
|
-
init_node_asciify_image();
|
|
4993
5698
|
originalConsole = {
|
|
4994
|
-
debug: isBrowser3 ? console.debug || console.log : console.log,
|
|
5699
|
+
debug: isBrowser3() ? console.debug || console.log : console.log,
|
|
4995
5700
|
log: console.log,
|
|
4996
5701
|
info: console.info,
|
|
4997
5702
|
warn: console.warn,
|
|
4998
5703
|
error: console.error
|
|
4999
5704
|
};
|
|
5000
|
-
|
|
5705
|
+
DEFAULT_LOG_CONFIGURATION = {
|
|
5001
5706
|
enabled: true,
|
|
5002
5707
|
level: 0
|
|
5003
5708
|
};
|
|
@@ -5020,8 +5725,8 @@
|
|
|
5020
5725
|
_defineProperty(this, "userData", {});
|
|
5021
5726
|
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
5022
5727
|
this.id = id;
|
|
5023
|
-
this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
|
|
5024
5728
|
this.userData = {};
|
|
5729
|
+
this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
|
|
5025
5730
|
this.timeStamp("".concat(this.id, " started"));
|
|
5026
5731
|
autobind(this);
|
|
5027
5732
|
Object.seal(this);
|
|
@@ -5055,13 +5760,13 @@
|
|
|
5055
5760
|
}
|
|
5056
5761
|
enable() {
|
|
5057
5762
|
let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
5058
|
-
this._storage.
|
|
5763
|
+
this._storage.setConfiguration({
|
|
5059
5764
|
enabled
|
|
5060
5765
|
});
|
|
5061
5766
|
return this;
|
|
5062
5767
|
}
|
|
5063
5768
|
setLevel(level) {
|
|
5064
|
-
this._storage.
|
|
5769
|
+
this._storage.setConfiguration({
|
|
5065
5770
|
level
|
|
5066
5771
|
});
|
|
5067
5772
|
return this;
|
|
@@ -5070,7 +5775,7 @@
|
|
|
5070
5775
|
return this._storage.config[setting];
|
|
5071
5776
|
}
|
|
5072
5777
|
set(setting, value) {
|
|
5073
|
-
this._storage.
|
|
5778
|
+
this._storage.setConfiguration({
|
|
5074
5779
|
[setting]: value
|
|
5075
5780
|
});
|
|
5076
5781
|
}
|
|
@@ -5109,9 +5814,6 @@
|
|
|
5109
5814
|
return this._getLogFunction(logLevel, message, console.info, arguments);
|
|
5110
5815
|
}
|
|
5111
5816
|
once(logLevel, message) {
|
|
5112
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
5113
|
-
args[_key - 2] = arguments[_key];
|
|
5114
|
-
}
|
|
5115
5817
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
5116
5818
|
}
|
|
5117
5819
|
table(logLevel, table, columns) {
|
|
@@ -5133,7 +5835,7 @@
|
|
|
5133
5835
|
if (!this._shouldLog(logLevel || priority)) {
|
|
5134
5836
|
return noop;
|
|
5135
5837
|
}
|
|
5136
|
-
return isBrowser3 ? logImageInBrowser({
|
|
5838
|
+
return isBrowser3() ? logImageInBrowser({
|
|
5137
5839
|
image,
|
|
5138
5840
|
message,
|
|
5139
5841
|
scale: scale5
|
|
@@ -5206,7 +5908,7 @@
|
|
|
5206
5908
|
opts.delta = this.getDelta();
|
|
5207
5909
|
this._deltaTs = getHiResTimestamp();
|
|
5208
5910
|
const tag = opts.tag || opts.message;
|
|
5209
|
-
if (opts.once) {
|
|
5911
|
+
if (opts.once && tag) {
|
|
5210
5912
|
if (!cache[tag]) {
|
|
5211
5913
|
cache[tag] = getHiResTimestamp();
|
|
5212
5914
|
} else {
|
|
@@ -5223,13 +5925,13 @@
|
|
|
5223
5925
|
}
|
|
5224
5926
|
});
|
|
5225
5927
|
|
|
5226
|
-
//
|
|
5227
|
-
var
|
|
5228
|
-
var
|
|
5229
|
-
"
|
|
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"() {
|
|
5230
5932
|
init_log();
|
|
5231
5933
|
init_log();
|
|
5232
|
-
|
|
5934
|
+
dist_default = new Log({
|
|
5233
5935
|
id: "@probe.gl/log"
|
|
5234
5936
|
});
|
|
5235
5937
|
}
|
|
@@ -5239,7 +5941,7 @@
|
|
|
5239
5941
|
var probeLog, NullLog, ConsoleLog;
|
|
5240
5942
|
var init_loggers = __esm({
|
|
5241
5943
|
"../core/src/lib/loader-utils/loggers.ts"() {
|
|
5242
|
-
|
|
5944
|
+
init_dist2();
|
|
5243
5945
|
probeLog = new Log({ id: "loaders.gl" });
|
|
5244
5946
|
NullLog = class {
|
|
5245
5947
|
log() {
|
|
@@ -5337,20 +6039,6 @@
|
|
|
5337
6039
|
validateOptions(options, loaders);
|
|
5338
6040
|
return normalizeOptionsInternal(loader, options, url);
|
|
5339
6041
|
}
|
|
5340
|
-
function getFetchFunction(options, context) {
|
|
5341
|
-
const globalOptions = getGlobalLoaderOptions();
|
|
5342
|
-
const fetchOptions = options || globalOptions;
|
|
5343
|
-
if (typeof fetchOptions.fetch === "function") {
|
|
5344
|
-
return fetchOptions.fetch;
|
|
5345
|
-
}
|
|
5346
|
-
if (isObject(fetchOptions.fetch)) {
|
|
5347
|
-
return (url) => fetchFile(url, fetchOptions);
|
|
5348
|
-
}
|
|
5349
|
-
if (context?.fetch) {
|
|
5350
|
-
return context?.fetch;
|
|
5351
|
-
}
|
|
5352
|
-
return fetchFile;
|
|
5353
|
-
}
|
|
5354
6042
|
function validateOptions(options, loaders) {
|
|
5355
6043
|
validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
|
|
5356
6044
|
for (const loader of loaders) {
|
|
@@ -5429,7 +6117,6 @@
|
|
|
5429
6117
|
var init_option_utils = __esm({
|
|
5430
6118
|
"../core/src/lib/loader-utils/option-utils.ts"() {
|
|
5431
6119
|
init_is_type();
|
|
5432
|
-
init_fetch_file();
|
|
5433
6120
|
init_loggers();
|
|
5434
6121
|
init_option_defaults();
|
|
5435
6122
|
getGlobalLoaderOptions = () => {
|
|
@@ -5497,7 +6184,7 @@
|
|
|
5497
6184
|
var log;
|
|
5498
6185
|
var init_log2 = __esm({
|
|
5499
6186
|
"../core/src/lib/utils/log.ts"() {
|
|
5500
|
-
|
|
6187
|
+
init_dist2();
|
|
5501
6188
|
log = new Log({ id: "loaders.gl" });
|
|
5502
6189
|
}
|
|
5503
6190
|
});
|
|
@@ -5770,7 +6457,7 @@
|
|
|
5770
6457
|
if (done) {
|
|
5771
6458
|
return;
|
|
5772
6459
|
}
|
|
5773
|
-
yield
|
|
6460
|
+
yield toArrayBuffer2(value);
|
|
5774
6461
|
}
|
|
5775
6462
|
} catch (error) {
|
|
5776
6463
|
reader.releaseLock();
|
|
@@ -5778,7 +6465,7 @@
|
|
|
5778
6465
|
}
|
|
5779
6466
|
async function* makeNodeStreamIterator(stream, options) {
|
|
5780
6467
|
for await (const chunk of stream) {
|
|
5781
|
-
yield
|
|
6468
|
+
yield toArrayBuffer2(chunk);
|
|
5782
6469
|
}
|
|
5783
6470
|
}
|
|
5784
6471
|
var init_make_stream_iterator = __esm({
|
|
@@ -5879,6 +6566,29 @@
|
|
|
5879
6566
|
}
|
|
5880
6567
|
});
|
|
5881
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
|
+
|
|
5882
6592
|
// ../core/src/lib/loader-utils/loader-context.ts
|
|
5883
6593
|
function getLoaderContext(context, options, previousContext = null) {
|
|
5884
6594
|
if (previousContext) {
|
|
@@ -5909,7 +6619,7 @@
|
|
|
5909
6619
|
}
|
|
5910
6620
|
var init_loader_context = __esm({
|
|
5911
6621
|
"../core/src/lib/loader-utils/loader-context.ts"() {
|
|
5912
|
-
|
|
6622
|
+
init_get_fetch_function();
|
|
5913
6623
|
}
|
|
5914
6624
|
});
|
|
5915
6625
|
|
|
@@ -5994,7 +6704,7 @@
|
|
|
5994
6704
|
"../core/src/lib/api/load.ts"() {
|
|
5995
6705
|
init_is_type();
|
|
5996
6706
|
init_normalize_loader();
|
|
5997
|
-
|
|
6707
|
+
init_get_fetch_function();
|
|
5998
6708
|
init_parse();
|
|
5999
6709
|
}
|
|
6000
6710
|
});
|
|
@@ -6009,7 +6719,7 @@
|
|
|
6009
6719
|
|
|
6010
6720
|
// ../tiles/src/constants.ts
|
|
6011
6721
|
var TILE_REFINEMENT, TILE_TYPE, TILESET_TYPE, LOD_METRIC_TYPE;
|
|
6012
|
-
var
|
|
6722
|
+
var init_constants3 = __esm({
|
|
6013
6723
|
"../tiles/src/constants.ts"() {
|
|
6014
6724
|
TILE_REFINEMENT = {
|
|
6015
6725
|
ADD: 1,
|
|
@@ -6035,7 +6745,7 @@
|
|
|
6035
6745
|
// ../tiles/src/index.ts
|
|
6036
6746
|
var init_src4 = __esm({
|
|
6037
6747
|
"../tiles/src/index.ts"() {
|
|
6038
|
-
|
|
6748
|
+
init_constants3();
|
|
6039
6749
|
}
|
|
6040
6750
|
});
|
|
6041
6751
|
|
|
@@ -6049,7 +6759,7 @@
|
|
|
6049
6759
|
|
|
6050
6760
|
// src/lib/constants.ts
|
|
6051
6761
|
var TILE3D_TYPE, TILE3D_TYPES, MAGIC_ARRAY;
|
|
6052
|
-
var
|
|
6762
|
+
var init_constants4 = __esm({
|
|
6053
6763
|
"src/lib/constants.ts"() {
|
|
6054
6764
|
TILE3D_TYPE = {
|
|
6055
6765
|
COMPOSITE: "cmpt",
|
|
@@ -7172,7 +7882,7 @@
|
|
|
7172
7882
|
|
|
7173
7883
|
// ../math/src/geometry/constants.ts
|
|
7174
7884
|
var GL_PRIMITIVE_MODE, GL_TYPE, GL2;
|
|
7175
|
-
var
|
|
7885
|
+
var init_constants5 = __esm({
|
|
7176
7886
|
"../math/src/geometry/constants.ts"() {
|
|
7177
7887
|
GL_PRIMITIVE_MODE = {
|
|
7178
7888
|
POINTS: 0,
|
|
@@ -7204,7 +7914,7 @@
|
|
|
7204
7914
|
var GL_TYPE_TO_ARRAY_TYPE, NAME_TO_GL_TYPE, ERR_TYPE_CONVERSION, GLType;
|
|
7205
7915
|
var init_gl_type = __esm({
|
|
7206
7916
|
"../math/src/geometry/gl/gl-type.ts"() {
|
|
7207
|
-
|
|
7917
|
+
init_constants5();
|
|
7208
7918
|
GL_TYPE_TO_ARRAY_TYPE = {
|
|
7209
7919
|
[GL_TYPE.DOUBLE]: Float64Array,
|
|
7210
7920
|
[GL_TYPE.FLOAT]: Float32Array,
|
|
@@ -7327,14 +8037,14 @@
|
|
|
7327
8037
|
function octDecode(x, y, result) {
|
|
7328
8038
|
return octDecodeInRange(x, y, 255, result);
|
|
7329
8039
|
}
|
|
7330
|
-
var RIGHT_SHIFT,
|
|
8040
|
+
var RIGHT_SHIFT, scratchVector25, scratchVector34, scratchEncodeVector2, octEncodeScratch, uint8ForceArray;
|
|
7331
8041
|
var init_attribute_compression = __esm({
|
|
7332
8042
|
"../math/src/geometry/compression/attribute-compression.ts"() {
|
|
7333
8043
|
init_esm();
|
|
7334
8044
|
init_assert6();
|
|
7335
8045
|
RIGHT_SHIFT = 1 / 256;
|
|
7336
|
-
|
|
7337
|
-
|
|
8046
|
+
scratchVector25 = new Vector2();
|
|
8047
|
+
scratchVector34 = new Vector3();
|
|
7338
8048
|
scratchEncodeVector2 = new Vector2();
|
|
7339
8049
|
octEncodeScratch = new Vector2();
|
|
7340
8050
|
uint8ForceArray = new Uint8Array(1);
|
|
@@ -7344,7 +8054,7 @@
|
|
|
7344
8054
|
// ../math/src/index.ts
|
|
7345
8055
|
var init_src7 = __esm({
|
|
7346
8056
|
"../math/src/index.ts"() {
|
|
7347
|
-
|
|
8057
|
+
init_constants5();
|
|
7348
8058
|
init_gl_type();
|
|
7349
8059
|
init_rgb565();
|
|
7350
8060
|
init_attribute_compression();
|
|
@@ -8125,8 +8835,8 @@
|
|
|
8125
8835
|
if (tile.isOctEncoded16P) {
|
|
8126
8836
|
const decodedArray = new Float32Array(tile.pointsLength * 3);
|
|
8127
8837
|
for (let i2 = 0; i2 < tile.pointsLength; i2++) {
|
|
8128
|
-
octDecode(normals[i2 * 2], normals[i2 * 2 + 1],
|
|
8129
|
-
|
|
8838
|
+
octDecode(normals[i2 * 2], normals[i2 * 2 + 1], scratchNormal4);
|
|
8839
|
+
scratchNormal4.toArray(decodedArray, i2 * 3);
|
|
8130
8840
|
}
|
|
8131
8841
|
return {
|
|
8132
8842
|
type: GL2.FLOAT,
|
|
@@ -8140,12 +8850,12 @@
|
|
|
8140
8850
|
value: normals
|
|
8141
8851
|
};
|
|
8142
8852
|
}
|
|
8143
|
-
var
|
|
8853
|
+
var scratchNormal4;
|
|
8144
8854
|
var init_normalize_3d_tile_normals = __esm({
|
|
8145
8855
|
"src/lib/parsers/helpers/normalize-3d-tile-normals.ts"() {
|
|
8146
8856
|
init_esm();
|
|
8147
8857
|
init_src7();
|
|
8148
|
-
|
|
8858
|
+
scratchNormal4 = new Vector3();
|
|
8149
8859
|
}
|
|
8150
8860
|
});
|
|
8151
8861
|
|
|
@@ -8166,10 +8876,10 @@
|
|
|
8166
8876
|
};
|
|
8167
8877
|
}
|
|
8168
8878
|
function decodeQuantizedPositions(tile, positions) {
|
|
8169
|
-
const
|
|
8879
|
+
const scratchPosition3 = new Vector3();
|
|
8170
8880
|
const decodedArray = new Float32Array(tile.pointCount * 3);
|
|
8171
8881
|
for (let i2 = 0; i2 < tile.pointCount; i2++) {
|
|
8172
|
-
|
|
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);
|
|
8173
8883
|
}
|
|
8174
8884
|
return decodedArray;
|
|
8175
8885
|
}
|
|
@@ -9055,10 +9765,62 @@
|
|
|
9055
9765
|
}
|
|
9056
9766
|
});
|
|
9057
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
|
+
|
|
9058
9808
|
// ../images/src/lib/category-api/binary-image-api.ts
|
|
9059
9809
|
function getBinaryImageMetadata(binaryData) {
|
|
9060
9810
|
const dataView = toDataView(binaryData);
|
|
9061
|
-
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
|
+
};
|
|
9062
9824
|
}
|
|
9063
9825
|
function getPngMetadata(binaryData) {
|
|
9064
9826
|
const dataView = toDataView(binaryData);
|
|
@@ -9159,6 +9921,7 @@
|
|
|
9159
9921
|
var BIG_ENDIAN, LITTLE_ENDIAN;
|
|
9160
9922
|
var init_binary_image_api = __esm({
|
|
9161
9923
|
"../images/src/lib/category-api/binary-image-api.ts"() {
|
|
9924
|
+
init_parse_isobmff_binary();
|
|
9162
9925
|
BIG_ENDIAN = false;
|
|
9163
9926
|
LITTLE_ENDIAN = true;
|
|
9164
9927
|
}
|
|
@@ -9232,12 +9995,13 @@
|
|
|
9232
9995
|
init_version6();
|
|
9233
9996
|
init_parse_image();
|
|
9234
9997
|
init_binary_image_api();
|
|
9235
|
-
EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
|
|
9998
|
+
EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
|
|
9236
9999
|
MIME_TYPES = [
|
|
9237
10000
|
"image/png",
|
|
9238
10001
|
"image/jpeg",
|
|
9239
10002
|
"image/gif",
|
|
9240
10003
|
"image/webp",
|
|
10004
|
+
"image/avif",
|
|
9241
10005
|
"image/bmp",
|
|
9242
10006
|
"image/vnd.microsoft.icon",
|
|
9243
10007
|
"image/svg+xml"
|
|
@@ -9263,43 +10027,41 @@
|
|
|
9263
10027
|
});
|
|
9264
10028
|
|
|
9265
10029
|
// ../images/src/lib/category-api/image-format.ts
|
|
9266
|
-
function
|
|
9267
|
-
if (
|
|
9268
|
-
|
|
10030
|
+
function isImageFormatSupported(mimeType) {
|
|
10031
|
+
if (mimeTypeSupportedSync[mimeType] === void 0) {
|
|
10032
|
+
const supported = isBrowser ? checkBrowserImageFormatSupport(mimeType) : checkNodeImageFormatSupport(mimeType);
|
|
10033
|
+
mimeTypeSupportedSync[mimeType] = supported;
|
|
9269
10034
|
}
|
|
9270
|
-
return
|
|
10035
|
+
return mimeTypeSupportedSync[mimeType];
|
|
9271
10036
|
}
|
|
9272
|
-
function
|
|
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);
|
|
10041
|
+
}
|
|
10042
|
+
function checkBrowserImageFormatSupport(mimeType) {
|
|
9273
10043
|
switch (mimeType) {
|
|
10044
|
+
case "image/avif":
|
|
9274
10045
|
case "image/webp":
|
|
9275
|
-
return
|
|
9276
|
-
case "image/svg":
|
|
9277
|
-
return isBrowser;
|
|
10046
|
+
return testBrowserImageFormatSupport(mimeType);
|
|
9278
10047
|
default:
|
|
9279
|
-
if (!isBrowser) {
|
|
9280
|
-
const { _parseImageNode: _parseImageNode2 } = globalThis;
|
|
9281
|
-
return Boolean(_parseImageNode2) && NODE_FORMAT_SUPPORT.includes(mimeType);
|
|
9282
|
-
}
|
|
9283
10048
|
return true;
|
|
9284
10049
|
}
|
|
9285
10050
|
}
|
|
9286
|
-
function
|
|
9287
|
-
if (!isBrowser) {
|
|
9288
|
-
return false;
|
|
9289
|
-
}
|
|
10051
|
+
function testBrowserImageFormatSupport(mimeType) {
|
|
9290
10052
|
try {
|
|
9291
10053
|
const element = document.createElement("canvas");
|
|
9292
|
-
|
|
10054
|
+
const dataURL = element.toDataURL(mimeType);
|
|
10055
|
+
return dataURL.indexOf(`data:${mimeType}`) === 0;
|
|
9293
10056
|
} catch {
|
|
9294
10057
|
return false;
|
|
9295
10058
|
}
|
|
9296
10059
|
}
|
|
9297
|
-
var
|
|
10060
|
+
var mimeTypeSupportedSync;
|
|
9298
10061
|
var init_image_format = __esm({
|
|
9299
10062
|
"../images/src/lib/category-api/image-format.ts"() {
|
|
9300
10063
|
init_src2();
|
|
9301
|
-
|
|
9302
|
-
mimeTypeSupported = {};
|
|
10064
|
+
mimeTypeSupportedSync = {};
|
|
9303
10065
|
}
|
|
9304
10066
|
});
|
|
9305
10067
|
|
|
@@ -9638,8 +10400,8 @@
|
|
|
9638
10400
|
this.json.scenes.push({ nodes: nodeIndices });
|
|
9639
10401
|
return this.json.scenes.length - 1;
|
|
9640
10402
|
}
|
|
9641
|
-
addNode(
|
|
9642
|
-
const { meshIndex, matrix } =
|
|
10403
|
+
addNode(node3) {
|
|
10404
|
+
const { meshIndex, matrix } = node3;
|
|
9643
10405
|
this.json.nodes = this.json.nodes || [];
|
|
9644
10406
|
const nodeData = { mesh: meshIndex };
|
|
9645
10407
|
if (matrix) {
|
|
@@ -9849,12 +10611,12 @@
|
|
|
9849
10611
|
return wasmPromise;
|
|
9850
10612
|
}
|
|
9851
10613
|
async function loadWasmModule() {
|
|
9852
|
-
let
|
|
10614
|
+
let wasm2 = wasm_base;
|
|
9853
10615
|
if (WebAssembly.validate(detector)) {
|
|
9854
|
-
|
|
10616
|
+
wasm2 = wasm_simd;
|
|
9855
10617
|
console.log("Warning: meshopt_decoder is using experimental SIMD support");
|
|
9856
10618
|
}
|
|
9857
|
-
const result = await WebAssembly.instantiate(unpack(
|
|
10619
|
+
const result = await WebAssembly.instantiate(unpack(wasm2), {});
|
|
9858
10620
|
await result.instance.exports.__wasm_call_ctors();
|
|
9859
10621
|
return result.instance;
|
|
9860
10622
|
}
|
|
@@ -10084,7 +10846,7 @@
|
|
|
10084
10846
|
});
|
|
10085
10847
|
function preprocess(gltfData, options) {
|
|
10086
10848
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
10087
|
-
if (!
|
|
10849
|
+
if (!isImageFormatSupported("image/webp")) {
|
|
10088
10850
|
if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {
|
|
10089
10851
|
throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);
|
|
10090
10852
|
}
|
|
@@ -10419,9 +11181,9 @@
|
|
|
10419
11181
|
const result = new Float32Array(length4);
|
|
10420
11182
|
for (let i2 = 0; i2 < accessor.count; i2++) {
|
|
10421
11183
|
const uv = new ArrayType(arrayBuffer, byteOffset + i2 * elementAddressScale, 2);
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
result.set([
|
|
11184
|
+
scratchVector7.set(uv[0], uv[1], 1);
|
|
11185
|
+
scratchVector7.transformByMatrix3(matrix);
|
|
11186
|
+
result.set([scratchVector7[0], scratchVector7[1]], i2 * components);
|
|
10425
11187
|
}
|
|
10426
11188
|
if (originalTexCoord === texCoord) {
|
|
10427
11189
|
updateGltf(accessor, bufferView, gltfData.buffers, result);
|
|
@@ -10479,7 +11241,7 @@
|
|
|
10479
11241
|
const scaleMatrix = scratchScaleMatrix.set(scale5[0], 0, 0, 0, scale5[1], 0, 0, 0, 1);
|
|
10480
11242
|
return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);
|
|
10481
11243
|
}
|
|
10482
|
-
var EXT_MESHOPT_TRANSFORM, name5,
|
|
11244
|
+
var EXT_MESHOPT_TRANSFORM, name5, scratchVector7, scratchRotationMatrix, scratchScaleMatrix;
|
|
10483
11245
|
var init_KHR_texture_transform = __esm({
|
|
10484
11246
|
"../gltf/src/lib/extensions/KHR_texture_transform.ts"() {
|
|
10485
11247
|
init_esm();
|
|
@@ -10488,7 +11250,7 @@
|
|
|
10488
11250
|
init_gltf_scenegraph();
|
|
10489
11251
|
EXT_MESHOPT_TRANSFORM = "KHR_texture_transform";
|
|
10490
11252
|
name5 = EXT_MESHOPT_TRANSFORM;
|
|
10491
|
-
|
|
11253
|
+
scratchVector7 = new Vector3();
|
|
10492
11254
|
scratchRotationMatrix = new Matrix3();
|
|
10493
11255
|
scratchScaleMatrix = new Matrix3();
|
|
10494
11256
|
}
|
|
@@ -10509,12 +11271,12 @@
|
|
|
10509
11271
|
gltfScenegraph.json.lights = extension.lights;
|
|
10510
11272
|
gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);
|
|
10511
11273
|
}
|
|
10512
|
-
for (const
|
|
10513
|
-
const nodeExtension = gltfScenegraph.getObjectExtension(
|
|
11274
|
+
for (const node3 of json.nodes || []) {
|
|
11275
|
+
const nodeExtension = gltfScenegraph.getObjectExtension(node3, KHR_LIGHTS_PUNCTUAL);
|
|
10514
11276
|
if (nodeExtension) {
|
|
10515
|
-
|
|
11277
|
+
node3.light = nodeExtension.light;
|
|
10516
11278
|
}
|
|
10517
|
-
gltfScenegraph.removeObjectExtension(
|
|
11279
|
+
gltfScenegraph.removeObjectExtension(node3, KHR_LIGHTS_PUNCTUAL);
|
|
10518
11280
|
}
|
|
10519
11281
|
}
|
|
10520
11282
|
async function encode2(gltfData) {
|
|
@@ -10528,8 +11290,8 @@
|
|
|
10528
11290
|
}
|
|
10529
11291
|
if (gltfScenegraph.json.lights) {
|
|
10530
11292
|
for (const light of gltfScenegraph.json.lights) {
|
|
10531
|
-
const
|
|
10532
|
-
gltfScenegraph.addObjectExtension(
|
|
11293
|
+
const node3 = light.node;
|
|
11294
|
+
gltfScenegraph.addObjectExtension(node3, KHR_LIGHTS_PUNCTUAL, light);
|
|
10533
11295
|
}
|
|
10534
11296
|
delete gltfScenegraph.json.lights;
|
|
10535
11297
|
}
|
|
@@ -10920,11 +11682,11 @@
|
|
|
10920
11682
|
for (const mesh of json.meshes) {
|
|
10921
11683
|
this._convertMeshIds(mesh);
|
|
10922
11684
|
}
|
|
10923
|
-
for (const
|
|
10924
|
-
this._convertNodeIds(
|
|
11685
|
+
for (const node3 of json.nodes) {
|
|
11686
|
+
this._convertNodeIds(node3);
|
|
10925
11687
|
}
|
|
10926
|
-
for (const
|
|
10927
|
-
this._convertSceneIds(
|
|
11688
|
+
for (const node3 of json.scenes) {
|
|
11689
|
+
this._convertSceneIds(node3);
|
|
10928
11690
|
}
|
|
10929
11691
|
}
|
|
10930
11692
|
_convertTextureIds(texture) {
|
|
@@ -10946,17 +11708,17 @@
|
|
|
10946
11708
|
}
|
|
10947
11709
|
}
|
|
10948
11710
|
}
|
|
10949
|
-
_convertNodeIds(
|
|
10950
|
-
if (
|
|
10951
|
-
|
|
11711
|
+
_convertNodeIds(node3) {
|
|
11712
|
+
if (node3.children) {
|
|
11713
|
+
node3.children = node3.children.map((child) => this._convertIdToIndex(child, "node"));
|
|
10952
11714
|
}
|
|
10953
|
-
if (
|
|
10954
|
-
|
|
11715
|
+
if (node3.meshes) {
|
|
11716
|
+
node3.meshes = node3.meshes.map((mesh) => this._convertIdToIndex(mesh, "mesh"));
|
|
10955
11717
|
}
|
|
10956
11718
|
}
|
|
10957
11719
|
_convertSceneIds(scene) {
|
|
10958
11720
|
if (scene.nodes) {
|
|
10959
|
-
scene.nodes = scene.nodes.map((
|
|
11721
|
+
scene.nodes = scene.nodes.map((node3) => this._convertIdToIndex(node3, "node"));
|
|
10960
11722
|
}
|
|
10961
11723
|
}
|
|
10962
11724
|
_convertIdsToIndices(json, topLevelArrayName) {
|
|
@@ -11099,7 +11861,7 @@
|
|
|
11099
11861
|
json.meshes = json.meshes.map((mesh, i2) => this._resolveMesh(mesh, i2));
|
|
11100
11862
|
}
|
|
11101
11863
|
if (json.nodes) {
|
|
11102
|
-
json.nodes = json.nodes.map((
|
|
11864
|
+
json.nodes = json.nodes.map((node3, i2) => this._resolveNode(node3, i2));
|
|
11103
11865
|
}
|
|
11104
11866
|
if (json.skins) {
|
|
11105
11867
|
json.skins = json.skins.map((skin, i2) => this._resolveSkin(skin, i2));
|
|
@@ -11159,31 +11921,31 @@
|
|
|
11159
11921
|
}
|
|
11160
11922
|
_resolveScene(scene, index) {
|
|
11161
11923
|
scene.id = scene.id || `scene-${index}`;
|
|
11162
|
-
scene.nodes = (scene.nodes || []).map((
|
|
11924
|
+
scene.nodes = (scene.nodes || []).map((node3) => this.getNode(node3));
|
|
11163
11925
|
return scene;
|
|
11164
11926
|
}
|
|
11165
|
-
_resolveNode(
|
|
11166
|
-
|
|
11167
|
-
if (
|
|
11168
|
-
|
|
11927
|
+
_resolveNode(node3, index) {
|
|
11928
|
+
node3.id = node3.id || `node-${index}`;
|
|
11929
|
+
if (node3.children) {
|
|
11930
|
+
node3.children = node3.children.map((child) => this.getNode(child));
|
|
11169
11931
|
}
|
|
11170
|
-
if (
|
|
11171
|
-
|
|
11172
|
-
} else if (
|
|
11173
|
-
|
|
11932
|
+
if (node3.mesh !== void 0) {
|
|
11933
|
+
node3.mesh = this.getMesh(node3.mesh);
|
|
11934
|
+
} else if (node3.meshes !== void 0 && node3.meshes.length) {
|
|
11935
|
+
node3.mesh = node3.meshes.reduce((accum, meshIndex) => {
|
|
11174
11936
|
const mesh = this.getMesh(meshIndex);
|
|
11175
11937
|
accum.id = mesh.id;
|
|
11176
11938
|
accum.primitives = accum.primitives.concat(mesh.primitives);
|
|
11177
11939
|
return accum;
|
|
11178
11940
|
}, { primitives: [] });
|
|
11179
11941
|
}
|
|
11180
|
-
if (
|
|
11181
|
-
|
|
11942
|
+
if (node3.camera !== void 0) {
|
|
11943
|
+
node3.camera = this.getCamera(node3.camera);
|
|
11182
11944
|
}
|
|
11183
|
-
if (
|
|
11184
|
-
|
|
11945
|
+
if (node3.skin !== void 0) {
|
|
11946
|
+
node3.skin = this.getSkin(node3.skin);
|
|
11185
11947
|
}
|
|
11186
|
-
return
|
|
11948
|
+
return node3;
|
|
11187
11949
|
}
|
|
11188
11950
|
_resolveSkin(skin, index) {
|
|
11189
11951
|
skin.id = skin.id || `skin-${index}`;
|
|
@@ -11781,7 +12543,7 @@
|
|
|
11781
12543
|
const scratch1 = [];
|
|
11782
12544
|
const scratch2 = [];
|
|
11783
12545
|
const scratchVector12 = new Vector3();
|
|
11784
|
-
const
|
|
12546
|
+
const scratchVector26 = new Vector3();
|
|
11785
12547
|
for (let i2 = 0; i2 < instancesLength; i2++) {
|
|
11786
12548
|
let position;
|
|
11787
12549
|
if (featureTable.hasProperty("POSITION")) {
|
|
@@ -11792,7 +12554,7 @@
|
|
|
11792
12554
|
if (!quantizedVolumeOffset) {
|
|
11793
12555
|
throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
|
|
11794
12556
|
}
|
|
11795
|
-
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3,
|
|
12557
|
+
const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3, scratchVector26);
|
|
11796
12558
|
if (!quantizedVolumeScale) {
|
|
11797
12559
|
throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
|
|
11798
12560
|
}
|
|
@@ -11931,7 +12693,7 @@
|
|
|
11931
12693
|
}
|
|
11932
12694
|
var init_parse_3d_tile = __esm({
|
|
11933
12695
|
"src/lib/parsers/parse-3d-tile.ts"() {
|
|
11934
|
-
|
|
12696
|
+
init_constants4();
|
|
11935
12697
|
init_parse_utils();
|
|
11936
12698
|
init_parse_3d_tile_point_cloud();
|
|
11937
12699
|
init_parse_3d_tile_batched_model();
|
|
@@ -12034,7 +12796,1260 @@
|
|
|
12034
12796
|
}
|
|
12035
12797
|
});
|
|
12036
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
|
+
|
|
12037
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
|
+
}
|
|
12038
14053
|
async function parseImplicitTiles(params) {
|
|
12039
14054
|
const {
|
|
12040
14055
|
options,
|
|
@@ -12051,7 +14066,8 @@
|
|
|
12051
14066
|
x: 0,
|
|
12052
14067
|
y: 0,
|
|
12053
14068
|
z: 0
|
|
12054
|
-
}
|
|
14069
|
+
},
|
|
14070
|
+
s2VolumeBox
|
|
12055
14071
|
} = params;
|
|
12056
14072
|
let { subtree, level = 0 } = params;
|
|
12057
14073
|
const {
|
|
@@ -12109,18 +14125,20 @@
|
|
|
12109
14125
|
const childTileLevel = level + 1;
|
|
12110
14126
|
const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
|
|
12111
14127
|
for (let index = 0; index < childrenPerTile; index++) {
|
|
12112
|
-
const
|
|
14128
|
+
const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
|
|
14129
|
+
const childTileParsed = await parseImplicitTiles({
|
|
12113
14130
|
subtree,
|
|
12114
14131
|
options,
|
|
12115
14132
|
parentData: pData,
|
|
12116
14133
|
childIndex: index,
|
|
12117
14134
|
level: childTileLevel,
|
|
12118
|
-
globalData
|
|
14135
|
+
globalData,
|
|
14136
|
+
s2VolumeBox: childS2VolumeBox
|
|
12119
14137
|
});
|
|
12120
|
-
if (
|
|
14138
|
+
if (childTileParsed.contentUrl || childTileParsed.children.length) {
|
|
12121
14139
|
const globalLevel = lev + 1;
|
|
12122
14140
|
const childCoordinates = { childTileX, childTileY, childTileZ };
|
|
12123
|
-
const formattedTile = formatTileData(
|
|
14141
|
+
const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, options, s2VolumeBox);
|
|
12124
14142
|
tile.children.push(formattedTile);
|
|
12125
14143
|
}
|
|
12126
14144
|
}
|
|
@@ -12135,7 +14153,7 @@
|
|
|
12135
14153
|
}
|
|
12136
14154
|
return false;
|
|
12137
14155
|
}
|
|
12138
|
-
function formatTileData(tile, level, childCoordinates, options) {
|
|
14156
|
+
function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
|
|
12139
14157
|
const {
|
|
12140
14158
|
basePath,
|
|
12141
14159
|
refine,
|
|
@@ -12147,7 +14165,8 @@
|
|
|
12147
14165
|
} = options;
|
|
12148
14166
|
const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
|
|
12149
14167
|
const lodMetricValue = rootLodMetricValue / 2 ** level;
|
|
12150
|
-
const boundingVolume =
|
|
14168
|
+
const boundingVolume = s2VolumeBox?.box ? { box: s2VolumeBox.box } : rootBoundingVolume;
|
|
14169
|
+
const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(level, boundingVolume, childCoordinates);
|
|
12151
14170
|
return {
|
|
12152
14171
|
children: tile.children,
|
|
12153
14172
|
contentUrl: tile.contentUrl,
|
|
@@ -12159,7 +14178,7 @@
|
|
|
12159
14178
|
lodMetricValue,
|
|
12160
14179
|
geometricError: lodMetricValue,
|
|
12161
14180
|
transform: tile.transform,
|
|
12162
|
-
boundingVolume
|
|
14181
|
+
boundingVolume: boundingVolumeForChildTile
|
|
12163
14182
|
};
|
|
12164
14183
|
}
|
|
12165
14184
|
function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoordinates) {
|
|
@@ -12180,8 +14199,10 @@
|
|
|
12180
14199
|
region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
|
|
12181
14200
|
};
|
|
12182
14201
|
}
|
|
12183
|
-
|
|
12184
|
-
|
|
14202
|
+
if (rootBoundingVolume.box) {
|
|
14203
|
+
return rootBoundingVolume;
|
|
14204
|
+
}
|
|
14205
|
+
throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
|
|
12185
14206
|
}
|
|
12186
14207
|
function concatBits(first, second) {
|
|
12187
14208
|
return parseInt(first.toString(2) + second.toString(2), 2);
|
|
@@ -12208,6 +14229,8 @@
|
|
|
12208
14229
|
"src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"() {
|
|
12209
14230
|
init_tile_3d_subtree_loader();
|
|
12210
14231
|
init_src3();
|
|
14232
|
+
init_s2();
|
|
14233
|
+
init_s2_corners_to_obb();
|
|
12211
14234
|
QUADTREE_DEVISION_COUNT = 4;
|
|
12212
14235
|
OCTREE_DEVISION_COUNT = 8;
|
|
12213
14236
|
SUBDIVISION_COUNT_MAP = {
|
|
@@ -12314,6 +14337,12 @@
|
|
|
12314
14337
|
const contentUrlTemplate = resolveUri(tile.content.uri, basePath);
|
|
12315
14338
|
const refine = tileset?.root?.refine;
|
|
12316
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
|
+
}
|
|
12317
14346
|
const rootBoundingVolume = tile.boundingVolume;
|
|
12318
14347
|
const implicitOptions = {
|
|
12319
14348
|
contentUrlTemplate,
|
|
@@ -12338,7 +14367,11 @@
|
|
|
12338
14367
|
tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
12339
14368
|
tile.lodMetricValue = tile.geometricError;
|
|
12340
14369
|
tile.transformMatrix = tile.transform;
|
|
12341
|
-
const { children, contentUrl } = await parseImplicitTiles({
|
|
14370
|
+
const { children, contentUrl } = await parseImplicitTiles({
|
|
14371
|
+
subtree: rootSubtree,
|
|
14372
|
+
options,
|
|
14373
|
+
s2VolumeBox: tile
|
|
14374
|
+
});
|
|
12342
14375
|
if (contentUrl) {
|
|
12343
14376
|
tile.contentUrl = contentUrl;
|
|
12344
14377
|
tile.content = { uri: contentUrl.replace(`${options.basePath}/`, "") };
|
|
@@ -12358,6 +14391,7 @@
|
|
|
12358
14391
|
init_src3();
|
|
12359
14392
|
init_src4();
|
|
12360
14393
|
init_parse_3d_implicit_tiles();
|
|
14394
|
+
init_s2_corners_to_obb();
|
|
12361
14395
|
}
|
|
12362
14396
|
});
|
|
12363
14397
|
|
|
@@ -12570,7 +14604,7 @@
|
|
|
12570
14604
|
}
|
|
12571
14605
|
var init_encode_3d_tile_composite = __esm({
|
|
12572
14606
|
"src/lib/encoders/encode-3d-tile-composite.ts"() {
|
|
12573
|
-
|
|
14607
|
+
init_constants4();
|
|
12574
14608
|
init_encode_3d_tile_header();
|
|
12575
14609
|
}
|
|
12576
14610
|
});
|
|
@@ -12609,7 +14643,7 @@
|
|
|
12609
14643
|
var init_encode_3d_tile_batched_model = __esm({
|
|
12610
14644
|
"src/lib/encoders/encode-3d-tile-batched-model.ts"() {
|
|
12611
14645
|
init_src2();
|
|
12612
|
-
|
|
14646
|
+
init_constants4();
|
|
12613
14647
|
init_encode_3d_tile_header();
|
|
12614
14648
|
}
|
|
12615
14649
|
});
|
|
@@ -12643,7 +14677,7 @@
|
|
|
12643
14677
|
var init_encode_3d_tile_instanced_model = __esm({
|
|
12644
14678
|
"src/lib/encoders/encode-3d-tile-instanced-model.ts"() {
|
|
12645
14679
|
init_src2();
|
|
12646
|
-
|
|
14680
|
+
init_constants4();
|
|
12647
14681
|
init_encode_3d_tile_header();
|
|
12648
14682
|
}
|
|
12649
14683
|
});
|
|
@@ -12674,7 +14708,7 @@
|
|
|
12674
14708
|
var DEFAULT_FEATURE_TABLE_JSON;
|
|
12675
14709
|
var init_encode_3d_tile_point_cloud = __esm({
|
|
12676
14710
|
"src/lib/encoders/encode-3d-tile-point-cloud.ts"() {
|
|
12677
|
-
|
|
14711
|
+
init_constants4();
|
|
12678
14712
|
init_encode_3d_tile_header();
|
|
12679
14713
|
init_src2();
|
|
12680
14714
|
DEFAULT_FEATURE_TABLE_JSON = {
|
|
@@ -12711,7 +14745,7 @@
|
|
|
12711
14745
|
}
|
|
12712
14746
|
var init_encode_3d_tile = __esm({
|
|
12713
14747
|
"src/lib/encoders/encode-3d-tile.ts"() {
|
|
12714
|
-
|
|
14748
|
+
init_constants4();
|
|
12715
14749
|
init_src2();
|
|
12716
14750
|
init_encode_3d_tile_composite();
|
|
12717
14751
|
init_encode_3d_tile_batched_model();
|
|
@@ -12765,7 +14799,7 @@
|
|
|
12765
14799
|
init_tile_3d_writer();
|
|
12766
14800
|
init_tile_3d_feature_table();
|
|
12767
14801
|
init_tile_3d_batch_table();
|
|
12768
|
-
|
|
14802
|
+
init_constants4();
|
|
12769
14803
|
init_ion();
|
|
12770
14804
|
}
|
|
12771
14805
|
});
|
|
@@ -12780,3 +14814,22 @@
|
|
|
12780
14814
|
});
|
|
12781
14815
|
require_bundle();
|
|
12782
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
|
+
*/
|