@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
|
@@ -1,245 +1,433 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is derived from the Cesium code base under Apache 2 license
|
|
3
|
+
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.loadDraco = exports.parsePointCloud3DTile = void 0;
|
|
9
|
+
const draco_1 = require("@loaders.gl/draco");
|
|
10
|
+
const math_1 = require("@loaders.gl/math");
|
|
11
|
+
const core_1 = require("@math.gl/core");
|
|
12
|
+
const tile_3d_feature_table_1 = __importDefault(require("../classes/tile-3d-feature-table"));
|
|
13
|
+
const tile_3d_batch_table_1 = __importDefault(require("../classes/tile-3d-batch-table"));
|
|
14
|
+
const parse_3d_tile_header_1 = require("./helpers/parse-3d-tile-header");
|
|
15
|
+
const parse_3d_tile_tables_1 = require("./helpers/parse-3d-tile-tables");
|
|
16
|
+
const normalize_3d_tile_colors_1 = require("./helpers/normalize-3d-tile-colors");
|
|
17
|
+
const normalize_3d_tile_normals_1 = require("./helpers/normalize-3d-tile-normals");
|
|
18
|
+
const normalize_3d_tile_positions_1 = require("./helpers/normalize-3d-tile-positions");
|
|
19
|
+
async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
20
|
+
byteOffset = (0, parse_3d_tile_header_1.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
|
|
21
|
+
byteOffset = (0, parse_3d_tile_tables_1.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset);
|
|
22
|
+
byteOffset = (0, parse_3d_tile_tables_1.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
|
|
23
|
+
initializeTile(tile);
|
|
24
|
+
const { featureTable, batchTable } = parsePointCloudTables(tile);
|
|
25
|
+
await parseDraco(tile, featureTable, batchTable, options, context);
|
|
26
|
+
parsePositions(tile, featureTable, options);
|
|
27
|
+
// @ts-expect-error TODO - do we need to assert on the batch table?
|
|
28
|
+
parseColors(tile, featureTable, batchTable);
|
|
29
|
+
parseNormals(tile, featureTable);
|
|
30
|
+
return byteOffset;
|
|
25
31
|
}
|
|
26
|
-
|
|
32
|
+
exports.parsePointCloud3DTile = parsePointCloud3DTile;
|
|
27
33
|
function initializeTile(tile) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// Initialize point cloud tile defaults
|
|
35
|
+
tile.attributes = {
|
|
36
|
+
positions: null,
|
|
37
|
+
colors: null,
|
|
38
|
+
normals: null,
|
|
39
|
+
batchIds: null
|
|
40
|
+
};
|
|
41
|
+
tile.isQuantized = false;
|
|
42
|
+
tile.isTranslucent = false;
|
|
43
|
+
tile.isRGB565 = false;
|
|
44
|
+
tile.isOctEncoded16P = false;
|
|
38
45
|
}
|
|
39
|
-
|
|
40
46
|
function parsePointCloudTables(tile) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const batchTable = parseBatchIds(tile, featureTable);
|
|
54
|
-
return {
|
|
55
|
-
featureTable,
|
|
56
|
-
batchTable
|
|
57
|
-
};
|
|
47
|
+
const featureTable = new tile_3d_feature_table_1.default(tile.featureTableJson, tile.featureTableBinary);
|
|
48
|
+
const pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');
|
|
49
|
+
if (!Number.isFinite(pointsLength)) {
|
|
50
|
+
throw new Error('POINTS_LENGTH must be defined');
|
|
51
|
+
}
|
|
52
|
+
featureTable.featuresLength = pointsLength;
|
|
53
|
+
tile.featuresLength = pointsLength;
|
|
54
|
+
tile.pointsLength = pointsLength;
|
|
55
|
+
tile.pointCount = pointsLength;
|
|
56
|
+
tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', math_1.GL.FLOAT, 3);
|
|
57
|
+
const batchTable = parseBatchIds(tile, featureTable);
|
|
58
|
+
return { featureTable, batchTable };
|
|
58
59
|
}
|
|
59
|
-
|
|
60
60
|
function parsePositions(tile, featureTable, options) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
tile.attributes = tile.attributes || {
|
|
62
|
+
positions: null,
|
|
63
|
+
colors: null,
|
|
64
|
+
normals: null,
|
|
65
|
+
batchIds: null
|
|
66
|
+
};
|
|
67
|
+
if (!tile.attributes.positions) {
|
|
68
|
+
if (featureTable.hasProperty('POSITION')) {
|
|
69
|
+
tile.attributes.positions = featureTable.getPropertyArray('POSITION', math_1.GL.FLOAT, 3);
|
|
70
|
+
}
|
|
71
|
+
else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
|
|
72
|
+
const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', math_1.GL.UNSIGNED_SHORT, 3);
|
|
73
|
+
tile.isQuantized = true;
|
|
74
|
+
tile.quantizedRange = (1 << 16) - 1;
|
|
75
|
+
tile.quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', math_1.GL.FLOAT, 3);
|
|
76
|
+
if (!tile.quantizedVolumeScale) {
|
|
77
|
+
throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');
|
|
78
|
+
}
|
|
79
|
+
tile.quantizedVolumeOffset = featureTable.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', math_1.GL.FLOAT, 3);
|
|
80
|
+
if (!tile.quantizedVolumeOffset) {
|
|
81
|
+
throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');
|
|
82
|
+
}
|
|
83
|
+
tile.attributes.positions = (0, normalize_3d_tile_positions_1.normalize3DTilePositionAttribute)(tile, positions, options);
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
|
-
|
|
86
|
+
if (!tile.attributes.positions) {
|
|
87
|
+
throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function parseColors(tile, featureTable, batchTable) {
|
|
91
|
+
tile.attributes = tile.attributes || {
|
|
92
|
+
positions: null,
|
|
93
|
+
colors: null,
|
|
94
|
+
normals: null,
|
|
95
|
+
batchIds: null
|
|
96
|
+
};
|
|
97
|
+
if (!tile.attributes.colors) {
|
|
98
|
+
let colors = null;
|
|
99
|
+
if (featureTable.hasProperty('RGBA')) {
|
|
100
|
+
colors = featureTable.getPropertyArray('RGBA', math_1.GL.UNSIGNED_BYTE, 4);
|
|
101
|
+
tile.isTranslucent = true;
|
|
102
|
+
}
|
|
103
|
+
else if (featureTable.hasProperty('RGB')) {
|
|
104
|
+
colors = featureTable.getPropertyArray('RGB', math_1.GL.UNSIGNED_BYTE, 3);
|
|
105
|
+
}
|
|
106
|
+
else if (featureTable.hasProperty('RGB565')) {
|
|
107
|
+
colors = featureTable.getPropertyArray('RGB565', math_1.GL.UNSIGNED_SHORT, 1);
|
|
108
|
+
tile.isRGB565 = true;
|
|
109
|
+
}
|
|
110
|
+
tile.attributes.colors = (0, normalize_3d_tile_colors_1.normalize3DTileColorAttribute)(tile, colors, batchTable);
|
|
111
|
+
}
|
|
112
|
+
if (featureTable.hasProperty('CONSTANT_RGBA')) {
|
|
113
|
+
tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', math_1.GL.UNSIGNED_BYTE, 4);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function parseNormals(tile, featureTable) {
|
|
117
|
+
tile.attributes = tile.attributes || {
|
|
118
|
+
positions: null,
|
|
119
|
+
colors: null,
|
|
120
|
+
normals: null,
|
|
121
|
+
batchIds: null
|
|
122
|
+
};
|
|
123
|
+
if (!tile.attributes.normals) {
|
|
124
|
+
let normals = null;
|
|
125
|
+
if (featureTable.hasProperty('NORMAL')) {
|
|
126
|
+
normals = featureTable.getPropertyArray('NORMAL', math_1.GL.FLOAT, 3);
|
|
127
|
+
}
|
|
128
|
+
else if (featureTable.hasProperty('NORMAL_OCT16P')) {
|
|
129
|
+
normals = featureTable.getPropertyArray('NORMAL_OCT16P', math_1.GL.UNSIGNED_BYTE, 2);
|
|
130
|
+
tile.isOctEncoded16P = true;
|
|
131
|
+
}
|
|
132
|
+
tile.attributes.normals = (0, normalize_3d_tile_normals_1.normalize3DTileNormalAttribute)(tile, normals);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function parseBatchIds(tile, featureTable) {
|
|
136
|
+
let batchTable = null;
|
|
137
|
+
if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {
|
|
138
|
+
tile.batchIds = featureTable.getPropertyArray('BATCH_ID', math_1.GL.UNSIGNED_SHORT, 1);
|
|
139
|
+
if (tile.batchIds) {
|
|
140
|
+
const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');
|
|
141
|
+
if (!batchFeatureLength) {
|
|
142
|
+
throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');
|
|
143
|
+
}
|
|
144
|
+
const { batchTableJson, batchTableBinary } = tile;
|
|
145
|
+
batchTable = new tile_3d_batch_table_1.default(batchTableJson, batchTableBinary, batchFeatureLength);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return batchTable;
|
|
149
|
+
}
|
|
150
|
+
// eslint-disable-next-line complexity
|
|
151
|
+
async function parseDraco(tile, featureTable, batchTable, options, context) {
|
|
152
|
+
let dracoBuffer;
|
|
153
|
+
let dracoFeatureTableProperties;
|
|
154
|
+
let dracoBatchTableProperties;
|
|
155
|
+
const batchTableDraco = tile.batchTableJson &&
|
|
156
|
+
tile.batchTableJson.extensions &&
|
|
157
|
+
tile.batchTableJson.extensions['3DTILES_draco_point_compression'];
|
|
158
|
+
if (batchTableDraco) {
|
|
159
|
+
dracoBatchTableProperties = batchTableDraco.properties;
|
|
160
|
+
}
|
|
161
|
+
const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
|
|
162
|
+
if (featureTableDraco) {
|
|
163
|
+
dracoFeatureTableProperties = featureTableDraco.properties;
|
|
164
|
+
const dracoByteOffset = featureTableDraco.byteOffset;
|
|
165
|
+
const dracoByteLength = featureTableDraco.byteLength;
|
|
166
|
+
if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
|
|
167
|
+
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
|
|
168
|
+
}
|
|
169
|
+
dracoBuffer = (tile.featureTableBinary || []).slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
|
|
170
|
+
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
|
|
171
|
+
tile.hasColors =
|
|
172
|
+
Number.isFinite(dracoFeatureTableProperties.RGB) ||
|
|
173
|
+
Number.isFinite(dracoFeatureTableProperties.RGBA);
|
|
174
|
+
tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
|
|
175
|
+
tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
|
|
176
|
+
tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
|
|
177
|
+
}
|
|
178
|
+
if (!dracoBuffer) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
const dracoData = {
|
|
182
|
+
buffer: dracoBuffer,
|
|
183
|
+
properties: { ...dracoFeatureTableProperties, ...dracoBatchTableProperties },
|
|
184
|
+
featureTableProperties: dracoFeatureTableProperties,
|
|
185
|
+
batchTableProperties: dracoBatchTableProperties,
|
|
186
|
+
dequantizeInShader: false
|
|
187
|
+
};
|
|
188
|
+
return await loadDraco(tile, dracoData, options, context);
|
|
189
|
+
}
|
|
190
|
+
// eslint-disable-next-line complexity, max-statements
|
|
191
|
+
async function loadDraco(tile, dracoData, options, context) {
|
|
192
|
+
if (!context) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const { parse } = context;
|
|
196
|
+
const dracoOptions = {
|
|
197
|
+
...options,
|
|
198
|
+
draco: {
|
|
199
|
+
...options?.draco,
|
|
200
|
+
extraAttributes: dracoData.batchTableProperties || {}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
// The entire tileset might be included, too expensive to serialize
|
|
204
|
+
delete dracoOptions['3d-tiles'];
|
|
205
|
+
const data = await parse(dracoData.buffer, draco_1.DracoLoader, dracoOptions);
|
|
206
|
+
const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
|
|
207
|
+
const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
|
|
208
|
+
const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
|
|
209
|
+
const decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
|
|
210
|
+
const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
|
|
211
|
+
const isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
|
|
212
|
+
if (isQuantizedDraco) {
|
|
213
|
+
// Draco quantization range == quantized volume scale - size in meters of the quantized volume
|
|
214
|
+
// Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc
|
|
215
|
+
const quantization = data.POSITION.data.quantization;
|
|
216
|
+
const range = quantization.range;
|
|
217
|
+
tile.quantizedVolumeScale = new core_1.Vector3(range, range, range);
|
|
218
|
+
tile.quantizedVolumeOffset = new core_1.Vector3(quantization.minValues);
|
|
219
|
+
tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
|
|
220
|
+
tile.isQuantizedDraco = true;
|
|
221
|
+
}
|
|
222
|
+
if (isOctEncodedDraco) {
|
|
223
|
+
tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
|
|
224
|
+
tile.isOctEncodedDraco = true;
|
|
225
|
+
}
|
|
226
|
+
// Extra batch table attributes
|
|
227
|
+
const batchTableAttributes = {};
|
|
228
|
+
if (dracoData.batchTableProperties) {
|
|
229
|
+
for (const attributeName of Object.keys(dracoData.batchTableProperties)) {
|
|
230
|
+
if (data.attributes[attributeName] && data.attributes[attributeName].value) {
|
|
231
|
+
batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
tile.attributes = {
|
|
236
|
+
positions: decodedPositions,
|
|
237
|
+
colors: (0, normalize_3d_tile_colors_1.normalize3DTileColorAttribute)(tile, decodedColors, undefined),
|
|
238
|
+
normals: decodedNormals,
|
|
239
|
+
batchIds: decodedBatchIds,
|
|
240
|
+
...batchTableAttributes
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
exports.loadDraco = loadDraco;
|
|
244
|
+
// TODO - this is the remaining code from Cesium's parser
|
|
245
|
+
/*
|
|
246
|
+
const batchTable = new Tile3DBatchTable(tile);
|
|
247
|
+
|
|
248
|
+
// parseDracoBuffer(tile, featureTable, batchTable);
|
|
83
249
|
|
|
84
250
|
if (!tile.attributes.positions) {
|
|
85
251
|
throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');
|
|
86
252
|
}
|
|
87
253
|
}
|
|
254
|
+
/*
|
|
255
|
+
|
|
256
|
+
if (!tile.attributes.positions) {
|
|
257
|
+
if (featureTable.hasProperty('POSITION')) {
|
|
258
|
+
tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);
|
|
259
|
+
} else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
|
|
260
|
+
tile.attributes.positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);
|
|
88
261
|
|
|
89
|
-
function parseColors(tile, featureTable, batchTable) {
|
|
90
|
-
if (!tile.attributes.colors) {
|
|
91
|
-
let colors = null;
|
|
92
262
|
|
|
263
|
+
if (!tile.colors) {
|
|
93
264
|
if (featureTable.hasProperty('RGBA')) {
|
|
94
|
-
colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);
|
|
265
|
+
tile.colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);
|
|
95
266
|
tile.isTranslucent = true;
|
|
96
267
|
} else if (featureTable.hasProperty('RGB')) {
|
|
97
|
-
colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);
|
|
98
|
-
} else if (featureTable.
|
|
99
|
-
colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);
|
|
268
|
+
tile.colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);
|
|
269
|
+
} else if (featureTable.hasPropertry('RGB565')) {
|
|
270
|
+
tile.colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);
|
|
100
271
|
tile.isRGB565 = true;
|
|
101
272
|
}
|
|
102
|
-
|
|
103
|
-
tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);
|
|
104
273
|
}
|
|
105
274
|
|
|
106
|
-
if (featureTable.hasProperty('CONSTANT_RGBA')) {
|
|
107
|
-
tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function parseNormals(tile, featureTable) {
|
|
112
275
|
if (!tile.attributes.normals) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (featureTable.
|
|
116
|
-
normals = featureTable.getPropertyArray('
|
|
117
|
-
} else if (featureTable.hasProperty('NORMAL_OCT16P')) {
|
|
118
|
-
normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);
|
|
276
|
+
if (featureTable.getPropertry('NORMAL')) {
|
|
277
|
+
tile.attributes.normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);
|
|
278
|
+
} else if (featureTable.getProperty('NORMAL_OCT16P')) {
|
|
279
|
+
tile.attributes.normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);
|
|
119
280
|
tile.isOctEncoded16P = true;
|
|
120
281
|
}
|
|
282
|
+
}
|
|
121
283
|
|
|
122
|
-
|
|
284
|
+
if (!tile.batchIds) {
|
|
285
|
+
if (featureTable.hasProperty('BATCH_ID')) {
|
|
286
|
+
tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);
|
|
287
|
+
}
|
|
123
288
|
}
|
|
124
|
-
}
|
|
125
289
|
|
|
126
|
-
|
|
127
|
-
|
|
290
|
+
if (!tile.attributes.positions) {
|
|
291
|
+
throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');
|
|
292
|
+
}
|
|
128
293
|
|
|
129
|
-
if (
|
|
130
|
-
tile.
|
|
294
|
+
if (featureTable.getPropertry('CONSTANT_RGBA')) {
|
|
295
|
+
tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);
|
|
296
|
+
}
|
|
131
297
|
|
|
132
|
-
|
|
133
|
-
|
|
298
|
+
if (tile.batchIds) {
|
|
299
|
+
const batchLength = featureTable.getGlobalProperty('BATCH_LENGTH');
|
|
300
|
+
if (!defined(batchLength)) {
|
|
301
|
+
throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');
|
|
302
|
+
}
|
|
134
303
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
304
|
+
if (defined(batchTableBinary)) {
|
|
305
|
+
// Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
|
|
306
|
+
batchTableBinary = new Uint8Array(batchTableBinary);
|
|
307
|
+
}
|
|
138
308
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
batchTableBinary
|
|
142
|
-
} = tile;
|
|
143
|
-
batchTable = new Tile3DBatchTable(batchTableJson, batchTableBinary, batchFeatureLength);
|
|
309
|
+
if (defined(pointCloud._batchTableLoaded)) {
|
|
310
|
+
pointCloud._batchTableLoaded(batchLength, batchTableJson, batchTableBinary);
|
|
144
311
|
}
|
|
145
312
|
}
|
|
146
313
|
|
|
147
|
-
|
|
314
|
+
// If points are not batched and there are per-point properties, use these properties for styling purposes
|
|
315
|
+
var styleableProperties;
|
|
316
|
+
if (!hasBatchIds && defined(batchTableBinary)) {
|
|
317
|
+
tile.styleableProperties = Cesium3DTileBatchTable.getBinaryProperties(
|
|
318
|
+
pointsLength,
|
|
319
|
+
batchTableJson,
|
|
320
|
+
batchTableBinary
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
tile.draco = draco;
|
|
148
325
|
}
|
|
149
326
|
|
|
150
|
-
|
|
327
|
+
// Separate parsing and decoding of Draco
|
|
328
|
+
export function parseDracoBuffer(tile, featureTable, batchTable) {
|
|
151
329
|
let dracoBuffer;
|
|
152
330
|
let dracoFeatureTableProperties;
|
|
153
331
|
let dracoBatchTableProperties;
|
|
154
|
-
const batchTableDraco = tile.batchTableJson && tile.batchTableJson.extensions && tile.batchTableJson.extensions['3DTILES_draco_point_compression'];
|
|
155
332
|
|
|
333
|
+
const batchTableDraco = batchTable.getExtension('3DTILES_draco_point_compression');
|
|
156
334
|
if (batchTableDraco) {
|
|
157
335
|
dracoBatchTableProperties = batchTableDraco.properties;
|
|
158
336
|
}
|
|
159
337
|
|
|
160
338
|
const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
|
|
161
|
-
|
|
162
339
|
if (featureTableDraco) {
|
|
163
340
|
dracoFeatureTableProperties = featureTableDraco.properties;
|
|
164
341
|
const dracoByteOffset = featureTableDraco.byteOffset;
|
|
165
342
|
const dracoByteLength = featureTableDraco.byteLength;
|
|
166
|
-
|
|
167
|
-
if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
|
|
343
|
+
if (!dracoFeatureTableProperties || !dracoByteOffset || !dracoByteLength) {
|
|
168
344
|
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
|
|
169
345
|
}
|
|
170
346
|
|
|
171
|
-
dracoBuffer =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
tile.
|
|
347
|
+
dracoBuffer = arraySlice(
|
|
348
|
+
featureTableBinary,
|
|
349
|
+
dracoByteOffset,
|
|
350
|
+
dracoByteOffset + dracoByteLength
|
|
351
|
+
);
|
|
352
|
+
tile.hasPositions = dracoFeatureTableProperties.POSITION;
|
|
353
|
+
tile.hasColors = dracoFeatureTableProperties.RGB || dracoFeatureTableProperties.RGBA;
|
|
354
|
+
tile.hasNormals = dracoFeatureTableProperties.NORMAL;
|
|
355
|
+
tile.hasBatchIds = dracoFeatureTableProperties.BATCH_ID;
|
|
356
|
+
tile.isTranslucent = dracoFeatureTableProperties.RGBA;
|
|
177
357
|
}
|
|
178
358
|
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
featureTableProperties: dracoFeatureTableProperties,
|
|
189
|
-
batchTableProperties: dracoBatchTableProperties,
|
|
190
|
-
dequantizeInShader: false
|
|
191
|
-
};
|
|
192
|
-
return await loadDraco(tile, dracoData, options, context);
|
|
193
|
-
}
|
|
359
|
+
if (dracoBuffer) {
|
|
360
|
+
tile.draco = {
|
|
361
|
+
buffer: dracoBuffer,
|
|
362
|
+
properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},
|
|
363
|
+
featureTableProperties: dracoFeatureTableProperties,
|
|
364
|
+
batchTableProperties: dracoBatchTableProperties,
|
|
365
|
+
dequantizeInShader: false
|
|
366
|
+
};
|
|
194
367
|
|
|
195
|
-
|
|
196
|
-
const {
|
|
197
|
-
parse
|
|
198
|
-
} = context;
|
|
199
|
-
const dracoOptions = { ...options,
|
|
200
|
-
draco: { ...options.draco,
|
|
201
|
-
extraAttributes: dracoData.batchTableProperties || {}
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
delete dracoOptions['3d-tiles'];
|
|
205
|
-
const data = await parse(dracoData.buffer, DracoLoader, dracoOptions);
|
|
206
|
-
const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
|
|
207
|
-
const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
|
|
208
|
-
const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
|
|
209
|
-
const decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
|
|
210
|
-
const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
|
|
211
|
-
const isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
|
|
212
|
-
|
|
213
|
-
if (isQuantizedDraco) {
|
|
214
|
-
const quantization = data.POSITION.data.quantization;
|
|
215
|
-
const range = quantization.range;
|
|
216
|
-
tile.quantizedVolumeScale = new Vector3(range, range, range);
|
|
217
|
-
tile.quantizedVolumeOffset = new Vector3(quantization.minValues);
|
|
218
|
-
tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
|
|
219
|
-
tile.isQuantizedDraco = true;
|
|
368
|
+
tile.decodingState = DECODING_STATE.NEEDS_DECODE;
|
|
220
369
|
}
|
|
370
|
+
}
|
|
221
371
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
372
|
+
/*
|
|
373
|
+
function decodeDraco(tile, context) {
|
|
374
|
+
if (tile.decodingState === DECODING_STATE.READY) {
|
|
375
|
+
return false;
|
|
225
376
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
377
|
+
if (tile.decodingState === DECODING_STATE.NEEDS_DECODE) {
|
|
378
|
+
var parsedContent = tile._parsedContent;
|
|
379
|
+
var draco = parsedContent.draco;
|
|
380
|
+
var decodePromise = DracoLoader.decodePointCloud(draco, context);
|
|
381
|
+
if (defined(decodePromise)) {
|
|
382
|
+
tile.decodingState = DECODING_STATE.DECODING;
|
|
383
|
+
decodePromise.then(function(result) {
|
|
384
|
+
tile.decodingState = DECODING_STATE.READY;
|
|
385
|
+
var decodedPositions = defined(result.POSITION) ? result.POSITION.array : undefined;
|
|
386
|
+
var decodedRgb = defined(result.RGB) ? result.RGB.array : undefined;
|
|
387
|
+
var decodedRgba = defined(result.RGBA) ? result.RGBA.array : undefined;
|
|
388
|
+
var decodedNormals = defined(result.NORMAL) ? result.NORMAL.array : undefined;
|
|
389
|
+
var decodedBatchIds = defined(result.BATCH_ID) ? result.BATCH_ID.array : undefined;
|
|
390
|
+
var isQuantizedDraco = defined(decodedPositions) && defined(result.POSITION.data.quantization);
|
|
391
|
+
var isOctEncodedDraco = defined(decodedNormals) && defined(result.NORMAL.data.quantization);
|
|
392
|
+
if (isQuantizedDraco) {
|
|
393
|
+
// Draco quantization range == quantized volume scale - size in meters of the quantized volume
|
|
394
|
+
// Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc
|
|
395
|
+
var quantization = result.POSITION.data.quantization;
|
|
396
|
+
var range = quantization.range;
|
|
397
|
+
tile._quantizedVolumeScale = Cartesian3.fromElements(range, range, range);
|
|
398
|
+
tile._quantizedVolumeOffset = Cartesian3.unpack(quantization.minValues);
|
|
399
|
+
tile._quantizedRange = (1 << quantization.quantizationBits) - 1.0;
|
|
400
|
+
tile._isQuantizedDraco = true;
|
|
401
|
+
}
|
|
402
|
+
if (isOctEncodedDraco) {
|
|
403
|
+
tile._octEncodedRange = (1 << result.NORMAL.data.quantization.quantizationBits) - 1.0;
|
|
404
|
+
tile._isOctEncodedDraco = true;
|
|
405
|
+
}
|
|
406
|
+
var styleableProperties = parsedContent.styleableProperties;
|
|
407
|
+
var batchTableProperties = draco.batchTableProperties;
|
|
408
|
+
for (var name in batchTableProperties) {
|
|
409
|
+
if (batchTableProperties.hasOwnProperty(name)) {
|
|
410
|
+
var property = result[name];
|
|
411
|
+
if (!defined(styleableProperties)) {
|
|
412
|
+
styleableProperties = {};
|
|
413
|
+
}
|
|
414
|
+
styleableProperties[name] = {
|
|
415
|
+
typedArray : property.array,
|
|
416
|
+
componentCount : property.data.componentsPerAttribute
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
parsedContent.positions = defaultValue(decodedPositions, parsedContent.positions);
|
|
421
|
+
parsedContent.colors = defaultValue(defaultValue(decodedRgba, decodedRgb), parsedContent.colors);
|
|
422
|
+
parsedContent.normals = defaultValue(decodedNormals, parsedContent.normals);
|
|
423
|
+
parsedContent.batchIds = defaultValue(decodedBatchIds, parsedContent.batchIds);
|
|
424
|
+
parsedContent.styleableProperties = styleableProperties;
|
|
425
|
+
}).otherwise(function(error) {
|
|
426
|
+
tile.decodingState = DECODING_STATE.FAILED;
|
|
427
|
+
tile._readyPromise.reject(error);
|
|
428
|
+
});
|
|
234
429
|
}
|
|
235
430
|
}
|
|
236
|
-
|
|
237
|
-
tile.attributes = {
|
|
238
|
-
positions: decodedPositions,
|
|
239
|
-
colors: normalize3DTileColorAttribute(tile, decodedColors),
|
|
240
|
-
normals: decodedNormals,
|
|
241
|
-
batchIds: decodedBatchIds,
|
|
242
|
-
...batchTableAttributes
|
|
243
|
-
};
|
|
431
|
+
return true;
|
|
244
432
|
}
|
|
245
|
-
|
|
433
|
+
*/
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LoaderContext } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { Tiles3DLoaderOptions } from '../../tiles-3d-loader';
|
|
3
|
+
import { Tiles3DTileContent } from '../../types';
|
|
4
|
+
export declare function parse3DTile(arrayBuffer: ArrayBuffer, byteOffset: number | undefined, options: Tiles3DLoaderOptions | undefined, context: LoaderContext | undefined, tile?: Tiles3DTileContent): Promise<number | void>;
|
|
5
|
+
//# sourceMappingURL=parse-3d-tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-3d-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-3d-tile.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAG/C,wBAAsB,WAAW,CAC/B,WAAW,EAAE,WAAW,EACxB,UAAU,oBAAI,EACd,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,IAAI,GAAE,kBAAuB,0BAgC9B"}
|