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