@loaders.gl/3d-tiles 4.0.0-alpha.1 → 4.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +14805 -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 +65 -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 +110 -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 +52 -0
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +289 -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 +163 -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 +295 -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 +133 -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/{src → dist/esm}/lib/parsers/helpers/normalize-3d-tile-normals.js +5 -10
- 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 +67 -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 +20 -0
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +181 -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 +138 -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 +232 -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 +68 -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 +11 -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 +9 -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 +7 -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 +10 -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 +90 -63
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +3 -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 +5 -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 +5 -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 +8 -0
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-composite.js +23 -16
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +5 -0
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-gltf.js +28 -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 +186 -71
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +5 -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 +165 -170
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +6 -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 +372 -184
- package/dist/lib/parsers/parse-3d-tile.d.ts +5 -0
- package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -0
- package/dist/lib/parsers/parse-3d-tile.js +32 -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 +20 -0
- package/dist/tiles-3d-loader.d.ts.map +1 -0
- package/dist/tiles-3d-loader.js +69 -65
- package/dist/types.d.ts +335 -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 +13 -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} +10 -4
- package/src/lib/parsers/helpers/normalize-3d-tile-normals.ts +35 -0
- 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} +40 -16
- package/src/lib/parsers/helpers/{parse-3d-tile-header.js → parse-3d-tile-header.ts} +7 -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} +33 -12
- package/src/lib/parsers/{parse-3d-tile-batched-model.js → parse-3d-tile-batched-model.ts} +18 -3
- package/src/lib/parsers/{parse-3d-tile-composite.js → parse-3d-tile-composite.ts} +20 -8
- package/src/lib/parsers/parse-3d-tile-gltf.ts +33 -0
- package/src/lib/parsers/parse-3d-tile-header.ts +253 -0
- package/src/lib/parsers/{parse-3d-tile-instanced-model.js → parse-3d-tile-instanced-model.ts} +41 -30
- package/src/lib/parsers/{parse-3d-tile-point-cloud.js → parse-3d-tile-point-cloud.ts} +73 -14
- package/src/lib/parsers/{parse-3d-tile.js → parse-3d-tile.ts} +14 -1
- 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 +68 -37
- package/src/types.ts +321 -13
- 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-positions.js → normalize-3d-tile-positions.ts} +0 -0
- /package/src/lib/parsers/helpers/{parse-utils.js → parse-utils.ts} +0 -0
- /package/src/lib/utils/{version.js → version.ts} +0 -0
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
3
3
|
|
|
4
4
|
import {getStringFromArrayBuffer} from './parse-utils';
|
|
5
|
+
import {Tiles3DLoaderOptions} from '../../../tiles-3d-loader';
|
|
6
|
+
import {Tiles3DTileContent} from '../../../types';
|
|
5
7
|
|
|
6
8
|
const SIZEOF_UINT32 = 4;
|
|
7
|
-
const DEPRECATION_WARNING =
|
|
9
|
+
const DEPRECATION_WARNING = 'b3dm tile in legacy format.';
|
|
8
10
|
|
|
9
11
|
// eslint-disable-next-line max-statements
|
|
10
|
-
export function parse3DTileTablesHeaderSync(
|
|
12
|
+
export function parse3DTileTablesHeaderSync(
|
|
13
|
+
tile: Tiles3DTileContent,
|
|
14
|
+
arrayBuffer: ArrayBuffer,
|
|
15
|
+
byteOffset: number
|
|
16
|
+
) {
|
|
11
17
|
const view = new DataView(arrayBuffer);
|
|
12
18
|
let batchLength;
|
|
13
19
|
|
|
@@ -58,20 +64,30 @@ export function parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset) {
|
|
|
58
64
|
return byteOffset;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
export function parse3DTileTablesSync(
|
|
67
|
+
export function parse3DTileTablesSync(
|
|
68
|
+
tile: Tiles3DTileContent,
|
|
69
|
+
arrayBuffer: ArrayBuffer,
|
|
70
|
+
byteOffset: number,
|
|
71
|
+
options?: Tiles3DLoaderOptions
|
|
72
|
+
) {
|
|
62
73
|
byteOffset = parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options);
|
|
63
74
|
byteOffset = parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options);
|
|
64
75
|
return byteOffset;
|
|
65
76
|
}
|
|
66
77
|
|
|
67
|
-
function parse3DTileFeatureTable(
|
|
68
|
-
|
|
78
|
+
function parse3DTileFeatureTable(
|
|
79
|
+
tile: Tiles3DTileContent,
|
|
80
|
+
arrayBuffer: ArrayBuffer,
|
|
81
|
+
byteOffset: number,
|
|
82
|
+
options?: Tiles3DLoaderOptions
|
|
83
|
+
) {
|
|
84
|
+
const {featureTableJsonByteLength, featureTableBinaryByteLength, batchLength} = tile.header || {};
|
|
69
85
|
|
|
70
86
|
tile.featureTableJson = {
|
|
71
87
|
BATCH_LENGTH: batchLength || 0
|
|
72
88
|
};
|
|
73
89
|
|
|
74
|
-
if (featureTableJsonByteLength > 0) {
|
|
90
|
+
if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {
|
|
75
91
|
const featureTableString = getStringFromArrayBuffer(
|
|
76
92
|
arrayBuffer,
|
|
77
93
|
byteOffset,
|
|
@@ -79,10 +95,10 @@ function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
|
|
|
79
95
|
);
|
|
80
96
|
tile.featureTableJson = JSON.parse(featureTableString);
|
|
81
97
|
}
|
|
82
|
-
byteOffset += featureTableJsonByteLength;
|
|
98
|
+
byteOffset += featureTableJsonByteLength || 0;
|
|
83
99
|
|
|
84
100
|
tile.featureTableBinary = new Uint8Array(arrayBuffer, byteOffset, featureTableBinaryByteLength);
|
|
85
|
-
byteOffset += featureTableBinaryByteLength;
|
|
101
|
+
byteOffset += featureTableBinaryByteLength || 0;
|
|
86
102
|
|
|
87
103
|
/*
|
|
88
104
|
const featureTable = parseFeatureTable(featureTableJson, featureTableBinary);
|
|
@@ -94,10 +110,15 @@ function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
|
|
|
94
110
|
return byteOffset;
|
|
95
111
|
}
|
|
96
112
|
|
|
97
|
-
function parse3DTileBatchTable(
|
|
98
|
-
|
|
113
|
+
function parse3DTileBatchTable(
|
|
114
|
+
tile: Tiles3DTileContent,
|
|
115
|
+
arrayBuffer: ArrayBuffer,
|
|
116
|
+
byteOffset: number,
|
|
117
|
+
options?: Tiles3DLoaderOptions
|
|
118
|
+
) {
|
|
119
|
+
const {batchTableJsonByteLength, batchTableBinaryByteLength} = tile.header || {};
|
|
99
120
|
|
|
100
|
-
if (batchTableJsonByteLength > 0) {
|
|
121
|
+
if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {
|
|
101
122
|
const batchTableString = getStringFromArrayBuffer(
|
|
102
123
|
arrayBuffer,
|
|
103
124
|
byteOffset,
|
|
@@ -106,7 +127,7 @@ function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
|
|
|
106
127
|
tile.batchTableJson = JSON.parse(batchTableString);
|
|
107
128
|
byteOffset += batchTableJsonByteLength;
|
|
108
129
|
|
|
109
|
-
if (batchTableBinaryByteLength > 0) {
|
|
130
|
+
if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {
|
|
110
131
|
// Has a batch table binary
|
|
111
132
|
tile.batchTableBinary = new Uint8Array(arrayBuffer, byteOffset, batchTableBinaryByteLength);
|
|
112
133
|
// Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
|
|
@@ -8,8 +8,17 @@ import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
|
|
|
8
8
|
import {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';
|
|
9
9
|
import {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';
|
|
10
10
|
import {parse3DTileGLTFViewSync, extractGLTF, GLTF_FORMAT} from './helpers/parse-3d-tile-gltf-view';
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
import {Tiles3DTileContent} from '../../types';
|
|
12
|
+
import {Tiles3DLoaderOptions} from '../../tiles-3d-loader';
|
|
13
|
+
import {LoaderContext} from '@loaders.gl/loader-utils';
|
|
14
|
+
|
|
15
|
+
export async function parseBatchedModel3DTile(
|
|
16
|
+
tile: Tiles3DTileContent,
|
|
17
|
+
arrayBuffer: ArrayBuffer,
|
|
18
|
+
byteOffset: number,
|
|
19
|
+
options?: Tiles3DLoaderOptions,
|
|
20
|
+
context?: LoaderContext
|
|
21
|
+
) {
|
|
13
22
|
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
|
|
14
23
|
await extractGLTF(tile, GLTF_FORMAT.EMBEDDED, options, context);
|
|
15
24
|
|
|
@@ -21,7 +30,13 @@ export async function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, opt
|
|
|
21
30
|
return byteOffset;
|
|
22
31
|
}
|
|
23
32
|
|
|
24
|
-
function parseBatchedModel(
|
|
33
|
+
function parseBatchedModel(
|
|
34
|
+
tile: Tiles3DTileContent,
|
|
35
|
+
arrayBuffer: ArrayBuffer,
|
|
36
|
+
byteOffset: number,
|
|
37
|
+
options?: Tiles3DLoaderOptions,
|
|
38
|
+
context?: LoaderContext
|
|
39
|
+
) {
|
|
25
40
|
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
|
|
26
41
|
|
|
27
42
|
byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);
|
|
@@ -4,17 +4,29 @@
|
|
|
4
4
|
// Reference code:
|
|
5
5
|
// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Composite3DTileContent.js#L182
|
|
6
6
|
|
|
7
|
+
import type {LoaderContext} from '@loaders.gl/loader-utils';
|
|
8
|
+
import type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';
|
|
7
9
|
import {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';
|
|
10
|
+
import {Tiles3DTileContent} from '../../types';
|
|
11
|
+
|
|
12
|
+
/** Resolve circulate dependency by passing in parsing function as argument */
|
|
13
|
+
type Parse3DTile = (
|
|
14
|
+
arrayBuffer: ArrayBuffer,
|
|
15
|
+
byteOffset: number,
|
|
16
|
+
options: Tiles3DLoaderOptions | undefined,
|
|
17
|
+
context: LoaderContext | undefined,
|
|
18
|
+
subtile
|
|
19
|
+
) => Promise<number>;
|
|
8
20
|
|
|
9
21
|
// eslint-disable-next-line max-params
|
|
10
22
|
export async function parseComposite3DTile(
|
|
11
|
-
tile,
|
|
12
|
-
arrayBuffer,
|
|
13
|
-
byteOffset,
|
|
14
|
-
options,
|
|
15
|
-
context,
|
|
16
|
-
parse3DTile
|
|
17
|
-
) {
|
|
23
|
+
tile: Tiles3DTileContent,
|
|
24
|
+
arrayBuffer: ArrayBuffer,
|
|
25
|
+
byteOffset: number,
|
|
26
|
+
options: Tiles3DLoaderOptions | undefined,
|
|
27
|
+
context: LoaderContext | undefined,
|
|
28
|
+
parse3DTile: Parse3DTile
|
|
29
|
+
): Promise<number> {
|
|
18
30
|
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
|
|
19
31
|
|
|
20
32
|
const view = new DataView(arrayBuffer);
|
|
@@ -25,7 +37,7 @@ export async function parseComposite3DTile(
|
|
|
25
37
|
|
|
26
38
|
// extract each tile from the byte stream
|
|
27
39
|
tile.tiles = [];
|
|
28
|
-
while (tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12) {
|
|
40
|
+
while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {
|
|
29
41
|
const subtile = {};
|
|
30
42
|
tile.tiles.push(subtile);
|
|
31
43
|
byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type {LoaderContext} from '@loaders.gl/loader-utils';
|
|
2
|
+
import type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';
|
|
3
|
+
import {_getMemoryUsageGLTF, GLTFLoader, postProcessGLTF} from '@loaders.gl/gltf';
|
|
4
|
+
import {Tiles3DTileContent} from '../../types';
|
|
5
|
+
|
|
6
|
+
export async function parseGltf3DTile(
|
|
7
|
+
tile: Tiles3DTileContent,
|
|
8
|
+
arrayBuffer: ArrayBuffer,
|
|
9
|
+
options?: Tiles3DLoaderOptions,
|
|
10
|
+
context?: LoaderContext
|
|
11
|
+
): Promise<void> {
|
|
12
|
+
// Set flags
|
|
13
|
+
// glTF models need to be rotated from Y to Z up
|
|
14
|
+
// https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up
|
|
15
|
+
tile.rotateYtoZ = true;
|
|
16
|
+
// Save gltf up axis
|
|
17
|
+
tile.gltfUpAxis =
|
|
18
|
+
options?.['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis
|
|
19
|
+
? options['3d-tiles'].assetGltfUpAxis
|
|
20
|
+
: 'Y';
|
|
21
|
+
|
|
22
|
+
if (options?.['3d-tiles']?.loadGLTF) {
|
|
23
|
+
if (!context) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const {parse} = context;
|
|
27
|
+
const gltfWithBuffers = await parse(arrayBuffer, GLTFLoader, options, context);
|
|
28
|
+
tile.gltf = postProcessGLTF(gltfWithBuffers);
|
|
29
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
30
|
+
} else {
|
|
31
|
+
tile.gltfArrayBuffer = arrayBuffer;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';
|
|
2
|
+
import type {LoaderOptions} from '@loaders.gl/loader-utils';
|
|
3
|
+
import {Tile3DSubtreeLoader} from '../../tile-3d-subtree-loader';
|
|
4
|
+
import {load} from '@loaders.gl/core';
|
|
5
|
+
import {LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE} from '@loaders.gl/tiles';
|
|
6
|
+
import {
|
|
7
|
+
ImplicitTilingExensionData,
|
|
8
|
+
Subtree,
|
|
9
|
+
Tiles3DTileContentJSON,
|
|
10
|
+
Tiles3DTileJSON,
|
|
11
|
+
Tiles3DTileJSONPostprocessed,
|
|
12
|
+
Tiles3DTilesetJSON
|
|
13
|
+
} from '../../types';
|
|
14
|
+
import type {S2VolumeBox} from './helpers/parse-3d-implicit-tiles';
|
|
15
|
+
import {parseImplicitTiles, replaceContentUrlTemplate} from './helpers/parse-3d-implicit-tiles';
|
|
16
|
+
import type {S2VolumeInfo} from '../utils/obb/s2-corners-to-obb';
|
|
17
|
+
import {convertS2BoundingVolumetoOBB} from '../utils/obb/s2-corners-to-obb';
|
|
18
|
+
|
|
19
|
+
function getTileType(tile: Tiles3DTileJSON, tileContentUrl: string = ''): TILE_TYPE | string {
|
|
20
|
+
if (!tileContentUrl) {
|
|
21
|
+
return TILE_TYPE.EMPTY;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const contentUrl = tileContentUrl.split('?')[0]; // Discard query string
|
|
25
|
+
const fileExtension = contentUrl.split('.').pop();
|
|
26
|
+
switch (fileExtension) {
|
|
27
|
+
case 'pnts':
|
|
28
|
+
return TILE_TYPE.POINTCLOUD;
|
|
29
|
+
case 'i3dm':
|
|
30
|
+
case 'b3dm':
|
|
31
|
+
case 'glb':
|
|
32
|
+
case 'gltf':
|
|
33
|
+
return TILE_TYPE.SCENEGRAPH;
|
|
34
|
+
default:
|
|
35
|
+
return fileExtension || TILE_TYPE.EMPTY;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getRefine(refine?: string): TILE_REFINEMENT | string | undefined {
|
|
40
|
+
switch (refine) {
|
|
41
|
+
case 'REPLACE':
|
|
42
|
+
case 'replace':
|
|
43
|
+
return TILE_REFINEMENT.REPLACE;
|
|
44
|
+
case 'ADD':
|
|
45
|
+
case 'add':
|
|
46
|
+
return TILE_REFINEMENT.ADD;
|
|
47
|
+
default:
|
|
48
|
+
return refine;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function resolveUri(uri: string = '', basePath: string): string {
|
|
53
|
+
// url scheme per RFC3986
|
|
54
|
+
const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;
|
|
55
|
+
|
|
56
|
+
if (urlSchemeRegex.test(basePath)) {
|
|
57
|
+
const url = new URL(uri, `${basePath}/`);
|
|
58
|
+
return decodeURI(url.toString());
|
|
59
|
+
} else if (uri.startsWith('/')) {
|
|
60
|
+
return uri;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return `${basePath}/${uri}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function normalizeTileData(
|
|
67
|
+
tile: Tiles3DTileJSON | null,
|
|
68
|
+
basePath: string
|
|
69
|
+
): Tiles3DTileJSONPostprocessed | null {
|
|
70
|
+
if (!tile) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
let tileContentUrl: string | undefined;
|
|
74
|
+
if (tile.content) {
|
|
75
|
+
const contentUri = tile.content.uri || tile.content?.url;
|
|
76
|
+
tileContentUrl = resolveUri(contentUri, basePath);
|
|
77
|
+
}
|
|
78
|
+
const tilePostprocessed: Tiles3DTileJSONPostprocessed = {
|
|
79
|
+
...tile,
|
|
80
|
+
id: tileContentUrl,
|
|
81
|
+
contentUrl: tileContentUrl,
|
|
82
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
83
|
+
lodMetricValue: tile.geometricError,
|
|
84
|
+
transformMatrix: tile.transform,
|
|
85
|
+
type: getTileType(tile, tileContentUrl),
|
|
86
|
+
refine: getRefine(tile.refine)
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return tilePostprocessed;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// normalize tile headers
|
|
93
|
+
export async function normalizeTileHeaders(
|
|
94
|
+
tileset: Tiles3DTilesetJSON,
|
|
95
|
+
basePath: string,
|
|
96
|
+
options: LoaderOptions
|
|
97
|
+
): Promise<Tiles3DTileJSONPostprocessed | null> {
|
|
98
|
+
let root: Tiles3DTileJSONPostprocessed | null = null;
|
|
99
|
+
|
|
100
|
+
const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);
|
|
101
|
+
if (rootImplicitTilingExtension && tileset.root) {
|
|
102
|
+
root = await normalizeImplicitTileHeaders(
|
|
103
|
+
tileset.root,
|
|
104
|
+
tileset,
|
|
105
|
+
basePath,
|
|
106
|
+
rootImplicitTilingExtension,
|
|
107
|
+
options
|
|
108
|
+
);
|
|
109
|
+
} else {
|
|
110
|
+
root = normalizeTileData(tileset.root, basePath);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const stack: any[] = [];
|
|
114
|
+
stack.push(root);
|
|
115
|
+
|
|
116
|
+
while (stack.length > 0) {
|
|
117
|
+
const tile = stack.pop() || {};
|
|
118
|
+
const children = tile.children || [];
|
|
119
|
+
const childrenPostprocessed: Tiles3DTileJSONPostprocessed[] = [];
|
|
120
|
+
for (const childHeader of children) {
|
|
121
|
+
const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
|
|
122
|
+
let childHeaderPostprocessed: Tiles3DTileJSONPostprocessed | null;
|
|
123
|
+
if (childImplicitTilingExtension) {
|
|
124
|
+
childHeaderPostprocessed = await normalizeImplicitTileHeaders(
|
|
125
|
+
childHeader,
|
|
126
|
+
tileset,
|
|
127
|
+
basePath,
|
|
128
|
+
childImplicitTilingExtension,
|
|
129
|
+
options
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
childHeaderPostprocessed = normalizeTileData(childHeader, basePath);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (childHeaderPostprocessed) {
|
|
136
|
+
childrenPostprocessed.push(childHeaderPostprocessed);
|
|
137
|
+
stack.push(childHeaderPostprocessed);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
tile.children = childrenPostprocessed;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return root;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Do normalisation of implicit tile headers
|
|
148
|
+
* TODO Check if Tile3D class can be a return type here.
|
|
149
|
+
* @param tileset
|
|
150
|
+
*/
|
|
151
|
+
export async function normalizeImplicitTileHeaders(
|
|
152
|
+
tile: Tiles3DTileJSON,
|
|
153
|
+
tileset: Tiles3DTilesetJSON,
|
|
154
|
+
basePath: string,
|
|
155
|
+
implicitTilingExtension: ImplicitTilingExensionData,
|
|
156
|
+
options: Tiles3DLoaderOptions
|
|
157
|
+
): Promise<Tiles3DTileJSONPostprocessed | null> {
|
|
158
|
+
const {
|
|
159
|
+
subdivisionScheme,
|
|
160
|
+
maximumLevel,
|
|
161
|
+
subtreeLevels,
|
|
162
|
+
subtrees: {uri: subtreesUriTemplate}
|
|
163
|
+
} = implicitTilingExtension;
|
|
164
|
+
const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
|
|
165
|
+
const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
|
|
166
|
+
const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);
|
|
167
|
+
const contentUrlTemplate = resolveUri(tile.content?.uri, basePath);
|
|
168
|
+
const refine = tileset?.root?.refine;
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
const rootLodMetricValue = tile.geometricError;
|
|
171
|
+
|
|
172
|
+
// Replace tile.boundingVolume with the the bounding volume specified by the extensions['3DTILES_bounding_volume_S2']
|
|
173
|
+
const s2VolumeInfo: S2VolumeInfo = tile.boundingVolume.extensions?.['3DTILES_bounding_volume_S2'];
|
|
174
|
+
if (s2VolumeInfo) {
|
|
175
|
+
const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);
|
|
176
|
+
const s2VolumeBox: S2VolumeBox = {box, s2VolumeInfo};
|
|
177
|
+
tile.boundingVolume = s2VolumeBox;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const rootBoundingVolume = tile.boundingVolume;
|
|
181
|
+
|
|
182
|
+
const implicitOptions = {
|
|
183
|
+
contentUrlTemplate,
|
|
184
|
+
subtreesUriTemplate,
|
|
185
|
+
subdivisionScheme,
|
|
186
|
+
subtreeLevels,
|
|
187
|
+
maximumLevel,
|
|
188
|
+
refine,
|
|
189
|
+
basePath,
|
|
190
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
191
|
+
rootLodMetricValue,
|
|
192
|
+
rootBoundingVolume,
|
|
193
|
+
getTileType,
|
|
194
|
+
getRefine
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Do implicit data normalisation to create hierarchical tile structure
|
|
202
|
+
* @param tile
|
|
203
|
+
* @param rootSubtree
|
|
204
|
+
* @param options
|
|
205
|
+
* @returns
|
|
206
|
+
*/
|
|
207
|
+
export async function normalizeImplicitTileData(
|
|
208
|
+
tile: Tiles3DTileJSON,
|
|
209
|
+
basePath: string,
|
|
210
|
+
rootSubtree: Subtree,
|
|
211
|
+
options: any
|
|
212
|
+
): Promise<Tiles3DTileJSONPostprocessed | null> {
|
|
213
|
+
if (!tile) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const {children, contentUrl} = await parseImplicitTiles({
|
|
218
|
+
subtree: rootSubtree,
|
|
219
|
+
options
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
let tileContentUrl: string | undefined;
|
|
223
|
+
let tileContent: Tiles3DTileContentJSON | null = null;
|
|
224
|
+
if (contentUrl) {
|
|
225
|
+
tileContentUrl = contentUrl;
|
|
226
|
+
tileContent = {uri: contentUrl.replace(`${basePath}/`, '')};
|
|
227
|
+
}
|
|
228
|
+
const tilePostprocessed: Tiles3DTileJSONPostprocessed = {
|
|
229
|
+
...tile,
|
|
230
|
+
id: tileContentUrl,
|
|
231
|
+
contentUrl: tileContentUrl,
|
|
232
|
+
lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
|
|
233
|
+
lodMetricValue: tile.geometricError,
|
|
234
|
+
transformMatrix: tile.transform,
|
|
235
|
+
type: getTileType(tile, tileContentUrl),
|
|
236
|
+
refine: getRefine(tile.refine),
|
|
237
|
+
content: tileContent || tile.content,
|
|
238
|
+
children
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
return tilePostprocessed;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Implicit Tiling data can be in 3DTILES_implicit_tiling for 3DTiles v.Next or directly in implicitTiling object for 3DTiles v1.1.
|
|
246
|
+
* Spec 3DTiles v.Next - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling
|
|
247
|
+
* Spec 3DTiles v.1.1 - https://github.com/CesiumGS/3d-tiles/tree/draft-1.1/specification/ImplicitTiling
|
|
248
|
+
* @param tile
|
|
249
|
+
* @returns
|
|
250
|
+
*/
|
|
251
|
+
function getImplicitTilingExtensionData(tile: Tiles3DTileJSON | null): ImplicitTilingExensionData {
|
|
252
|
+
return tile?.extensions?.['3DTILES_implicit_tiling'] || tile?.implicitTiling;
|
|
253
|
+
}
|
package/src/lib/parsers/{parse-3d-tile-instanced-model.js → parse-3d-tile-instanced-model.ts}
RENAMED
|
@@ -10,14 +10,29 @@ import Tile3DBatchTable from '../classes/tile-3d-batch-table';
|
|
|
10
10
|
import {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';
|
|
11
11
|
import {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';
|
|
12
12
|
import {parse3DTileGLTFViewSync, extractGLTF} from './helpers/parse-3d-tile-gltf-view';
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import {Tiles3DLoaderOptions} from '../../tiles-3d-loader';
|
|
14
|
+
import {LoaderContext} from '@loaders.gl/loader-utils';
|
|
15
|
+
import {Tiles3DTileContent} from '../../types';
|
|
16
|
+
|
|
17
|
+
export async function parseInstancedModel3DTile(
|
|
18
|
+
tile: Tiles3DTileContent,
|
|
19
|
+
arrayBuffer: ArrayBuffer,
|
|
20
|
+
byteOffset: number,
|
|
21
|
+
options?: Tiles3DLoaderOptions,
|
|
22
|
+
context?: LoaderContext
|
|
23
|
+
): Promise<number> {
|
|
15
24
|
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
|
|
16
|
-
await extractGLTF(tile, tile.gltfFormat, options, context);
|
|
25
|
+
await extractGLTF(tile, tile.gltfFormat || 0, options, context);
|
|
17
26
|
return byteOffset;
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
function parseInstancedModel(
|
|
29
|
+
function parseInstancedModel(
|
|
30
|
+
tile: Tiles3DTileContent,
|
|
31
|
+
arrayBuffer: ArrayBuffer,
|
|
32
|
+
byteOffset: number,
|
|
33
|
+
options?: Tiles3DLoaderOptions,
|
|
34
|
+
context?: LoaderContext
|
|
35
|
+
): number {
|
|
21
36
|
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
|
|
22
37
|
if (tile.version !== 1) {
|
|
23
38
|
throw new Error(`Instanced 3D Model version ${tile.version} is not supported`);
|
|
@@ -36,7 +51,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
|
36
51
|
byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);
|
|
37
52
|
|
|
38
53
|
// TODO - Is the feature table sometimes optional or can check be moved into table header parser?
|
|
39
|
-
if (tile.featureTableJsonByteLength === 0) {
|
|
54
|
+
if (!tile?.header?.featureTableJsonByteLength || tile.header.featureTableJsonByteLength === 0) {
|
|
40
55
|
throw new Error('i3dm parser: featureTableJsonByteLength is zero.');
|
|
41
56
|
}
|
|
42
57
|
|
|
@@ -64,23 +79,13 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
|
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
// eslint-disable-next-line max-statements, complexity
|
|
67
|
-
function extractInstancedAttributes(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// requestType: RequestType.TILES3D,
|
|
75
|
-
gltf: undefined,
|
|
76
|
-
basePath: undefined,
|
|
77
|
-
incrementallyLoadTextures: false,
|
|
78
|
-
// TODO - tileset is not available at this stage, tile is parsed independently
|
|
79
|
-
// upAxis: (tileset && tileset._gltfUpAxis) || [0, 1, 0],
|
|
80
|
-
forwardAxis: [1, 0, 0]
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const instances = collectionOptions.instances;
|
|
82
|
+
function extractInstancedAttributes(
|
|
83
|
+
tile: Tiles3DTileContent,
|
|
84
|
+
featureTable: Tile3DFeatureTable,
|
|
85
|
+
batchTable: Tile3DBatchTable,
|
|
86
|
+
instancesLength: number
|
|
87
|
+
) {
|
|
88
|
+
const instances = new Array(instancesLength);
|
|
84
89
|
const instancePosition = new Vector3();
|
|
85
90
|
const instanceNormalRight = new Vector3();
|
|
86
91
|
const instanceNormalUp = new Vector3();
|
|
@@ -92,8 +97,8 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
92
97
|
const instanceTransform = new Matrix4();
|
|
93
98
|
const scratch1 = [];
|
|
94
99
|
const scratch2 = [];
|
|
95
|
-
const
|
|
96
|
-
const
|
|
100
|
+
const scratch3 = [];
|
|
101
|
+
const scratch4 = [];
|
|
97
102
|
|
|
98
103
|
for (let i = 0; i < instancesLength; i++) {
|
|
99
104
|
let position;
|
|
@@ -113,8 +118,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
113
118
|
const quantizedVolumeOffset = featureTable.getGlobalProperty(
|
|
114
119
|
'QUANTIZED_VOLUME_OFFSET',
|
|
115
120
|
GL.FLOAT,
|
|
116
|
-
3
|
|
117
|
-
scratchVector1
|
|
121
|
+
3
|
|
118
122
|
);
|
|
119
123
|
if (!quantizedVolumeOffset) {
|
|
120
124
|
throw new Error(
|
|
@@ -125,8 +129,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
125
129
|
const quantizedVolumeScale = featureTable.getGlobalProperty(
|
|
126
130
|
'QUANTIZED_VOLUME_SCALE',
|
|
127
131
|
GL.FLOAT,
|
|
128
|
-
3
|
|
129
|
-
scratchVector2
|
|
132
|
+
3
|
|
130
133
|
);
|
|
131
134
|
if (!quantizedVolumeScale) {
|
|
132
135
|
throw new Error(
|
|
@@ -146,6 +149,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
instancePosition.copy(position);
|
|
152
|
+
// @ts-expect-error
|
|
149
153
|
instanceTranslationRotationScale.translation = instancePosition;
|
|
150
154
|
|
|
151
155
|
// Get the instance rotation
|
|
@@ -165,12 +169,14 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
165
169
|
'NORMAL_UP_OCT32P',
|
|
166
170
|
GL.UNSIGNED_SHORT,
|
|
167
171
|
2,
|
|
172
|
+
i,
|
|
168
173
|
scratch1
|
|
169
174
|
);
|
|
170
175
|
tile.octNormalRight = featureTable.getProperty(
|
|
171
176
|
'NORMAL_RIGHT_OCT32P',
|
|
172
177
|
GL.UNSIGNED_SHORT,
|
|
173
178
|
2,
|
|
179
|
+
i,
|
|
174
180
|
scratch2
|
|
175
181
|
);
|
|
176
182
|
|
|
@@ -203,11 +209,12 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
instanceQuaternion.fromMatrix3(instanceRotation);
|
|
212
|
+
// @ts-expect-error
|
|
206
213
|
instanceTranslationRotationScale.rotation = instanceQuaternion;
|
|
207
214
|
|
|
208
215
|
// Get the instance scale
|
|
209
216
|
instanceScale.set(1.0, 1.0, 1.0);
|
|
210
|
-
const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i);
|
|
217
|
+
const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i, scratch3);
|
|
211
218
|
if (Number.isFinite(scale)) {
|
|
212
219
|
instanceScale.multiplyByScalar(scale);
|
|
213
220
|
}
|
|
@@ -216,21 +223,25 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
216
223
|
instanceScale.scale(nonUniformScale);
|
|
217
224
|
}
|
|
218
225
|
|
|
226
|
+
// @ts-expect-error
|
|
219
227
|
instanceTranslationRotationScale.scale = instanceScale;
|
|
220
228
|
|
|
221
229
|
// Get the batchId
|
|
222
|
-
let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i);
|
|
230
|
+
let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i, scratch4);
|
|
223
231
|
if (batchId === undefined) {
|
|
224
232
|
// If BATCH_ID semantic is undefined, batchId is just the instance number
|
|
225
233
|
batchId = i;
|
|
226
234
|
}
|
|
227
235
|
|
|
236
|
+
// @ts-expect-error
|
|
228
237
|
const rotationMatrix = new Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);
|
|
229
238
|
|
|
230
239
|
// Create the model matrix and the instance
|
|
231
240
|
instanceTransform.identity();
|
|
241
|
+
// @ts-expect-error
|
|
232
242
|
instanceTransform.translate(instanceTranslationRotationScale.translation);
|
|
233
243
|
instanceTransform.multiplyRight(rotationMatrix);
|
|
244
|
+
// @ts-expect-error
|
|
234
245
|
instanceTransform.scale(instanceTranslationRotationScale.scale);
|
|
235
246
|
|
|
236
247
|
const modelMatrix = instanceTransform.clone();
|