@loaders.gl/tile-converter 4.3.0-alpha.3 → 4.3.0-alpha.4
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/converter-cli.js +6 -1
- package/dist/converter.min.cjs +92 -93
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +2 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +9 -5
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +4 -2
- package/dist/i3s-converter/i3s-converter.d.ts +1 -0
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +9 -4
- package/dist/i3s-server/bin/i3s-server.min.cjs +63 -63
- package/dist/i3s-server/routes/slpk-router.js +7 -1
- package/dist/index.cjs +19 -9
- package/dist/index.cjs.map +2 -2
- package/dist/pgm-loader.js +1 -1
- package/package.json +16 -16
- package/src/converter-cli.ts +8 -1
- package/src/i3s-converter/helpers/coordinate-converter.ts +13 -7
- package/src/i3s-converter/helpers/geometry-converter.ts +6 -4
- package/src/i3s-converter/i3s-converter.ts +14 -8
- package/src/i3s-server/routes/slpk-router.ts +6 -1
|
@@ -23,7 +23,13 @@ router.get('*', (req, res, next) => {
|
|
|
23
23
|
async function routerCallback(req, res, next) {
|
|
24
24
|
const file = await getFileByUrl(req.path.replace(/\/+$/, ''));
|
|
25
25
|
if (file) {
|
|
26
|
-
|
|
26
|
+
try {
|
|
27
|
+
const json = JSON.parse(textDecoder.decode(file));
|
|
28
|
+
res.send(json);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
res.send(Buffer.from(file));
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
else {
|
|
29
35
|
res.status(404);
|
package/dist/index.cjs
CHANGED
|
@@ -960,7 +960,9 @@ function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
|
960
960
|
let halfSize;
|
|
961
961
|
let quaternion;
|
|
962
962
|
const cartographicCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new import_core2.Vector3());
|
|
963
|
-
|
|
963
|
+
if (geoidHeightModel) {
|
|
964
|
+
cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
965
|
+
}
|
|
964
966
|
if (sourceBoundingVolume instanceof import_culling.OrientedBoundingBox) {
|
|
965
967
|
halfSize = sourceBoundingVolume.halfSize;
|
|
966
968
|
radius = new import_core2.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
@@ -985,8 +987,10 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
|
|
|
985
987
|
const geometryMbs = (0, import_culling.makeBoundingSphereFromPoints)(positionVectors);
|
|
986
988
|
const mbsCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core2.Vector3());
|
|
987
989
|
const obbCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core2.Vector3());
|
|
988
|
-
|
|
989
|
-
|
|
990
|
+
if (geoidHeightModel) {
|
|
991
|
+
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
992
|
+
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
993
|
+
}
|
|
990
994
|
return {
|
|
991
995
|
mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
|
|
992
996
|
obb: {
|
|
@@ -1447,7 +1451,9 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
1447
1451
|
for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
|
|
1448
1452
|
const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
|
|
1449
1453
|
import_geospatial3.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector);
|
|
1450
|
-
|
|
1454
|
+
if (geoidHeightModel) {
|
|
1455
|
+
scratchVector[2] = scratchVector[2] - geoidHeightModel.getHeight(scratchVector[1], scratchVector[0]);
|
|
1456
|
+
}
|
|
1451
1457
|
scratchVector = scratchVector.subtract(cartographicOrigin);
|
|
1452
1458
|
attributes.positions.set(scratchVector, index);
|
|
1453
1459
|
}
|
|
@@ -2342,7 +2348,7 @@ function convertScreenThresholdToGeometricError(node) {
|
|
|
2342
2348
|
|
|
2343
2349
|
// dist/pgm-loader.js
|
|
2344
2350
|
var import_geoid = require("@math.gl/geoid");
|
|
2345
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
2351
|
+
var VERSION = true ? "4.3.0-alpha.3" : "latest";
|
|
2346
2352
|
var PGMLoader = {
|
|
2347
2353
|
dataType: null,
|
|
2348
2354
|
batchType: null,
|
|
@@ -4378,7 +4384,7 @@ var I3SConverter = class {
|
|
|
4378
4384
|
return BROWSER_ERROR_MESSAGE;
|
|
4379
4385
|
}
|
|
4380
4386
|
this.conversionStartTime = import_process4.default.hrtime();
|
|
4381
|
-
const { tilesetName, slpk, egmFilePath, inputUrl, validate, outputPath, draco = true, sevenZipExe, maxDepth, token, generateTextures, generateBoundingVolumes, instantNodeWriting = false, mergeMaterials: mergeMaterials2 = true, inquirer, metadataClass, analyze = false } = options;
|
|
4387
|
+
const { tilesetName, slpk, egmFilePath, inputUrl, validate, outputPath, draco = true, sevenZipExe, maxDepth, token, generateTextures, generateBoundingVolumes, instantNodeWriting = false, mergeMaterials: mergeMaterials2 = true, inquirer, metadataClass, analyze = false, noEgm = false } = options;
|
|
4382
4388
|
this.options = {
|
|
4383
4389
|
outputPath,
|
|
4384
4390
|
tilesetName,
|
|
@@ -4402,9 +4408,13 @@ var I3SConverter = class {
|
|
|
4402
4408
|
this.generateBoundingVolumes = Boolean(generateBoundingVolumes);
|
|
4403
4409
|
this.writeQueue = new WriteQueue(this.conversionDump);
|
|
4404
4410
|
this.writeQueue.startListening();
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4411
|
+
if (!noEgm) {
|
|
4412
|
+
console.log("--no-egm option selected, skip loading egm file");
|
|
4413
|
+
} else {
|
|
4414
|
+
console.log("Loading egm file...");
|
|
4415
|
+
this.geoidHeightModel = await (0, import_core9.load)(egmFilePath, PGMLoader);
|
|
4416
|
+
console.log("Loading egm file completed!");
|
|
4417
|
+
}
|
|
4408
4418
|
if (slpk) {
|
|
4409
4419
|
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
4410
4420
|
}
|