@loaders.gl/tile-converter 5.0.0-alpha.10 → 5.0.0-alpha.11
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/README.md +33 -0
- package/dist/converter.min.cjs +103 -103
- package/dist/i3s-server/bin/i3s-server.min.cjs +1 -1
- package/dist/index.cjs +651 -547
- package/dist/index.js +641 -537
- package/dist/v5/adapters.cjs +1756 -200
- package/dist/v5/adapters.d.ts +13 -2
- package/dist/v5/adapters.js +1755 -190
- package/dist/v5/browser.cjs +12 -0
- package/dist/v5/browser.d.ts +12 -2
- package/dist/v5/browser.js +19 -1
- package/dist/v5/core.cjs +54 -0
- package/dist/v5/core.js +54 -0
- package/dist/v5/i3s-mesh-conversion.d.ts +10 -4
- package/dist/v5/i3s-mesh-sink.d.ts +25 -0
- package/dist/v5/i3s-mesh-source-features.d.ts +13 -0
- package/dist/v5/i3s-mesh-source-material.d.ts +5 -0
- package/dist/v5/i3s-mesh-source.d.ts +30 -0
- package/dist/v5/index.cjs +10 -0
- package/dist/v5/index.d.ts +10 -2
- package/dist/v5/index.js +17 -1
- package/dist/v5/mesh-conversion.d.ts +11 -2
- package/dist/v5/mesh-features.d.ts +9 -0
- package/dist/v5/mesh-source-texture.d.ts +2 -0
- package/dist/v5/mesh-source.d.ts +8 -1
- package/dist/v5/mesh.d.ts +6 -1
- package/dist/v5/point-cloud-source-encoder.d.ts +4 -7
- package/dist/v5/point-cloud-spatial.d.ts +22 -0
- package/dist/v5/point-cloud-tileset-sink.d.ts +28 -0
- package/dist/v5/point-cloud.d.ts +26 -1
- package/dist/v5/resource-fetcher.d.ts +18 -0
- package/dist/v5/spatial-conversion.d.ts +3 -1
- package/package.json +23 -23
- package/src/v5/adapters.ts +21 -2
- package/src/v5/browser.ts +36 -2
- package/src/v5/i3s-mesh-conversion.ts +58 -18
- package/src/v5/i3s-mesh-sink.ts +351 -0
- package/src/v5/i3s-mesh-source-features.ts +279 -0
- package/src/v5/i3s-mesh-source-material.ts +157 -0
- package/src/v5/i3s-mesh-source.ts +227 -0
- package/src/v5/index.ts +34 -2
- package/src/v5/mesh-conversion.ts +41 -11
- package/src/v5/mesh-draco.ts +47 -3
- package/src/v5/mesh-features.ts +319 -0
- package/src/v5/mesh-source-features.ts +37 -6
- package/src/v5/mesh-source-texture.ts +47 -0
- package/src/v5/mesh-source.ts +83 -21
- package/src/v5/mesh.ts +16 -7
- package/src/v5/point-cloud-conversion.ts +9 -1
- package/src/v5/point-cloud-source-encoder.ts +31 -20
- package/src/v5/point-cloud-spatial.ts +280 -0
- package/src/v5/point-cloud-tileset-sink.ts +234 -0
- package/src/v5/point-cloud.ts +159 -32
- package/src/v5/resource-fetcher.ts +110 -0
- package/src/v5/spatial-conversion.ts +84 -0
package/dist/index.cjs
CHANGED
|
@@ -15841,6 +15841,8 @@ async function decompressPrimitive(iterator, primitive, options, context) {
|
|
|
15841
15841
|
...options.draco,
|
|
15842
15842
|
// Internal glTF decoding consumes the legacy mesh contract.
|
|
15843
15843
|
shape: "mesh",
|
|
15844
|
+
// Normalize compressed strips to the triangle indices returned below.
|
|
15845
|
+
topology: "triangle-list",
|
|
15844
15846
|
decoderProfile: options.draco?.decoderProfile || "gltf",
|
|
15845
15847
|
extraAttributes: dracoExtension.attributes
|
|
15846
15848
|
}
|
|
@@ -15869,6 +15871,7 @@ async function decompressPrimitive(iterator, primitive, options, context) {
|
|
|
15869
15871
|
primitive.attributes = decodedAttributes;
|
|
15870
15872
|
if (decodedData.indices) {
|
|
15871
15873
|
primitive.indices = getGLTFAccessor(decodedData.indices);
|
|
15874
|
+
primitive.mode = 4;
|
|
15872
15875
|
}
|
|
15873
15876
|
iterator.removeExtension(primitive, KHR_DRACO_MESH_COMPRESSION);
|
|
15874
15877
|
checkPrimitive(primitive);
|
|
@@ -20739,16 +20742,20 @@ var init_format_spatial_reference = __esm({
|
|
|
20739
20742
|
});
|
|
20740
20743
|
|
|
20741
20744
|
// ../../modules/tiles/src/spatial/spatial-resource-registry.ts
|
|
20745
|
+
function getSpatialProjectionEngine() {
|
|
20746
|
+
return spatialProjectionEngine;
|
|
20747
|
+
}
|
|
20742
20748
|
function getGeoidModel(name18) {
|
|
20743
20749
|
return geoidModels.get(name18);
|
|
20744
20750
|
}
|
|
20745
|
-
var import_geoid, import_projection, geoidModels;
|
|
20751
|
+
var import_geoid, import_projection, geoidModels, spatialProjectionEngine;
|
|
20746
20752
|
var init_spatial_resource_registry = __esm({
|
|
20747
20753
|
"../../modules/tiles/src/spatial/spatial-resource-registry.ts"() {
|
|
20748
20754
|
"use strict";
|
|
20749
20755
|
import_geoid = require("@math.gl/geoid");
|
|
20750
20756
|
import_projection = require("@math.gl/projection");
|
|
20751
20757
|
geoidModels = /* @__PURE__ */ new Map();
|
|
20758
|
+
spatialProjectionEngine = new import_projection.FullProjectionEngine();
|
|
20752
20759
|
}
|
|
20753
20760
|
});
|
|
20754
20761
|
|
|
@@ -20853,13 +20860,12 @@ function transformHeight(height, geoidUndulation, source, target) {
|
|
|
20853
20860
|
}
|
|
20854
20861
|
throw new Error(`Unsupported height conversion from ${source} to ${target}`);
|
|
20855
20862
|
}
|
|
20856
|
-
var import_core4, import_geospatial2,
|
|
20863
|
+
var import_core4, import_geospatial2, SpatialCoordinateTransformer;
|
|
20857
20864
|
var init_spatial_coordinate_transformer = __esm({
|
|
20858
20865
|
"../../modules/tiles/src/spatial/spatial-coordinate-transformer.ts"() {
|
|
20859
20866
|
"use strict";
|
|
20860
20867
|
import_core4 = require("@math.gl/core");
|
|
20861
20868
|
import_geospatial2 = require("@math.gl/geospatial");
|
|
20862
|
-
import_projection2 = require("@math.gl/projection");
|
|
20863
20869
|
init_spatial_resource_registry();
|
|
20864
20870
|
init_normalize_crs_identifier();
|
|
20865
20871
|
init_get_spatial_coordinate_frame();
|
|
@@ -20890,6 +20896,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20890
20896
|
*/
|
|
20891
20897
|
constructor(spatialReference, options = {}) {
|
|
20892
20898
|
this.spatialReference = spatialReference;
|
|
20899
|
+
const projectionEngine = getSpatialProjectionEngine();
|
|
20893
20900
|
validateTransformRequest(spatialReference);
|
|
20894
20901
|
const outputCrs = spatialReference.targetCrs || spatialReference.sourceCrs;
|
|
20895
20902
|
this.sourceIsGeocentric = isWgs84Geocentric(spatialReference.sourceCrs);
|
|
@@ -20897,7 +20904,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20897
20904
|
this.sourceIsGeographic = isWgs84Geographic(spatialReference.sourceCrs);
|
|
20898
20905
|
this.outputIsGeographic = isWgs84Geographic(outputCrs);
|
|
20899
20906
|
if (spatialReference.sourceCrs && spatialReference.targetCrs && !this.sourceIsGeocentric && !this.outputIsGeocentric) {
|
|
20900
|
-
this.horizontalProjection =
|
|
20907
|
+
this.horizontalProjection = projectionEngine.createProjection({
|
|
20901
20908
|
from: getHorizontalProjectionDefinition(spatialReference.sourceCrs),
|
|
20902
20909
|
to: getHorizontalProjectionDefinition(spatialReference.targetCrs),
|
|
20903
20910
|
enforceAxis: false
|
|
@@ -20905,14 +20912,14 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20905
20912
|
}
|
|
20906
20913
|
if (requiresHeightTransformation(spatialReference) || this.sourceIsGeocentric || this.outputIsGeocentric) {
|
|
20907
20914
|
if (!this.sourceIsGeographic && !this.sourceIsGeocentric) {
|
|
20908
|
-
this.geographicProjection =
|
|
20915
|
+
this.geographicProjection = projectionEngine.createProjection({
|
|
20909
20916
|
from: getHorizontalProjectionDefinition(spatialReference.sourceCrs),
|
|
20910
20917
|
to: WGS84_GEOGRAPHIC_CRS,
|
|
20911
20918
|
enforceAxis: false
|
|
20912
20919
|
});
|
|
20913
20920
|
}
|
|
20914
20921
|
if (!this.outputIsGeographic && !this.outputIsGeocentric) {
|
|
20915
|
-
this.heightOutputProjection =
|
|
20922
|
+
this.heightOutputProjection = projectionEngine.createProjection({
|
|
20916
20923
|
from: WGS84_GEOGRAPHIC_CRS,
|
|
20917
20924
|
to: getHorizontalProjectionDefinition(outputCrs),
|
|
20918
20925
|
enforceAxis: false
|
|
@@ -20959,7 +20966,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20959
20966
|
return result;
|
|
20960
20967
|
}
|
|
20961
20968
|
if (this.horizontalProjection) {
|
|
20962
|
-
const projected = this.horizontalProjection.
|
|
20969
|
+
const projected = this.horizontalProjection.projectSync(result.slice(0, 3));
|
|
20963
20970
|
result.splice(0, projected.length, ...projected);
|
|
20964
20971
|
}
|
|
20965
20972
|
return result;
|
|
@@ -21023,7 +21030,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
21023
21030
|
if (this.sourceIsGeographic) {
|
|
21024
21031
|
return coordinate.slice(0, 3);
|
|
21025
21032
|
}
|
|
21026
|
-
return this.geographicProjection.
|
|
21033
|
+
return this.geographicProjection.projectSync(coordinate.slice(0, 3));
|
|
21027
21034
|
}
|
|
21028
21035
|
/** Convert one conventional WGS84 geographic coordinate to the selected output CRS. */
|
|
21029
21036
|
fromGeographic(coordinate) {
|
|
@@ -21033,7 +21040,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
21033
21040
|
if (this.outputIsGeographic) {
|
|
21034
21041
|
return coordinate.slice(0, 3);
|
|
21035
21042
|
}
|
|
21036
|
-
return this.heightOutputProjection.
|
|
21043
|
+
return this.heightOutputProjection.projectSync(coordinate.slice(0, 3));
|
|
21037
21044
|
}
|
|
21038
21045
|
};
|
|
21039
21046
|
}
|
|
@@ -21139,14 +21146,12 @@ function createAxisAlignedBox(samples) {
|
|
|
21139
21146
|
(maximum[2] - minimum[2]) / 2 + padding[2]
|
|
21140
21147
|
];
|
|
21141
21148
|
}
|
|
21142
|
-
var import_core5,
|
|
21149
|
+
var import_core5, Tiles3DSpatialTransformer;
|
|
21143
21150
|
var init_tiles_3d_spatial_transformer = __esm({
|
|
21144
21151
|
"../../modules/tiles/src/spatial/tiles-3d-spatial-transformer.ts"() {
|
|
21145
21152
|
"use strict";
|
|
21146
21153
|
init_spatial_coordinate_transformer();
|
|
21147
|
-
init_get_spatial_coordinate_frame();
|
|
21148
21154
|
import_core5 = require("@math.gl/core");
|
|
21149
|
-
import_geospatial3 = require("@math.gl/geospatial");
|
|
21150
21155
|
Tiles3DSpatialTransformer = class {
|
|
21151
21156
|
/** Normalized reference describing the completed operation. */
|
|
21152
21157
|
spatialReference;
|
|
@@ -21190,16 +21195,6 @@ var init_tiles_3d_spatial_transformer = __esm({
|
|
|
21190
21195
|
}
|
|
21191
21196
|
/** Transforms one WGS84 region sample into the selected output frame. */
|
|
21192
21197
|
transformRegionSample(sample) {
|
|
21193
|
-
const [longitudeDegrees, latitudeDegrees, height] = sample;
|
|
21194
|
-
const targetCrs = this.spatialReference.targetCrs || this.spatialReference.sourceCrs;
|
|
21195
|
-
if (targetCrs && getSpatialCoordinateFrame(targetCrs) === "geocentric") {
|
|
21196
|
-
const cartesian = import_geospatial3.Ellipsoid.WGS84.cartographicToCartesian([
|
|
21197
|
-
longitudeDegrees,
|
|
21198
|
-
latitudeDegrees,
|
|
21199
|
-
height
|
|
21200
|
-
]);
|
|
21201
|
-
return Array.from(cartesian);
|
|
21202
|
-
}
|
|
21203
21198
|
return this.geographicCoordinateTransformer.transformPosition(sample);
|
|
21204
21199
|
}
|
|
21205
21200
|
};
|
|
@@ -21209,19 +21204,19 @@ var init_tiles_3d_spatial_transformer = __esm({
|
|
|
21209
21204
|
// ../../modules/tiles/src/tileset-3d/helpers/s2-bounding-volume.ts
|
|
21210
21205
|
function convertS2BoundingVolumeToOBB(s2VolumeInfo) {
|
|
21211
21206
|
const [[west, south], [east, north]] = (0, import_s2.getS2Bounds)(s2VolumeInfo.token);
|
|
21212
|
-
const orientedBoundingBox = (0,
|
|
21207
|
+
const orientedBoundingBox = (0, import_geospatial3.makeOBBFromRegion)(
|
|
21213
21208
|
[west, south, east, north, s2VolumeInfo.minimumHeight, s2VolumeInfo.maximumHeight],
|
|
21214
|
-
|
|
21209
|
+
import_geospatial3.Ellipsoid.WGS84,
|
|
21215
21210
|
{ units: "degrees" }
|
|
21216
21211
|
);
|
|
21217
21212
|
return [...orientedBoundingBox.center, ...orientedBoundingBox.halfAxes];
|
|
21218
21213
|
}
|
|
21219
|
-
var import_s2,
|
|
21214
|
+
var import_s2, import_geospatial3;
|
|
21220
21215
|
var init_s2_bounding_volume = __esm({
|
|
21221
21216
|
"../../modules/tiles/src/tileset-3d/helpers/s2-bounding-volume.ts"() {
|
|
21222
21217
|
"use strict";
|
|
21223
21218
|
import_s2 = require("@math.gl/dggs/s2");
|
|
21224
|
-
|
|
21219
|
+
import_geospatial3 = require("@math.gl/geospatial");
|
|
21225
21220
|
}
|
|
21226
21221
|
});
|
|
21227
21222
|
|
|
@@ -21310,7 +21305,7 @@ function getGeographicBoundingSphere(geographicSamples) {
|
|
|
21310
21305
|
throw new Error("I3S spatial transformation requires at least one bound sample");
|
|
21311
21306
|
}
|
|
21312
21307
|
const cartesianSamples = geographicSamples.map(
|
|
21313
|
-
(position) =>
|
|
21308
|
+
(position) => import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(new import_core6.Vector3(position))
|
|
21314
21309
|
);
|
|
21315
21310
|
const cartesianCenter = new import_core6.Vector3();
|
|
21316
21311
|
for (const sample of cartesianSamples) {
|
|
@@ -21321,7 +21316,7 @@ function getGeographicBoundingSphere(geographicSamples) {
|
|
|
21321
21316
|
for (const sample of cartesianSamples) {
|
|
21322
21317
|
radius = Math.max(radius, new import_core6.Vector3(sample).subtract(cartesianCenter).magnitude());
|
|
21323
21318
|
}
|
|
21324
|
-
const geographicCenter =
|
|
21319
|
+
const geographicCenter = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(cartesianCenter);
|
|
21325
21320
|
return [geographicCenter[0], geographicCenter[1], geographicCenter[2], radius];
|
|
21326
21321
|
}
|
|
21327
21322
|
function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransformer, sourceVerticalUnitScale) {
|
|
@@ -21338,7 +21333,7 @@ function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransforme
|
|
|
21338
21333
|
];
|
|
21339
21334
|
if (sourceFrame === "geographic") {
|
|
21340
21335
|
const geographicCenter = sourceToGeographicTransformer.transformPosition(center2);
|
|
21341
|
-
const cartesianCenter =
|
|
21336
|
+
const cartesianCenter = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
|
|
21342
21337
|
new import_core6.Vector3(geographicCenter)
|
|
21343
21338
|
);
|
|
21344
21339
|
const cartesianAxes = bounds.normalReferenceFrame === "vertex-reference-frame" ? axes.map((axis) => localEnuVectorToEcef(axis, geographicCenter)) : axes;
|
|
@@ -21347,7 +21342,7 @@ function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransforme
|
|
|
21347
21342
|
for (let axisIndex = 0; axisIndex < 3; axisIndex++) {
|
|
21348
21343
|
corner.add(new import_core6.Vector3(cartesianAxes[axisIndex]).scale(signs[axisIndex]));
|
|
21349
21344
|
}
|
|
21350
|
-
return Array.from(
|
|
21345
|
+
return Array.from(import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(corner));
|
|
21351
21346
|
});
|
|
21352
21347
|
}
|
|
21353
21348
|
return getBoxSigns().map((signs) => {
|
|
@@ -21367,10 +21362,10 @@ function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransforme
|
|
|
21367
21362
|
const radius = mbs[3];
|
|
21368
21363
|
if (sourceFrame === "geographic") {
|
|
21369
21364
|
const geographicCenter = sourceToGeographicTransformer.transformPosition(center);
|
|
21370
|
-
const cartesianCenter =
|
|
21365
|
+
const cartesianCenter = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(new import_core6.Vector3(geographicCenter));
|
|
21371
21366
|
return getAxisDirections().map(
|
|
21372
21367
|
(direction) => Array.from(
|
|
21373
|
-
|
|
21368
|
+
import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(
|
|
21374
21369
|
new import_core6.Vector3(cartesianCenter).add(new import_core6.Vector3(direction).scale(radius))
|
|
21375
21370
|
)
|
|
21376
21371
|
)
|
|
@@ -21470,12 +21465,12 @@ function getGeographicRegion(positions) {
|
|
|
21470
21465
|
function normalizeLongitude(longitude) {
|
|
21471
21466
|
return ((longitude + 180) % 360 + 360) % 360 - 180;
|
|
21472
21467
|
}
|
|
21473
|
-
var import_core6,
|
|
21468
|
+
var import_core6, import_geospatial4, I3SSpatialTransformer;
|
|
21474
21469
|
var init_i3s_spatial_transformer = __esm({
|
|
21475
21470
|
"../../modules/tiles/src/spatial/i3s-spatial-transformer.ts"() {
|
|
21476
21471
|
"use strict";
|
|
21477
21472
|
import_core6 = require("@math.gl/core");
|
|
21478
|
-
|
|
21473
|
+
import_geospatial4 = require("@math.gl/geospatial");
|
|
21479
21474
|
init_spatial_coordinate_transformer();
|
|
21480
21475
|
init_spatial_types();
|
|
21481
21476
|
init_i3s_elevation();
|
|
@@ -21684,6 +21679,34 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21684
21679
|
placedPositions.subarray(sourcePositions.length)
|
|
21685
21680
|
);
|
|
21686
21681
|
}
|
|
21682
|
+
/**
|
|
21683
|
+
* Transforms conversion geometry without passing through renderer float32 offsets.
|
|
21684
|
+
* Positions and normals share one batch of elevation samples. Source arrays remain unchanged.
|
|
21685
|
+
* @param sourcePositions - Packed absolute xyz positions in source units.
|
|
21686
|
+
* @param normals - Optional packed normals paired with the positions.
|
|
21687
|
+
* @param normalReferenceFrame - I3S earth-centered or vertex-reference-frame declaration.
|
|
21688
|
+
* @returns Absolute target positions and optional transformed normals.
|
|
21689
|
+
*/
|
|
21690
|
+
async transformGeometryAsync(sourcePositions, normals, normalReferenceFrame = "earth-centered") {
|
|
21691
|
+
if (sourcePositions.length % 3 || normals && normals.length !== sourcePositions.length) {
|
|
21692
|
+
throw new Error("Conversion positions and normals must contain matching finite xyz triples");
|
|
21693
|
+
}
|
|
21694
|
+
for (let index = 0; index < sourcePositions.length; index++) {
|
|
21695
|
+
if (!Number.isFinite(sourcePositions[index]) || normals && !Number.isFinite(normals[index])) {
|
|
21696
|
+
throw new Error(
|
|
21697
|
+
"Conversion positions and normals must contain matching finite xyz triples"
|
|
21698
|
+
);
|
|
21699
|
+
}
|
|
21700
|
+
}
|
|
21701
|
+
if (!["earth-centered", "vertex-reference-frame"].includes(normalReferenceFrame)) {
|
|
21702
|
+
throw new Error("Unsupported I3S normal reference frame");
|
|
21703
|
+
}
|
|
21704
|
+
const placedPositions = await this.placeSourcePositions(sourcePositions);
|
|
21705
|
+
return {
|
|
21706
|
+
positions: this.positionTransformer.transformPositions(placedPositions),
|
|
21707
|
+
normals: normals ? this.transformNormals(normals, placedPositions, normalReferenceFrame) : void 0
|
|
21708
|
+
};
|
|
21709
|
+
}
|
|
21687
21710
|
/** Transform already placed positions into renderer-relative target coordinates. */
|
|
21688
21711
|
transformPlacedPositions(sourcePositions, sourceOrigin) {
|
|
21689
21712
|
const origin = this.transformPlacedPosition(sourceOrigin);
|
|
@@ -21721,7 +21744,19 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21721
21744
|
* @param normalReferenceFrame - I3S normal frame declaration.
|
|
21722
21745
|
*/
|
|
21723
21746
|
transformNormals(normals, sourcePositions, normalReferenceFrame = "earth-centered") {
|
|
21747
|
+
if (normals.length !== sourcePositions.length || normals.length % 3) {
|
|
21748
|
+
throw new Error("I3S normals and positions must have matching xyz component counts");
|
|
21749
|
+
}
|
|
21724
21750
|
const transformedNormals = new Float32Array(normals.length);
|
|
21751
|
+
if (normalReferenceFrame === "earth-centered" && (this.spatialReference.targetCrs || this.spatialReference.sourceCrs) === "EPSG:4978") {
|
|
21752
|
+
for (let index = 0; index < normals.length; index += 3) {
|
|
21753
|
+
const length = Math.hypot(normals[index], normals[index + 1], normals[index + 2]);
|
|
21754
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
21755
|
+
transformedNormals[index + axis] = length ? normals[index + axis] / length : normals[index + axis];
|
|
21756
|
+
}
|
|
21757
|
+
}
|
|
21758
|
+
return transformedNormals;
|
|
21759
|
+
}
|
|
21725
21760
|
for (let index = 0; index < normals.length; index += 3) {
|
|
21726
21761
|
const geographic = this.sourceToGeographicTransformer.transformPosition([
|
|
21727
21762
|
sourcePositions[index],
|
|
@@ -21771,14 +21806,14 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21771
21806
|
/** Rebuild an I3S bound as a WGS84 ECEF box for generic `Tileset3D` traversal. */
|
|
21772
21807
|
transformBoundingVolumeToGeocentric(bounds) {
|
|
21773
21808
|
const cartesianSamples = this.getGeographicBoundSamples(bounds).map(
|
|
21774
|
-
(position) => Array.from(
|
|
21809
|
+
(position) => Array.from(import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(new import_core6.Vector3(position)))
|
|
21775
21810
|
);
|
|
21776
21811
|
return { box: getAxisAlignedBox(cartesianSamples) };
|
|
21777
21812
|
}
|
|
21778
21813
|
/** Rebuild an I3S bound as WGS84 ECEF after asynchronous elevation placement. */
|
|
21779
21814
|
async transformBoundingVolumeToGeocentricAsync(bounds) {
|
|
21780
21815
|
const cartesianSamples = (await this.getGeographicBoundSamplesAsync(bounds)).map(
|
|
21781
|
-
(position) => Array.from(
|
|
21816
|
+
(position) => Array.from(import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(new import_core6.Vector3(position)))
|
|
21782
21817
|
);
|
|
21783
21818
|
return { box: getAxisAlignedBox(cartesianSamples) };
|
|
21784
21819
|
}
|
|
@@ -21808,7 +21843,7 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21808
21843
|
async transformBoundsAsync(bounds) {
|
|
21809
21844
|
const geographicSamples = await this.getGeographicBoundSamplesAsync(bounds);
|
|
21810
21845
|
const cartesianSamples = geographicSamples.map(
|
|
21811
|
-
(position) => Array.from(
|
|
21846
|
+
(position) => Array.from(import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(new import_core6.Vector3(position)))
|
|
21812
21847
|
);
|
|
21813
21848
|
const targetSamples = geographicSamples.map(
|
|
21814
21849
|
(position) => this.geographicToTargetTransformer.transformPosition(position)
|
|
@@ -21967,13 +22002,13 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21967
22002
|
if (this.targetCoordinateFrame === "geographic") {
|
|
21968
22003
|
return ecefVectorToLocalEnu(ecefNormal, geographic).normalize();
|
|
21969
22004
|
}
|
|
21970
|
-
const cartesian =
|
|
22005
|
+
const cartesian = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(new import_core6.Vector3(geographic));
|
|
21971
22006
|
const jacobianColumns = [];
|
|
21972
22007
|
for (const direction of getPositiveAxisDirections()) {
|
|
21973
|
-
const positiveGeographic =
|
|
22008
|
+
const positiveGeographic = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(
|
|
21974
22009
|
new import_core6.Vector3(cartesian).add(direction)
|
|
21975
22010
|
);
|
|
21976
|
-
const negativeGeographic =
|
|
22011
|
+
const negativeGeographic = import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(
|
|
21977
22012
|
new import_core6.Vector3(cartesian).subtract(direction)
|
|
21978
22013
|
);
|
|
21979
22014
|
const positiveTarget = this.geographicToTargetTransformer.transformPosition(positiveGeographic);
|
|
@@ -23480,7 +23515,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
23480
23515
|
tile.hasCustomOrientation = true;
|
|
23481
23516
|
hasCustomOrientation = true;
|
|
23482
23517
|
} else if (tile.eastNorthUp) {
|
|
23483
|
-
|
|
23518
|
+
import_geospatial5.Ellipsoid.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);
|
|
23484
23519
|
instanceTransform.getRotationMatrix3(instanceRotation);
|
|
23485
23520
|
} else {
|
|
23486
23521
|
instanceRotation.identity();
|
|
@@ -23525,12 +23560,12 @@ function decodeOct32POrientation(encodedUp, encodedRight, normalUp, normalRight)
|
|
|
23525
23560
|
(0, import_geometry_utils9.octDecodeInRange)(encodedUp[0], encodedUp[1], 65535, normalUp);
|
|
23526
23561
|
(0, import_geometry_utils9.octDecodeInRange)(encodedRight[0], encodedRight[1], 65535, normalRight);
|
|
23527
23562
|
}
|
|
23528
|
-
var import_core10,
|
|
23563
|
+
var import_core10, import_geospatial5, import_geometry_utils9;
|
|
23529
23564
|
var init_parse_3d_tile_instanced_model = __esm({
|
|
23530
23565
|
"../../modules/3d-tiles/src/lib/parsers/parse-3d-tile-instanced-model.ts"() {
|
|
23531
23566
|
"use strict";
|
|
23532
23567
|
import_core10 = require("@math.gl/core");
|
|
23533
|
-
|
|
23568
|
+
import_geospatial5 = require("@math.gl/geospatial");
|
|
23534
23569
|
import_geometry_utils9 = require("@math.gl/geometry-utils");
|
|
23535
23570
|
init_tile_3d_feature_table();
|
|
23536
23571
|
init_tile_3d_batch_table();
|
|
@@ -25043,7 +25078,7 @@ function getGeoreferenceMatrix(longitudeDegrees, latitudeDegrees, height) {
|
|
|
25043
25078
|
const sinLongitude = Math.sin(longitude);
|
|
25044
25079
|
const cosLatitude = Math.cos(latitude);
|
|
25045
25080
|
const sinLatitude = Math.sin(latitude);
|
|
25046
|
-
const position =
|
|
25081
|
+
const position = import_geospatial6.Ellipsoid.WGS84.cartographicToCartesian([longitude, latitude, height]);
|
|
25047
25082
|
return new import_core12.Matrix4([
|
|
25048
25083
|
sinLongitude,
|
|
25049
25084
|
-cosLongitude,
|
|
@@ -25075,13 +25110,13 @@ function isNonnegativeNumber(value) {
|
|
|
25075
25110
|
function isRecord4(value) {
|
|
25076
25111
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
25077
25112
|
}
|
|
25078
|
-
var import_core12,
|
|
25113
|
+
var import_core12, import_geospatial6, TILESET_EXTENSION, SUBTREE_EXTENSION, IMPLICIT_TILING_EXTENSION, VECTOR_EXTENSION;
|
|
25079
25114
|
var init_parse_3d_tiles_2_gltf = __esm({
|
|
25080
25115
|
"../../modules/3d-tiles/src/lib/parsers/parse-3d-tiles-2-gltf.ts"() {
|
|
25081
25116
|
"use strict";
|
|
25082
25117
|
init_src9();
|
|
25083
25118
|
import_core12 = require("@math.gl/core");
|
|
25084
|
-
|
|
25119
|
+
import_geospatial6 = require("@math.gl/geospatial");
|
|
25085
25120
|
init_src2();
|
|
25086
25121
|
init_s2_corners_to_obb();
|
|
25087
25122
|
TILESET_EXTENSION = "3DTILES_tileset";
|
|
@@ -27738,116 +27773,358 @@ var init_compression = __esm({
|
|
|
27738
27773
|
}
|
|
27739
27774
|
});
|
|
27740
27775
|
|
|
27741
|
-
// ../../modules/compression/src/lib/
|
|
27742
|
-
function
|
|
27743
|
-
|
|
27776
|
+
// ../../modules/compression/src/lib/decompression-stream.ts
|
|
27777
|
+
async function decompressWithNativeDecompressionStream(input, format) {
|
|
27778
|
+
const outputBatches = decompressBatchesWithNativeDecompressionStream([input], format);
|
|
27779
|
+
return outputBatches ? await concatenateNativeDecompressionBatches(outputBatches) : null;
|
|
27744
27780
|
}
|
|
27745
|
-
function
|
|
27746
|
-
|
|
27781
|
+
function decompressBatchesWithNativeDecompressionStream(inputBatches, format) {
|
|
27782
|
+
const decompressionStream = createNativeDecompressionStream(format);
|
|
27783
|
+
return decompressionStream ? transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) : null;
|
|
27747
27784
|
}
|
|
27748
|
-
function
|
|
27749
|
-
return
|
|
27785
|
+
function isNativeDecompressionSupported(format) {
|
|
27786
|
+
return Boolean(createNativeDecompressionStream(format));
|
|
27750
27787
|
}
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27788
|
+
function createNativeDecompressionStream(format) {
|
|
27789
|
+
if (typeof globalThis.DecompressionStream === "undefined") {
|
|
27790
|
+
return null;
|
|
27791
|
+
}
|
|
27792
|
+
if (globalThis.process?.release?.name === "node" && typeof globalThis.Buffer === "undefined") {
|
|
27793
|
+
return null;
|
|
27794
|
+
}
|
|
27795
|
+
try {
|
|
27796
|
+
const DecompressionStreamConstructor = globalThis.DecompressionStream;
|
|
27797
|
+
return new DecompressionStreamConstructor(format);
|
|
27798
|
+
} catch (error) {
|
|
27799
|
+
if (error instanceof TypeError || error?.name === "TypeError") {
|
|
27800
|
+
return null;
|
|
27801
|
+
}
|
|
27802
|
+
throw error;
|
|
27803
|
+
}
|
|
27804
|
+
}
|
|
27805
|
+
async function* transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) {
|
|
27806
|
+
const writer = decompressionStream.writable.getWriter();
|
|
27807
|
+
const reader = decompressionStream.readable.getReader();
|
|
27808
|
+
const writePromise = writeBatchesToNativeDecompressionStream(inputBatches, writer);
|
|
27809
|
+
writePromise.catch(() => {
|
|
27810
|
+
});
|
|
27811
|
+
let outputCompleted = false;
|
|
27812
|
+
try {
|
|
27813
|
+
while (true) {
|
|
27814
|
+
const { done, value } = await reader.read();
|
|
27815
|
+
if (done) {
|
|
27816
|
+
outputCompleted = true;
|
|
27817
|
+
break;
|
|
27818
|
+
}
|
|
27819
|
+
yield copyExactArrayBuffer(value);
|
|
27820
|
+
}
|
|
27821
|
+
await writePromise;
|
|
27822
|
+
} finally {
|
|
27823
|
+
if (!outputCompleted) {
|
|
27824
|
+
await reader.cancel().catch(() => {
|
|
27825
|
+
});
|
|
27826
|
+
await writer.abort().catch(() => {
|
|
27827
|
+
});
|
|
27828
|
+
await writePromise.catch(() => {
|
|
27829
|
+
});
|
|
27830
|
+
}
|
|
27831
|
+
reader.releaseLock();
|
|
27832
|
+
}
|
|
27833
|
+
}
|
|
27834
|
+
async function concatenateNativeDecompressionBatches(outputBatches) {
|
|
27835
|
+
const batches = [];
|
|
27836
|
+
let byteLength = 0;
|
|
27837
|
+
for await (const outputBatch of outputBatches) {
|
|
27838
|
+
const bytes = new Uint8Array(outputBatch);
|
|
27839
|
+
batches.push(bytes);
|
|
27840
|
+
byteLength += bytes.byteLength;
|
|
27841
|
+
}
|
|
27842
|
+
const output = new Uint8Array(byteLength);
|
|
27843
|
+
let byteOffset = 0;
|
|
27844
|
+
for (const batch of batches) {
|
|
27845
|
+
output.set(batch, byteOffset);
|
|
27846
|
+
byteOffset += batch.byteLength;
|
|
27847
|
+
}
|
|
27848
|
+
return output.buffer;
|
|
27849
|
+
}
|
|
27850
|
+
function copyExactArrayBuffer(value) {
|
|
27851
|
+
return new Uint8Array(value).buffer;
|
|
27852
|
+
}
|
|
27853
|
+
async function writeBatchesToNativeDecompressionStream(inputBatches, writer) {
|
|
27854
|
+
try {
|
|
27855
|
+
for await (const inputBatch of inputBatches) {
|
|
27856
|
+
await writer.write(new Uint8Array(inputBatch));
|
|
27857
|
+
}
|
|
27858
|
+
await writer.close();
|
|
27859
|
+
} catch (error) {
|
|
27860
|
+
await writer.abort(error).catch(() => {
|
|
27861
|
+
});
|
|
27862
|
+
throw error;
|
|
27863
|
+
}
|
|
27864
|
+
}
|
|
27865
|
+
var init_decompression_stream = __esm({
|
|
27866
|
+
"../../modules/compression/src/lib/decompression-stream.ts"() {
|
|
27754
27867
|
"use strict";
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27759
|
-
|
|
27760
|
-
|
|
27761
|
-
|
|
27762
|
-
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
|
|
27769
|
-
|
|
27770
|
-
|
|
27771
|
-
|
|
27772
|
-
|
|
27773
|
-
|
|
27774
|
-
|
|
27775
|
-
|
|
27776
|
-
|
|
27777
|
-
|
|
27778
|
-
|
|
27779
|
-
|
|
27780
|
-
|
|
27781
|
-
|
|
27782
|
-
4,
|
|
27783
|
-
5,
|
|
27784
|
-
5,
|
|
27785
|
-
5,
|
|
27786
|
-
5,
|
|
27787
|
-
0,
|
|
27788
|
-
/* unused */
|
|
27789
|
-
0,
|
|
27790
|
-
0,
|
|
27791
|
-
/* impossible */
|
|
27792
|
-
0
|
|
27793
|
-
]);
|
|
27794
|
-
fdeb = new u8([
|
|
27795
|
-
0,
|
|
27796
|
-
0,
|
|
27797
|
-
0,
|
|
27798
|
-
0,
|
|
27799
|
-
1,
|
|
27800
|
-
1,
|
|
27801
|
-
2,
|
|
27802
|
-
2,
|
|
27803
|
-
3,
|
|
27804
|
-
3,
|
|
27805
|
-
4,
|
|
27806
|
-
4,
|
|
27807
|
-
5,
|
|
27808
|
-
5,
|
|
27809
|
-
6,
|
|
27810
|
-
6,
|
|
27811
|
-
7,
|
|
27812
|
-
7,
|
|
27813
|
-
8,
|
|
27814
|
-
8,
|
|
27815
|
-
9,
|
|
27816
|
-
9,
|
|
27817
|
-
10,
|
|
27818
|
-
10,
|
|
27819
|
-
11,
|
|
27820
|
-
11,
|
|
27821
|
-
12,
|
|
27822
|
-
12,
|
|
27823
|
-
13,
|
|
27824
|
-
13,
|
|
27825
|
-
/* unused */
|
|
27826
|
-
0,
|
|
27827
|
-
0
|
|
27828
|
-
]);
|
|
27829
|
-
clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
27830
|
-
freb = (eb, start) => {
|
|
27831
|
-
const b = new u16(31);
|
|
27832
|
-
for (let i = 0; i < 31; ++i) {
|
|
27833
|
-
b[i] = start += 1 << eb[i - 1];
|
|
27868
|
+
}
|
|
27869
|
+
});
|
|
27870
|
+
|
|
27871
|
+
// ../../modules/compression/src/lib/native-decompressor.ts
|
|
27872
|
+
var native_decompressor_exports = {};
|
|
27873
|
+
__export(native_decompressor_exports, {
|
|
27874
|
+
NativeDecompressor: () => NativeDecompressor
|
|
27875
|
+
});
|
|
27876
|
+
var NativeDecompressor;
|
|
27877
|
+
var init_native_decompressor = __esm({
|
|
27878
|
+
"../../modules/compression/src/lib/native-decompressor.ts"() {
|
|
27879
|
+
"use strict";
|
|
27880
|
+
init_compression();
|
|
27881
|
+
init_decompression_stream();
|
|
27882
|
+
NativeDecompressor = class extends Decompressor {
|
|
27883
|
+
name;
|
|
27884
|
+
extensions;
|
|
27885
|
+
contentEncodings;
|
|
27886
|
+
isSupported = true;
|
|
27887
|
+
/** Runtime stream format used for every operation. */
|
|
27888
|
+
format;
|
|
27889
|
+
constructor(metadata, format, options = {}) {
|
|
27890
|
+
super(options);
|
|
27891
|
+
this.name = metadata.name;
|
|
27892
|
+
this.extensions = [...metadata.extensions];
|
|
27893
|
+
this.contentEncodings = [...metadata.contentEncodings];
|
|
27894
|
+
this.format = format;
|
|
27834
27895
|
}
|
|
27835
|
-
|
|
27836
|
-
|
|
27837
|
-
|
|
27838
|
-
|
|
27839
|
-
|
|
27896
|
+
/** Decompresses one buffer with the runtime-provided stream. */
|
|
27897
|
+
async decompress(input) {
|
|
27898
|
+
const output = await decompressWithNativeDecompressionStream(input, this.format);
|
|
27899
|
+
if (!output) throw new Error(`${this.name}: built-in decompression is no longer available`);
|
|
27900
|
+
return output;
|
|
27901
|
+
}
|
|
27902
|
+
/** Decompresses batches incrementally with the runtime-provided stream. */
|
|
27903
|
+
async *decompressBatches(inputBatches) {
|
|
27904
|
+
const output = decompressBatchesWithNativeDecompressionStream(inputBatches, this.format);
|
|
27905
|
+
if (!output) throw new Error(`${this.name}: built-in decompression is no longer available`);
|
|
27906
|
+
yield* output;
|
|
27840
27907
|
}
|
|
27841
|
-
return [b, r];
|
|
27842
27908
|
};
|
|
27843
|
-
|
|
27844
|
-
|
|
27845
|
-
|
|
27846
|
-
|
|
27847
|
-
|
|
27848
|
-
|
|
27849
|
-
|
|
27850
|
-
|
|
27909
|
+
}
|
|
27910
|
+
});
|
|
27911
|
+
|
|
27912
|
+
// ../../modules/compression/src/lib/lazy-compression.ts
|
|
27913
|
+
function mergeModules(options, modules) {
|
|
27914
|
+
return { ...options, modules: { ...options.modules, ...modules } };
|
|
27915
|
+
}
|
|
27916
|
+
var LazyDecompressor;
|
|
27917
|
+
var init_lazy_compression = __esm({
|
|
27918
|
+
"../../modules/compression/src/lib/lazy-compression.ts"() {
|
|
27919
|
+
"use strict";
|
|
27920
|
+
init_compression();
|
|
27921
|
+
init_decompression_stream();
|
|
27922
|
+
LazyDecompressor = class extends Decompressor {
|
|
27923
|
+
name;
|
|
27924
|
+
extensions;
|
|
27925
|
+
contentEncodings;
|
|
27926
|
+
isSupported = true;
|
|
27927
|
+
/** Constructor options retained until a concrete implementation is selected. */
|
|
27928
|
+
options;
|
|
27929
|
+
/** Built-in stream format to probe, or null when the format has no built-in path. */
|
|
27930
|
+
nativeFormat;
|
|
27931
|
+
/** Returns whether built-in selection remains eligible for the merged preload options. */
|
|
27932
|
+
shouldUseNative;
|
|
27933
|
+
/** Dynamically imports the balanced fallback constructor. */
|
|
27934
|
+
loadFallback;
|
|
27935
|
+
/** Selected concrete implementation after preload completes. */
|
|
27936
|
+
implementation = null;
|
|
27937
|
+
/** Shared in-flight selection used by concurrent asynchronous calls. */
|
|
27938
|
+
implementationPromise = null;
|
|
27939
|
+
constructor(metadata, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
|
|
27940
|
+
super(options);
|
|
27941
|
+
this.name = metadata.name;
|
|
27942
|
+
this.extensions = [...metadata.extensions];
|
|
27943
|
+
this.contentEncodings = [...metadata.contentEncodings];
|
|
27944
|
+
this.options = options;
|
|
27945
|
+
this.nativeFormat = nativeFormat;
|
|
27946
|
+
this.shouldUseNative = shouldUseNative;
|
|
27947
|
+
this.loadFallback = loadFallback;
|
|
27948
|
+
}
|
|
27949
|
+
/** Selects and returns the built-in or dynamically imported fallback decompressor. */
|
|
27950
|
+
async preload(modules = {}) {
|
|
27951
|
+
if (this.implementation) return this.implementation;
|
|
27952
|
+
const options = mergeModules(this.options, modules);
|
|
27953
|
+
this.implementationPromise ||= this.loadImplementation(options);
|
|
27954
|
+
try {
|
|
27955
|
+
this.implementation = await this.implementationPromise;
|
|
27956
|
+
return this.implementation;
|
|
27957
|
+
} catch (error) {
|
|
27958
|
+
this.implementationPromise = null;
|
|
27959
|
+
throw error;
|
|
27960
|
+
}
|
|
27961
|
+
}
|
|
27962
|
+
/** Loads the selected concrete decompressor. */
|
|
27963
|
+
async loadImplementation(options) {
|
|
27964
|
+
if (options.useNative !== false && this.nativeFormat && this.shouldUseNative(options) && isNativeDecompressionSupported(this.nativeFormat)) {
|
|
27965
|
+
const { NativeDecompressor: NativeDecompressor2 } = await Promise.resolve().then(() => (init_native_decompressor(), native_decompressor_exports));
|
|
27966
|
+
return new NativeDecompressor2(this, this.nativeFormat, options);
|
|
27967
|
+
}
|
|
27968
|
+
const Decompressor2 = await this.loadFallback();
|
|
27969
|
+
const implementation = new Decompressor2({ ...options, useNative: false });
|
|
27970
|
+
await implementation.preload(options.modules);
|
|
27971
|
+
return implementation;
|
|
27972
|
+
}
|
|
27973
|
+
/** Decompresses after lazily selecting the default implementation. */
|
|
27974
|
+
async decompress(input, size) {
|
|
27975
|
+
return (await this.preload()).decompress(input, size);
|
|
27976
|
+
}
|
|
27977
|
+
/** Decompresses synchronously after an implementation has been preloaded. */
|
|
27978
|
+
decompressSync(input, size) {
|
|
27979
|
+
if (!this.implementation) {
|
|
27980
|
+
throw new Error(`${this.name}: call preload() before decompressSync()`);
|
|
27981
|
+
}
|
|
27982
|
+
return this.implementation.decompressSync(input, size);
|
|
27983
|
+
}
|
|
27984
|
+
/** Decompresses batches after lazily selecting the default implementation. */
|
|
27985
|
+
async *decompressBatches(inputBatches) {
|
|
27986
|
+
yield* (await this.preload()).decompressBatches(inputBatches);
|
|
27987
|
+
}
|
|
27988
|
+
};
|
|
27989
|
+
}
|
|
27990
|
+
});
|
|
27991
|
+
|
|
27992
|
+
// ../../modules/compression/src/no-decompressor.ts
|
|
27993
|
+
var no_decompressor_exports = {};
|
|
27994
|
+
__export(no_decompressor_exports, {
|
|
27995
|
+
NoDecompressor: () => NoDecompressor
|
|
27996
|
+
});
|
|
27997
|
+
var NoDecompressor;
|
|
27998
|
+
var init_no_decompressor = __esm({
|
|
27999
|
+
"../../modules/compression/src/no-decompressor.ts"() {
|
|
28000
|
+
"use strict";
|
|
28001
|
+
init_compression();
|
|
28002
|
+
NoDecompressor = class extends Decompressor {
|
|
28003
|
+
name = "uncompressed";
|
|
28004
|
+
extensions = [];
|
|
28005
|
+
contentEncodings = [];
|
|
28006
|
+
isSupported = true;
|
|
28007
|
+
constructor(options = {}) {
|
|
28008
|
+
super(options);
|
|
28009
|
+
}
|
|
28010
|
+
/** Returns the input without modification. */
|
|
28011
|
+
decompressSync(input) {
|
|
28012
|
+
return input;
|
|
28013
|
+
}
|
|
28014
|
+
};
|
|
28015
|
+
}
|
|
28016
|
+
});
|
|
28017
|
+
|
|
28018
|
+
// ../../modules/compression/src/lib/fflate/index.ts
|
|
28019
|
+
function inflateSync(data, out) {
|
|
28020
|
+
return inflt(data, out);
|
|
28021
|
+
}
|
|
28022
|
+
function gunzipSync(data, out) {
|
|
28023
|
+
return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));
|
|
28024
|
+
}
|
|
28025
|
+
function unzlibSync(data, out) {
|
|
28026
|
+
return inflt((zlv(data), data.subarray(2, -4)), out);
|
|
28027
|
+
}
|
|
28028
|
+
var u8, u16, u32, fleb, fdeb, clim, freb, fl, revfl, fd, revfd, rev, hMap, flt, fdt, flrm, fdrm, max, bits, bits16, shft, slc, ec, err, inflt, gzs, gzl, zlv, Inflate, Gunzip, Unzlib;
|
|
28029
|
+
var init_fflate = __esm({
|
|
28030
|
+
"../../modules/compression/src/lib/fflate/index.ts"() {
|
|
28031
|
+
"use strict";
|
|
28032
|
+
u8 = Uint8Array;
|
|
28033
|
+
u16 = Uint16Array;
|
|
28034
|
+
u32 = Uint32Array;
|
|
28035
|
+
fleb = new u8([
|
|
28036
|
+
0,
|
|
28037
|
+
0,
|
|
28038
|
+
0,
|
|
28039
|
+
0,
|
|
28040
|
+
0,
|
|
28041
|
+
0,
|
|
28042
|
+
0,
|
|
28043
|
+
0,
|
|
28044
|
+
1,
|
|
28045
|
+
1,
|
|
28046
|
+
1,
|
|
28047
|
+
1,
|
|
28048
|
+
2,
|
|
28049
|
+
2,
|
|
28050
|
+
2,
|
|
28051
|
+
2,
|
|
28052
|
+
3,
|
|
28053
|
+
3,
|
|
28054
|
+
3,
|
|
28055
|
+
3,
|
|
28056
|
+
4,
|
|
28057
|
+
4,
|
|
28058
|
+
4,
|
|
28059
|
+
4,
|
|
28060
|
+
5,
|
|
28061
|
+
5,
|
|
28062
|
+
5,
|
|
28063
|
+
5,
|
|
28064
|
+
0,
|
|
28065
|
+
/* unused */
|
|
28066
|
+
0,
|
|
28067
|
+
0,
|
|
28068
|
+
/* impossible */
|
|
28069
|
+
0
|
|
28070
|
+
]);
|
|
28071
|
+
fdeb = new u8([
|
|
28072
|
+
0,
|
|
28073
|
+
0,
|
|
28074
|
+
0,
|
|
28075
|
+
0,
|
|
28076
|
+
1,
|
|
28077
|
+
1,
|
|
28078
|
+
2,
|
|
28079
|
+
2,
|
|
28080
|
+
3,
|
|
28081
|
+
3,
|
|
28082
|
+
4,
|
|
28083
|
+
4,
|
|
28084
|
+
5,
|
|
28085
|
+
5,
|
|
28086
|
+
6,
|
|
28087
|
+
6,
|
|
28088
|
+
7,
|
|
28089
|
+
7,
|
|
28090
|
+
8,
|
|
28091
|
+
8,
|
|
28092
|
+
9,
|
|
28093
|
+
9,
|
|
28094
|
+
10,
|
|
28095
|
+
10,
|
|
28096
|
+
11,
|
|
28097
|
+
11,
|
|
28098
|
+
12,
|
|
28099
|
+
12,
|
|
28100
|
+
13,
|
|
28101
|
+
13,
|
|
28102
|
+
/* unused */
|
|
28103
|
+
0,
|
|
28104
|
+
0
|
|
28105
|
+
]);
|
|
28106
|
+
clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
28107
|
+
freb = (eb, start) => {
|
|
28108
|
+
const b = new u16(31);
|
|
28109
|
+
for (let i = 0; i < 31; ++i) {
|
|
28110
|
+
b[i] = start += 1 << eb[i - 1];
|
|
28111
|
+
}
|
|
28112
|
+
const r = new u32(b[30]);
|
|
28113
|
+
for (let i = 1; i < 30; ++i) {
|
|
28114
|
+
for (let j = b[i]; j < b[i + 1]; ++j) {
|
|
28115
|
+
r[j] = j - b[i] << 5 | i;
|
|
28116
|
+
}
|
|
28117
|
+
}
|
|
28118
|
+
return [b, r];
|
|
28119
|
+
};
|
|
28120
|
+
[fl, revfl] = freb(fleb, 2);
|
|
28121
|
+
fl[28] = 258, revfl[258] = 28;
|
|
28122
|
+
[fd, revfd] = freb(fdeb, 0);
|
|
28123
|
+
rev = new u16(32768);
|
|
28124
|
+
for (let i = 0; i < 32768; ++i) {
|
|
28125
|
+
let x = (i & 43690) >>> 1 | (i & 21845) << 1;
|
|
28126
|
+
x = (x & 52428) >>> 2 | (x & 13107) << 2;
|
|
28127
|
+
x = (x & 61680) >>> 4 | (x & 3855) << 4;
|
|
27851
28128
|
rev[i] = ((x & 65280) >>> 8 | (x & 255) << 8) >>> 1;
|
|
27852
28129
|
}
|
|
27853
28130
|
hMap = (cd, mb, r) => {
|
|
@@ -28048,379 +28325,137 @@ var init_fflate = __esm({
|
|
|
28048
28325
|
}
|
|
28049
28326
|
if (noBuf) cbuf(bt + 131072);
|
|
28050
28327
|
const end = bt + add;
|
|
28051
|
-
for (; bt < end; bt += 4) {
|
|
28052
|
-
buf[bt] = buf[bt - dt];
|
|
28053
|
-
buf[bt + 1] = buf[bt + 1 - dt];
|
|
28054
|
-
buf[bt + 2] = buf[bt + 2 - dt];
|
|
28055
|
-
buf[bt + 3] = buf[bt + 3 - dt];
|
|
28056
|
-
}
|
|
28057
|
-
bt = end;
|
|
28058
|
-
}
|
|
28059
|
-
}
|
|
28060
|
-
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
28061
|
-
if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
28062
|
-
} while (!final);
|
|
28063
|
-
return bt == buf.length ? buf : slc(buf, 0, bt);
|
|
28064
|
-
};
|
|
28065
|
-
gzs = (d) => {
|
|
28066
|
-
if (d[0] != 31 || d[1] != 139 || d[2] != 8) err(6, "invalid gzip data");
|
|
28067
|
-
const flg = d[3];
|
|
28068
|
-
let st = 10;
|
|
28069
|
-
if (flg & 4) st += d[10] | (d[11] << 8) + 2;
|
|
28070
|
-
for (let zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) ;
|
|
28071
|
-
return st + (flg & 2);
|
|
28072
|
-
};
|
|
28073
|
-
gzl = (d) => {
|
|
28074
|
-
const l = d.length;
|
|
28075
|
-
return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;
|
|
28076
|
-
};
|
|
28077
|
-
zlv = (d) => {
|
|
28078
|
-
if ((d[0] & 15) != 8 || d[0] >>> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, "invalid zlib data");
|
|
28079
|
-
if (d[1] & 32) err(6, "invalid zlib data: preset dictionaries not supported");
|
|
28080
|
-
};
|
|
28081
|
-
Inflate = class {
|
|
28082
|
-
/**
|
|
28083
|
-
* Creates an inflation stream
|
|
28084
|
-
* @param cb The callback to call whenever data is inflated
|
|
28085
|
-
*/
|
|
28086
|
-
constructor(cb) {
|
|
28087
|
-
this.ondata = cb;
|
|
28088
|
-
}
|
|
28089
|
-
/** Persistent bit-reader and Huffman decoding state. */
|
|
28090
|
-
s = {};
|
|
28091
|
-
/** Compression options or retained output window for this stream. */
|
|
28092
|
-
o;
|
|
28093
|
-
/** Compressed bytes pending decoding. */
|
|
28094
|
-
p = new u8(0);
|
|
28095
|
-
/** Whether the stream has received its final chunk. */
|
|
28096
|
-
d;
|
|
28097
|
-
/**
|
|
28098
|
-
* The handler to call whenever data is available
|
|
28099
|
-
*/
|
|
28100
|
-
ondata;
|
|
28101
|
-
/** Appends pending input after checking stream lifecycle. */
|
|
28102
|
-
e(c) {
|
|
28103
|
-
if (!this.ondata) err(5);
|
|
28104
|
-
if (this.d) err(4);
|
|
28105
|
-
const l = this.p.length;
|
|
28106
|
-
const n = new u8(l + c.length);
|
|
28107
|
-
n.set(this.p), n.set(c, l), this.p = n;
|
|
28108
|
-
}
|
|
28109
|
-
/** Decodes pending input and retains the sliding window. */
|
|
28110
|
-
c(final) {
|
|
28111
|
-
this.d = this.s.i = final || false;
|
|
28112
|
-
const bts = this.s.b;
|
|
28113
|
-
const dt = inflt(this.p, this.o, this.s);
|
|
28114
|
-
this.ondata(slc(dt, bts, this.s.b), this.d);
|
|
28115
|
-
this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
|
|
28116
|
-
this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
28117
|
-
}
|
|
28118
|
-
/**
|
|
28119
|
-
* Pushes a chunk to be inflated
|
|
28120
|
-
* @param chunk The chunk to push
|
|
28121
|
-
* @param final Whether this is the final chunk
|
|
28122
|
-
*/
|
|
28123
|
-
push(chunk, final) {
|
|
28124
|
-
this.e(chunk), this.c(final);
|
|
28125
|
-
}
|
|
28126
|
-
};
|
|
28127
|
-
Gunzip = class extends Inflate {
|
|
28128
|
-
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28129
|
-
v = 1;
|
|
28130
|
-
/**
|
|
28131
|
-
* Creates a GUNZIP stream
|
|
28132
|
-
* @param cb The callback to call whenever data is inflated
|
|
28133
|
-
*/
|
|
28134
|
-
constructor(cb) {
|
|
28135
|
-
super(cb);
|
|
28136
|
-
}
|
|
28137
|
-
/**
|
|
28138
|
-
* Pushes a chunk to be GUNZIPped
|
|
28139
|
-
* @param chunk The chunk to push
|
|
28140
|
-
* @param final Whether this is the last chunk
|
|
28141
|
-
*/
|
|
28142
|
-
push(chunk, final) {
|
|
28143
|
-
Inflate.prototype.e.call(this, chunk);
|
|
28144
|
-
if (this.v) {
|
|
28145
|
-
const s = this.p.length > 3 ? gzs(this.p) : 4;
|
|
28146
|
-
if (s >= this.p.length && !final) return;
|
|
28147
|
-
this.p = this.p.subarray(s), this.v = 0;
|
|
28148
|
-
}
|
|
28149
|
-
if (final) {
|
|
28150
|
-
if (this.p.length < 8) err(6, "invalid gzip data");
|
|
28151
|
-
this.p = this.p.subarray(0, -8);
|
|
28152
|
-
}
|
|
28153
|
-
Inflate.prototype.c.call(this, final);
|
|
28154
|
-
}
|
|
28155
|
-
};
|
|
28156
|
-
Unzlib = class extends Inflate {
|
|
28157
|
-
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28158
|
-
v = 1;
|
|
28159
|
-
/**
|
|
28160
|
-
* Creates a Zlib decompression stream
|
|
28161
|
-
* @param cb The callback to call whenever data is inflated
|
|
28162
|
-
*/
|
|
28163
|
-
constructor(cb) {
|
|
28164
|
-
super(cb);
|
|
28165
|
-
}
|
|
28166
|
-
/**
|
|
28167
|
-
* Pushes a chunk to be unzlibbed
|
|
28168
|
-
* @param chunk The chunk to push
|
|
28169
|
-
* @param final Whether this is the last chunk
|
|
28170
|
-
*/
|
|
28171
|
-
push(chunk, final) {
|
|
28172
|
-
Inflate.prototype.e.call(this, chunk);
|
|
28173
|
-
if (this.v) {
|
|
28174
|
-
if (this.p.length < 2 && !final) return;
|
|
28175
|
-
this.p = this.p.subarray(2), this.v = 0;
|
|
28176
|
-
}
|
|
28177
|
-
if (final) {
|
|
28178
|
-
if (this.p.length < 4) err(6, "invalid zlib data");
|
|
28179
|
-
this.p = this.p.subarray(0, -4);
|
|
28180
|
-
}
|
|
28181
|
-
Inflate.prototype.c.call(this, final);
|
|
28182
|
-
}
|
|
28183
|
-
};
|
|
28184
|
-
}
|
|
28185
|
-
});
|
|
28186
|
-
|
|
28187
|
-
// ../../modules/compression/src/lib/decompression-stream.ts
|
|
28188
|
-
async function decompressWithNativeDecompressionStream(input, format) {
|
|
28189
|
-
const outputBatches = decompressBatchesWithNativeDecompressionStream([input], format);
|
|
28190
|
-
return outputBatches ? await concatenateNativeDecompressionBatches(outputBatches) : null;
|
|
28191
|
-
}
|
|
28192
|
-
function decompressBatchesWithNativeDecompressionStream(inputBatches, format) {
|
|
28193
|
-
const decompressionStream = createNativeDecompressionStream(format);
|
|
28194
|
-
return decompressionStream ? transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) : null;
|
|
28195
|
-
}
|
|
28196
|
-
function isNativeDecompressionSupported(format) {
|
|
28197
|
-
return Boolean(createNativeDecompressionStream(format));
|
|
28198
|
-
}
|
|
28199
|
-
function createNativeDecompressionStream(format) {
|
|
28200
|
-
if (typeof globalThis.DecompressionStream === "undefined") {
|
|
28201
|
-
return null;
|
|
28202
|
-
}
|
|
28203
|
-
if (globalThis.process?.release?.name === "node" && typeof globalThis.Buffer === "undefined") {
|
|
28204
|
-
return null;
|
|
28205
|
-
}
|
|
28206
|
-
try {
|
|
28207
|
-
const DecompressionStreamConstructor = globalThis.DecompressionStream;
|
|
28208
|
-
return new DecompressionStreamConstructor(format);
|
|
28209
|
-
} catch (error) {
|
|
28210
|
-
if (error instanceof TypeError || error?.name === "TypeError") {
|
|
28211
|
-
return null;
|
|
28212
|
-
}
|
|
28213
|
-
throw error;
|
|
28214
|
-
}
|
|
28215
|
-
}
|
|
28216
|
-
async function* transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) {
|
|
28217
|
-
const writer = decompressionStream.writable.getWriter();
|
|
28218
|
-
const reader = decompressionStream.readable.getReader();
|
|
28219
|
-
const writePromise = writeBatchesToNativeDecompressionStream(inputBatches, writer);
|
|
28220
|
-
writePromise.catch(() => {
|
|
28221
|
-
});
|
|
28222
|
-
let outputCompleted = false;
|
|
28223
|
-
try {
|
|
28224
|
-
while (true) {
|
|
28225
|
-
const { done, value } = await reader.read();
|
|
28226
|
-
if (done) {
|
|
28227
|
-
outputCompleted = true;
|
|
28228
|
-
break;
|
|
28229
|
-
}
|
|
28230
|
-
yield copyExactArrayBuffer(value);
|
|
28231
|
-
}
|
|
28232
|
-
await writePromise;
|
|
28233
|
-
} finally {
|
|
28234
|
-
if (!outputCompleted) {
|
|
28235
|
-
await reader.cancel().catch(() => {
|
|
28236
|
-
});
|
|
28237
|
-
await writer.abort().catch(() => {
|
|
28238
|
-
});
|
|
28239
|
-
await writePromise.catch(() => {
|
|
28240
|
-
});
|
|
28241
|
-
}
|
|
28242
|
-
reader.releaseLock();
|
|
28243
|
-
}
|
|
28244
|
-
}
|
|
28245
|
-
async function concatenateNativeDecompressionBatches(outputBatches) {
|
|
28246
|
-
const batches = [];
|
|
28247
|
-
let byteLength = 0;
|
|
28248
|
-
for await (const outputBatch of outputBatches) {
|
|
28249
|
-
const bytes = new Uint8Array(outputBatch);
|
|
28250
|
-
batches.push(bytes);
|
|
28251
|
-
byteLength += bytes.byteLength;
|
|
28252
|
-
}
|
|
28253
|
-
const output = new Uint8Array(byteLength);
|
|
28254
|
-
let byteOffset = 0;
|
|
28255
|
-
for (const batch of batches) {
|
|
28256
|
-
output.set(batch, byteOffset);
|
|
28257
|
-
byteOffset += batch.byteLength;
|
|
28258
|
-
}
|
|
28259
|
-
return output.buffer;
|
|
28260
|
-
}
|
|
28261
|
-
function copyExactArrayBuffer(value) {
|
|
28262
|
-
return new Uint8Array(value).buffer;
|
|
28263
|
-
}
|
|
28264
|
-
async function writeBatchesToNativeDecompressionStream(inputBatches, writer) {
|
|
28265
|
-
try {
|
|
28266
|
-
for await (const inputBatch of inputBatches) {
|
|
28267
|
-
await writer.write(new Uint8Array(inputBatch));
|
|
28268
|
-
}
|
|
28269
|
-
await writer.close();
|
|
28270
|
-
} catch (error) {
|
|
28271
|
-
await writer.abort(error).catch(() => {
|
|
28272
|
-
});
|
|
28273
|
-
throw error;
|
|
28274
|
-
}
|
|
28275
|
-
}
|
|
28276
|
-
var init_decompression_stream = __esm({
|
|
28277
|
-
"../../modules/compression/src/lib/decompression-stream.ts"() {
|
|
28278
|
-
"use strict";
|
|
28279
|
-
}
|
|
28280
|
-
});
|
|
28281
|
-
|
|
28282
|
-
// ../../modules/compression/src/lib/native-decompressor.ts
|
|
28283
|
-
var native_decompressor_exports = {};
|
|
28284
|
-
__export(native_decompressor_exports, {
|
|
28285
|
-
NativeDecompressor: () => NativeDecompressor
|
|
28286
|
-
});
|
|
28287
|
-
var NativeDecompressor;
|
|
28288
|
-
var init_native_decompressor = __esm({
|
|
28289
|
-
"../../modules/compression/src/lib/native-decompressor.ts"() {
|
|
28290
|
-
"use strict";
|
|
28291
|
-
init_compression();
|
|
28292
|
-
init_decompression_stream();
|
|
28293
|
-
NativeDecompressor = class extends Decompressor {
|
|
28294
|
-
name;
|
|
28295
|
-
extensions;
|
|
28296
|
-
contentEncodings;
|
|
28297
|
-
isSupported = true;
|
|
28298
|
-
/** Runtime stream format used for every operation. */
|
|
28299
|
-
format;
|
|
28300
|
-
constructor(metadata, format, options = {}) {
|
|
28301
|
-
super(options);
|
|
28302
|
-
this.name = metadata.name;
|
|
28303
|
-
this.extensions = [...metadata.extensions];
|
|
28304
|
-
this.contentEncodings = [...metadata.contentEncodings];
|
|
28305
|
-
this.format = format;
|
|
28328
|
+
for (; bt < end; bt += 4) {
|
|
28329
|
+
buf[bt] = buf[bt - dt];
|
|
28330
|
+
buf[bt + 1] = buf[bt + 1 - dt];
|
|
28331
|
+
buf[bt + 2] = buf[bt + 2 - dt];
|
|
28332
|
+
buf[bt + 3] = buf[bt + 3 - dt];
|
|
28333
|
+
}
|
|
28334
|
+
bt = end;
|
|
28335
|
+
}
|
|
28336
|
+
}
|
|
28337
|
+
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
28338
|
+
if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
28339
|
+
} while (!final);
|
|
28340
|
+
return bt == buf.length ? buf : slc(buf, 0, bt);
|
|
28341
|
+
};
|
|
28342
|
+
gzs = (d) => {
|
|
28343
|
+
if (d[0] != 31 || d[1] != 139 || d[2] != 8) err(6, "invalid gzip data");
|
|
28344
|
+
const flg = d[3];
|
|
28345
|
+
let st = 10;
|
|
28346
|
+
if (flg & 4) st += d[10] | (d[11] << 8) + 2;
|
|
28347
|
+
for (let zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) ;
|
|
28348
|
+
return st + (flg & 2);
|
|
28349
|
+
};
|
|
28350
|
+
gzl = (d) => {
|
|
28351
|
+
const l = d.length;
|
|
28352
|
+
return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;
|
|
28353
|
+
};
|
|
28354
|
+
zlv = (d) => {
|
|
28355
|
+
if ((d[0] & 15) != 8 || d[0] >>> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, "invalid zlib data");
|
|
28356
|
+
if (d[1] & 32) err(6, "invalid zlib data: preset dictionaries not supported");
|
|
28357
|
+
};
|
|
28358
|
+
Inflate = class {
|
|
28359
|
+
/**
|
|
28360
|
+
* Creates an inflation stream
|
|
28361
|
+
* @param cb The callback to call whenever data is inflated
|
|
28362
|
+
*/
|
|
28363
|
+
constructor(cb) {
|
|
28364
|
+
this.ondata = cb;
|
|
28306
28365
|
}
|
|
28307
|
-
/**
|
|
28308
|
-
|
|
28309
|
-
|
|
28310
|
-
|
|
28311
|
-
|
|
28366
|
+
/** Persistent bit-reader and Huffman decoding state. */
|
|
28367
|
+
s = {};
|
|
28368
|
+
/** Compression options or retained output window for this stream. */
|
|
28369
|
+
o;
|
|
28370
|
+
/** Compressed bytes pending decoding. */
|
|
28371
|
+
p = new u8(0);
|
|
28372
|
+
/** Whether the stream has received its final chunk. */
|
|
28373
|
+
d;
|
|
28374
|
+
/**
|
|
28375
|
+
* The handler to call whenever data is available
|
|
28376
|
+
*/
|
|
28377
|
+
ondata;
|
|
28378
|
+
/** Appends pending input after checking stream lifecycle. */
|
|
28379
|
+
e(c) {
|
|
28380
|
+
if (!this.ondata) err(5);
|
|
28381
|
+
if (this.d) err(4);
|
|
28382
|
+
const l = this.p.length;
|
|
28383
|
+
const n = new u8(l + c.length);
|
|
28384
|
+
n.set(this.p), n.set(c, l), this.p = n;
|
|
28312
28385
|
}
|
|
28313
|
-
/**
|
|
28314
|
-
|
|
28315
|
-
|
|
28316
|
-
|
|
28317
|
-
|
|
28386
|
+
/** Decodes pending input and retains the sliding window. */
|
|
28387
|
+
c(final) {
|
|
28388
|
+
this.d = this.s.i = final || false;
|
|
28389
|
+
const bts = this.s.b;
|
|
28390
|
+
const dt = inflt(this.p, this.o, this.s);
|
|
28391
|
+
this.ondata(slc(dt, bts, this.s.b), this.d);
|
|
28392
|
+
this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
|
|
28393
|
+
this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
28318
28394
|
}
|
|
28319
|
-
|
|
28320
|
-
|
|
28321
|
-
|
|
28322
|
-
|
|
28323
|
-
|
|
28324
|
-
|
|
28325
|
-
|
|
28326
|
-
}
|
|
28327
|
-
var LazyDecompressor;
|
|
28328
|
-
var init_lazy_compression = __esm({
|
|
28329
|
-
"../../modules/compression/src/lib/lazy-compression.ts"() {
|
|
28330
|
-
"use strict";
|
|
28331
|
-
init_compression();
|
|
28332
|
-
init_decompression_stream();
|
|
28333
|
-
LazyDecompressor = class extends Decompressor {
|
|
28334
|
-
name;
|
|
28335
|
-
extensions;
|
|
28336
|
-
contentEncodings;
|
|
28337
|
-
isSupported = true;
|
|
28338
|
-
/** Constructor options retained until a concrete implementation is selected. */
|
|
28339
|
-
options;
|
|
28340
|
-
/** Built-in stream format to probe, or null when the format has no built-in path. */
|
|
28341
|
-
nativeFormat;
|
|
28342
|
-
/** Returns whether built-in selection remains eligible for the merged preload options. */
|
|
28343
|
-
shouldUseNative;
|
|
28344
|
-
/** Dynamically imports the balanced fallback constructor. */
|
|
28345
|
-
loadFallback;
|
|
28346
|
-
/** Selected concrete implementation after preload completes. */
|
|
28347
|
-
implementation = null;
|
|
28348
|
-
/** Shared in-flight selection used by concurrent asynchronous calls. */
|
|
28349
|
-
implementationPromise = null;
|
|
28350
|
-
constructor(metadata, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
|
|
28351
|
-
super(options);
|
|
28352
|
-
this.name = metadata.name;
|
|
28353
|
-
this.extensions = [...metadata.extensions];
|
|
28354
|
-
this.contentEncodings = [...metadata.contentEncodings];
|
|
28355
|
-
this.options = options;
|
|
28356
|
-
this.nativeFormat = nativeFormat;
|
|
28357
|
-
this.shouldUseNative = shouldUseNative;
|
|
28358
|
-
this.loadFallback = loadFallback;
|
|
28395
|
+
/**
|
|
28396
|
+
* Pushes a chunk to be inflated
|
|
28397
|
+
* @param chunk The chunk to push
|
|
28398
|
+
* @param final Whether this is the final chunk
|
|
28399
|
+
*/
|
|
28400
|
+
push(chunk, final) {
|
|
28401
|
+
this.e(chunk), this.c(final);
|
|
28359
28402
|
}
|
|
28360
|
-
|
|
28361
|
-
|
|
28362
|
-
|
|
28363
|
-
|
|
28364
|
-
|
|
28365
|
-
|
|
28366
|
-
|
|
28367
|
-
|
|
28368
|
-
|
|
28369
|
-
|
|
28370
|
-
throw error;
|
|
28371
|
-
}
|
|
28403
|
+
};
|
|
28404
|
+
Gunzip = class extends Inflate {
|
|
28405
|
+
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28406
|
+
v = 1;
|
|
28407
|
+
/**
|
|
28408
|
+
* Creates a GUNZIP stream
|
|
28409
|
+
* @param cb The callback to call whenever data is inflated
|
|
28410
|
+
*/
|
|
28411
|
+
constructor(cb) {
|
|
28412
|
+
super(cb);
|
|
28372
28413
|
}
|
|
28373
|
-
/**
|
|
28374
|
-
|
|
28375
|
-
|
|
28376
|
-
|
|
28377
|
-
|
|
28414
|
+
/**
|
|
28415
|
+
* Pushes a chunk to be GUNZIPped
|
|
28416
|
+
* @param chunk The chunk to push
|
|
28417
|
+
* @param final Whether this is the last chunk
|
|
28418
|
+
*/
|
|
28419
|
+
push(chunk, final) {
|
|
28420
|
+
Inflate.prototype.e.call(this, chunk);
|
|
28421
|
+
if (this.v) {
|
|
28422
|
+
const s = this.p.length > 3 ? gzs(this.p) : 4;
|
|
28423
|
+
if (s >= this.p.length && !final) return;
|
|
28424
|
+
this.p = this.p.subarray(s), this.v = 0;
|
|
28378
28425
|
}
|
|
28379
|
-
|
|
28380
|
-
|
|
28381
|
-
|
|
28382
|
-
return implementation;
|
|
28383
|
-
}
|
|
28384
|
-
/** Decompresses after lazily selecting the default implementation. */
|
|
28385
|
-
async decompress(input, size) {
|
|
28386
|
-
return (await this.preload()).decompress(input, size);
|
|
28387
|
-
}
|
|
28388
|
-
/** Decompresses synchronously after an implementation has been preloaded. */
|
|
28389
|
-
decompressSync(input, size) {
|
|
28390
|
-
if (!this.implementation) {
|
|
28391
|
-
throw new Error(`${this.name}: call preload() before decompressSync()`);
|
|
28426
|
+
if (final) {
|
|
28427
|
+
if (this.p.length < 8) err(6, "invalid gzip data");
|
|
28428
|
+
this.p = this.p.subarray(0, -8);
|
|
28392
28429
|
}
|
|
28393
|
-
|
|
28394
|
-
}
|
|
28395
|
-
/** Decompresses batches after lazily selecting the default implementation. */
|
|
28396
|
-
async *decompressBatches(inputBatches) {
|
|
28397
|
-
yield* (await this.preload()).decompressBatches(inputBatches);
|
|
28430
|
+
Inflate.prototype.c.call(this, final);
|
|
28398
28431
|
}
|
|
28399
28432
|
};
|
|
28400
|
-
|
|
28401
|
-
|
|
28402
|
-
|
|
28403
|
-
|
|
28404
|
-
|
|
28405
|
-
|
|
28406
|
-
|
|
28407
|
-
|
|
28408
|
-
|
|
28409
|
-
var init_no_decompressor = __esm({
|
|
28410
|
-
"../../modules/compression/src/no-decompressor.ts"() {
|
|
28411
|
-
"use strict";
|
|
28412
|
-
init_compression();
|
|
28413
|
-
NoDecompressor = class extends Decompressor {
|
|
28414
|
-
name = "uncompressed";
|
|
28415
|
-
extensions = [];
|
|
28416
|
-
contentEncodings = [];
|
|
28417
|
-
isSupported = true;
|
|
28418
|
-
constructor(options = {}) {
|
|
28419
|
-
super(options);
|
|
28433
|
+
Unzlib = class extends Inflate {
|
|
28434
|
+
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28435
|
+
v = 1;
|
|
28436
|
+
/**
|
|
28437
|
+
* Creates a Zlib decompression stream
|
|
28438
|
+
* @param cb The callback to call whenever data is inflated
|
|
28439
|
+
*/
|
|
28440
|
+
constructor(cb) {
|
|
28441
|
+
super(cb);
|
|
28420
28442
|
}
|
|
28421
|
-
/**
|
|
28422
|
-
|
|
28423
|
-
|
|
28443
|
+
/**
|
|
28444
|
+
* Pushes a chunk to be unzlibbed
|
|
28445
|
+
* @param chunk The chunk to push
|
|
28446
|
+
* @param final Whether this is the last chunk
|
|
28447
|
+
*/
|
|
28448
|
+
push(chunk, final) {
|
|
28449
|
+
Inflate.prototype.e.call(this, chunk);
|
|
28450
|
+
if (this.v) {
|
|
28451
|
+
if (this.p.length < 2 && !final) return;
|
|
28452
|
+
this.p = this.p.subarray(2), this.v = 0;
|
|
28453
|
+
}
|
|
28454
|
+
if (final) {
|
|
28455
|
+
if (this.p.length < 4) err(6, "invalid zlib data");
|
|
28456
|
+
this.p = this.p.subarray(0, -4);
|
|
28457
|
+
}
|
|
28458
|
+
Inflate.prototype.c.call(this, final);
|
|
28424
28459
|
}
|
|
28425
28460
|
};
|
|
28426
28461
|
}
|
|
@@ -29275,6 +29310,7 @@ var init_i3s_loader_options = __esm({
|
|
|
29275
29310
|
decodeTextures: true,
|
|
29276
29311
|
attributeValues: "legacy",
|
|
29277
29312
|
colorFormat: "uint8norm",
|
|
29313
|
+
geometryMode: "render",
|
|
29278
29314
|
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
29279
29315
|
};
|
|
29280
29316
|
}
|
|
@@ -29364,7 +29400,12 @@ function getLoaderForTextureFormat(textureFormat) {
|
|
|
29364
29400
|
}
|
|
29365
29401
|
}
|
|
29366
29402
|
async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
|
|
29403
|
+
const geometryMode = options?.i3s?.geometryMode ?? "render";
|
|
29404
|
+
if (geometryMode !== "render" && geometryMode !== "source") {
|
|
29405
|
+
throw new Error("Unsupported I3S geometry mode");
|
|
29406
|
+
}
|
|
29367
29407
|
const content = {
|
|
29408
|
+
geometryMode,
|
|
29368
29409
|
attributes: {},
|
|
29369
29410
|
indices: null,
|
|
29370
29411
|
featureIds: [],
|
|
@@ -29514,6 +29555,13 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
|
|
|
29514
29555
|
id: featureIndex
|
|
29515
29556
|
};
|
|
29516
29557
|
copyDracoTextureCoordinates(attributes, decompressedGeometry.attributes);
|
|
29558
|
+
if (content.geometryMode === "source") {
|
|
29559
|
+
for (const [name18, attribute] of Object.entries(decompressedGeometry.attributes)) {
|
|
29560
|
+
if (!["POSITION", "NORMAL", "COLOR_0", "feature-index", "uv-region"].includes(name18) && !/^TEXCOORD_\d+$/.test(name18)) {
|
|
29561
|
+
attributes[name18] = attribute;
|
|
29562
|
+
}
|
|
29563
|
+
}
|
|
29564
|
+
}
|
|
29517
29565
|
updateAttributesMetadata(attributes, decompressedGeometry);
|
|
29518
29566
|
const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
|
|
29519
29567
|
if (featureIds) {
|
|
@@ -29562,7 +29610,32 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
|
|
|
29562
29610
|
attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
|
|
29563
29611
|
}
|
|
29564
29612
|
const spatialReference = tilesetOptions.spatialReference;
|
|
29565
|
-
if (
|
|
29613
|
+
if (content.geometryMode === "source") {
|
|
29614
|
+
if (attributes.position.size !== 3 || attributes.position.transform || attributes.position.normalized || (attributes.position.byteStride ?? 0) !== 0 || (attributes.position.byteOffset ?? 0) !== 0 || attributes.position.value.length !== vertexCount * 3 || tileOptions.mbs.length < 3 || tileOptions.mbs.slice(0, 3).some((value) => !Number.isFinite(value))) {
|
|
29615
|
+
throw new Error("Source I3S geometry requires packed xyz values and a finite source origin");
|
|
29616
|
+
}
|
|
29617
|
+
const positions = offsetsToSourcePositions(
|
|
29618
|
+
attributes.position.value,
|
|
29619
|
+
attributes.position.metadata,
|
|
29620
|
+
tileOptions.mbs
|
|
29621
|
+
);
|
|
29622
|
+
if (positions.some((value) => !Number.isFinite(value))) {
|
|
29623
|
+
throw new Error("Source I3S positions must be finite");
|
|
29624
|
+
}
|
|
29625
|
+
attributes.position = { value: positions, size: 3 };
|
|
29626
|
+
content.origin = [0, 0, 0];
|
|
29627
|
+
content.cartographicOrigin = [0, 0, 0];
|
|
29628
|
+
content.coordinateSystem = spatialReference?.sourceCrs && getSpatialCoordinateFrame(spatialReference.sourceCrs) === "geographic" ? "lnglat" : "cartesian";
|
|
29629
|
+
content.spatialReference = spatialReference ? Object.freeze({
|
|
29630
|
+
...spatialReference,
|
|
29631
|
+
status: "native",
|
|
29632
|
+
targetCrs: void 0,
|
|
29633
|
+
targetHeightReference: "native",
|
|
29634
|
+
outputCoordinates: "auto"
|
|
29635
|
+
}) : void 0;
|
|
29636
|
+
content.normalReferenceFrame = tilesetOptions.store.normalReferenceFrame || "earth-centered";
|
|
29637
|
+
content.sourceAttributes = attributes;
|
|
29638
|
+
} else if (spatialReference?.status === "transformable" || spatialReference?.status === "transformed") {
|
|
29566
29639
|
const spatialTransformer = new I3SSpatialTransformer(
|
|
29567
29640
|
spatialReference,
|
|
29568
29641
|
tilesetOptions.spatialOptions || options?.i3s?.spatial
|
|
@@ -29813,15 +29886,15 @@ function parsePositions2(attribute, options) {
|
|
|
29813
29886
|
const enuMatrix = new import_core23.Matrix4();
|
|
29814
29887
|
const cartographicOrigin = new import_core23.Vector3(mbs[0], mbs[1], mbs[2]);
|
|
29815
29888
|
const cartesianOrigin = new import_core23.Vector3();
|
|
29816
|
-
|
|
29817
|
-
|
|
29889
|
+
import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
|
|
29890
|
+
import_geospatial11.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
|
|
29818
29891
|
attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
|
|
29819
29892
|
return enuMatrix;
|
|
29820
29893
|
}
|
|
29821
29894
|
function offsetsToSourcePositions(vertices, metadata = {}, sourceOrigin) {
|
|
29822
29895
|
const positions = new Float64Array(vertices.length);
|
|
29823
|
-
const scaleX = metadata["i3s-scale_x"]
|
|
29824
|
-
const scaleY = metadata["i3s-scale_y"]
|
|
29896
|
+
const scaleX = metadata["i3s-scale_x"]?.double ?? 1;
|
|
29897
|
+
const scaleY = metadata["i3s-scale_y"]?.double ?? 1;
|
|
29825
29898
|
for (let index = 0; index < positions.length; index += 3) {
|
|
29826
29899
|
positions[index] = vertices[index] * scaleX + sourceOrigin[0];
|
|
29827
29900
|
positions[index + 1] = vertices[index + 1] * scaleY + sourceOrigin[1];
|
|
@@ -29832,7 +29905,7 @@ function offsetsToSourcePositions(vertices, metadata = {}, sourceOrigin) {
|
|
|
29832
29905
|
function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
|
|
29833
29906
|
const positions = offsetsToSourcePositions(vertices, metadata, cartographicOrigin);
|
|
29834
29907
|
for (let i = 0; i < positions.length; i += 3) {
|
|
29835
|
-
|
|
29908
|
+
import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector3);
|
|
29836
29909
|
positions[i] = scratchVector3.x;
|
|
29837
29910
|
positions[i + 1] = scratchVector3.y;
|
|
29838
29911
|
positions[i + 2] = scratchVector3.z;
|
|
@@ -30012,13 +30085,13 @@ function flattenFeatureIdsByFeatureIndices(attributes, featureIds) {
|
|
|
30012
30085
|
function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
|
|
30013
30086
|
return featureIndex?.metadata?.["i3s-feature-ids"]?.intArray;
|
|
30014
30087
|
}
|
|
30015
|
-
var import_core23,
|
|
30088
|
+
var import_core23, import_geospatial11, scratchVector3, I3S_ATTRIBUTE_TYPE;
|
|
30016
30089
|
var init_parse_i3s_tile_content = __esm({
|
|
30017
30090
|
"../../modules/i3s/src/lib/parsers/parse-i3s-tile-content.ts"() {
|
|
30018
30091
|
"use strict";
|
|
30019
30092
|
init_src3();
|
|
30020
30093
|
import_core23 = require("@math.gl/core");
|
|
30021
|
-
|
|
30094
|
+
import_geospatial11 = require("@math.gl/geospatial");
|
|
30022
30095
|
init_src2();
|
|
30023
30096
|
init_src6();
|
|
30024
30097
|
init_src8();
|
|
@@ -30645,14 +30718,14 @@ function normalizeTileNonUrlData(tile) {
|
|
|
30645
30718
|
if (tile.mbs) {
|
|
30646
30719
|
mbs = tile.mbs;
|
|
30647
30720
|
boundingVolume.sphere = [
|
|
30648
|
-
...
|
|
30721
|
+
...import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
|
|
30649
30722
|
// cartesian center of sphere
|
|
30650
30723
|
tile.mbs[3]
|
|
30651
30724
|
// radius of sphere
|
|
30652
30725
|
];
|
|
30653
30726
|
} else if (tile.obb) {
|
|
30654
30727
|
boundingVolume.box = [
|
|
30655
|
-
...
|
|
30728
|
+
...import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
|
|
30656
30729
|
// cartesian center of box
|
|
30657
30730
|
...tile.obb.halfSize,
|
|
30658
30731
|
// halfSize
|
|
@@ -30713,12 +30786,12 @@ async function normalizeTilesetData(tileset, options, context) {
|
|
|
30713
30786
|
lodMetricValue: root.lodMetricValue
|
|
30714
30787
|
};
|
|
30715
30788
|
}
|
|
30716
|
-
var import_culling4,
|
|
30789
|
+
var import_culling4, import_geospatial12;
|
|
30717
30790
|
var init_parse_i3s = __esm({
|
|
30718
30791
|
"../../modules/i3s/src/lib/parsers/parse-i3s.ts"() {
|
|
30719
30792
|
"use strict";
|
|
30720
30793
|
import_culling4 = require("@math.gl/culling");
|
|
30721
|
-
|
|
30794
|
+
import_geospatial12 = require("@math.gl/geospatial");
|
|
30722
30795
|
init_src5();
|
|
30723
30796
|
init_i3s_nodepages_tiles();
|
|
30724
30797
|
init_url_utils2();
|
|
@@ -31037,10 +31110,11 @@ function parseI3STileAttribute(arrayBuffer, options) {
|
|
|
31037
31110
|
[attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer, options.i3s?.attributeValues === "exact") : null
|
|
31038
31111
|
};
|
|
31039
31112
|
}
|
|
31040
|
-
function parseAttribute(attributeType, arrayBuffer,
|
|
31113
|
+
function parseAttribute(attributeType, arrayBuffer, exactValues = false) {
|
|
31114
|
+
if (exactValues) validateExactNumericLayout(attributeType, arrayBuffer);
|
|
31041
31115
|
switch (attributeType) {
|
|
31042
31116
|
case STRING_ATTRIBUTE_TYPE:
|
|
31043
|
-
return parseStringsAttribute(arrayBuffer,
|
|
31117
|
+
return parseStringsAttribute(arrayBuffer, exactValues);
|
|
31044
31118
|
case OBJECT_ID_ATTRIBUTE_TYPE:
|
|
31045
31119
|
return parseShortNumberAttribute(arrayBuffer);
|
|
31046
31120
|
case FLOAT_64_TYPE:
|
|
@@ -31052,14 +31126,44 @@ function parseAttribute(attributeType, arrayBuffer, exactStrings = false) {
|
|
|
31052
31126
|
case INT_16_ATTRIBUTE_TYPE:
|
|
31053
31127
|
case "Int32":
|
|
31054
31128
|
case "Int64":
|
|
31055
|
-
return parseNumericAttribute(attributeType, arrayBuffer);
|
|
31129
|
+
return parseNumericAttribute(attributeType, arrayBuffer, exactValues);
|
|
31056
31130
|
default:
|
|
31057
31131
|
return parseShortNumberAttribute(arrayBuffer);
|
|
31058
31132
|
}
|
|
31059
31133
|
}
|
|
31060
|
-
function
|
|
31134
|
+
function validateExactNumericLayout(attributeType, arrayBuffer) {
|
|
31135
|
+
if (attributeType === "String") return;
|
|
31136
|
+
const widths = {
|
|
31137
|
+
Oid32: 4,
|
|
31138
|
+
UInt8: 1,
|
|
31139
|
+
UInt16: 2,
|
|
31140
|
+
UInt32: 4,
|
|
31141
|
+
UInt64: 8,
|
|
31142
|
+
Int16: 2,
|
|
31143
|
+
Int32: 4,
|
|
31144
|
+
Int64: 8,
|
|
31145
|
+
Float32: 4,
|
|
31146
|
+
Float64: 8
|
|
31147
|
+
};
|
|
31148
|
+
const width = Object.hasOwn(widths, attributeType) ? widths[attributeType] : void 0;
|
|
31149
|
+
const valueOffset = Math.max(4, width || 0);
|
|
31150
|
+
if (!width || arrayBuffer.byteLength < valueOffset || new DataView(arrayBuffer).getUint32(0, true) * width !== arrayBuffer.byteLength - valueOffset) {
|
|
31151
|
+
throw new Error(
|
|
31152
|
+
"Exact I3S attributes require a supported scalar type and matching count/length"
|
|
31153
|
+
);
|
|
31154
|
+
}
|
|
31155
|
+
}
|
|
31156
|
+
function parseNumericAttribute(attributeType, arrayBuffer, exactValues) {
|
|
31061
31157
|
const valueOffset = attributeType === "Float64" || attributeType === "Int64" || attributeType === "UInt64" ? 8 : 4;
|
|
31062
31158
|
if (attributeType === "UInt64" || attributeType === "Int64") {
|
|
31159
|
+
if (exactValues) {
|
|
31160
|
+
const values = attributeType === "UInt64" ? new BigUint64Array((arrayBuffer.byteLength - valueOffset) / 8) : new BigInt64Array((arrayBuffer.byteLength - valueOffset) / 8);
|
|
31161
|
+
const view = new DataView(arrayBuffer);
|
|
31162
|
+
for (let index = 0; index < values.length; index++) {
|
|
31163
|
+
values[index] = attributeType === "UInt64" ? view.getBigUint64(valueOffset + index * 8, true) : view.getBigInt64(valueOffset + index * 8, true);
|
|
31164
|
+
}
|
|
31165
|
+
return values;
|
|
31166
|
+
}
|
|
31063
31167
|
return parseInt64Attribute(attributeType, arrayBuffer, valueOffset);
|
|
31064
31168
|
}
|
|
31065
31169
|
const TypedArrayType = getNumericAttributeConstructor(attributeType);
|
|
@@ -32378,7 +32482,7 @@ async function getDirectorySize(dirPath) {
|
|
|
32378
32482
|
|
|
32379
32483
|
// src/v4/i3s-converter/helpers/geometry-converter.ts
|
|
32380
32484
|
var import_core16 = require("@math.gl/core");
|
|
32381
|
-
var
|
|
32485
|
+
var import_geospatial9 = require("@math.gl/geospatial");
|
|
32382
32486
|
var import_node_module = require("node:module");
|
|
32383
32487
|
init_src8();
|
|
32384
32488
|
init_src5();
|
|
@@ -32600,13 +32704,13 @@ function encodeStringAttribute(values) {
|
|
|
32600
32704
|
|
|
32601
32705
|
// src/v4/i3s-converter/helpers/coordinate-converter.ts
|
|
32602
32706
|
var import_core14 = require("@math.gl/core");
|
|
32603
|
-
var
|
|
32707
|
+
var import_geospatial7 = require("@math.gl/geospatial");
|
|
32604
32708
|
var import_culling2 = require("@math.gl/culling");
|
|
32605
32709
|
function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
32606
32710
|
let radius;
|
|
32607
32711
|
let halfSize;
|
|
32608
32712
|
let quaternion;
|
|
32609
|
-
const cartographicCenter =
|
|
32713
|
+
const cartographicCenter = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(
|
|
32610
32714
|
sourceBoundingVolume.center,
|
|
32611
32715
|
new import_core14.Vector3()
|
|
32612
32716
|
);
|
|
@@ -32635,8 +32739,8 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
|
|
|
32635
32739
|
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
32636
32740
|
const geometryObb = (0, import_culling2.makeOrientedBoundingBoxFromPoints)(positionVectors);
|
|
32637
32741
|
const geometryMbs = (0, import_culling2.makeBoundingSphereFromPoints)(positionVectors);
|
|
32638
|
-
const mbsCenter =
|
|
32639
|
-
const obbCenter =
|
|
32742
|
+
const mbsCenter = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core14.Vector3());
|
|
32743
|
+
const obbCenter = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core14.Vector3());
|
|
32640
32744
|
if (geoidHeightModel) {
|
|
32641
32745
|
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
32642
32746
|
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
@@ -32667,11 +32771,11 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
|
32667
32771
|
}
|
|
32668
32772
|
const center = sphere.center;
|
|
32669
32773
|
const radius = sphere.radius;
|
|
32670
|
-
const vertexMax =
|
|
32774
|
+
const vertexMax = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(
|
|
32671
32775
|
new import_core14.Vector3(center[0] + radius, center[1] + radius, center[2] + radius),
|
|
32672
32776
|
new import_core14.Vector3()
|
|
32673
32777
|
);
|
|
32674
|
-
const vertexMin =
|
|
32778
|
+
const vertexMin = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(
|
|
32675
32779
|
new import_core14.Vector3(center[0] - radius, center[1] - radius, center[2] - radius),
|
|
32676
32780
|
new import_core14.Vector3()
|
|
32677
32781
|
);
|
|
@@ -32694,7 +32798,7 @@ function createObbFromMbs(mbs) {
|
|
|
32694
32798
|
// src/v4/i3s-converter/helpers/gltf-attributes.ts
|
|
32695
32799
|
var import_core15 = require("@math.gl/core");
|
|
32696
32800
|
init_src6();
|
|
32697
|
-
var
|
|
32801
|
+
var import_geospatial8 = require("@math.gl/geospatial");
|
|
32698
32802
|
function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
|
|
32699
32803
|
const nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
|
|
32700
32804
|
const images = tileContent.gltf?.images?.map((imageObject) => {
|
|
@@ -32757,7 +32861,7 @@ function calculateTransformProps(tileContent, tileTransform, boundingVolume) {
|
|
|
32757
32861
|
break;
|
|
32758
32862
|
}
|
|
32759
32863
|
const cartesianOrigin = new import_core15.Vector3(center);
|
|
32760
|
-
const cartographicOrigin =
|
|
32864
|
+
const cartographicOrigin = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(
|
|
32761
32865
|
cartesianOrigin,
|
|
32762
32866
|
new import_core15.Vector3()
|
|
32763
32867
|
);
|
|
@@ -33144,7 +33248,7 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
33144
33248
|
const cartographicOrigin = boundingVolumes.obb.center;
|
|
33145
33249
|
for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
|
|
33146
33250
|
const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
|
|
33147
|
-
|
|
33251
|
+
import_geospatial9.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector2);
|
|
33148
33252
|
if (geoidHeightModel) {
|
|
33149
33253
|
scratchVector2[2] = scratchVector2[2] - geoidHeightModel.getHeight(scratchVector2[1], scratchVector2[0]);
|
|
33150
33254
|
}
|
|
@@ -33478,7 +33582,7 @@ function transformVertexPositions(vertexVector, calleeArgs) {
|
|
|
33478
33582
|
if (useCartesianPositions) {
|
|
33479
33583
|
return vertexVector;
|
|
33480
33584
|
}
|
|
33481
|
-
|
|
33585
|
+
import_geospatial9.Ellipsoid.WGS84.cartesianToCartographic(
|
|
33482
33586
|
[vertexVector[0], vertexVector[1], vertexVector[2]],
|
|
33483
33587
|
vertexVector
|
|
33484
33588
|
);
|
|
@@ -34621,7 +34725,7 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
|
|
|
34621
34725
|
// src/v4/i3s-converter/helpers/node-debug.ts
|
|
34622
34726
|
var import_culling3 = require("@math.gl/culling");
|
|
34623
34727
|
var import_core18 = require("@math.gl/core");
|
|
34624
|
-
var
|
|
34728
|
+
var import_geospatial10 = require("@math.gl/geospatial");
|
|
34625
34729
|
var CUBE_POSITIONS = new Float32Array([
|
|
34626
34730
|
-1,
|
|
34627
34731
|
-1,
|
|
@@ -34734,7 +34838,7 @@ function createBoundingBoxFromTileObb(obb) {
|
|
|
34734
34838
|
function getTileObbVertices(node) {
|
|
34735
34839
|
const halfSize = node.obb.halfSize;
|
|
34736
34840
|
const positions = CUBE_POSITIONS;
|
|
34737
|
-
const obbCenterCartesian =
|
|
34841
|
+
const obbCenterCartesian = import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(node.obb.center);
|
|
34738
34842
|
let vertices = [];
|
|
34739
34843
|
for (let i = 0; i < positions.length; i += 3) {
|
|
34740
34844
|
positions[i] *= halfSize[0];
|
|
@@ -34750,7 +34854,7 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
|
|
|
34750
34854
|
let isVerticesInsideObb = true;
|
|
34751
34855
|
for (let index = 0; index < positions.length / 3; index += 3) {
|
|
34752
34856
|
const point = [positions[index], positions[index + 1], positions[index + 2]];
|
|
34753
|
-
const cartographicPoint =
|
|
34857
|
+
const cartographicPoint = import_geospatial10.Ellipsoid.WGS84.cartesianToCartographic(point);
|
|
34754
34858
|
const distance = boundingVolume.distanceTo(cartographicPoint);
|
|
34755
34859
|
if (distance > 0) {
|
|
34756
34860
|
isVerticesInsideObb = false;
|
|
@@ -37520,7 +37624,7 @@ function collectWktNodes(node) {
|
|
|
37520
37624
|
|
|
37521
37625
|
// src/v4/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
|
|
37522
37626
|
var import_core25 = require("@math.gl/core");
|
|
37523
|
-
var
|
|
37627
|
+
var import_geospatial13 = require("@math.gl/geospatial");
|
|
37524
37628
|
var import_culling5 = require("@math.gl/culling");
|
|
37525
37629
|
function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
37526
37630
|
const tiles3DCenter = [
|
|
@@ -37528,7 +37632,7 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
|
37528
37632
|
i3SObb.center[1],
|
|
37529
37633
|
i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
|
|
37530
37634
|
];
|
|
37531
|
-
const cartesianCenter =
|
|
37635
|
+
const cartesianCenter = import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core25.Vector3());
|
|
37532
37636
|
const tiles3DObb = new import_culling5.OrientedBoundingBox().fromCenterHalfSizeQuaternion(
|
|
37533
37637
|
cartesianCenter,
|
|
37534
37638
|
i3SObb.halfSize,
|
|
@@ -37586,7 +37690,7 @@ init_src5();
|
|
|
37586
37690
|
init_src9();
|
|
37587
37691
|
var import_core27 = require("@math.gl/core");
|
|
37588
37692
|
var import_types5 = require("@math.gl/types");
|
|
37589
|
-
var
|
|
37693
|
+
var import_geospatial14 = require("@math.gl/geospatial");
|
|
37590
37694
|
|
|
37591
37695
|
// src/v4/3d-tiles-converter/helpers/texture-atlas.ts
|
|
37592
37696
|
function convertTextureAtlas(texCoords, uvRegions) {
|
|
@@ -37681,7 +37785,7 @@ var Tiles3DContentConverter = class {
|
|
|
37681
37785
|
);
|
|
37682
37786
|
}
|
|
37683
37787
|
const cartesianOrigin = new import_core27.Vector3(box);
|
|
37684
|
-
const cartographicOrigin =
|
|
37788
|
+
const cartographicOrigin = import_geospatial14.Ellipsoid.WGS84.cartesianToCartographic(
|
|
37685
37789
|
cartesianOrigin,
|
|
37686
37790
|
new import_core27.Vector3()
|
|
37687
37791
|
);
|
|
@@ -37846,7 +37950,7 @@ var Tiles3DContentConverter = class {
|
|
|
37846
37950
|
const vertex = positionsValue.subarray(index, index + 3);
|
|
37847
37951
|
const cartesianOriginVector = new import_core27.Vector3(cartesianOrigin);
|
|
37848
37952
|
let vertexVector = new import_core27.Vector3(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
|
|
37849
|
-
|
|
37953
|
+
import_geospatial14.Ellipsoid.WGS84.cartographicToCartesian(vertexVector, scratchVector4);
|
|
37850
37954
|
vertexVector = scratchVector4.subtract(cartesianOriginVector);
|
|
37851
37955
|
newPositionsValue.set(vertexVector, index);
|
|
37852
37956
|
}
|