@loaders.gl/3d-tiles 4.0.0-alpha.4 → 4.0.0-alpha.6
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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/cesium-ion-loader.d.ts +6 -0
- package/dist/cesium-ion-loader.d.ts.map +1 -0
- package/dist/cesium-ion-loader.js +37 -32
- package/dist/dist.min.js +14526 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/cesium-ion-loader.js +77 -0
- package/dist/es5/cesium-ion-loader.js.map +1 -0
- package/dist/es5/index.js +63 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +114 -0
- package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
- package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +180 -0
- package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
- package/dist/es5/lib/classes/tile-3d-batch-table.js +285 -0
- package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -0
- package/dist/es5/lib/classes/tile-3d-feature-table.js +97 -0
- package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -0
- package/dist/es5/lib/constants.js +32 -0
- package/dist/es5/lib/constants.js.map +1 -0
- package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +49 -0
- package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
- package/dist/es5/lib/encoders/encode-3d-tile-composite.js +30 -0
- package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -0
- package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +47 -0
- package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
- package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +48 -0
- package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
- package/dist/es5/lib/encoders/encode-3d-tile.js +35 -0
- package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -0
- package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +35 -0
- package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
- package/dist/es5/lib/ion/ion.js +170 -0
- package/dist/es5/lib/ion/ion.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +64 -0
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +32 -0
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +32 -0
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +280 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +96 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +22 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +145 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +85 -0
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
- package/dist/es5/lib/parsers/helpers/parse-utils.js +28 -0
- package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +51 -0
- package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js +48 -0
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +35 -0
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +271 -0
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +172 -0
- package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +271 -0
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile.js +74 -0
- package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -0
- package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +30 -0
- package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +44 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +30 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-region.js +52 -0
- package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -0
- package/dist/es5/lib/utils/s2/index.js +90 -0
- package/dist/es5/lib/utils/s2/index.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2-geometry-functions.js +19 -0
- package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2-token-functions.js +41 -0
- package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +22 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +207 -0
- package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
- package/dist/es5/lib/utils/version.js +9 -0
- package/dist/es5/lib/utils/version.js.map +1 -0
- package/dist/es5/tile-3d-subtree-loader.js +22 -0
- package/dist/es5/tile-3d-subtree-loader.js.map +1 -0
- package/dist/es5/tile-3d-writer.js +26 -0
- package/dist/es5/tile-3d-writer.js.map +1 -0
- package/dist/es5/tiles-3d-loader.js +134 -0
- package/dist/es5/tiles-3d-loader.js.map +1 -0
- package/dist/es5/types.js +2 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/cesium-ion-loader.js +36 -0
- package/dist/esm/cesium-ion-loader.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +96 -0
- package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
- package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +171 -0
- package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
- package/dist/esm/lib/classes/tile-3d-batch-table.js +231 -0
- package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -0
- package/dist/esm/lib/classes/tile-3d-feature-table.js +70 -0
- package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -0
- package/dist/esm/lib/constants.js +22 -0
- package/dist/esm/lib/constants.js.map +1 -0
- package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +40 -0
- package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
- package/dist/esm/lib/encoders/encode-3d-tile-composite.js +21 -0
- package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -0
- package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +36 -0
- package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
- package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +39 -0
- package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
- package/dist/esm/lib/encoders/encode-3d-tile.js +29 -0
- package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -0
- package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +28 -0
- package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
- package/dist/esm/lib/ion/ion.js +70 -0
- package/dist/esm/lib/ion/ion.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +58 -0
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -0
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +26 -0
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +241 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +59 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +16 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +67 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +80 -0
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
- package/dist/esm/lib/parsers/helpers/parse-utils.js +20 -0
- package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +25 -0
- package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js +15 -0
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +10 -0
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +164 -0
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +147 -0
- package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +211 -0
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile.js +30 -0
- package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -0
- package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +23 -0
- package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +40 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +24 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-region.js +42 -0
- package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -0
- package/dist/esm/lib/utils/s2/index.js +7 -0
- package/dist/esm/lib/utils/s2/index.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2-geometry-functions.js +12 -0
- package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2-token-functions.js +32 -0
- package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +15 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +186 -0
- package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
- package/dist/esm/lib/utils/version.js +2 -0
- package/dist/esm/lib/utils/version.js.map +1 -0
- package/dist/esm/tile-3d-subtree-loader.js +14 -0
- package/dist/esm/tile-3d-subtree-loader.js.map +1 -0
- package/dist/esm/tile-3d-writer.js +19 -0
- package/dist/esm/tile-3d-writer.js.map +1 -0
- package/dist/esm/tiles-3d-loader.js +64 -0
- package/dist/esm/tiles-3d-loader.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -8
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +8 -0
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -0
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +106 -89
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.d.ts +10 -0
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -0
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +184 -202
- package/dist/lib/classes/tile-3d-batch-table.d.ts +34 -0
- package/dist/lib/classes/tile-3d-batch-table.d.ts.map +1 -0
- package/dist/lib/classes/tile-3d-batch-table.js +223 -267
- package/dist/lib/classes/tile-3d-feature-table.d.ts +15 -0
- package/dist/lib/classes/tile-3d-feature-table.d.ts.map +1 -0
- package/dist/lib/classes/tile-3d-feature-table.js +64 -79
- package/dist/lib/constants.d.ts +22 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +23 -18
- package/dist/lib/encoders/encode-3d-tile-batched-model.d.ts +2 -0
- package/dist/lib/encoders/encode-3d-tile-batched-model.d.ts.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-batched-model.js +45 -45
- package/dist/lib/encoders/encode-3d-tile-composite.d.ts +2 -0
- package/dist/lib/encoders/encode-3d-tile-composite.d.ts.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-composite.js +23 -24
- package/dist/lib/encoders/encode-3d-tile-instanced-model.d.ts +2 -0
- package/dist/lib/encoders/encode-3d-tile-instanced-model.d.ts.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js +37 -37
- package/dist/lib/encoders/encode-3d-tile-point-cloud.d.ts +2 -0
- package/dist/lib/encoders/encode-3d-tile-point-cloud.d.ts.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js +36 -38
- package/dist/lib/encoders/encode-3d-tile.d.ts +2 -0
- package/dist/lib/encoders/encode-3d-tile.d.ts.map +1 -0
- package/dist/lib/encoders/encode-3d-tile.js +30 -32
- package/dist/lib/encoders/helpers/encode-3d-tile-header.d.ts +3 -0
- package/dist/lib/encoders/helpers/encode-3d-tile-header.d.ts.map +1 -0
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js +28 -29
- package/dist/lib/ion/ion.d.ts +4 -0
- package/dist/lib/ion/ion.d.ts.map +1 -0
- package/dist/lib/ion/ion.js +60 -69
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +7 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +60 -62
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +6 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -26
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.d.ts +2 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +39 -28
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +57 -0
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +266 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts +7 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +82 -63
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +2 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js +26 -15
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +10 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +104 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts +3 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +85 -81
- package/dist/lib/parsers/helpers/parse-utils.d.ts +4 -0
- package/dist/lib/parsers/helpers/parse-utils.d.ts.map +1 -0
- package/dist/lib/parsers/helpers/parse-utils.js +29 -16
- package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts +2 -0
- package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-batched-model.js +30 -26
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts +2 -0
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-composite.js +25 -16
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +2 -0
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-gltf.js +18 -0
- package/dist/lib/parsers/parse-3d-tile-header.d.ts +20 -0
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-header.js +170 -70
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +2 -0
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js +179 -170
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +3 -0
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js +350 -184
- package/dist/lib/parsers/parse-3d-tile.d.ts +2 -0
- package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile.js +36 -27
- package/dist/lib/utils/obb/s2-corners-to-obb.d.ts +15 -0
- package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -0
- package/dist/lib/utils/obb/s2-corners-to-obb.js +37 -0
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +9 -0
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -0
- package/dist/lib/utils/s2/converters/s2-to-boundary.js +61 -0
- package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts +15 -0
- package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts.map +1 -0
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js +36 -0
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts +13 -0
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -0
- package/dist/lib/utils/s2/converters/s2-to-region.js +59 -0
- package/dist/lib/utils/s2/index.d.ts +8 -0
- package/dist/lib/utils/s2/index.d.ts.map +1 -0
- package/dist/lib/utils/s2/index.js +23 -0
- package/dist/lib/utils/s2/s2-geometry-functions.d.ts +14 -0
- package/dist/lib/utils/s2/s2-geometry-functions.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2-geometry-functions.js +29 -0
- package/dist/lib/utils/s2/s2-token-functions.d.ts +23 -0
- package/dist/lib/utils/s2/s2-token-functions.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2-token-functions.js +68 -0
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +14 -0
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +32 -0
- package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts +52 -0
- package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts.map +1 -0
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js +260 -0
- package/dist/lib/utils/version.d.ts +2 -0
- package/dist/lib/utils/version.d.ts.map +1 -0
- package/dist/lib/utils/version.js +7 -2
- package/dist/tile-3d-subtree-loader.d.ts +7 -0
- package/dist/tile-3d-subtree-loader.d.ts.map +1 -0
- package/dist/tile-3d-subtree-loader.js +23 -0
- package/dist/tile-3d-writer.d.ts +6 -0
- package/dist/tile-3d-writer.d.ts.map +1 -0
- package/dist/tile-3d-writer.js +24 -17
- package/dist/tiles-3d-loader.d.ts +6 -0
- package/dist/tiles-3d-loader.d.ts.map +1 -0
- package/dist/tiles-3d-loader.js +63 -62
- package/dist/types.d.ts +93 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -2
- package/package.json +14 -13
- package/src/cesium-ion-loader.ts +1 -0
- package/src/index.ts +2 -1
- package/src/lib/classes/{tile-3d-batch-table.js → tile-3d-batch-table.ts} +14 -4
- package/src/lib/classes/{tile-3d-feature-table.js → tile-3d-feature-table.ts} +5 -2
- package/src/lib/{constants.js → constants.ts} +2 -1
- package/src/lib/parsers/helpers/{normalize-3d-tile-colors.js → normalize-3d-tile-colors.ts} +1 -1
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +396 -0
- package/src/lib/parsers/helpers/{parse-3d-tile-gltf-view.js → parse-3d-tile-gltf-view.ts} +1 -1
- package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +148 -0
- package/src/lib/parsers/helpers/{parse-3d-tile-tables.js → parse-3d-tile-tables.ts} +1 -1
- package/src/lib/parsers/parse-3d-tile-gltf.ts +16 -0
- package/src/lib/parsers/parse-3d-tile-header.ts +220 -0
- package/src/lib/parsers/{parse-3d-tile-instanced-model.js → parse-3d-tile-instanced-model.ts} +6 -0
- package/src/lib/parsers/{parse-3d-tile-point-cloud.js → parse-3d-tile-point-cloud.ts} +2 -2
- package/src/lib/parsers/{parse-3d-tile.js → parse-3d-tile.ts} +8 -0
- package/src/lib/utils/obb/s2-corners-to-obb.ts +51 -0
- package/src/lib/utils/s2/converters/s2-to-boundary.ts +67 -0
- package/src/lib/utils/s2/converters/s2-to-obb-points.ts +46 -0
- package/src/lib/utils/s2/converters/s2-to-region.ts +69 -0
- package/src/lib/utils/s2/index.ts +17 -0
- package/src/lib/utils/s2/s2-geometry-functions.ts +28 -0
- package/src/lib/utils/s2/s2-token-functions.ts +67 -0
- package/src/lib/utils/s2/s2geometry/s2-cell-utils.ts +33 -0
- package/src/lib/utils/s2/s2geometry/s2-geometry.ts +296 -0
- package/src/tile-3d-subtree-loader.ts +19 -0
- package/src/tiles-3d-loader.ts +2 -1
- package/src/types.ts +60 -6
- package/dist/bundle.js.map +0 -1
- package/dist/cesium-ion-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
- package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
- package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
- package/dist/lib/ion/ion.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
- package/dist/lib/utils/version.js.map +0 -1
- package/dist/tile-3d-writer.js.map +0 -1
- package/dist/tiles-3d-loader.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/lib/parsers/parse-3d-tile-header.js +0 -69
- /package/src/lib/classes/helpers/{tile-3d-accessor-utils.js → tile-3d-accessor-utils.ts} +0 -0
- /package/src/lib/classes/{tile-3d-batch-table-hierarchy.js → tile-3d-batch-table-hierarchy.ts} +0 -0
- /package/src/lib/encoders/{encode-3d-tile-batched-model.js → encode-3d-tile-batched-model.ts} +0 -0
- /package/src/lib/encoders/{encode-3d-tile-composite.js → encode-3d-tile-composite.ts} +0 -0
- /package/src/lib/encoders/{encode-3d-tile-instanced-model.js → encode-3d-tile-instanced-model.ts} +0 -0
- /package/src/lib/encoders/{encode-3d-tile-point-cloud.js → encode-3d-tile-point-cloud.ts} +0 -0
- /package/src/lib/encoders/{encode-3d-tile.js → encode-3d-tile.ts} +0 -0
- /package/src/lib/encoders/helpers/{encode-3d-tile-header.js → encode-3d-tile-header.ts} +0 -0
- /package/src/lib/ion/{ion.js → ion.ts} +0 -0
- /package/src/lib/parsers/helpers/{normalize-3d-tile-normals.js → normalize-3d-tile-normals.ts} +0 -0
- /package/src/lib/parsers/helpers/{normalize-3d-tile-positions.js → normalize-3d-tile-positions.ts} +0 -0
- /package/src/lib/parsers/helpers/{parse-3d-tile-header.js → parse-3d-tile-header.ts} +0 -0
- /package/src/lib/parsers/helpers/{parse-utils.js → parse-utils.ts} +0 -0
- /package/src/lib/parsers/{parse-3d-tile-batched-model.js → parse-3d-tile-batched-model.ts} +0 -0
- /package/src/lib/parsers/{parse-3d-tile-composite.js → parse-3d-tile-composite.ts} +0 -0
- /package/src/lib/utils/{version.js → version.ts} +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type {Subtree, ExplicitBitstream} from '../../../types';
|
|
2
|
+
import type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
3
|
+
|
|
4
|
+
const SUBTREE_FILE_MAGIC = 0x74627573;
|
|
5
|
+
const SUBTREE_FILE_VERSION = 1;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Parse subtree file
|
|
9
|
+
* Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subtree-file-format
|
|
10
|
+
* @param data
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line max-statements
|
|
14
|
+
export default async function parse3DTilesSubtree(
|
|
15
|
+
data: ArrayBuffer,
|
|
16
|
+
options: LoaderOptions | undefined,
|
|
17
|
+
context: LoaderContext | undefined
|
|
18
|
+
): Promise<Subtree> {
|
|
19
|
+
const magic = new Uint32Array(data.slice(0, 4));
|
|
20
|
+
|
|
21
|
+
if (magic[0] !== SUBTREE_FILE_MAGIC) {
|
|
22
|
+
throw new Error('Wrong subtree file magic number');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const version = new Uint32Array(data.slice(4, 8));
|
|
26
|
+
|
|
27
|
+
if (version[0] !== SUBTREE_FILE_VERSION) {
|
|
28
|
+
throw new Error('Wrong subtree file verson, must be 1');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const jsonByteLength = parseUint64Value(data.slice(8, 16));
|
|
32
|
+
const stringAttribute = new Uint8Array(data, 24, jsonByteLength);
|
|
33
|
+
|
|
34
|
+
const textDecoder = new TextDecoder('utf8');
|
|
35
|
+
const string = textDecoder.decode(stringAttribute);
|
|
36
|
+
const subtree = JSON.parse(string);
|
|
37
|
+
|
|
38
|
+
const binaryByteLength = parseUint64Value(data.slice(16, 24));
|
|
39
|
+
let internalBinaryBuffer = new ArrayBuffer(0);
|
|
40
|
+
|
|
41
|
+
if (binaryByteLength) {
|
|
42
|
+
internalBinaryBuffer = data.slice(24 + jsonByteLength);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if ('bufferView' in subtree.tileAvailability) {
|
|
46
|
+
subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(
|
|
47
|
+
subtree,
|
|
48
|
+
'tileAvailability',
|
|
49
|
+
internalBinaryBuffer,
|
|
50
|
+
context
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if ('bufferView' in subtree.contentAvailability) {
|
|
55
|
+
subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(
|
|
56
|
+
subtree,
|
|
57
|
+
'contentAvailability',
|
|
58
|
+
internalBinaryBuffer,
|
|
59
|
+
context
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ('bufferView' in subtree.childSubtreeAvailability) {
|
|
64
|
+
subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(
|
|
65
|
+
subtree,
|
|
66
|
+
'childSubtreeAvailability',
|
|
67
|
+
internalBinaryBuffer,
|
|
68
|
+
context
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return subtree;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get url for bitstream downloading
|
|
77
|
+
* @param bitstreamRelativeUri
|
|
78
|
+
* @param baseUri
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
function resolveBufferUri(bitstreamRelativeUri: string, basePath: string): string {
|
|
82
|
+
const hasProtocol = basePath.startsWith('http');
|
|
83
|
+
|
|
84
|
+
if (hasProtocol) {
|
|
85
|
+
const resolvedUri = new URL(bitstreamRelativeUri, basePath);
|
|
86
|
+
return decodeURI(resolvedUri.toString());
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Adding http protocol only for new URL constructor usage.
|
|
91
|
+
* It allows to resolve relative paths like ../../example with basePath.
|
|
92
|
+
*/
|
|
93
|
+
const basePathWithProtocol = `http://${basePath}`;
|
|
94
|
+
const resolvedUri = new URL(bitstreamRelativeUri, basePathWithProtocol);
|
|
95
|
+
/**
|
|
96
|
+
* Drop protocol and use just relative path.
|
|
97
|
+
*/
|
|
98
|
+
return `/${resolvedUri.host}${resolvedUri.pathname}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get explicit bitstream for subtree availability data.
|
|
103
|
+
* @param subtree
|
|
104
|
+
* @param name
|
|
105
|
+
* @param internalBinaryBuffer
|
|
106
|
+
*/
|
|
107
|
+
async function getExplicitBitstream(
|
|
108
|
+
subtree: Subtree,
|
|
109
|
+
name: string,
|
|
110
|
+
internalBinaryBuffer: ArrayBuffer,
|
|
111
|
+
context: LoaderContext | undefined
|
|
112
|
+
): Promise<ExplicitBitstream> {
|
|
113
|
+
const bufferViewIndex = subtree[name].bufferView;
|
|
114
|
+
const bufferView = subtree.bufferViews[bufferViewIndex];
|
|
115
|
+
const buffer = subtree.buffers[bufferView.buffer];
|
|
116
|
+
|
|
117
|
+
if (!context?.url || !context.fetch) {
|
|
118
|
+
throw new Error('Url is not provided');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!context.fetch) {
|
|
122
|
+
throw new Error('fetch is not provided');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// External bitstream loading
|
|
126
|
+
if (buffer.uri) {
|
|
127
|
+
const bufferUri = resolveBufferUri(buffer.uri, context?.url);
|
|
128
|
+
const response = await context.fetch(bufferUri);
|
|
129
|
+
const data = await response.arrayBuffer();
|
|
130
|
+
// Return view of bitstream.
|
|
131
|
+
return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
|
|
132
|
+
}
|
|
133
|
+
// Return view of bitstream.
|
|
134
|
+
return new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Parse buffer to return uint64 value
|
|
139
|
+
* @param buffer
|
|
140
|
+
* @returns 64-bit value until precision is lost after Number.MAX_SAFE_INTEGER
|
|
141
|
+
*/
|
|
142
|
+
function parseUint64Value(buffer: ArrayBuffer): number {
|
|
143
|
+
const dataView = new DataView(buffer);
|
|
144
|
+
const left = dataView.getUint32(0, true);
|
|
145
|
+
const right = dataView.getUint32(4, true);
|
|
146
|
+
// combine the two 32-bit values
|
|
147
|
+
return left + 2 ** 32 * right;
|
|
148
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import {getStringFromArrayBuffer} from './parse-utils';
|
|
5
5
|
|
|
6
6
|
const SIZEOF_UINT32 = 4;
|
|
7
|
-
const DEPRECATION_WARNING =
|
|
7
|
+
const DEPRECATION_WARNING = 'b3dm tile in legacy format.';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line max-statements
|
|
10
10
|
export function parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {GLTFLoader} from '@loaders.gl/gltf';
|
|
2
|
+
|
|
3
|
+
export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
4
|
+
// Set flags
|
|
5
|
+
// glTF models need to be rotated from Y to Z up
|
|
6
|
+
// https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up
|
|
7
|
+
tile.rotateYtoZ = true;
|
|
8
|
+
// Save gltf up axis
|
|
9
|
+
tile.gltfUpAxis =
|
|
10
|
+
options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis
|
|
11
|
+
? options['3d-tiles'].assetGltfUpAxis
|
|
12
|
+
: 'Y';
|
|
13
|
+
|
|
14
|
+
const {parse} = context;
|
|
15
|
+
tile.gltf = await parse(arrayBuffer, GLTFLoader, options, context);
|
|
16
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type {LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
|
+
import {Tile3DSubtreeLoader} from '../../tile-3d-subtree-loader';
|
|
3
|
+
import {load} from '@loaders.gl/core';
|
|
4
|
+
import {Tileset3D, LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE, Tile3D} from '@loaders.gl/tiles';
|
|
5
|
+
import {ImplicitTilingExtension, Subtree} from '../../types';
|
|
6
|
+
import type {S2VolumeBox} from './helpers/parse-3d-implicit-tiles';
|
|
7
|
+
import {parseImplicitTiles, replaceContentUrlTemplate} from './helpers/parse-3d-implicit-tiles';
|
|
8
|
+
import type {S2VolumeInfo} from '../utils/obb/s2-corners-to-obb';
|
|
9
|
+
import {convertS2BoundingVolumetoOBB} from '../utils/obb/s2-corners-to-obb';
|
|
10
|
+
|
|
11
|
+
function getTileType(tile) {
|
|
12
|
+
if (!tile.contentUrl) {
|
|
13
|
+
return TILE_TYPE.EMPTY;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const contentUrl = tile.contentUrl;
|
|
17
|
+
const fileExtension = contentUrl.split('.').pop();
|
|
18
|
+
switch (fileExtension) {
|
|
19
|
+
case 'pnts':
|
|
20
|
+
return TILE_TYPE.POINTCLOUD;
|
|
21
|
+
case 'i3dm':
|
|
22
|
+
case 'b3dm':
|
|
23
|
+
case 'glb':
|
|
24
|
+
case 'gltf':
|
|
25
|
+
return TILE_TYPE.SCENEGRAPH;
|
|
26
|
+
default:
|
|
27
|
+
return fileExtension;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getRefine(refine) {
|
|
32
|
+
switch (refine) {
|
|
33
|
+
case 'REPLACE':
|
|
34
|
+
case 'replace':
|
|
35
|
+
return TILE_REFINEMENT.REPLACE;
|
|
36
|
+
case 'ADD':
|
|
37
|
+
case 'add':
|
|
38
|
+
return TILE_REFINEMENT.ADD;
|
|
39
|
+
default:
|
|
40
|
+
return refine;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function resolveUri(uri, basePath) {
|
|
45
|
+
// url scheme per RFC3986
|
|
46
|
+
const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;
|
|
47
|
+
|
|
48
|
+
if (urlSchemeRegex.test(basePath)) {
|
|
49
|
+
const url = new URL(uri, `${basePath}/`);
|
|
50
|
+
return decodeURI(url.toString());
|
|
51
|
+
} else if (uri.startsWith('/')) {
|
|
52
|
+
return uri;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return `${basePath}/${uri}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function normalizeTileData(tile, options) {
|
|
59
|
+
if (!tile) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
if (tile.content) {
|
|
63
|
+
const contentUri = tile.content.uri || tile.content.url;
|
|
64
|
+
tile.contentUrl = resolveUri(contentUri, options.basePath);
|
|
65
|
+
}
|
|
66
|
+
tile.id = tile.contentUrl;
|
|
67
|
+
tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
68
|
+
tile.lodMetricValue = tile.geometricError;
|
|
69
|
+
tile.transformMatrix = tile.transform;
|
|
70
|
+
tile.type = getTileType(tile);
|
|
71
|
+
tile.refine = getRefine(tile.refine);
|
|
72
|
+
|
|
73
|
+
return tile;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// normalize tile headers
|
|
77
|
+
export async function normalizeTileHeaders(
|
|
78
|
+
tileset: Tileset3D,
|
|
79
|
+
options: LoaderOptions
|
|
80
|
+
): Promise<Tileset3D> {
|
|
81
|
+
const basePath = tileset.basePath;
|
|
82
|
+
let root: Tileset3D;
|
|
83
|
+
|
|
84
|
+
const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset?.root);
|
|
85
|
+
if (rootImplicitTilingExtension && tileset.root) {
|
|
86
|
+
root = await normalizeImplicitTileHeaders(
|
|
87
|
+
tileset.root,
|
|
88
|
+
tileset,
|
|
89
|
+
rootImplicitTilingExtension,
|
|
90
|
+
options
|
|
91
|
+
);
|
|
92
|
+
} else {
|
|
93
|
+
root = normalizeTileData(tileset.root, tileset);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const stack: any[] = [];
|
|
97
|
+
stack.push(root);
|
|
98
|
+
|
|
99
|
+
while (stack.length > 0) {
|
|
100
|
+
const tile = stack.pop() || {};
|
|
101
|
+
const children = tile.children || [];
|
|
102
|
+
for (let childHeader of children) {
|
|
103
|
+
const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
|
|
104
|
+
if (childImplicitTilingExtension) {
|
|
105
|
+
childHeader = await normalizeImplicitTileHeaders(
|
|
106
|
+
childHeader,
|
|
107
|
+
tileset,
|
|
108
|
+
childImplicitTilingExtension,
|
|
109
|
+
options
|
|
110
|
+
);
|
|
111
|
+
} else {
|
|
112
|
+
normalizeTileData(childHeader, {basePath});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
stack.push(childHeader);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return root;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Do normalisation of implicit tile headers
|
|
124
|
+
* TODO Check if Tile3D class can be a return type here.
|
|
125
|
+
* @param tileset
|
|
126
|
+
*/
|
|
127
|
+
export async function normalizeImplicitTileHeaders(
|
|
128
|
+
tile: Tile3D,
|
|
129
|
+
tileset: Tileset3D,
|
|
130
|
+
implicitTilingExtension: ImplicitTilingExtension,
|
|
131
|
+
options: LoaderOptions
|
|
132
|
+
) {
|
|
133
|
+
const basePath = tileset.basePath;
|
|
134
|
+
const {
|
|
135
|
+
subdivisionScheme,
|
|
136
|
+
maximumLevel,
|
|
137
|
+
subtreeLevels,
|
|
138
|
+
subtrees: {uri: subtreesUriTemplate}
|
|
139
|
+
} = implicitTilingExtension;
|
|
140
|
+
const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
141
|
+
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
142
|
+
const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);
|
|
143
|
+
const contentUrlTemplate = resolveUri(tile.content.uri, basePath);
|
|
144
|
+
const refine = tileset?.root?.refine;
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
const rootLodMetricValue = tile.geometricError;
|
|
147
|
+
|
|
148
|
+
// Replace tile.boundingVolume with the the bounding volume specified by the extensions['3DTILES_bounding_volume_S2']
|
|
149
|
+
const s2VolumeInfo: S2VolumeInfo = tile.boundingVolume.extensions?.['3DTILES_bounding_volume_S2'];
|
|
150
|
+
if (s2VolumeInfo) {
|
|
151
|
+
const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);
|
|
152
|
+
const s2VolumeBox: S2VolumeBox = {box, s2VolumeInfo};
|
|
153
|
+
tile.boundingVolume = s2VolumeBox;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const rootBoundingVolume = tile.boundingVolume;
|
|
157
|
+
|
|
158
|
+
const implicitOptions = {
|
|
159
|
+
contentUrlTemplate,
|
|
160
|
+
subtreesUriTemplate,
|
|
161
|
+
subdivisionScheme,
|
|
162
|
+
subtreeLevels,
|
|
163
|
+
maximumLevel,
|
|
164
|
+
refine,
|
|
165
|
+
basePath,
|
|
166
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
167
|
+
rootLodMetricValue,
|
|
168
|
+
rootBoundingVolume,
|
|
169
|
+
getTileType,
|
|
170
|
+
getRefine
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
return await normalizeImplicitTileData(tile, subtree, implicitOptions);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Do implicit data normalisation to create hierarchical tile structure
|
|
178
|
+
* @param tile
|
|
179
|
+
* @param rootSubtree
|
|
180
|
+
* @param options
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
export async function normalizeImplicitTileData(tile, rootSubtree: Subtree, options: any) {
|
|
184
|
+
if (!tile) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
189
|
+
tile.lodMetricValue = tile.geometricError;
|
|
190
|
+
tile.transformMatrix = tile.transform;
|
|
191
|
+
|
|
192
|
+
const {children, contentUrl} = await parseImplicitTiles({
|
|
193
|
+
subtree: rootSubtree,
|
|
194
|
+
options,
|
|
195
|
+
s2VolumeBox: tile
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (contentUrl) {
|
|
199
|
+
tile.contentUrl = contentUrl;
|
|
200
|
+
tile.content = {uri: contentUrl.replace(`${options.basePath}/`, '')};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
tile.refine = getRefine(tile.refine);
|
|
204
|
+
tile.type = getTileType(tile);
|
|
205
|
+
tile.children = children;
|
|
206
|
+
tile.id = tile.contentUrl;
|
|
207
|
+
|
|
208
|
+
return tile;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Implicit Tiling data can be in 3DTILES_implicit_tiling for 3DTiles v.Next or directly in implicitTiling object for 3DTiles v1.1.
|
|
213
|
+
* Spec 3DTiles v.Next - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling
|
|
214
|
+
* Spec 3DTiles v.1.1 - https://github.com/CesiumGS/3d-tiles/tree/draft-1.1/specification/ImplicitTiling
|
|
215
|
+
* @param tile
|
|
216
|
+
* @returns
|
|
217
|
+
*/
|
|
218
|
+
function getImplicitTilingExtensionData(tile: Tile3D | null): ImplicitTilingExtension {
|
|
219
|
+
return tile?.extensions?.['3DTILES_implicit_tiling'] || tile?.implicitTiling;
|
|
220
|
+
}
|
package/src/lib/parsers/{parse-3d-tile-instanced-model.js → parse-3d-tile-instanced-model.ts}
RENAMED
|
@@ -146,6 +146,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
instancePosition.copy(position);
|
|
149
|
+
// @ts-expect-error
|
|
149
150
|
instanceTranslationRotationScale.translation = instancePosition;
|
|
150
151
|
|
|
151
152
|
// Get the instance rotation
|
|
@@ -203,6 +204,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
instanceQuaternion.fromMatrix3(instanceRotation);
|
|
207
|
+
// @ts-expect-error
|
|
206
208
|
instanceTranslationRotationScale.rotation = instanceQuaternion;
|
|
207
209
|
|
|
208
210
|
// Get the instance scale
|
|
@@ -216,6 +218,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
216
218
|
instanceScale.scale(nonUniformScale);
|
|
217
219
|
}
|
|
218
220
|
|
|
221
|
+
// @ts-expect-error
|
|
219
222
|
instanceTranslationRotationScale.scale = instanceScale;
|
|
220
223
|
|
|
221
224
|
// Get the batchId
|
|
@@ -225,12 +228,15 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
225
228
|
batchId = i;
|
|
226
229
|
}
|
|
227
230
|
|
|
231
|
+
// @ts-expect-error
|
|
228
232
|
const rotationMatrix = new Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);
|
|
229
233
|
|
|
230
234
|
// Create the model matrix and the instance
|
|
231
235
|
instanceTransform.identity();
|
|
236
|
+
// @ts-expect-error
|
|
232
237
|
instanceTransform.translate(instanceTranslationRotationScale.translation);
|
|
233
238
|
instanceTransform.multiplyRight(rotationMatrix);
|
|
239
|
+
// @ts-expect-error
|
|
234
240
|
instanceTransform.scale(instanceTranslationRotationScale.scale);
|
|
235
241
|
|
|
236
242
|
const modelMatrix = instanceTransform.clone();
|
|
@@ -137,7 +137,7 @@ function parseNormals(tile, featureTable) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
function parseBatchIds(tile, featureTable) {
|
|
140
|
-
let batchTable = null;
|
|
140
|
+
let batchTable: Tile3DBatchTable | null = null;
|
|
141
141
|
if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {
|
|
142
142
|
tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);
|
|
143
143
|
|
|
@@ -250,7 +250,7 @@ export async function loadDraco(tile, dracoData, options, context) {
|
|
|
250
250
|
|
|
251
251
|
tile.attributes = {
|
|
252
252
|
positions: decodedPositions,
|
|
253
|
-
colors: normalize3DTileColorAttribute(tile, decodedColors),
|
|
253
|
+
colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),
|
|
254
254
|
normals: decodedNormals,
|
|
255
255
|
batchIds: decodedBatchIds,
|
|
256
256
|
...batchTableAttributes
|
|
@@ -8,12 +8,16 @@ import {parsePointCloud3DTile} from './parse-3d-tile-point-cloud';
|
|
|
8
8
|
import {parseBatchedModel3DTile} from './parse-3d-tile-batched-model';
|
|
9
9
|
import {parseInstancedModel3DTile} from './parse-3d-tile-instanced-model';
|
|
10
10
|
import {parseComposite3DTile} from './parse-3d-tile-composite';
|
|
11
|
+
import {parseGltf3DTile} from './parse-3d-tile-gltf';
|
|
11
12
|
|
|
12
13
|
// Extracts
|
|
13
14
|
export async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {
|
|
15
|
+
// @ts-expect-error
|
|
14
16
|
tile.byteOffset = byteOffset;
|
|
17
|
+
// @ts-expect-error
|
|
15
18
|
tile.type = getMagicString(arrayBuffer, byteOffset);
|
|
16
19
|
|
|
20
|
+
// @ts-expect-error
|
|
17
21
|
switch (tile.type) {
|
|
18
22
|
case TILE3D_TYPE.COMPOSITE:
|
|
19
23
|
// Note: We pass this function as argument so that embedded tiles can be parsed recursively
|
|
@@ -29,6 +33,9 @@ export async function parse3DTile(arrayBuffer, byteOffset = 0, options, context,
|
|
|
29
33
|
case TILE3D_TYPE.BATCHED_3D_MODEL:
|
|
30
34
|
return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
|
|
31
35
|
|
|
36
|
+
case TILE3D_TYPE.GLTF:
|
|
37
|
+
return await parseGltf3DTile(tile, arrayBuffer, options, context);
|
|
38
|
+
|
|
32
39
|
case TILE3D_TYPE.INSTANCED_3D_MODEL:
|
|
33
40
|
return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
|
|
34
41
|
|
|
@@ -36,6 +43,7 @@ export async function parse3DTile(arrayBuffer, byteOffset = 0, options, context,
|
|
|
36
43
|
return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);
|
|
37
44
|
|
|
38
45
|
default:
|
|
46
|
+
// @ts-expect-error
|
|
39
47
|
throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line
|
|
40
48
|
}
|
|
41
49
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {Vector3} from '@math.gl/core';
|
|
2
|
+
import {OrientedBoundingBox, makeOrientedBoundingBoxFromPoints} from '@math.gl/culling';
|
|
3
|
+
|
|
4
|
+
import type {S2HeightInfo} from '../../utils/s2/index';
|
|
5
|
+
import {getS2OrientedBoundingBoxCornerPoints} from '../../utils/s2/index';
|
|
6
|
+
|
|
7
|
+
import {getS2LngLat} from '../../utils/s2/index';
|
|
8
|
+
import {Ellipsoid} from '@math.gl/geospatial';
|
|
9
|
+
|
|
10
|
+
export type S2VolumeInfo = {
|
|
11
|
+
/** S2 key or token */
|
|
12
|
+
token: string;
|
|
13
|
+
/** minimum height in meters */
|
|
14
|
+
minimumHeight: number;
|
|
15
|
+
/** maximum height in meters */
|
|
16
|
+
maximumHeight: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Converts S2VolumeInfo to OrientedBoundingBox
|
|
21
|
+
* @param {S2VolumeInfo} s2VolumeInfo - s2 volume to convert
|
|
22
|
+
* @returns Oriented Bounding Box of type Box
|
|
23
|
+
*/
|
|
24
|
+
export function convertS2BoundingVolumetoOBB(s2VolumeInfo: S2VolumeInfo): number[] {
|
|
25
|
+
const token: string = s2VolumeInfo.token;
|
|
26
|
+
const heightInfo: S2HeightInfo = {
|
|
27
|
+
minimumHeight: s2VolumeInfo.minimumHeight,
|
|
28
|
+
maximumHeight: s2VolumeInfo.maximumHeight
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const corners: Vector3[] = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);
|
|
32
|
+
|
|
33
|
+
// Add a point that doesn't allow the box dive under the Earth
|
|
34
|
+
|
|
35
|
+
const center = getS2LngLat(token);
|
|
36
|
+
const centerLng: number = center[0];
|
|
37
|
+
const centerLat: number = center[1];
|
|
38
|
+
const point = Ellipsoid.WGS84.cartographicToCartesian([
|
|
39
|
+
centerLng,
|
|
40
|
+
centerLat,
|
|
41
|
+
heightInfo.maximumHeight
|
|
42
|
+
]);
|
|
43
|
+
const centerPointAdditional = new Vector3(point[0], point[1], point[2]);
|
|
44
|
+
corners.push(centerPointAdditional);
|
|
45
|
+
|
|
46
|
+
// corners should be an array of Vector3 (XYZ)
|
|
47
|
+
const obb: OrientedBoundingBox = makeOrientedBoundingBoxFromPoints(corners);
|
|
48
|
+
const box: number[] = [...obb.center, ...obb.halfAxes];
|
|
49
|
+
|
|
50
|
+
return box;
|
|
51
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {S2Cell} from '../s2geometry/s2-geometry';
|
|
2
|
+
import {IJToST, STToUV, FaceUVToXYZ, XYZToLngLat} from '../s2geometry/s2-geometry';
|
|
3
|
+
|
|
4
|
+
const MAX_RESOLUTION = 100;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Get a polygon with corner coordinates for an S2 cell
|
|
8
|
+
* @param s2cell {S2Cell} S2 cell
|
|
9
|
+
* @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]
|
|
10
|
+
* - the polygon is closed, i.e. last coordinate is a copy of the first coordinate
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line max-statements
|
|
13
|
+
export function getS2BoundaryFlatFromS2Cell(s2cell: S2Cell): Float64Array {
|
|
14
|
+
const {face, ij, level} = s2cell;
|
|
15
|
+
const offsets = [
|
|
16
|
+
[0, 0],
|
|
17
|
+
[0, 1],
|
|
18
|
+
[1, 1],
|
|
19
|
+
[1, 0],
|
|
20
|
+
[0, 0]
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// The S2 cell edge is curved: http://s2geometry.io/
|
|
24
|
+
// This is more prominent at lower levels
|
|
25
|
+
// resolution is the number of segments to generate per edge.
|
|
26
|
+
// We exponentially reduce resolution as level increases so it doesn't affect perf
|
|
27
|
+
// when there are a large number of cells
|
|
28
|
+
const resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));
|
|
29
|
+
const result = new Float64Array(4 * resolution * 2 + 2);
|
|
30
|
+
let ptIndex = 0;
|
|
31
|
+
let prevLng = 0;
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < 4; i++) {
|
|
34
|
+
const offset = offsets[i].slice(0) as [number, number];
|
|
35
|
+
const nextOffset = offsets[i + 1];
|
|
36
|
+
const stepI = (nextOffset[0] - offset[0]) / resolution;
|
|
37
|
+
const stepJ = (nextOffset[1] - offset[1]) / resolution;
|
|
38
|
+
|
|
39
|
+
for (let j = 0; j < resolution; j++) {
|
|
40
|
+
offset[0] += stepI;
|
|
41
|
+
offset[1] += stepJ;
|
|
42
|
+
// Cell can be represented by coordinates IJ, ST, UV, XYZ
|
|
43
|
+
// http://s2geometry.io/devguide/s2cell_hierarchy#coordinate-systems
|
|
44
|
+
const st = IJToST(ij, level, offset);
|
|
45
|
+
const uv = STToUV(st);
|
|
46
|
+
const xyz = FaceUVToXYZ(face, uv);
|
|
47
|
+
const lngLat = XYZToLngLat(xyz);
|
|
48
|
+
|
|
49
|
+
// Adjust longitude for Web Mercator projection
|
|
50
|
+
|
|
51
|
+
if (Math.abs(lngLat[1]) > 89.999) {
|
|
52
|
+
lngLat[0] = prevLng;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const deltaLng = lngLat[0] - prevLng;
|
|
56
|
+
lngLat[0] += deltaLng > 180 ? -360 : deltaLng < -180 ? 360 : 0;
|
|
57
|
+
|
|
58
|
+
result[ptIndex++] = lngLat[0];
|
|
59
|
+
result[ptIndex++] = lngLat[1];
|
|
60
|
+
prevLng = lngLat[0];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// close the loop
|
|
64
|
+
result[ptIndex++] = result[0];
|
|
65
|
+
result[ptIndex++] = result[1];
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {getS2Cell} from '../s2geometry/s2-cell-utils';
|
|
2
|
+
import {getS2Region} from './s2-to-region';
|
|
3
|
+
import {Vector3} from '@math.gl/core';
|
|
4
|
+
|
|
5
|
+
export type S2HeightInfo = {
|
|
6
|
+
minimumHeight: number;
|
|
7
|
+
maximumHeight: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Converts S2HeightInfo to corner points of an oriented bounding box
|
|
12
|
+
* Can be used to constuct an OrientedBoundingBox instance
|
|
13
|
+
* @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
|
|
14
|
+
* @param heightInfo {S2HeightInfo} min and max height of the box
|
|
15
|
+
* @returns corner points of the oriented bounding box
|
|
16
|
+
*/
|
|
17
|
+
export function getS2OrientedBoundingBoxCornerPoints(
|
|
18
|
+
tokenOrKey: string, // This can be an S2 key or token
|
|
19
|
+
heightInfo?: S2HeightInfo
|
|
20
|
+
): Vector3[] {
|
|
21
|
+
const min: number = heightInfo?.minimumHeight || 0;
|
|
22
|
+
const max: number = heightInfo?.maximumHeight || 0;
|
|
23
|
+
|
|
24
|
+
const s2cell = getS2Cell(tokenOrKey);
|
|
25
|
+
const region = getS2Region(s2cell);
|
|
26
|
+
|
|
27
|
+
// region lng/lat are in degrees
|
|
28
|
+
const W = region.west;
|
|
29
|
+
const S = region.south;
|
|
30
|
+
const E = region.east;
|
|
31
|
+
const N = region.north;
|
|
32
|
+
|
|
33
|
+
const points: Vector3[] = [];
|
|
34
|
+
|
|
35
|
+
points.push(new Vector3(W, N, min));
|
|
36
|
+
points.push(new Vector3(E, N, min));
|
|
37
|
+
points.push(new Vector3(E, S, min));
|
|
38
|
+
points.push(new Vector3(W, S, min));
|
|
39
|
+
|
|
40
|
+
points.push(new Vector3(W, N, max));
|
|
41
|
+
points.push(new Vector3(E, N, max));
|
|
42
|
+
points.push(new Vector3(E, S, max));
|
|
43
|
+
points.push(new Vector3(W, S, max));
|
|
44
|
+
|
|
45
|
+
return points;
|
|
46
|
+
}
|