@loaders.gl/3d-tiles 3.1.3 → 4.0.0-alpha.5
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/bundle.js.map +1 -0
- package/dist/cesium-ion-loader.js +32 -36
- package/dist/cesium-ion-loader.js.map +1 -0
- package/dist/dist.min.js +88 -40
- package/dist/index.js +9 -26
- package/dist/index.js.map +1 -0
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +89 -106
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +202 -184
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
- package/dist/lib/classes/tile-3d-batch-table.js +282 -223
- package/dist/lib/classes/tile-3d-batch-table.js.map +1 -0
- package/dist/lib/classes/tile-3d-feature-table.js +86 -64
- package/dist/lib/classes/tile-3d-feature-table.js.map +1 -0
- package/dist/lib/constants.js +19 -23
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-batched-model.js +45 -45
- package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-composite.js +24 -23
- package/dist/lib/encoders/encode-3d-tile-composite.js.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js +37 -37
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js +38 -36
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
- package/dist/lib/encoders/encode-3d-tile.js +32 -30
- package/dist/lib/encoders/encode-3d-tile.js.map +1 -0
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js +29 -28
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
- package/dist/lib/ion/ion.js +69 -60
- package/dist/lib/ion/ion.js.map +1 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +62 -60
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -26
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +28 -39
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +18 -11
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +203 -170
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +63 -82
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js +15 -26
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +57 -68
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +80 -84
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
- package/dist/lib/parsers/helpers/parse-utils.js +16 -29
- package/dist/lib/parsers/helpers/parse-utils.js.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-batched-model.js +26 -30
- package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-composite.js +16 -25
- package/dist/lib/parsers/parse-3d-tile-composite.js.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-gltf.js +9 -17
- package/dist/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +139 -122
- package/dist/lib/parsers/parse-3d-tile-header.js.map +1 -0
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js +170 -179
- package/dist/{es5/lib → lib}/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js +184 -350
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
- package/dist/lib/parsers/parse-3d-tile.js +31 -36
- package/dist/lib/parsers/parse-3d-tile.js.map +1 -0
- package/dist/lib/utils/version.js +2 -7
- package/dist/lib/utils/version.js.map +1 -0
- package/dist/tile-3d-subtree-loader.js +13 -22
- package/dist/tile-3d-subtree-loader.js.map +1 -0
- package/dist/tile-3d-writer.js +17 -24
- package/dist/tile-3d-writer.js.map +1 -0
- package/dist/tiles-3d-loader.js +66 -67
- package/dist/tiles-3d-loader.js.map +1 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/{es5/types.js.map → types.js.map} +0 -0
- package/package.json +10 -10
- package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +95 -31
- package/src/lib/parsers/parse-3d-tile-header.ts +3 -1
- package/src/types.ts +2 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/cesium-ion-loader.js +0 -100
- package/dist/es5/cesium-ion-loader.js.map +0 -1
- package/dist/es5/index.js +0 -72
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +0 -120
- package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
- package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +0 -225
- package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
- package/dist/es5/lib/classes/tile-3d-batch-table.js +0 -349
- package/dist/es5/lib/classes/tile-3d-batch-table.js.map +0 -1
- package/dist/es5/lib/classes/tile-3d-feature-table.js +0 -119
- package/dist/es5/lib/classes/tile-3d-feature-table.js.map +0 -1
- package/dist/es5/lib/constants.js +0 -32
- package/dist/es5/lib/constants.js.map +0 -1
- package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +0 -63
- package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
- package/dist/es5/lib/encoders/encode-3d-tile-composite.js +0 -41
- package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +0 -1
- package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +0 -57
- package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
- package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +0 -59
- package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
- package/dist/es5/lib/encoders/encode-3d-tile.js +0 -48
- package/dist/es5/lib/encoders/encode-3d-tile.js.map +0 -1
- package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +0 -41
- package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
- package/dist/es5/lib/ion/ion.js +0 -219
- package/dist/es5/lib/ion/ion.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -76
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +0 -40
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -40
- package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +0 -270
- package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +0 -123
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +0 -25
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +0 -161
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +0 -98
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
- package/dist/es5/lib/parsers/helpers/parse-utils.js +0 -32
- package/dist/es5/lib/parsers/helpers/parse-utils.js.map +0 -1
- package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +0 -69
- package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js +0 -61
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +0 -1
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +0 -45
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +0 -233
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +0 -1
- package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +0 -220
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +0 -346
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
- package/dist/es5/lib/parsers/parse-3d-tile.js +0 -100
- package/dist/es5/lib/parsers/parse-3d-tile.js.map +0 -1
- package/dist/es5/lib/utils/version.js +0 -9
- package/dist/es5/lib/utils/version.js.map +0 -1
- package/dist/es5/tile-3d-subtree-loader.js +0 -26
- package/dist/es5/tile-3d-subtree-loader.js.map +0 -1
- package/dist/es5/tile-3d-writer.js +0 -32
- package/dist/es5/tile-3d-writer.js.map +0 -1
- package/dist/es5/tiles-3d-loader.js +0 -190
- package/dist/es5/tiles-3d-loader.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/cesium-ion-loader.js +0 -36
- package/dist/esm/cesium-ion-loader.js.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +0 -96
- package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
- package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +0 -215
- package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
- package/dist/esm/lib/classes/tile-3d-batch-table.js +0 -304
- package/dist/esm/lib/classes/tile-3d-batch-table.js.map +0 -1
- package/dist/esm/lib/classes/tile-3d-feature-table.js +0 -94
- package/dist/esm/lib/classes/tile-3d-feature-table.js.map +0 -1
- package/dist/esm/lib/constants.js +0 -22
- package/dist/esm/lib/constants.js.map +0 -1
- package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +0 -46
- package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
- package/dist/esm/lib/encoders/encode-3d-tile-composite.js +0 -25
- package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +0 -1
- package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +0 -38
- package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
- package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +0 -41
- package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
- package/dist/esm/lib/encoders/encode-3d-tile.js +0 -35
- package/dist/esm/lib/encoders/encode-3d-tile.js.map +0 -1
- package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +0 -31
- package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
- package/dist/esm/lib/ion/ion.js +0 -77
- package/dist/esm/lib/ion/ion.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -67
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js +0 -30
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -31
- package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +0 -173
- package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +0 -69
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +0 -17
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +0 -64
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +0 -89
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
- package/dist/esm/lib/parsers/helpers/parse-utils.js +0 -19
- package/dist/esm/lib/parsers/helpers/parse-utils.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +0 -29
- package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js +0 -17
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +0 -10
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +0 -144
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +0 -177
- package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +0 -245
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
- package/dist/esm/lib/parsers/parse-3d-tile.js +0 -32
- package/dist/esm/lib/parsers/parse-3d-tile.js.map +0 -1
- package/dist/esm/lib/utils/version.js +0 -2
- package/dist/esm/lib/utils/version.js.map +0 -1
- package/dist/esm/tile-3d-subtree-loader.js +0 -14
- package/dist/esm/tile-3d-subtree-loader.js.map +0 -1
- package/dist/esm/tile-3d-writer.js +0 -20
- package/dist/esm/tile-3d-writer.js.map +0 -1
- package/dist/esm/tiles-3d-loader.js +0 -79
- package/dist/esm/tiles-3d-loader.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
|
@@ -1,411 +1,245 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|
|
1
|
+
import { DracoLoader } from '@loaders.gl/draco';
|
|
2
|
+
import { GL } from '@loaders.gl/math';
|
|
3
|
+
import { Vector3 } from '@math.gl/core';
|
|
4
|
+
import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
|
|
5
|
+
import Tile3DBatchTable from '../classes/tile-3d-batch-table';
|
|
6
|
+
import { parse3DTileHeaderSync } from './helpers/parse-3d-tile-header';
|
|
7
|
+
import { parse3DTileTablesHeaderSync, parse3DTileTablesSync } from './helpers/parse-3d-tile-tables';
|
|
8
|
+
import { normalize3DTileColorAttribute } from './helpers/normalize-3d-tile-colors';
|
|
9
|
+
import { normalize3DTileNormalAttribute } from './helpers/normalize-3d-tile-normals';
|
|
10
|
+
import { normalize3DTilePositionAttribute } from './helpers/normalize-3d-tile-positions';
|
|
11
|
+
export async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
12
|
+
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
|
|
13
|
+
byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);
|
|
14
|
+
byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);
|
|
15
|
+
initializeTile(tile);
|
|
16
|
+
const {
|
|
17
|
+
featureTable,
|
|
18
|
+
batchTable
|
|
19
|
+
} = parsePointCloudTables(tile);
|
|
20
|
+
await parseDraco(tile, featureTable, batchTable, options, context);
|
|
21
|
+
parsePositions(tile, featureTable, options);
|
|
22
|
+
parseColors(tile, featureTable, batchTable);
|
|
23
|
+
parseNormals(tile, featureTable);
|
|
24
|
+
return byteOffset;
|
|
30
25
|
}
|
|
31
|
-
|
|
26
|
+
|
|
32
27
|
function initializeTile(tile) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
tile.isOctEncoded16P = false;
|
|
44
|
-
}
|
|
45
|
-
function parsePointCloudTables(tile) {
|
|
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
|
-
}
|
|
59
|
-
function parsePositions(tile, featureTable, 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
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (!tile.attributes.positions) {
|
|
80
|
-
throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');
|
|
81
|
-
}
|
|
28
|
+
tile.attributes = {
|
|
29
|
+
positions: null,
|
|
30
|
+
colors: null,
|
|
31
|
+
normals: null,
|
|
32
|
+
batchIds: null
|
|
33
|
+
};
|
|
34
|
+
tile.isQuantized = false;
|
|
35
|
+
tile.isTranslucent = false;
|
|
36
|
+
tile.isRGB565 = false;
|
|
37
|
+
tile.isOctEncoded16P = false;
|
|
82
38
|
}
|
|
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
39
|
|
|
226
|
-
|
|
40
|
+
function parsePointCloudTables(tile) {
|
|
41
|
+
const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);
|
|
42
|
+
const pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');
|
|
227
43
|
|
|
228
|
-
if (!
|
|
229
|
-
throw new Error('
|
|
44
|
+
if (!Number.isFinite(pointsLength)) {
|
|
45
|
+
throw new Error('POINTS_LENGTH must be defined');
|
|
230
46
|
}
|
|
47
|
+
|
|
48
|
+
featureTable.featuresLength = pointsLength;
|
|
49
|
+
tile.featuresLength = pointsLength;
|
|
50
|
+
tile.pointsLength = pointsLength;
|
|
51
|
+
tile.pointCount = pointsLength;
|
|
52
|
+
tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);
|
|
53
|
+
const batchTable = parseBatchIds(tile, featureTable);
|
|
54
|
+
return {
|
|
55
|
+
featureTable,
|
|
56
|
+
batchTable
|
|
57
|
+
};
|
|
231
58
|
}
|
|
232
|
-
/*
|
|
233
59
|
|
|
60
|
+
function parsePositions(tile, featureTable, options) {
|
|
234
61
|
if (!tile.attributes.positions) {
|
|
235
62
|
if (featureTable.hasProperty('POSITION')) {
|
|
236
63
|
tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);
|
|
237
64
|
} else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
|
|
238
|
-
|
|
65
|
+
const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);
|
|
66
|
+
tile.isQuantized = true;
|
|
67
|
+
tile.quantizedRange = (1 << 16) - 1;
|
|
68
|
+
tile.quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', GL.FLOAT, 3);
|
|
69
|
+
|
|
70
|
+
if (!tile.quantizedVolumeScale) {
|
|
71
|
+
throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
tile.quantizedVolumeOffset = featureTable.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', GL.FLOAT, 3);
|
|
75
|
+
|
|
76
|
+
if (!tile.quantizedVolumeOffset) {
|
|
77
|
+
throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
tile.attributes.positions = normalize3DTilePositionAttribute(tile, positions, options);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!tile.attributes.positions) {
|
|
85
|
+
throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
239
88
|
|
|
89
|
+
function parseColors(tile, featureTable, batchTable) {
|
|
90
|
+
if (!tile.attributes.colors) {
|
|
91
|
+
let colors = null;
|
|
240
92
|
|
|
241
|
-
if (!tile.colors) {
|
|
242
93
|
if (featureTable.hasProperty('RGBA')) {
|
|
243
|
-
|
|
94
|
+
colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);
|
|
244
95
|
tile.isTranslucent = true;
|
|
245
96
|
} else if (featureTable.hasProperty('RGB')) {
|
|
246
|
-
|
|
247
|
-
} else if (featureTable.
|
|
248
|
-
|
|
97
|
+
colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);
|
|
98
|
+
} else if (featureTable.hasProperty('RGB565')) {
|
|
99
|
+
colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);
|
|
249
100
|
tile.isRGB565 = true;
|
|
250
101
|
}
|
|
102
|
+
|
|
103
|
+
tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);
|
|
251
104
|
}
|
|
252
105
|
|
|
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) {
|
|
253
112
|
if (!tile.attributes.normals) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
113
|
+
let normals = null;
|
|
114
|
+
|
|
115
|
+
if (featureTable.hasProperty('NORMAL')) {
|
|
116
|
+
normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);
|
|
117
|
+
} else if (featureTable.hasProperty('NORMAL_OCT16P')) {
|
|
118
|
+
normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);
|
|
258
119
|
tile.isOctEncoded16P = true;
|
|
259
120
|
}
|
|
260
|
-
}
|
|
261
121
|
|
|
262
|
-
|
|
263
|
-
if (featureTable.hasProperty('BATCH_ID')) {
|
|
264
|
-
tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);
|
|
265
|
-
}
|
|
122
|
+
tile.attributes.normals = normalize3DTileNormalAttribute(tile, normals);
|
|
266
123
|
}
|
|
124
|
+
}
|
|
267
125
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
126
|
+
function parseBatchIds(tile, featureTable) {
|
|
127
|
+
let batchTable = null;
|
|
271
128
|
|
|
272
|
-
if (featureTable.
|
|
273
|
-
tile.
|
|
274
|
-
}
|
|
129
|
+
if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {
|
|
130
|
+
tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);
|
|
275
131
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (!defined(batchLength)) {
|
|
279
|
-
throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');
|
|
280
|
-
}
|
|
132
|
+
if (tile.batchIds) {
|
|
133
|
+
const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');
|
|
281
134
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
135
|
+
if (!batchFeatureLength) {
|
|
136
|
+
throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');
|
|
137
|
+
}
|
|
286
138
|
|
|
287
|
-
|
|
288
|
-
|
|
139
|
+
const {
|
|
140
|
+
batchTableJson,
|
|
141
|
+
batchTableBinary
|
|
142
|
+
} = tile;
|
|
143
|
+
batchTable = new Tile3DBatchTable(batchTableJson, batchTableBinary, batchFeatureLength);
|
|
289
144
|
}
|
|
290
145
|
}
|
|
291
146
|
|
|
292
|
-
|
|
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;
|
|
147
|
+
return batchTable;
|
|
303
148
|
}
|
|
304
149
|
|
|
305
|
-
|
|
306
|
-
export function parseDracoBuffer(tile, featureTable, batchTable) {
|
|
150
|
+
async function parseDraco(tile, featureTable, batchTable, options, context) {
|
|
307
151
|
let dracoBuffer;
|
|
308
152
|
let dracoFeatureTableProperties;
|
|
309
153
|
let dracoBatchTableProperties;
|
|
154
|
+
const batchTableDraco = tile.batchTableJson && tile.batchTableJson.extensions && tile.batchTableJson.extensions['3DTILES_draco_point_compression'];
|
|
310
155
|
|
|
311
|
-
const batchTableDraco = batchTable.getExtension('3DTILES_draco_point_compression');
|
|
312
156
|
if (batchTableDraco) {
|
|
313
157
|
dracoBatchTableProperties = batchTableDraco.properties;
|
|
314
158
|
}
|
|
315
159
|
|
|
316
160
|
const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
|
|
161
|
+
|
|
317
162
|
if (featureTableDraco) {
|
|
318
163
|
dracoFeatureTableProperties = featureTableDraco.properties;
|
|
319
164
|
const dracoByteOffset = featureTableDraco.byteOffset;
|
|
320
165
|
const dracoByteLength = featureTableDraco.byteLength;
|
|
321
|
-
|
|
166
|
+
|
|
167
|
+
if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
|
|
322
168
|
throw new Error('Draco properties, byteOffset, and byteLength must be defined');
|
|
323
169
|
}
|
|
324
170
|
|
|
325
|
-
dracoBuffer =
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
);
|
|
330
|
-
tile.
|
|
331
|
-
tile.hasColors = dracoFeatureTableProperties.RGB || dracoFeatureTableProperties.RGBA;
|
|
332
|
-
tile.hasNormals = dracoFeatureTableProperties.NORMAL;
|
|
333
|
-
tile.hasBatchIds = dracoFeatureTableProperties.BATCH_ID;
|
|
334
|
-
tile.isTranslucent = dracoFeatureTableProperties.RGBA;
|
|
171
|
+
dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
|
|
172
|
+
tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
|
|
173
|
+
tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || 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);
|
|
335
177
|
}
|
|
336
178
|
|
|
337
|
-
if (dracoBuffer) {
|
|
338
|
-
|
|
339
|
-
buffer: dracoBuffer,
|
|
340
|
-
properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},
|
|
341
|
-
featureTableProperties: dracoFeatureTableProperties,
|
|
342
|
-
batchTableProperties: dracoBatchTableProperties,
|
|
343
|
-
dequantizeInShader: false
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
tile.decodingState = DECODING_STATE.NEEDS_DECODE;
|
|
179
|
+
if (!dracoBuffer) {
|
|
180
|
+
return true;
|
|
347
181
|
}
|
|
182
|
+
|
|
183
|
+
const dracoData = {
|
|
184
|
+
buffer: dracoBuffer,
|
|
185
|
+
properties: { ...dracoFeatureTableProperties,
|
|
186
|
+
...dracoBatchTableProperties
|
|
187
|
+
},
|
|
188
|
+
featureTableProperties: dracoFeatureTableProperties,
|
|
189
|
+
batchTableProperties: dracoBatchTableProperties,
|
|
190
|
+
dequantizeInShader: false
|
|
191
|
+
};
|
|
192
|
+
return await loadDraco(tile, dracoData, options, context);
|
|
348
193
|
}
|
|
349
194
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
195
|
+
export async function loadDraco(tile, dracoData, options, context) {
|
|
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;
|
|
354
220
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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
|
-
});
|
|
221
|
+
|
|
222
|
+
if (isOctEncodedDraco) {
|
|
223
|
+
tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
|
|
224
|
+
tile.isOctEncodedDraco = true;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const batchTableAttributes = {};
|
|
228
|
+
|
|
229
|
+
if (dracoData.batchTableProperties) {
|
|
230
|
+
for (const attributeName of Object.keys(dracoData.batchTableProperties)) {
|
|
231
|
+
if (data.attributes[attributeName] && data.attributes[attributeName].value) {
|
|
232
|
+
batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;
|
|
233
|
+
}
|
|
407
234
|
}
|
|
408
235
|
}
|
|
409
|
-
|
|
236
|
+
|
|
237
|
+
tile.attributes = {
|
|
238
|
+
positions: decodedPositions,
|
|
239
|
+
colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),
|
|
240
|
+
normals: decodedNormals,
|
|
241
|
+
batchIds: decodedBatchIds,
|
|
242
|
+
...batchTableAttributes
|
|
243
|
+
};
|
|
410
244
|
}
|
|
411
|
-
|
|
245
|
+
//# sourceMappingURL=parse-3d-tile-point-cloud.js.map
|