@loaders.gl/tile-converter 4.0.0-alpha.5 → 4.0.0-alpha.7
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/converter.js +1 -1
- package/dist/3d-tiles-attributes-worker.d.ts +28 -0
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/3d-tiles-attributes-worker.js +3 -0
- package/dist/3d-tiles-attributes-worker.js.map +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +13 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +274 -233
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +9 -16
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +256 -246
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +22 -9
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +47 -28
- package/dist/3d-tiles-converter/json-templates/tileset.js +38 -35
- package/dist/bundle.js +2 -2
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/converter-cli.d.ts +2 -0
- package/dist/converter-cli.d.ts.map +1 -0
- package/dist/converter-cli.js +280 -0
- package/dist/converter.min.js +185 -190
- package/dist/deps-installer/deps-installer.d.ts +11 -3
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +59 -18
- package/dist/dist.min.js +15153 -37895
- package/dist/es5/3d-tiles-attributes-worker.js +25 -0
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +467 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +293 -0
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +18 -0
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +33 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +61 -0
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/constants.js +9 -0
- package/dist/es5/constants.js.map +1 -0
- package/dist/es5/converter-cli.js +289 -0
- package/dist/es5/converter-cli.js.map +1 -0
- package/dist/es5/deps-installer/deps-installer.js +123 -0
- package/dist/es5/deps-installer/deps-installer.js.map +1 -0
- package/dist/es5/i3s-attributes-worker.js +25 -0
- package/dist/es5/i3s-attributes-worker.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +116 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +90 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +41 -0
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +174 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +213 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +1181 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +80 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-debug.js +76 -0
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-index-document.js +492 -0
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +519 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -0
- package/dist/es5/i3s-converter/i3s-converter.js +1512 -0
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/layers.js +163 -0
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/metadata.js +31 -0
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/node.js +99 -0
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/scene-server.js +39 -0
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +173 -0
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/store.js +107 -0
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -0
- package/dist/es5/i3s-converter/types.js +2 -0
- package/dist/es5/i3s-converter/types.js.map +1 -0
- package/dist/es5/i3s-server/app.js +18 -0
- package/dist/es5/i3s-server/app.js.map +1 -0
- package/dist/es5/i3s-server/controllers/index-controller.js +55 -0
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -0
- package/dist/es5/i3s-server/routes/index.js +37 -0
- package/dist/es5/i3s-server/routes/index.js.map +1 -0
- package/dist/es5/index.js +21 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/utils/compress-util.js +346 -0
- package/dist/es5/lib/utils/compress-util.js.map +1 -0
- package/dist/es5/lib/utils/file-utils.js +208 -0
- package/dist/es5/lib/utils/file-utils.js.map +1 -0
- package/dist/es5/lib/utils/geometry-utils.js +15 -0
- package/dist/es5/lib/utils/geometry-utils.js.map +1 -0
- package/dist/es5/lib/utils/lod-conversion-utils.js +44 -0
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -0
- package/dist/es5/lib/utils/queue.js +47 -0
- package/dist/es5/lib/utils/queue.js.map +1 -0
- package/dist/es5/lib/utils/statistic-utills.d.ts +25 -0
- package/dist/es5/lib/utils/statistic-utills.js +147 -0
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -0
- package/dist/es5/lib/utils/write-queue.js +214 -0
- package/dist/es5/lib/utils/write-queue.js.map +1 -0
- package/dist/es5/pgm-loader.js +41 -0
- package/dist/es5/pgm-loader.js.map +1 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js +28 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/workers/i3s-attributes-worker.js +30 -0
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +16 -0
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +245 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +218 -0
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +10 -0
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +27 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js +37 -0
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/converter-cli.js +232 -0
- package/dist/esm/converter-cli.js.map +1 -0
- package/dist/esm/deps-installer/deps-installer.js +44 -0
- package/dist/esm/deps-installer/deps-installer.js.map +1 -0
- package/dist/esm/i3s-attributes-worker.js +16 -0
- package/dist/esm/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +105 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +80 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +16 -0
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +147 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +190 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +895 -0
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +73 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-debug.js +72 -0
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-index-document.js +188 -0
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +206 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -0
- package/dist/esm/i3s-converter/i3s-converter.js +764 -0
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/layers.js +133 -0
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/metadata.js +22 -0
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/node.js +80 -0
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/scene-server.js +28 -0
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/shared-resources.js +123 -0
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/store.js +98 -0
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -0
- package/dist/esm/i3s-converter/types.js +2 -0
- package/dist/esm/i3s-converter/types.js.map +1 -0
- package/dist/esm/i3s-server/app.js +16 -0
- package/dist/esm/i3s-server/app.js.map +1 -0
- package/dist/esm/i3s-server/bin/www +102 -0
- package/dist/esm/i3s-server/certs/cert.pem +19 -0
- package/dist/esm/i3s-server/certs/key.pem +27 -0
- package/dist/esm/i3s-server/controllers/index-controller.js +24 -0
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -0
- package/dist/esm/i3s-server/routes/index.js +16 -0
- package/dist/esm/i3s-server/routes/index.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/utils/compress-util.js +168 -0
- package/dist/esm/lib/utils/compress-util.js.map +1 -0
- package/dist/esm/lib/utils/file-utils.js +87 -0
- package/dist/esm/lib/utils/file-utils.js.map +1 -0
- package/dist/esm/lib/utils/geometry-utils.js +8 -0
- package/dist/esm/lib/utils/geometry-utils.js.map +1 -0
- package/dist/esm/lib/utils/lod-conversion-utils.js +37 -0
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -0
- package/dist/esm/lib/utils/queue.js +15 -0
- package/dist/esm/lib/utils/queue.js.map +1 -0
- package/dist/esm/lib/utils/statistic-utills.d.ts +25 -0
- package/dist/esm/lib/utils/statistic-utills.js +62 -0
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -0
- package/dist/esm/lib/utils/write-queue.js +85 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -0
- package/dist/esm/pgm-loader.js +15 -0
- package/dist/esm/pgm-loader.js.map +1 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js +8 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/workers/i3s-attributes-worker.js +7 -0
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/i3s-attributes-worker.d.ts +45 -0
- package/dist/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/i3s-attributes-worker.js +9 -0
- package/dist/i3s-attributes-worker.js.map +7 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +13 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +141 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +9 -9
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +118 -72
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +5 -5
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js +27 -15
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +56 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/feature-attributes.js +216 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +4 -19
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +188 -185
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +36 -39
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1150 -689
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/gltf-attributes.js +85 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts +7 -1
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-debug.js +106 -72
- package/dist/i3s-converter/helpers/node-index-document.d.ts +95 -0
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-index-document.js +250 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +81 -41
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +313 -144
- package/dist/i3s-converter/i3s-converter.d.ts +60 -113
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +858 -951
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
- package/dist/i3s-converter/json-templates/layers.d.ts +5 -30
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
- package/dist/i3s-converter/json-templates/layers.js +132 -194
- package/dist/i3s-converter/json-templates/metadata.js +24 -21
- package/dist/i3s-converter/json-templates/node.js +82 -77
- package/dist/i3s-converter/json-templates/scene-server.js +30 -27
- package/dist/i3s-converter/json-templates/shared-resources.js +116 -122
- package/dist/i3s-converter/json-templates/store.js +100 -95
- package/dist/i3s-converter/types.d.ts +137 -6
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-converter/types.js +2 -2
- package/dist/i3s-server/app.js +2 -9
- package/dist/i3s-server/controllers/index-controller.js +16 -24
- package/dist/i3s-server/routes/index.js +11 -15
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/lib/utils/compress-util.d.ts +12 -20
- package/dist/lib/utils/compress-util.d.ts.map +1 -1
- package/dist/lib/utils/compress-util.js +238 -160
- package/dist/lib/utils/file-utils.d.ts +22 -14
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +133 -36
- package/dist/lib/utils/geometry-utils.d.ts +9 -0
- package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
- package/dist/lib/utils/geometry-utils.js +18 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts +21 -12
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/lib/utils/lod-conversion-utils.js +72 -39
- package/dist/lib/utils/queue.d.ts +7 -0
- package/dist/lib/utils/queue.d.ts.map +1 -0
- package/dist/lib/utils/queue.js +18 -0
- package/dist/lib/utils/statistic-utills.d.ts +3 -25
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +58 -67
- package/dist/lib/utils/write-queue.d.ts +39 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -0
- package/dist/lib/utils/write-queue.js +80 -0
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +23 -14
- package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/workers/3d-tiles-attributes-worker.js +9 -0
- package/dist/workers/i3s-attributes-worker.d.ts +2 -0
- package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/workers/i3s-attributes-worker.js +5 -0
- package/package.json +32 -24
- package/src/3d-tiles-attributes-worker.ts +43 -0
- package/src/3d-tiles-converter/3d-tiles-converter.ts +102 -40
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +39 -44
- package/src/constants.ts +2 -0
- package/src/converter-cli.ts +370 -0
- package/src/deps-installer/deps-installer.ts +71 -0
- package/src/i3s-attributes-worker.ts +59 -0
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +205 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +33 -26
- package/src/i3s-converter/helpers/create-scene-server-path.ts +9 -5
- package/src/i3s-converter/helpers/feature-attributes.ts +247 -0
- package/src/i3s-converter/helpers/geometry-attributes.ts +98 -47
- package/src/i3s-converter/helpers/geometry-converter.ts +1635 -0
- package/src/i3s-converter/helpers/gltf-attributes.ts +100 -0
- package/src/i3s-converter/helpers/node-debug.ts +68 -16
- package/src/i3s-converter/helpers/node-index-document.ts +315 -0
- package/src/i3s-converter/helpers/node-pages.ts +222 -101
- package/src/i3s-converter/i3s-converter.ts +408 -555
- package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
- package/src/i3s-converter/json-templates/layers.ts +27 -91
- package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
- package/src/i3s-converter/types.ts +156 -5
- package/src/index.ts +0 -4
- package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
- package/src/lib/utils/file-utils.ts +139 -0
- package/src/lib/utils/geometry-utils.ts +14 -0
- package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
- package/src/lib/utils/queue.ts +17 -0
- package/src/lib/utils/write-queue.ts +110 -0
- package/src/pgm-loader.ts +2 -2
- package/src/workers/3d-tiles-attributes-worker.ts +6 -0
- package/src/workers/i3s-attributes-worker.ts +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/src/deps-installer/deps-installer.d.ts +0 -10
- package/src/deps-installer/deps-installer.js +0 -22
- package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/src/i3s-converter/helpers/geometry-converter.js +0 -992
- package/src/lib/utils/compress-util.d.ts +0 -53
- package/src/lib/utils/file-utils.d.ts +0 -43
- package/src/lib/utils/file-utils.js +0 -38
- package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
- /package/dist/{i3s-server → es5/i3s-server}/bin/www +0 -0
- /package/dist/{i3s-server → es5/i3s-server}/certs/cert.pem +0 -0
- /package/dist/{i3s-server → es5/i3s-server}/certs/key.pem +0 -0
- /package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {BoundingVolumes,
|
|
1
|
+
import type {BoundingVolumes, FullExtent, Mbs, Obb} from '@loaders.gl/i3s';
|
|
2
2
|
|
|
3
3
|
import {Matrix3, Quaternion, Vector3} from '@math.gl/core';
|
|
4
4
|
import {Ellipsoid} from '@math.gl/geospatial';
|
|
5
5
|
import {
|
|
6
6
|
OrientedBoundingBox,
|
|
7
7
|
makeOrientedBoundingBoxFromPoints,
|
|
8
|
-
makeBoundingSphereFromPoints
|
|
8
|
+
makeBoundingSphereFromPoints,
|
|
9
|
+
BoundingSphere
|
|
9
10
|
} from '@math.gl/culling';
|
|
10
|
-
import
|
|
11
|
+
import {Tile3D} from '@loaders.gl/tiles';
|
|
11
12
|
import {Geoid} from '@math.gl/geoid';
|
|
12
|
-
import {Tileset3D} from '@loaders.gl/tiles';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Create bounding volumes object from tile and geoid height model.
|
|
@@ -17,7 +17,7 @@ import {Tileset3D} from '@loaders.gl/tiles';
|
|
|
17
17
|
* @param geoidHeightModel
|
|
18
18
|
* @returns - Bounding volumes object
|
|
19
19
|
*/
|
|
20
|
-
export function createBoundingVolumes(tile:
|
|
20
|
+
export function createBoundingVolumes(tile: Tile3D, geoidHeightModel: Geoid): BoundingVolumes {
|
|
21
21
|
let radius;
|
|
22
22
|
let halfSize;
|
|
23
23
|
let quaternion;
|
|
@@ -101,34 +101,41 @@ export function convertPositionsToVectors(positions: Float32Array): Vector3[] {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Convert common coordinate to
|
|
105
|
-
* @param
|
|
106
|
-
* @
|
|
107
|
-
* @
|
|
104
|
+
* Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md
|
|
105
|
+
* @param
|
|
106
|
+
* @param boundingVolume
|
|
107
|
+
* @returns - fullExtent object
|
|
108
108
|
*/
|
|
109
|
-
export function
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
export function convertBoundingVolumeToI3SFullExtent(
|
|
110
|
+
boundingVolume: OrientedBoundingBox | BoundingSphere
|
|
111
|
+
): FullExtent {
|
|
112
|
+
let sphere: BoundingSphere;
|
|
113
|
+
if (boundingVolume instanceof BoundingSphere) {
|
|
114
|
+
sphere = boundingVolume;
|
|
115
|
+
} else {
|
|
116
|
+
sphere = boundingVolume.getBoundingSphere();
|
|
113
117
|
}
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
118
|
+
const center: Vector3 = sphere.center;
|
|
119
|
+
const radius: number = sphere.radius;
|
|
120
|
+
const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(
|
|
121
|
+
new Vector3(center[0] + radius, center[1] + radius, center[2] + radius),
|
|
117
122
|
new Vector3()
|
|
118
123
|
);
|
|
119
|
-
const
|
|
120
|
-
new Vector3(
|
|
124
|
+
const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(
|
|
125
|
+
new Vector3(center[0] - radius, center[1] - radius, center[2] - radius),
|
|
121
126
|
new Vector3()
|
|
122
127
|
);
|
|
123
|
-
const isFirstRight = rightTop[0] < leftBottom[0];
|
|
124
|
-
const isFirstTop = rightTop[1] < leftBottom[1];
|
|
125
128
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
// Converter sometimes returns min values that are bigger then max,
|
|
130
|
+
// so we should check and take bigger value from max and smaller for nim
|
|
131
|
+
return {
|
|
132
|
+
xmin: Math.min(vertexMin[0], vertexMax[0]),
|
|
133
|
+
xmax: Math.max(vertexMin[0], vertexMax[0]),
|
|
134
|
+
ymin: Math.min(vertexMin[1], vertexMax[1]),
|
|
135
|
+
ymax: Math.max(vertexMin[1], vertexMax[1]),
|
|
136
|
+
zmin: Math.min(vertexMin[2], vertexMax[2]),
|
|
137
|
+
zmax: Math.max(vertexMin[2], vertexMax[2])
|
|
138
|
+
};
|
|
132
139
|
}
|
|
133
140
|
|
|
134
141
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type {SceneLayer3D} from '@loaders.gl/i3s';
|
|
1
2
|
import {v4 as uuidv4} from 'uuid';
|
|
2
3
|
import transform from 'json-map-transform';
|
|
3
4
|
import {join} from 'path';
|
|
@@ -7,12 +8,15 @@ import {writeFile} from '../../lib/utils/file-utils';
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Form and save sceneServer meta data into a file
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @return {promise}
|
|
11
|
+
* @param layerName - layer name to display
|
|
12
|
+
* @param layers0 - layer object embedded into sceneServer meta data
|
|
13
|
+
* @param rootPath - root path of new converted tileset
|
|
14
14
|
*/
|
|
15
|
-
export async function createSceneServerPath(
|
|
15
|
+
export async function createSceneServerPath(
|
|
16
|
+
layerName: string,
|
|
17
|
+
layers0: SceneLayer3D,
|
|
18
|
+
rootPath: string
|
|
19
|
+
): Promise<void> {
|
|
16
20
|
const sceneServerData = {
|
|
17
21
|
serviceItemId: uuidv4().replace(/-/gi, ''),
|
|
18
22
|
layerName,
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type {FeatureTableJson} from '@loaders.gl/3d-tiles';
|
|
2
|
+
import {
|
|
3
|
+
Attribute,
|
|
4
|
+
AttributeStorageInfo,
|
|
5
|
+
ESRIField,
|
|
6
|
+
Field,
|
|
7
|
+
FieldInfo,
|
|
8
|
+
PopupInfo
|
|
9
|
+
} from '@loaders.gl/i3s';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Takes attributes from property table based on featureIds.
|
|
13
|
+
* If there is no property value for particular featureId (index) the property will be null.
|
|
14
|
+
* Example:
|
|
15
|
+
* Initial data:
|
|
16
|
+
* OBJECTID: [0, 1, 5]
|
|
17
|
+
* component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']
|
|
18
|
+
* Result:
|
|
19
|
+
* OBJECTID: [0, 1, 5]
|
|
20
|
+
* component: ['Windows', 'Frames', 'null']
|
|
21
|
+
* @param featureIds
|
|
22
|
+
* @param propertyTable
|
|
23
|
+
*/
|
|
24
|
+
export function flattenPropertyTableByFeatureIds(
|
|
25
|
+
featureIds: number[],
|
|
26
|
+
propertyTable: FeatureTableJson
|
|
27
|
+
): FeatureTableJson {
|
|
28
|
+
const resultPropertyTable: FeatureTableJson = {};
|
|
29
|
+
for (const propertyName in propertyTable) {
|
|
30
|
+
const properties = propertyTable[propertyName];
|
|
31
|
+
resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return resultPropertyTable;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Getting properties by featureId index
|
|
39
|
+
* @param properties
|
|
40
|
+
* @param featureIds
|
|
41
|
+
*/
|
|
42
|
+
function getPropertiesByFeatureIds(properties: any[], featureIds: number[]): any[] {
|
|
43
|
+
const resultProperties: any = [];
|
|
44
|
+
|
|
45
|
+
for (const featureId of featureIds) {
|
|
46
|
+
const property = properties[featureId] || null;
|
|
47
|
+
resultProperties.push(property);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return resultProperties;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Check that all attributes in propertyTable have the same length as FeatureIds.
|
|
55
|
+
* If there are differencies between lengths we should flatten property table based on exiesting featureIds.
|
|
56
|
+
* @param featureIds
|
|
57
|
+
* @param propertyTable
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
export function checkPropertiesLength(
|
|
61
|
+
featureIds: number[],
|
|
62
|
+
propertyTable: FeatureTableJson
|
|
63
|
+
): boolean {
|
|
64
|
+
let needFlatten = false;
|
|
65
|
+
|
|
66
|
+
for (const attribute of Object.values(propertyTable)) {
|
|
67
|
+
if (featureIds.length !== attribute.length) {
|
|
68
|
+
needFlatten = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return needFlatten;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** String data type name for feature attributes */
|
|
76
|
+
const STRING_TYPE = 'string';
|
|
77
|
+
/** Integer data type name for feature attributes */
|
|
78
|
+
const SHORT_INT_TYPE = 'Int32';
|
|
79
|
+
/** Double data type name for feature attributes */
|
|
80
|
+
const DOUBLE_TYPE = 'double';
|
|
81
|
+
/** Type of attribute that is linked with feature ids */
|
|
82
|
+
const OBJECT_ID_TYPE = 'OBJECTID';
|
|
83
|
+
/**
|
|
84
|
+
* Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
85
|
+
* @param key - attribute's key
|
|
86
|
+
* @param attribute - attribute's type in propertyTable
|
|
87
|
+
*/
|
|
88
|
+
export function getAttributeType(key: string, attribute: string): string {
|
|
89
|
+
if (key === OBJECT_ID_TYPE) {
|
|
90
|
+
return OBJECT_ID_TYPE;
|
|
91
|
+
}
|
|
92
|
+
if (typeof attribute === STRING_TYPE) {
|
|
93
|
+
return STRING_TYPE;
|
|
94
|
+
} else if (typeof attribute === 'number') {
|
|
95
|
+
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
96
|
+
}
|
|
97
|
+
return STRING_TYPE;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Generate storage attribute for map segmentation.
|
|
102
|
+
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
103
|
+
* @param key - attribute key from propertyTable.
|
|
104
|
+
* @param attributeType - attribute type.
|
|
105
|
+
* @return Updated storageAttribute.
|
|
106
|
+
*/
|
|
107
|
+
export function createdStorageAttribute(
|
|
108
|
+
attributeIndex: number,
|
|
109
|
+
key: string,
|
|
110
|
+
attributeType: Attribute
|
|
111
|
+
): AttributeStorageInfo {
|
|
112
|
+
const storageAttribute = {
|
|
113
|
+
key: `f_${attributeIndex}`,
|
|
114
|
+
name: key,
|
|
115
|
+
ordering: ['attributeValues'],
|
|
116
|
+
header: [{property: 'count', valueType: 'UInt32'}],
|
|
117
|
+
attributeValues: {valueType: 'Int32', valuesPerElement: 1}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
switch (attributeType) {
|
|
121
|
+
case OBJECT_ID_TYPE:
|
|
122
|
+
setupIdAttribute(storageAttribute);
|
|
123
|
+
break;
|
|
124
|
+
case STRING_TYPE:
|
|
125
|
+
setupStringAttribute(storageAttribute);
|
|
126
|
+
break;
|
|
127
|
+
case DOUBLE_TYPE:
|
|
128
|
+
setupDoubleAttribute(storageAttribute);
|
|
129
|
+
break;
|
|
130
|
+
case SHORT_INT_TYPE:
|
|
131
|
+
break;
|
|
132
|
+
default:
|
|
133
|
+
setupStringAttribute(storageAttribute);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return storageAttribute;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Find and return attribute type based on key form propertyTable.
|
|
141
|
+
* @param attributeType
|
|
142
|
+
*/
|
|
143
|
+
export function getFieldAttributeType(attributeType: Attribute): ESRIField {
|
|
144
|
+
switch (attributeType) {
|
|
145
|
+
case OBJECT_ID_TYPE:
|
|
146
|
+
return 'esriFieldTypeOID';
|
|
147
|
+
case STRING_TYPE:
|
|
148
|
+
return 'esriFieldTypeString';
|
|
149
|
+
case SHORT_INT_TYPE:
|
|
150
|
+
return 'esriFieldTypeInteger';
|
|
151
|
+
case DOUBLE_TYPE:
|
|
152
|
+
return 'esriFieldTypeDouble';
|
|
153
|
+
default:
|
|
154
|
+
return 'esriFieldTypeString';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Setup field attribute for map segmentation.
|
|
160
|
+
* @param key - attribute for map segmentation.
|
|
161
|
+
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
162
|
+
*/
|
|
163
|
+
export function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {
|
|
164
|
+
return {
|
|
165
|
+
name: key,
|
|
166
|
+
type: fieldAttributeType,
|
|
167
|
+
alias: key
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Generate popup info to show metadata on the map.
|
|
173
|
+
* @param propertyTable - table data with OBJECTID.
|
|
174
|
+
* @return data for correct rendering of popup.
|
|
175
|
+
*/
|
|
176
|
+
export function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo {
|
|
177
|
+
const title = '{OBJECTID}';
|
|
178
|
+
const mediaInfos = [];
|
|
179
|
+
const fieldInfos: FieldInfo[] = [];
|
|
180
|
+
const popupElements: {
|
|
181
|
+
fieldInfos: FieldInfo[];
|
|
182
|
+
type: string;
|
|
183
|
+
}[] = [];
|
|
184
|
+
const expressionInfos = [];
|
|
185
|
+
|
|
186
|
+
for (const key in propertyTable) {
|
|
187
|
+
fieldInfos.push({
|
|
188
|
+
fieldName: key,
|
|
189
|
+
visible: true,
|
|
190
|
+
isEditable: false,
|
|
191
|
+
label: key
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
popupElements.push({
|
|
195
|
+
fieldInfos,
|
|
196
|
+
type: 'fields'
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
title,
|
|
201
|
+
mediaInfos,
|
|
202
|
+
popupElements,
|
|
203
|
+
fieldInfos,
|
|
204
|
+
expressionInfos
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Setup storage attribute as string.
|
|
210
|
+
* @param storageAttribute - attribute for map segmentation.
|
|
211
|
+
*/
|
|
212
|
+
function setupStringAttribute(storageAttribute: AttributeStorageInfo): void {
|
|
213
|
+
// @ts-expect-error
|
|
214
|
+
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
215
|
+
storageAttribute.header.push({property: 'attributeValuesByteCount', valueType: 'UInt32'});
|
|
216
|
+
storageAttribute.attributeValues = {
|
|
217
|
+
valueType: 'String',
|
|
218
|
+
encoding: 'UTF-8',
|
|
219
|
+
valuesPerElement: 1
|
|
220
|
+
};
|
|
221
|
+
storageAttribute.attributeByteCounts = {
|
|
222
|
+
valueType: 'UInt32',
|
|
223
|
+
valuesPerElement: 1
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Setup Id attribute for map segmentation.
|
|
229
|
+
* @param storageAttribute - attribute for map segmentation .
|
|
230
|
+
*/
|
|
231
|
+
function setupIdAttribute(storageAttribute: AttributeStorageInfo): void {
|
|
232
|
+
storageAttribute.attributeValues = {
|
|
233
|
+
valueType: 'Oid32',
|
|
234
|
+
valuesPerElement: 1
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Setup double attribute for map segmentation.
|
|
240
|
+
* @param storageAttribute - attribute for map segmentation .
|
|
241
|
+
*/
|
|
242
|
+
function setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {
|
|
243
|
+
storageAttribute.attributeValues = {
|
|
244
|
+
valueType: 'Float64',
|
|
245
|
+
valuesPerElement: 1
|
|
246
|
+
};
|
|
247
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type {GeometryAttributes, ConvertedAttributes, GroupedByFeatureIdAttributes} from '../types';
|
|
1
2
|
import {concatenateTypedArrays} from '@loaders.gl/loader-utils';
|
|
2
3
|
|
|
3
4
|
const VALUES_PER_VERTEX = 3;
|
|
@@ -5,11 +6,12 @@ const POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
|
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Generate geometry attributes with faceRange and featureCount
|
|
8
|
-
* @param
|
|
9
|
-
* @returns
|
|
9
|
+
* @param attributes
|
|
10
|
+
* @returns attirbutes with featureCount, featureIds and changed faceRange.
|
|
10
11
|
*/
|
|
11
|
-
export function generateAttributes(attributes) {
|
|
12
|
-
const {positions, normals, texCoords, colors,
|
|
12
|
+
export function generateAttributes(attributes: ConvertedAttributes): GeometryAttributes {
|
|
13
|
+
const {positions, normals, texCoords, colors, uvRegions, featureIndices} = attributes;
|
|
14
|
+
const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
|
|
13
15
|
|
|
14
16
|
if (!featureIndices.length) {
|
|
15
17
|
return {
|
|
@@ -19,28 +21,34 @@ export function generateAttributes(attributes) {
|
|
|
19
21
|
positions,
|
|
20
22
|
normals,
|
|
21
23
|
texCoords,
|
|
22
|
-
colors
|
|
24
|
+
colors,
|
|
25
|
+
uvRegions
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
const
|
|
27
|
-
const attributeObjects = makeAttributeObjects({
|
|
29
|
+
const data = calculateFaceRangesAndFeaturesCount(featureIndices);
|
|
30
|
+
const attributeObjects = makeAttributeObjects({...data, ...attributes});
|
|
28
31
|
const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);
|
|
29
32
|
const groupedAttributes = groupAttributesAndRangesByFeatureId(
|
|
30
|
-
unifiedAttributeObjectsByFeatureIds
|
|
33
|
+
unifiedAttributeObjectsByFeatureIds,
|
|
34
|
+
data.featureCount
|
|
31
35
|
);
|
|
32
|
-
return
|
|
36
|
+
return groupedAttributes;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
/**
|
|
36
40
|
* Calculates face Ranges and feature count based on featureIndices.
|
|
37
|
-
* @param
|
|
38
|
-
* @returns
|
|
41
|
+
* @param featureIndices
|
|
42
|
+
* @returns Object with featureCount, reordered attributes and changed faceRange.
|
|
39
43
|
*/
|
|
40
|
-
function calculateFaceRangesAndFeaturesCount(featureIndices) {
|
|
44
|
+
function calculateFaceRangesAndFeaturesCount(featureIndices: number[]): {
|
|
45
|
+
faceRange: Uint32Array;
|
|
46
|
+
featureCount: number;
|
|
47
|
+
featureIds: number[];
|
|
48
|
+
} {
|
|
41
49
|
let rangeIndex = 1;
|
|
42
50
|
let featureIndex = 1;
|
|
43
|
-
let currentFeatureId = featureIndices
|
|
51
|
+
let currentFeatureId = getFrequentValue(featureIndices.slice(0, VALUES_PER_VERTEX));
|
|
44
52
|
const faceRangeList: any[] = [];
|
|
45
53
|
const featureIds: any[] = [];
|
|
46
54
|
const uniqueFeatureIds = [currentFeatureId];
|
|
@@ -48,20 +56,21 @@ function calculateFaceRangesAndFeaturesCount(featureIndices) {
|
|
|
48
56
|
faceRangeList[0] = 0;
|
|
49
57
|
featureIds[0] = currentFeatureId;
|
|
50
58
|
|
|
51
|
-
for (let index =
|
|
52
|
-
|
|
59
|
+
for (let index = VALUES_PER_VERTEX; index < featureIndices.length; index += VALUES_PER_VERTEX) {
|
|
60
|
+
const newFeatureId = getFrequentValue(featureIndices.slice(index, index + VALUES_PER_VERTEX));
|
|
61
|
+
if (currentFeatureId !== newFeatureId) {
|
|
53
62
|
faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;
|
|
54
63
|
faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;
|
|
55
|
-
featureIds[featureIndex] =
|
|
64
|
+
featureIds[featureIndex] = newFeatureId;
|
|
56
65
|
|
|
57
|
-
if (!uniqueFeatureIds.includes(
|
|
58
|
-
uniqueFeatureIds.push(
|
|
66
|
+
if (!uniqueFeatureIds.includes(newFeatureId)) {
|
|
67
|
+
uniqueFeatureIds.push(newFeatureId);
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
rangeIndex += 2;
|
|
62
71
|
featureIndex += 1;
|
|
63
72
|
}
|
|
64
|
-
currentFeatureId =
|
|
73
|
+
currentFeatureId = newFeatureId;
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;
|
|
@@ -72,29 +81,59 @@ function calculateFaceRangesAndFeaturesCount(featureIndices) {
|
|
|
72
81
|
return {faceRange, featureCount, featureIds};
|
|
73
82
|
}
|
|
74
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Find most frequent value to avoid situation where one vertex can be part of multiple features (objects).
|
|
86
|
+
* @param values
|
|
87
|
+
*/
|
|
88
|
+
function getFrequentValue(values: number[]): number {
|
|
89
|
+
const map: {[key: number]: number} = {};
|
|
90
|
+
|
|
91
|
+
let mostFrequentValue = values[0];
|
|
92
|
+
let maxCount = 1;
|
|
93
|
+
|
|
94
|
+
for (const value of values) {
|
|
95
|
+
// Save item and it's frequency count to the map.
|
|
96
|
+
map[value] = (map[value] || 0) + 1;
|
|
97
|
+
// Find max count of frequency.
|
|
98
|
+
maxCount = maxCount > map[value] ? maxCount : map[value];
|
|
99
|
+
// Find the most frequent value.
|
|
100
|
+
mostFrequentValue = maxCount > map[value] ? mostFrequentValue : value;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return mostFrequentValue;
|
|
104
|
+
}
|
|
105
|
+
|
|
75
106
|
/**
|
|
76
107
|
* Generate list of attribute object grouped by feature ids.
|
|
77
|
-
* @param
|
|
78
|
-
* @returns
|
|
108
|
+
* @param attributes
|
|
109
|
+
* @returns sorted list of attribute objects.
|
|
79
110
|
*/
|
|
80
|
-
function makeAttributeObjects(attributes) {
|
|
81
|
-
const {
|
|
82
|
-
|
|
111
|
+
function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureIdAttributes[] {
|
|
112
|
+
const {
|
|
113
|
+
featureIds,
|
|
114
|
+
positions,
|
|
115
|
+
normals,
|
|
116
|
+
colors,
|
|
117
|
+
uvRegions,
|
|
118
|
+
texCoords,
|
|
119
|
+
faceRange = new Uint32Array(0)
|
|
120
|
+
} = attributes;
|
|
121
|
+
const groupedData: GroupedByFeatureIdAttributes[] = [];
|
|
83
122
|
|
|
84
123
|
let positionsList = new Float32Array(positions);
|
|
85
124
|
let normalsList = new Float32Array(normals);
|
|
86
125
|
let colorsList = new Uint8Array(colors);
|
|
87
126
|
let texCoordsList = new Float32Array(texCoords);
|
|
88
|
-
|
|
89
|
-
let faceRangeIndex = 0;
|
|
127
|
+
let uvRegionsList = new Uint16Array(uvRegions);
|
|
90
128
|
|
|
91
129
|
for (let index = 0; index < featureIds.length; index++) {
|
|
92
|
-
const startIndex = faceRange[index
|
|
93
|
-
const endIndex = faceRange[index
|
|
130
|
+
const startIndex = faceRange[index * 2];
|
|
131
|
+
const endIndex = faceRange[index * 2 + 1];
|
|
94
132
|
|
|
95
133
|
const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);
|
|
96
134
|
const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);
|
|
97
135
|
const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);
|
|
136
|
+
const uvRegionsCount = getSliceAttributeCount('uvRegions', startIndex, endIndex);
|
|
98
137
|
const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);
|
|
99
138
|
|
|
100
139
|
groupedData.push({
|
|
@@ -102,15 +141,15 @@ function makeAttributeObjects(attributes) {
|
|
|
102
141
|
positions: positionsList.slice(0, positionsCount),
|
|
103
142
|
normals: normalsList.slice(0, normalsCount),
|
|
104
143
|
colors: colorsList.slice(0, colorsCount),
|
|
144
|
+
uvRegions: uvRegionsList.slice(0, uvRegionsCount),
|
|
105
145
|
texCoords: texCoordsList.slice(0, texCoordsCount)
|
|
106
146
|
});
|
|
107
147
|
|
|
108
148
|
positionsList = positionsList.slice(positionsCount);
|
|
109
149
|
normalsList = normalsList.slice(normalsCount);
|
|
110
150
|
colorsList = colorsList.slice(colorsCount);
|
|
151
|
+
uvRegionsList = uvRegionsList.slice(uvRegionsCount);
|
|
111
152
|
texCoordsList = texCoordsList.slice(texCoordsCount);
|
|
112
|
-
|
|
113
|
-
faceRangeIndex += 1;
|
|
114
153
|
}
|
|
115
154
|
|
|
116
155
|
return groupedData.sort((first, second) => first.featureId - second.featureId);
|
|
@@ -118,13 +157,17 @@ function makeAttributeObjects(attributes) {
|
|
|
118
157
|
|
|
119
158
|
/**
|
|
120
159
|
* Generate sliced count for generating attribute objects depends on attribute name and range.
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @returns
|
|
160
|
+
* @param attributeName
|
|
161
|
+
* @param startIndex
|
|
162
|
+
* @param endIndex
|
|
163
|
+
* @returns sliced count
|
|
125
164
|
*/
|
|
126
|
-
function getSliceAttributeCount(
|
|
127
|
-
|
|
165
|
+
function getSliceAttributeCount(
|
|
166
|
+
attributeName: string,
|
|
167
|
+
startIndex: number,
|
|
168
|
+
endIndex: number
|
|
169
|
+
): number {
|
|
170
|
+
const itemsPerVertex4 = 4;
|
|
128
171
|
const texCoordsPerVertex = 2;
|
|
129
172
|
|
|
130
173
|
const trianglesCount = endIndex - startIndex + 1;
|
|
@@ -135,7 +178,8 @@ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
|
|
|
135
178
|
case 'normals':
|
|
136
179
|
return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;
|
|
137
180
|
case 'colors':
|
|
138
|
-
|
|
181
|
+
case 'uvRegions':
|
|
182
|
+
return vertexCount * itemsPerVertex4;
|
|
139
183
|
case 'texCoords':
|
|
140
184
|
return vertexCount * texCoordsPerVertex;
|
|
141
185
|
default:
|
|
@@ -145,11 +189,13 @@ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
|
|
|
145
189
|
|
|
146
190
|
/**
|
|
147
191
|
* Generates unique object list depends on feature ids and concantenate their attributes.
|
|
148
|
-
* @param
|
|
149
|
-
* @returns
|
|
192
|
+
* @param sortedData
|
|
193
|
+
* @returns unique list of objects
|
|
150
194
|
*/
|
|
151
|
-
function unifyObjectsByFeatureId(
|
|
152
|
-
|
|
195
|
+
function unifyObjectsByFeatureId(
|
|
196
|
+
sortedData: GroupedByFeatureIdAttributes[]
|
|
197
|
+
): GroupedByFeatureIdAttributes[] {
|
|
198
|
+
const uniqueObjects: GroupedByFeatureIdAttributes[] = [];
|
|
153
199
|
|
|
154
200
|
for (let index = 0; index < sortedData.length; index++) {
|
|
155
201
|
const currentObject = sortedData[index];
|
|
@@ -176,16 +222,20 @@ function unifyObjectsByFeatureId(sortedData) {
|
|
|
176
222
|
|
|
177
223
|
/**
|
|
178
224
|
* Generates attribute objects with new faceRange and reordered attributes.
|
|
179
|
-
* @param
|
|
180
|
-
* @returns
|
|
225
|
+
* @param unifiedObjects
|
|
226
|
+
* @returns generated attributes with new faceRange.
|
|
181
227
|
*/
|
|
182
|
-
function groupAttributesAndRangesByFeatureId(
|
|
228
|
+
function groupAttributesAndRangesByFeatureId(
|
|
229
|
+
unifiedObjects: GroupedByFeatureIdAttributes[],
|
|
230
|
+
featureCount: number
|
|
231
|
+
): GeometryAttributes {
|
|
183
232
|
const firstAttributeObject = unifiedObjects[0];
|
|
184
|
-
const featureIds = [firstAttributeObject.featureId];
|
|
233
|
+
const featureIds = [firstAttributeObject.featureId || 0];
|
|
185
234
|
|
|
186
235
|
let positions = new Float32Array(firstAttributeObject.positions);
|
|
187
236
|
let normals = new Float32Array(firstAttributeObject.normals);
|
|
188
237
|
let colors = new Uint8Array(firstAttributeObject.colors);
|
|
238
|
+
let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
|
|
189
239
|
let texCoords = new Float32Array(firstAttributeObject.texCoords);
|
|
190
240
|
const range = [0];
|
|
191
241
|
|
|
@@ -194,11 +244,12 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects) {
|
|
|
194
244
|
|
|
195
245
|
for (let index = 1; index < unifiedObjects.length; index++) {
|
|
196
246
|
const currentAttributesObject = unifiedObjects[index];
|
|
197
|
-
featureIds.push(currentAttributesObject.featureId);
|
|
247
|
+
featureIds.push(currentAttributesObject.featureId || 0);
|
|
198
248
|
|
|
199
249
|
positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
|
|
200
250
|
normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
|
|
201
251
|
colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
|
|
252
|
+
uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
|
|
202
253
|
texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
|
|
203
254
|
|
|
204
255
|
const groupedObject = unifiedObjects[objIndex];
|
|
@@ -212,5 +263,5 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects) {
|
|
|
212
263
|
range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
|
|
213
264
|
|
|
214
265
|
const faceRange = new Uint32Array(range);
|
|
215
|
-
return {faceRange, featureIds, positions, normals, colors, texCoords};
|
|
266
|
+
return {faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount};
|
|
216
267
|
}
|