@loaders.gl/tile-converter 4.0.0-alpha.9 → 4.0.0-beta.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/bin/i3s-server.js +4 -0
- package/bin/slpk-extractor.js +4 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +10 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +10 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +2 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -1
- package/dist/converter.min.js +172 -103
- package/dist/deps-installer/deps-installer.d.ts +3 -2
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/dist.min.js +32715 -32567
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +97 -117
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +24 -22
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js +63 -0
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/converter-cli.js +25 -65
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +113 -39
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +45 -15
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +8 -18
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +83 -43
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +100 -102
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js +70 -4
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +3 -2
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js +47 -12
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +187 -174
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js +11 -11
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/README.md +46 -2
- package/dist/es5/i3s-server/app.js +23 -15
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/bin/www.js +33 -0
- package/dist/es5/i3s-server/bin/www.js.map +1 -0
- package/dist/es5/i3s-server/controllers/index-controller.js +23 -22
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/controllers/slpk-controller.js +35 -38
- package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +2 -2
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/i3s-server/routes/slpk-router.js +14 -13
- package/dist/es5/i3s-server/routes/slpk-router.js.map +1 -1
- package/dist/es5/i3s-server/utils/create-scene-server.js +7 -4
- package/dist/es5/i3s-server/utils/create-scene-server.js.map +1 -1
- package/dist/es5/i3s-server/utils/server-utils.js +49 -0
- package/dist/es5/i3s-server/utils/server-utils.js.map +1 -0
- package/dist/es5/lib/utils/cli-utils.js +57 -0
- package/dist/es5/lib/utils/cli-utils.js.map +1 -0
- package/dist/es5/lib/utils/compress-util.js +1 -1
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +10 -4
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/pgm-loader.js +11 -3
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/slpk-extractor/slpk-extractor.js +171 -0
- package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -0
- package/dist/es5/slpk-extractor-cli.js +117 -0
- package/dist/es5/slpk-extractor-cli.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +51 -58
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +12 -11
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js +32 -0
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/converter-cli.js +8 -48
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +38 -12
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +28 -11
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +10 -8
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +77 -34
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +60 -61
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js +33 -4
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js +2 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js +37 -12
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +101 -73
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js +9 -9
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/README.md +46 -2
- package/dist/esm/i3s-server/app.js +13 -11
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/bin/i3s-server.min.js +516 -0
- package/dist/esm/i3s-server/bin/www.js +30 -0
- package/dist/esm/i3s-server/bin/www.js.map +1 -0
- package/dist/esm/i3s-server/controllers/index-controller.js +4 -7
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/i3s-server/controllers/slpk-controller.js +9 -26
- package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -1
- package/dist/esm/i3s-server/routes/index.js +1 -1
- package/dist/esm/i3s-server/routes/index.js.map +1 -1
- package/dist/esm/i3s-server/routes/slpk-router.js +5 -11
- package/dist/esm/i3s-server/routes/slpk-router.js.map +1 -1
- package/dist/esm/i3s-server/utils/create-scene-server.js +2 -5
- package/dist/esm/i3s-server/utils/create-scene-server.js.map +1 -1
- package/dist/esm/i3s-server/utils/server-utils.js +40 -0
- package/dist/esm/i3s-server/utils/server-utils.js.map +1 -0
- package/dist/esm/lib/utils/cli-utils.js +47 -0
- package/dist/esm/lib/utils/cli-utils.js.map +1 -0
- package/dist/esm/lib/utils/compress-util.js +1 -1
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js +6 -4
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/pgm-loader.js +7 -4
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/slpk-extractor/slpk-extractor.js +63 -0
- package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -0
- package/dist/esm/slpk-extractor-cli.js +74 -0
- package/dist/esm/slpk-extractor-cli.js.map +1 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +15 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +1 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +8 -8
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -9
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +3 -3
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +15 -0
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +4 -5
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts +3 -2
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/types.d.ts +48 -7
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-server/app.d.ts +1 -2
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/bin/www.d.ts +3 -0
- package/dist/i3s-server/bin/www.d.ts.map +1 -0
- package/dist/i3s-server/controllers/index-controller.d.ts +6 -1
- package/dist/i3s-server/controllers/index-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.d.ts +13 -2
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/routes/index.d.ts +1 -2
- package/dist/i3s-server/routes/index.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.d.ts +2 -2
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/utils/create-scene-server.d.ts +11 -5
- package/dist/i3s-server/utils/create-scene-server.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.d.ts +24 -0
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -0
- package/dist/lib/utils/cli-utils.d.ts +34 -0
- package/dist/lib/utils/cli-utils.d.ts.map +1 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts +2 -2
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/pgm-loader.d.ts +9 -2
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts +23 -0
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -0
- package/dist/slpk-extractor-cli.d.ts +17 -0
- package/dist/slpk-extractor-cli.d.ts.map +1 -0
- package/dist/slpk-extractor.min.js +189 -0
- package/package.json +27 -21
- package/src/3d-tiles-converter/3d-tiles-converter.ts +65 -69
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +23 -19
- package/src/3d-tiles-converter/helpers/load-i3s.ts +52 -0
- package/src/3d-tiles-converter/helpers/texture-atlas.ts +6 -2
- package/src/converter-cli.ts +16 -74
- package/src/deps-installer/deps-installer.ts +56 -11
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +77 -32
- package/src/i3s-converter/helpers/coordinate-converter.ts +1 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +23 -18
- package/src/i3s-converter/helpers/geometry-attributes.ts +81 -44
- package/src/i3s-converter/helpers/geometry-converter.ts +149 -126
- package/src/i3s-converter/helpers/gltf-attributes.ts +9 -10
- package/src/i3s-converter/helpers/load-3d-tiles.ts +61 -5
- package/src/i3s-converter/helpers/node-index-document.ts +5 -1
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +70 -21
- package/src/i3s-converter/i3s-converter.ts +145 -73
- package/src/i3s-converter/types.ts +49 -7
- package/src/i3s-server/README.md +46 -2
- package/src/i3s-server/{app.js → app.ts} +11 -9
- package/src/i3s-server/bin/www.ts +38 -0
- package/src/i3s-server/controllers/{index-controller.js → index-controller.ts} +10 -9
- package/src/i3s-server/controllers/slpk-controller.ts +32 -0
- package/src/i3s-server/routes/{index.js → index.ts} +2 -1
- package/src/i3s-server/routes/{slpk-router.js → slpk-router.ts} +5 -10
- package/src/i3s-server/utils/create-scene-server.ts +20 -0
- package/src/i3s-server/utils/server-utils.ts +70 -0
- package/src/lib/utils/cli-utils.ts +78 -0
- package/src/lib/utils/compress-util.ts +1 -1
- package/src/lib/utils/lod-conversion-utils.ts +10 -6
- package/src/pgm-loader.ts +15 -7
- package/src/slpk-extractor/slpk-extractor.ts +101 -0
- package/src/slpk-extractor-cli.ts +128 -0
- package/dist/3d-tiles-attributes-worker.d.ts +0 -28
- package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/3d-tiles-attributes-worker.js +0 -3
- package/dist/3d-tiles-attributes-worker.js.map +0 -7
- package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -288
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +0 -269
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -23
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -52
- package/dist/3d-tiles-converter/json-templates/tileset.js +0 -43
- package/dist/bundle.js +0 -5
- package/dist/constants.js +0 -4
- package/dist/converter-cli.js +0 -280
- package/dist/deps-installer/deps-installer.js +0 -63
- package/dist/es5/3d-tiles-attributes-worker.js +0 -25
- package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-attributes-worker.js +0 -25
- package/dist/es5/i3s-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-server/bin/www +0 -102
- package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/workers/i3s-attributes-worker.js +0 -30
- package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/3d-tiles-attributes-worker.js +0 -16
- package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-attributes-worker.js +0 -16
- package/dist/esm/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-server/bin/www +0 -102
- package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/workers/i3s-attributes-worker.js +0 -7
- package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/i3s-attributes-worker.d.ts +0 -45
- package/dist/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/i3s-attributes-worker.js +0 -9
- package/dist/i3s-attributes-worker.js.map +0 -7
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -138
- package/dist/i3s-converter/helpers/coordinate-converter.js +0 -123
- package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -28
- package/dist/i3s-converter/helpers/feature-attributes.js +0 -216
- package/dist/i3s-converter/helpers/geometry-attributes.js +0 -202
- package/dist/i3s-converter/helpers/geometry-converter.js +0 -1225
- package/dist/i3s-converter/helpers/gltf-attributes.js +0 -128
- package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -53
- package/dist/i3s-converter/helpers/node-debug.js +0 -120
- package/dist/i3s-converter/helpers/node-index-document.js +0 -268
- package/dist/i3s-converter/helpers/node-pages.js +0 -316
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -76
- package/dist/i3s-converter/helpers/tileset-traversal.js +0 -29
- package/dist/i3s-converter/i3s-converter.js +0 -911
- package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -87
- package/dist/i3s-converter/json-templates/layers.js +0 -139
- package/dist/i3s-converter/json-templates/metadata.js +0 -25
- package/dist/i3s-converter/json-templates/node.js +0 -89
- package/dist/i3s-converter/json-templates/scene-server.js +0 -31
- package/dist/i3s-converter/json-templates/shared-resources.js +0 -129
- package/dist/i3s-converter/json-templates/store.js +0 -103
- package/dist/i3s-converter/types.js +0 -17
- package/dist/i3s-server/app.js +0 -22
- package/dist/i3s-server/controllers/index-controller.js +0 -23
- package/dist/i3s-server/controllers/slpk-controller.js +0 -32
- package/dist/i3s-server/routes/index.js +0 -16
- package/dist/i3s-server/routes/slpk-router.js +0 -33
- package/dist/i3s-server/utils/create-scene-server.js +0 -14
- package/dist/index.js +0 -10
- package/dist/lib/utils/compress-util.js +0 -257
- package/dist/lib/utils/file-utils.js +0 -139
- package/dist/lib/utils/geometry-utils.js +0 -18
- package/dist/lib/utils/lod-conversion-utils.js +0 -76
- package/dist/lib/utils/queue.js +0 -18
- package/dist/lib/utils/statistic-utills.js +0 -64
- package/dist/lib/utils/write-queue.js +0 -80
- package/dist/pgm-loader.js +0 -24
- package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/workers/3d-tiles-attributes-worker.js +0 -9
- package/dist/workers/i3s-attributes-worker.d.ts +0 -2
- package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/workers/i3s-attributes-worker.js +0 -5
- package/src/3d-tiles-attributes-worker.ts +0 -43
- package/src/i3s-attributes-worker.ts +0 -59
- package/src/i3s-server/bin/www +0 -102
- package/src/i3s-server/controllers/slpk-controller.js +0 -38
- package/src/i3s-server/utils/create-scene-server.js +0 -15
- package/src/workers/3d-tiles-attributes-worker.ts +0 -6
- package/src/workers/i3s-attributes-worker.ts +0 -7
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {GLTFImagePostprocessed} from '@loaders.gl/gltf';
|
|
1
|
+
import {GLTFImagePostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';
|
|
2
2
|
import {
|
|
3
3
|
BoundingVolumes,
|
|
4
4
|
I3SMaterialDefinition,
|
|
5
5
|
MaterialDefinitionInfo,
|
|
6
6
|
TextureDefinitionInfo
|
|
7
7
|
} from '@loaders.gl/i3s';
|
|
8
|
+
import {Matrix4, Vector3} from '@math.gl/core';
|
|
8
9
|
|
|
9
10
|
/** Converted resources for specific node */
|
|
10
11
|
export type I3SConvertedResources = {
|
|
@@ -105,10 +106,8 @@ export type GeometryAttributes = {
|
|
|
105
106
|
featureCount: number;
|
|
106
107
|
};
|
|
107
108
|
|
|
108
|
-
/** Geometry attributes
|
|
109
|
-
export type
|
|
110
|
-
/** Feature Id */
|
|
111
|
-
featureId: number;
|
|
109
|
+
/** Geometry attributes applicable for reordering by featureId */
|
|
110
|
+
export type GroupedAttributes = {
|
|
112
111
|
/** POSITION attribute value */
|
|
113
112
|
positions: Float32Array;
|
|
114
113
|
/** NORMAL attribute value */
|
|
@@ -121,6 +120,12 @@ export type GroupedByFeatureIdAttributes = {
|
|
|
121
120
|
texCoords: Float32Array;
|
|
122
121
|
};
|
|
123
122
|
|
|
123
|
+
/** Geometry attributes specific for the particular feature */
|
|
124
|
+
export type GroupedByFeatureIdAttributes = GroupedAttributes & {
|
|
125
|
+
/** Feature Id */
|
|
126
|
+
featureId: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
124
129
|
/** Shared resources made from GLTF material */
|
|
125
130
|
export type SharedResourcesArrays = {
|
|
126
131
|
/** material definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md */
|
|
@@ -168,7 +173,7 @@ export type TypedArrayConstructor =
|
|
|
168
173
|
* glTF primitive modes (mesh topology types)
|
|
169
174
|
* @see https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_mesh_primitive_mode
|
|
170
175
|
*/
|
|
171
|
-
export enum
|
|
176
|
+
export enum GLTFPrimitiveModeString {
|
|
172
177
|
POINTS = 'POINTS',
|
|
173
178
|
LINES = 'LINES',
|
|
174
179
|
LINE_LOOP = 'LINE_LOOP',
|
|
@@ -181,5 +186,42 @@ export enum GltfPrimitiveModeString {
|
|
|
181
186
|
/** Preprocessed data gathered from child tiles binary content */
|
|
182
187
|
export type PreprocessData = {
|
|
183
188
|
/** Mesh topology types used in gltf primitives of the tileset */
|
|
184
|
-
meshTopologyTypes: Set<
|
|
189
|
+
meshTopologyTypes: Set<GLTFPrimitiveModeString>;
|
|
190
|
+
/**
|
|
191
|
+
* Featrue metadata classes found in glTF extensions
|
|
192
|
+
* The tileset might contain multiple metadata classes provided by EXT_feature_metadata and EXT_structural_metadata extensions.
|
|
193
|
+
* Every class is a set of properties. But I3S can consume only one set of properties.
|
|
194
|
+
* On the pre-process we collect all classes from the tileset in order to show the prompt to select one class for conversion to I3S.
|
|
195
|
+
*/
|
|
196
|
+
metadataClasses: Set<string>;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/** Texture image properties required for conversion */
|
|
200
|
+
export type TextureImageProperties = {
|
|
201
|
+
/** Array with image data */
|
|
202
|
+
data: Uint8Array;
|
|
203
|
+
/** Is the texture compressed */
|
|
204
|
+
compressed?: boolean;
|
|
205
|
+
/** Height of the texture's image */
|
|
206
|
+
height?: number;
|
|
207
|
+
/** Width of the texture's image */
|
|
208
|
+
width?: number;
|
|
209
|
+
/** Number of components (3 for RGB, 4 for RGBA) */
|
|
210
|
+
components?: number;
|
|
211
|
+
/** Mime type of the texture's image */
|
|
212
|
+
mimeType?: string;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/** glTF attributes data, prepared for conversion */
|
|
216
|
+
export type GLTFAttributesData = {
|
|
217
|
+
/** glTF PBR materials (only id is required) */
|
|
218
|
+
gltfMaterials?: {id: string}[];
|
|
219
|
+
/** glTF geometry nodes */
|
|
220
|
+
nodes: GLTFNodePostprocessed[];
|
|
221
|
+
/** glTF texture images (set to null for compressed textures) */
|
|
222
|
+
images: (null | TextureImageProperties)[];
|
|
223
|
+
/** Source tile origin coordinates in cartographic coordinate system */
|
|
224
|
+
cartographicOrigin: Vector3;
|
|
225
|
+
/** Model matrix to convert coordinate system of POSITION and NORMAL attributes from METER_OFFSETS to CARTESIAN */
|
|
226
|
+
cartesianModelMatrix: Matrix4;
|
|
185
227
|
};
|
package/src/i3s-server/README.md
CHANGED
|
@@ -8,12 +8,56 @@ The server provides I3S Rest endpoints per specification https://github.com/Esri
|
|
|
8
8
|
### Serve 3DTiles to I3S converted dataset
|
|
9
9
|
|
|
10
10
|
- Convert data set from 3DTiles to I3S without `--slpk` option
|
|
11
|
-
- Serve output folder
|
|
11
|
+
- Serve output folder
|
|
12
|
+
|
|
13
|
+
Example for path `./data/BatchTextured/SceneServer/layers/0/...`:
|
|
14
|
+
|
|
15
|
+
#### Start the server
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
PORT=8080 HTTPS_PORT=4443 I3sLayerPath="./data" DEBUG=i3s-server:* npx i3s-server
|
|
19
|
+
```
|
|
20
|
+
#### Check the layer availability
|
|
21
|
+
|
|
22
|
+
The layer should be available on URLs:
|
|
23
|
+
|
|
24
|
+
- `http://localhost:8080/BatchTextured/SceneServer/layers/0/...`
|
|
25
|
+
- `https://localhost:4443/BatchTextured/SceneServer/layers/0/...`
|
|
26
|
+
|
|
27
|
+
#### Open in ArcGIS
|
|
28
|
+
|
|
29
|
+
`https://www.arcgis.com/home/webscene/viewer.html?url=http://localhost:8080/BatchTextured/SceneServer/layers/0/`
|
|
30
|
+
|
|
31
|
+
#### Open in I3S Explorer
|
|
32
|
+
|
|
33
|
+
`https://i3s.loaders.gl/viewer?tileset=http://localhost:8080/BatchTextured/SceneServer/layers/0`
|
|
12
34
|
|
|
13
35
|
### Serve SLPK
|
|
14
36
|
|
|
15
|
-
|
|
37
|
+
Example for path `../datasets/Rancho_Mesh_mesh_v17_1.slpk`:
|
|
38
|
+
|
|
39
|
+
#### Start the server
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
PORT=8080 HTTPS_PORT=4443 I3sLayerPath="../datasets/Rancho_Mesh_mesh_v17_1.slpk" DEBUG=i3s-server:* npx i3s-server
|
|
43
|
+
```
|
|
44
|
+
#### Check the layer availability
|
|
45
|
+
|
|
46
|
+
The layer should be available on URLs:
|
|
47
|
+
|
|
48
|
+
- `http://localhost:8080/SceneServer/layers/0/...`
|
|
49
|
+
- `https://localhost:4443/SceneServer/layers/0/...`
|
|
50
|
+
|
|
51
|
+
#### Open in ArcGIS
|
|
52
|
+
|
|
53
|
+
`https://www.arcgis.com/home/webscene/viewer.html?url=http://localhost:8080/SceneServer`
|
|
54
|
+
|
|
55
|
+
#### Open in I3S Explorer
|
|
56
|
+
|
|
57
|
+
`https://i3s.loaders.gl/viewer?tileset=http://localhost:8080/SceneServer/layers/0`
|
|
16
58
|
|
|
17
59
|
## ENV variables
|
|
18
60
|
|
|
19
61
|
- `I3sLayerPath` - path to converted data or SLPK file.
|
|
62
|
+
- `PORT` - HTTP port. Eg for `PORT = 8080 npx i3s-server` the server will work on host `http://localhost:8080/...`. Default value is `80`;
|
|
63
|
+
- `HTTPS_PORT` - HTTPS port. Eg for `PORT = 4443 npx i3s-server` the server will work on host `https://localhost:4443/...`. Default value is `443`
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import logger from 'morgan';
|
|
4
|
+
import cors from 'cors';
|
|
5
|
+
import {loadArchive} from './controllers/slpk-controller';
|
|
6
|
+
|
|
7
|
+
const I3S_LAYER_PATH = process.env.I3sLayerPath || ''; // eslint-disable-line no-process-env, no-undef
|
|
8
|
+
const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH); // eslint-disable-line no-undef
|
|
9
|
+
loadArchive(FULL_LAYER_PATH);
|
|
5
10
|
|
|
6
11
|
const indexRouter = require('./routes/index');
|
|
7
|
-
const {sceneServerRouter, router} = require('./routes/slpk-router');
|
|
8
12
|
|
|
9
|
-
const
|
|
10
|
-
const app = express();
|
|
13
|
+
export const app = express();
|
|
11
14
|
|
|
12
15
|
app.use(logger('dev'));
|
|
13
16
|
app.use(express.json());
|
|
@@ -16,10 +19,9 @@ app.use(express.static(path.join(__dirname, 'public')));
|
|
|
16
19
|
app.use(cors());
|
|
17
20
|
|
|
18
21
|
if (/\.slpk$/.test(I3S_LAYER_PATH)) {
|
|
22
|
+
const {sceneServerRouter, router} = require('./routes/slpk-router');
|
|
19
23
|
app.use('/SceneServer/layers/0', router);
|
|
20
24
|
app.use('/SceneServer', sceneServerRouter);
|
|
21
25
|
} else {
|
|
22
26
|
app.use('/', indexRouter);
|
|
23
27
|
}
|
|
24
|
-
|
|
25
|
-
module.exports = app;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import {app} from '../app';
|
|
4
|
+
import https from 'https';
|
|
5
|
+
import http from 'http';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import {formErrorHandler, formListeningHandler, normalizePort} from '../utils/server-utils';
|
|
9
|
+
|
|
10
|
+
/** Get port from environment and store in Express. */
|
|
11
|
+
const httpPort = normalizePort(process.env.PORT || '80');
|
|
12
|
+
if (httpPort === false) {
|
|
13
|
+
console.error(`Incorrect HTTP port`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
const httpsPort = normalizePort(process.env.HTTPS_PORT || '443');
|
|
17
|
+
if (httpsPort === false) {
|
|
18
|
+
console.error(`Incorrect HTTPs port`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Create HTTP server. */
|
|
23
|
+
const options = {
|
|
24
|
+
key: fs.readFileSync(path.join(__dirname, '../certs/key.pem')),
|
|
25
|
+
cert: fs.readFileSync(path.join(__dirname, '../certs/cert.pem'))
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const httpServer = http.createServer(app);
|
|
29
|
+
const httpsServer = https.createServer(options, app);
|
|
30
|
+
|
|
31
|
+
/** Listen on provided port, on all network interfaces. */
|
|
32
|
+
httpServer.listen(httpPort);
|
|
33
|
+
httpServer.on('error', formErrorHandler(httpPort));
|
|
34
|
+
httpServer.on('listening', formListeningHandler(httpServer));
|
|
35
|
+
|
|
36
|
+
httpsServer.listen(httpsPort);
|
|
37
|
+
httpsServer.on('error', formErrorHandler(httpsPort));
|
|
38
|
+
httpsServer.on('listening', formListeningHandler(httpsServer));
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
3
|
|
|
4
4
|
const {promises} = fs;
|
|
5
5
|
|
|
6
|
-
const I3S_LAYER_PATH = process.env.I3sLayerPath || '';
|
|
7
|
-
const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH); // eslint-disable-line no-undef
|
|
6
|
+
const I3S_LAYER_PATH = process.env.I3sLayerPath || '';
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Get local file name by input HTTP URL
|
|
10
|
+
* @param url - I3S HTTP service url
|
|
11
|
+
* @returns - local file name
|
|
12
|
+
*/
|
|
13
|
+
export async function getFileNameByUrl(url: string): Promise<string | null> {
|
|
10
14
|
const extensions = ['json', 'bin', 'jpg', 'jpeg', 'png', 'bin.dds', 'ktx2'];
|
|
15
|
+
const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH);
|
|
11
16
|
for (const ext of extensions) {
|
|
12
17
|
const fileName = `${FULL_LAYER_PATH}${url}/index.${ext}`;
|
|
13
18
|
try {
|
|
@@ -19,7 +24,3 @@ async function getFileNameByUrl(url) {
|
|
|
19
24
|
}
|
|
20
25
|
return null;
|
|
21
26
|
}
|
|
22
|
-
|
|
23
|
-
module.exports = {
|
|
24
|
-
getFileNameByUrl
|
|
25
|
-
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import '@loaders.gl/polyfills';
|
|
2
|
+
import {parseSLPK} from '@loaders.gl/i3s';
|
|
3
|
+
import {FileHandleFile} from '@loaders.gl/loader-utils';
|
|
4
|
+
|
|
5
|
+
let slpkArchive;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Open SLPK file for reading and load HASH file
|
|
9
|
+
* @param fullLayerPath - full path to SLPK file
|
|
10
|
+
*/
|
|
11
|
+
export const loadArchive = async (fullLayerPath: string): Promise<void> => {
|
|
12
|
+
slpkArchive = await parseSLPK(await FileHandleFile.from(fullLayerPath), (msg) =>
|
|
13
|
+
console.log(msg)
|
|
14
|
+
);
|
|
15
|
+
console.log('The server is ready to use');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get a file from SLPK
|
|
20
|
+
* @param url - I3S HTTP URL
|
|
21
|
+
* @returns - file content
|
|
22
|
+
*/
|
|
23
|
+
export async function getFileByUrl(url: string) {
|
|
24
|
+
const trimmedPath = /^\/?(.*)\/?$/.exec(url);
|
|
25
|
+
let uncompressedFile: Buffer | null = null;
|
|
26
|
+
if (trimmedPath) {
|
|
27
|
+
try {
|
|
28
|
+
uncompressedFile = Buffer.from(await slpkArchive.getFile(trimmedPath[1], 'http'));
|
|
29
|
+
} catch (e) {}
|
|
30
|
+
}
|
|
31
|
+
return uncompressedFile;
|
|
32
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import {getFileByUrl} from '../controllers/slpk-controller';
|
|
3
|
+
import {createSceneServer} from '../utils/create-scene-server';
|
|
4
4
|
|
|
5
|
-
const sceneServerRouter = express.Router();
|
|
5
|
+
export const sceneServerRouter = express.Router();
|
|
6
6
|
sceneServerRouter.get('*', async function (req, res, next) {
|
|
7
7
|
const file = await getFileByUrl('/');
|
|
8
8
|
if (file) {
|
|
@@ -15,7 +15,7 @@ sceneServerRouter.get('*', async function (req, res, next) {
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const router = express.Router();
|
|
18
|
+
export const router = express.Router();
|
|
19
19
|
router.get('*', async function (req, res, next) {
|
|
20
20
|
console.log(req.path);
|
|
21
21
|
const file = await getFileByUrl(req.path);
|
|
@@ -26,8 +26,3 @@ router.get('*', async function (req, res, next) {
|
|
|
26
26
|
res.send('File not found');
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
module.exports = {
|
|
31
|
-
sceneServerRouter,
|
|
32
|
-
router
|
|
33
|
-
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {SceneLayer3D} from '@loaders.gl/i3s';
|
|
2
|
+
import {v4 as uuidv4} from 'uuid';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create `/SceneServer` response
|
|
6
|
+
* @param name - service name, custom user-friendly name of the service
|
|
7
|
+
* @param layer - I3S layer JSON
|
|
8
|
+
* @returns reponse JSON for `/SceneServer` route
|
|
9
|
+
*/
|
|
10
|
+
export const createSceneServer = (name: string, layer: SceneLayer3D) => {
|
|
11
|
+
return {
|
|
12
|
+
serviceItemId: uuidv4().replace(/-/gi, ''),
|
|
13
|
+
serviceName: name,
|
|
14
|
+
name,
|
|
15
|
+
currentVersion: '10.7',
|
|
16
|
+
serviceVersion: '1.8',
|
|
17
|
+
supportedBindings: ['REST'],
|
|
18
|
+
layers: [layer]
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type {Server as HttpsServer} from 'https';
|
|
2
|
+
import type {Server as HttpServer} from 'http';
|
|
3
|
+
|
|
4
|
+
import debugFactory from 'debug';
|
|
5
|
+
const debug = debugFactory('i3s-server:server');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Normalize a port into a number, string, or false.
|
|
9
|
+
* @param val - port value from env variables
|
|
10
|
+
* @returns - `number` for port, `string` for a named pipe, or `false` if the port number is not correct
|
|
11
|
+
*/
|
|
12
|
+
export function normalizePort(val: string): number | string | false {
|
|
13
|
+
const chkPort = parseInt(val, 10);
|
|
14
|
+
|
|
15
|
+
if (Number.isNaN(chkPort)) {
|
|
16
|
+
// named pipe
|
|
17
|
+
return val;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (chkPort >= 0) {
|
|
21
|
+
// port number
|
|
22
|
+
return chkPort;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Event listener creator for HTTP/HTTPS server "error" event.
|
|
30
|
+
* @param optionalPort - the port/named pipe the server is started on
|
|
31
|
+
* @return callback to handle server errors
|
|
32
|
+
*/
|
|
33
|
+
export function formErrorHandler(
|
|
34
|
+
optionalPort: string | number
|
|
35
|
+
): (error: NodeJS.ErrnoException) => void {
|
|
36
|
+
return function onError(error: NodeJS.ErrnoException) {
|
|
37
|
+
if (error.syscall !== 'listen') {
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const bind = typeof optionalPort === 'string' ? `Pipe ${optionalPort}` : `Port ${optionalPort}`;
|
|
42
|
+
|
|
43
|
+
// handle specific listen errors with friendly messages
|
|
44
|
+
switch (error.code) {
|
|
45
|
+
case 'EACCES':
|
|
46
|
+
console.error(`${bind} requires elevated privileges`); // eslint-disable-line no-console, no-undef
|
|
47
|
+
process.exit(1); // eslint-disable-line no-process-exit, no-undef
|
|
48
|
+
break;
|
|
49
|
+
case 'EADDRINUSE':
|
|
50
|
+
console.error(`${bind} is already in use`); // eslint-disable-line no-console, no-undef
|
|
51
|
+
process.exit(1); // eslint-disable-line no-process-exit, no-undef
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Event listener for HTTP/HTTPS server "listening" event.
|
|
61
|
+
* @param optionalServer - http or https NodeJS server
|
|
62
|
+
* @return callback that is triggered when the server has started
|
|
63
|
+
*/
|
|
64
|
+
export function formListeningHandler(optionalServer: HttpsServer | HttpServer): () => void {
|
|
65
|
+
return function onListening() {
|
|
66
|
+
const addr = optionalServer.address();
|
|
67
|
+
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr?.port}`;
|
|
68
|
+
debug(`Listening on ${bind}`);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get string option value from cli arguments
|
|
3
|
+
* @param index - option's name index in the argument's array.
|
|
4
|
+
* The value of the option should be next to name of the option.
|
|
5
|
+
* @param args - cli arguments array
|
|
6
|
+
* @returns - string value of the option
|
|
7
|
+
*/
|
|
8
|
+
export function getStringValue(index: number, args: string[]): string {
|
|
9
|
+
if (index + 1 >= args.length) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
const value = args[index + 1];
|
|
13
|
+
if (value.indexOf('--') === 0) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Modyfy URL path to be compatible with fetch
|
|
21
|
+
* @param index - option's name index in the argument's array.
|
|
22
|
+
* The value of the option should be next to name of the option.
|
|
23
|
+
* @param args - cli arguments array
|
|
24
|
+
* @returns - string value of the option
|
|
25
|
+
*/
|
|
26
|
+
export function getURLValue(index: number, args: string[]): string {
|
|
27
|
+
const value = getStringValue(index, args);
|
|
28
|
+
console.log(`Input tileset value: ${value}`);
|
|
29
|
+
console.log(`Modified tileset value: ${value.replace(/\\/g, '/')}`);
|
|
30
|
+
return value.replace(/\\/g, '/');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function validateOptionsWithEqual(args: string[]): string[] {
|
|
34
|
+
return args.reduce((acc: string[], curr) => {
|
|
35
|
+
const equalSignIndex = curr.indexOf('=');
|
|
36
|
+
const beforeEqual = curr.slice(0, equalSignIndex);
|
|
37
|
+
const afterEqual = curr.slice(equalSignIndex + 1, curr.length);
|
|
38
|
+
const condition = curr.includes('=') && curr.startsWith('--') && afterEqual;
|
|
39
|
+
if (condition) {
|
|
40
|
+
return acc.concat(beforeEqual, afterEqual);
|
|
41
|
+
}
|
|
42
|
+
return acc.concat(curr);
|
|
43
|
+
}, []);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get integer option value from cli arguments
|
|
48
|
+
* @param index - option's name index in the argument's array
|
|
49
|
+
* The value of the option should be next to name of the option.
|
|
50
|
+
* @param args - cli arguments array
|
|
51
|
+
* @returns - number value of the option
|
|
52
|
+
*/
|
|
53
|
+
export function getIntegerValue(index: number, args: string[]): number {
|
|
54
|
+
const stringValue: string = getStringValue(index, args);
|
|
55
|
+
const result: number = Number.parseInt(stringValue);
|
|
56
|
+
if (isFinite(result)) {
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
return NaN;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get boolean option value from cli arguments
|
|
64
|
+
* @param index - option's name index in the argument's array
|
|
65
|
+
* The value of the option should be next to name of the option.
|
|
66
|
+
* @param args - cli arguments array
|
|
67
|
+
* @returns - boolean value of the option
|
|
68
|
+
*/
|
|
69
|
+
export function getBooleanValue(index: number, args: string[]): boolean {
|
|
70
|
+
const stringValue: string = getStringValue(index, args).toLowerCase().trim();
|
|
71
|
+
if (['--no-draco', '--split-nodes'].includes(args[index]) && !stringValue) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (!stringValue || stringValue === 'true') {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
@@ -206,7 +206,7 @@ export async function generateHash128FromZip(inputZipFile: string, outputFile: s
|
|
|
206
206
|
const content = zipEntry[_data].compressedContent;
|
|
207
207
|
if (zipEntry.dir) continue; // eslint-disable-line no-continue
|
|
208
208
|
// eslint-disable-next-line no-undef
|
|
209
|
-
const hash = await new MD5Hash().hash(Buffer.from(relativePath.toLowerCase()));
|
|
209
|
+
const hash = await new MD5Hash().hash(Buffer.from(relativePath.toLowerCase()), 'base64');
|
|
210
210
|
// eslint-disable-next-line no-undef
|
|
211
211
|
hashTable.push({key: atob(hash), value: content.byteOffset});
|
|
212
212
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Tiles3DTileJSONPostprocessed} from '@loaders.gl/3d-tiles';
|
|
2
2
|
import {BoundingVolumes} from '@loaders.gl/i3s';
|
|
3
|
-
import {
|
|
3
|
+
import {I3STileHeader} from '@loaders.gl/i3s/src/types';
|
|
4
4
|
|
|
5
5
|
// https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html
|
|
6
6
|
const DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
|
|
@@ -64,11 +64,15 @@ export function convertGeometricErrorToScreenThreshold(
|
|
|
64
64
|
* @param node - i3s node data
|
|
65
65
|
* @returns lod metric in 3d-tiles format
|
|
66
66
|
*/
|
|
67
|
-
export function convertScreenThresholdToGeometricError(node:
|
|
68
|
-
const metricData = node.
|
|
69
|
-
|
|
67
|
+
export function convertScreenThresholdToGeometricError(node: I3STileHeader): number {
|
|
68
|
+
const metricData = node.lodSelection?.find(
|
|
69
|
+
(metric) => metric.metricType === 'maxScreenThreshold'
|
|
70
|
+
);
|
|
71
|
+
let maxError = metricData?.maxError;
|
|
70
72
|
if (!maxError) {
|
|
71
|
-
const sqMetricData = node.
|
|
73
|
+
const sqMetricData = node.lodSelection?.find(
|
|
74
|
+
(metric) => metric.metricType === 'maxScreenThresholdSQ'
|
|
75
|
+
);
|
|
72
76
|
if (sqMetricData) {
|
|
73
77
|
maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));
|
|
74
78
|
}
|
|
@@ -78,5 +82,5 @@ export function convertScreenThresholdToGeometricError(node: Tile3D): number {
|
|
|
78
82
|
maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
return (node.
|
|
85
|
+
return (node.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / maxError;
|
|
82
86
|
}
|
package/src/pgm-loader.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
import type {LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
2
|
-
import {parsePGM} from '@math.gl/geoid';
|
|
1
|
+
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
|
+
import {Geoid, parsePGM} from '@math.gl/geoid';
|
|
3
3
|
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
6
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
7
7
|
|
|
8
|
+
export {Geoid};
|
|
9
|
+
|
|
10
|
+
export type PGMLoaderOptions = LoaderOptions & {
|
|
11
|
+
pgm?: {
|
|
12
|
+
cubic?: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Loader for PGM - Netpbm grayscale image format
|
|
10
18
|
*/
|
|
11
|
-
export const PGMLoader: LoaderWithParser = {
|
|
19
|
+
export const PGMLoader: LoaderWithParser<Geoid, never, PGMLoaderOptions> = {
|
|
12
20
|
name: 'PGM - Netpbm grayscale image format',
|
|
13
21
|
id: 'pgm',
|
|
14
22
|
module: 'tile-converter',
|
|
15
23
|
version: VERSION,
|
|
16
24
|
mimeTypes: ['image/x-portable-graymap'],
|
|
17
|
-
|
|
18
|
-
parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options),
|
|
25
|
+
parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options?.pgm || {}),
|
|
19
26
|
extensions: ['pgm'],
|
|
20
27
|
options: {
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
pgm: {
|
|
29
|
+
cubic: false
|
|
30
|
+
}
|
|
23
31
|
}
|
|
24
32
|
};
|