@loaders.gl/3d-tiles 3.4.14 → 3.4.15

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.
Files changed (89) hide show
  1. package/dist/dist.min.js +65 -64
  2. package/dist/es5/bundle.js +1 -1
  3. package/dist/es5/bundle.js.map +1 -1
  4. package/dist/es5/cesium-ion-loader.js +27 -61
  5. package/dist/es5/cesium-ion-loader.js.map +1 -1
  6. package/dist/es5/index.js +8 -8
  7. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +30 -42
  8. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  9. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +57 -59
  10. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  11. package/dist/es5/lib/classes/tile-3d-batch-table.js +177 -223
  12. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -1
  13. package/dist/es5/lib/classes/tile-3d-feature-table.js +52 -71
  14. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -1
  15. package/dist/es5/lib/constants.js +4 -4
  16. package/dist/es5/lib/constants.js.map +1 -1
  17. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +15 -18
  18. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -1
  19. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +6 -9
  20. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -1
  21. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +14 -19
  22. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -1
  23. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +15 -18
  24. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -1
  25. package/dist/es5/lib/encoders/encode-3d-tile.js +3 -3
  26. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -1
  27. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +6 -6
  28. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -1
  29. package/dist/es5/lib/ion/ion.js +63 -155
  30. package/dist/es5/lib/ion/ion.js.map +1 -1
  31. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +17 -17
  32. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  33. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +3 -3
  34. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  35. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +3 -3
  36. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  37. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +166 -198
  38. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  39. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +25 -53
  40. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  41. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +3 -3
  42. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -1
  43. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +57 -129
  44. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  45. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +19 -17
  46. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -1
  47. package/dist/es5/lib/parsers/helpers/parse-utils.js +7 -7
  48. package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -1
  49. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +10 -29
  50. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  51. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +12 -39
  52. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  53. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +8 -27
  54. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  55. package/dist/es5/lib/parsers/parse-3d-tile-header.js +99 -197
  56. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
  57. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +37 -55
  58. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  59. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +110 -162
  60. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  61. package/dist/es5/lib/parsers/parse-3d-tile.js +21 -59
  62. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -1
  63. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +10 -12
  64. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -1
  65. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +22 -20
  66. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -1
  67. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +9 -9
  68. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -1
  69. package/dist/es5/lib/utils/s2/converters/s2-to-region.js +14 -18
  70. package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -1
  71. package/dist/es5/lib/utils/s2/index.js +13 -13
  72. package/dist/es5/lib/utils/s2/s2-geometry-functions.js +2 -2
  73. package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -1
  74. package/dist/es5/lib/utils/s2/s2-token-functions.js +10 -10
  75. package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -1
  76. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +3 -3
  77. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -1
  78. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +48 -54
  79. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -1
  80. package/dist/es5/lib/utils/version.js +1 -1
  81. package/dist/es5/lib/utils/version.js.map +1 -1
  82. package/dist/es5/tile-3d-subtree-loader.js +1 -1
  83. package/dist/es5/tile-3d-subtree-loader.js.map +1 -1
  84. package/dist/es5/tile-3d-writer.js +5 -4
  85. package/dist/es5/tile-3d-writer.js.map +1 -1
  86. package/dist/es5/tiles-3d-loader.js +37 -100
  87. package/dist/es5/tiles-3d-loader.js.map +1 -1
  88. package/dist/esm/lib/utils/version.js +1 -1
  89. package/package.json +7 -7
@@ -6,9 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.loadDraco = loadDraco;
8
8
  exports.parsePointCloud3DTile = parsePointCloud3DTile;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
9
  var _draco = require("@loaders.gl/draco");
13
10
  var _math = require("@loaders.gl/math");
14
11
  var _core = require("@math.gl/core");
@@ -19,36 +16,20 @@ var _parse3dTileTables = require("./helpers/parse-3d-tile-tables");
19
16
  var _normalize3dTileColors = require("./helpers/normalize-3d-tile-colors");
20
17
  var _normalize3dTileNormals = require("./helpers/normalize-3d-tile-normals");
21
18
  var _normalize3dTilePositions = require("./helpers/normalize-3d-tile-positions");
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
- function parsePointCloud3DTile(_x, _x2, _x3, _x4, _x5) {
25
- return _parsePointCloud3DTile.apply(this, arguments);
26
- }
27
- function _parsePointCloud3DTile() {
28
- _parsePointCloud3DTile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
29
- var _parsePointCloudTable, featureTable, batchTable;
30
- return _regenerator.default.wrap(function _callee$(_context) {
31
- while (1) switch (_context.prev = _context.next) {
32
- case 0:
33
- byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
34
- byteOffset = (0, _parse3dTileTables.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset);
35
- byteOffset = (0, _parse3dTileTables.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
36
- initializeTile(tile);
37
- _parsePointCloudTable = parsePointCloudTables(tile), featureTable = _parsePointCloudTable.featureTable, batchTable = _parsePointCloudTable.batchTable;
38
- _context.next = 7;
39
- return parseDraco(tile, featureTable, batchTable, options, context);
40
- case 7:
41
- parsePositions(tile, featureTable, options);
42
- parseColors(tile, featureTable, batchTable);
43
- parseNormals(tile, featureTable);
44
- return _context.abrupt("return", byteOffset);
45
- case 11:
46
- case "end":
47
- return _context.stop();
48
- }
49
- }, _callee);
50
- }));
51
- return _parsePointCloud3DTile.apply(this, arguments);
19
+ async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
20
+ byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
21
+ byteOffset = (0, _parse3dTileTables.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset);
22
+ byteOffset = (0, _parse3dTileTables.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
23
+ initializeTile(tile);
24
+ const {
25
+ featureTable,
26
+ batchTable
27
+ } = parsePointCloudTables(tile);
28
+ await parseDraco(tile, featureTable, batchTable, options, context);
29
+ parsePositions(tile, featureTable, options);
30
+ parseColors(tile, featureTable, batchTable);
31
+ parseNormals(tile, featureTable);
32
+ return byteOffset;
52
33
  }
53
34
  function initializeTile(tile) {
54
35
  tile.attributes = {
@@ -63,8 +44,8 @@ function initializeTile(tile) {
63
44
  tile.isOctEncoded16P = false;
64
45
  }
65
46
  function parsePointCloudTables(tile) {
66
- var featureTable = new _tile3dFeatureTable.default(tile.featureTableJson, tile.featureTableBinary);
67
- var pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');
47
+ const featureTable = new _tile3dFeatureTable.default(tile.featureTableJson, tile.featureTableBinary);
48
+ const pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');
68
49
  if (!Number.isFinite(pointsLength)) {
69
50
  throw new Error('POINTS_LENGTH must be defined');
70
51
  }
@@ -73,10 +54,10 @@ function parsePointCloudTables(tile) {
73
54
  tile.pointsLength = pointsLength;
74
55
  tile.pointCount = pointsLength;
75
56
  tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', _math.GL.FLOAT, 3);
76
- var batchTable = parseBatchIds(tile, featureTable);
57
+ const batchTable = parseBatchIds(tile, featureTable);
77
58
  return {
78
- featureTable: featureTable,
79
- batchTable: batchTable
59
+ featureTable,
60
+ batchTable
80
61
  };
81
62
  }
82
63
  function parsePositions(tile, featureTable, options) {
@@ -84,7 +65,7 @@ function parsePositions(tile, featureTable, options) {
84
65
  if (featureTable.hasProperty('POSITION')) {
85
66
  tile.attributes.positions = featureTable.getPropertyArray('POSITION', _math.GL.FLOAT, 3);
86
67
  } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
87
- var positions = featureTable.getPropertyArray('POSITION_QUANTIZED', _math.GL.UNSIGNED_SHORT, 3);
68
+ const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', _math.GL.UNSIGNED_SHORT, 3);
88
69
  tile.isQuantized = true;
89
70
  tile.quantizedRange = (1 << 16) - 1;
90
71
  tile.quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', _math.GL.FLOAT, 3);
@@ -104,7 +85,7 @@ function parsePositions(tile, featureTable, options) {
104
85
  }
105
86
  function parseColors(tile, featureTable, batchTable) {
106
87
  if (!tile.attributes.colors) {
107
- var colors = null;
88
+ let colors = null;
108
89
  if (featureTable.hasProperty('RGBA')) {
109
90
  colors = featureTable.getPropertyArray('RGBA', _math.GL.UNSIGNED_BYTE, 4);
110
91
  tile.isTranslucent = true;
@@ -122,7 +103,7 @@ function parseColors(tile, featureTable, batchTable) {
122
103
  }
123
104
  function parseNormals(tile, featureTable) {
124
105
  if (!tile.attributes.normals) {
125
- var normals = null;
106
+ let normals = null;
126
107
  if (featureTable.hasProperty('NORMAL')) {
127
108
  normals = featureTable.getPropertyArray('NORMAL', _math.GL.FLOAT, 3);
128
109
  } else if (featureTable.hasProperty('NORMAL_OCT16P')) {
@@ -133,139 +114,106 @@ function parseNormals(tile, featureTable) {
133
114
  }
134
115
  }
135
116
  function parseBatchIds(tile, featureTable) {
136
- var batchTable = null;
117
+ let batchTable = null;
137
118
  if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {
138
119
  tile.batchIds = featureTable.getPropertyArray('BATCH_ID', _math.GL.UNSIGNED_SHORT, 1);
139
120
  if (tile.batchIds) {
140
- var batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');
121
+ const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');
141
122
  if (!batchFeatureLength) {
142
123
  throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');
143
124
  }
144
- var batchTableJson = tile.batchTableJson,
145
- batchTableBinary = tile.batchTableBinary;
125
+ const {
126
+ batchTableJson,
127
+ batchTableBinary
128
+ } = tile;
146
129
  batchTable = new _tile3dBatchTable.default(batchTableJson, batchTableBinary, batchFeatureLength);
147
130
  }
148
131
  }
149
132
  return batchTable;
150
133
  }
151
- function parseDraco(_x6, _x7, _x8, _x9, _x10) {
152
- return _parseDraco.apply(this, arguments);
153
- }
154
- function _parseDraco() {
155
- _parseDraco = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(tile, featureTable, batchTable, options, context) {
156
- var dracoBuffer, dracoFeatureTableProperties, dracoBatchTableProperties, batchTableDraco, featureTableDraco, dracoByteOffset, dracoByteLength, dracoData;
157
- return _regenerator.default.wrap(function _callee2$(_context2) {
158
- while (1) switch (_context2.prev = _context2.next) {
159
- case 0:
160
- batchTableDraco = tile.batchTableJson && tile.batchTableJson.extensions && tile.batchTableJson.extensions['3DTILES_draco_point_compression'];
161
- if (batchTableDraco) {
162
- dracoBatchTableProperties = batchTableDraco.properties;
163
- }
164
- featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
165
- if (!featureTableDraco) {
166
- _context2.next = 15;
167
- break;
168
- }
169
- dracoFeatureTableProperties = featureTableDraco.properties;
170
- dracoByteOffset = featureTableDraco.byteOffset;
171
- dracoByteLength = featureTableDraco.byteLength;
172
- if (!(!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength)) {
173
- _context2.next = 9;
174
- break;
175
- }
176
- throw new Error('Draco properties, byteOffset, and byteLength must be defined');
177
- case 9:
178
- dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
179
- tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
180
- tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
181
- tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
182
- tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
183
- tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
184
- case 15:
185
- if (dracoBuffer) {
186
- _context2.next = 17;
187
- break;
188
- }
189
- return _context2.abrupt("return", true);
190
- case 17:
191
- dracoData = {
192
- buffer: dracoBuffer,
193
- properties: _objectSpread(_objectSpread({}, dracoFeatureTableProperties), dracoBatchTableProperties),
194
- featureTableProperties: dracoFeatureTableProperties,
195
- batchTableProperties: dracoBatchTableProperties,
196
- dequantizeInShader: false
197
- };
198
- _context2.next = 20;
199
- return loadDraco(tile, dracoData, options, context);
200
- case 20:
201
- return _context2.abrupt("return", _context2.sent);
202
- case 21:
203
- case "end":
204
- return _context2.stop();
205
- }
206
- }, _callee2);
207
- }));
208
- return _parseDraco.apply(this, arguments);
209
- }
210
- function loadDraco(_x11, _x12, _x13, _x14) {
211
- return _loadDraco.apply(this, arguments);
134
+ async function parseDraco(tile, featureTable, batchTable, options, context) {
135
+ let dracoBuffer;
136
+ let dracoFeatureTableProperties;
137
+ let dracoBatchTableProperties;
138
+ const batchTableDraco = tile.batchTableJson && tile.batchTableJson.extensions && 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 = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
153
+ tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
154
+ tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
155
+ tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
156
+ }
157
+ if (!dracoBuffer) {
158
+ return true;
159
+ }
160
+ const dracoData = {
161
+ buffer: dracoBuffer,
162
+ properties: {
163
+ ...dracoFeatureTableProperties,
164
+ ...dracoBatchTableProperties
165
+ },
166
+ featureTableProperties: dracoFeatureTableProperties,
167
+ batchTableProperties: dracoBatchTableProperties,
168
+ dequantizeInShader: false
169
+ };
170
+ return await loadDraco(tile, dracoData, options, context);
212
171
  }
213
- function _loadDraco() {
214
- _loadDraco = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(tile, dracoData, options, context) {
215
- var parse, dracoOptions, data, decodedPositions, decodedColors, decodedNormals, decodedBatchIds, isQuantizedDraco, isOctEncodedDraco, quantization, range, batchTableAttributes, _i, _Object$keys, attributeName;
216
- return _regenerator.default.wrap(function _callee3$(_context3) {
217
- while (1) switch (_context3.prev = _context3.next) {
218
- case 0:
219
- parse = context.parse;
220
- dracoOptions = _objectSpread(_objectSpread({}, options), {}, {
221
- draco: _objectSpread(_objectSpread({}, options.draco), {}, {
222
- extraAttributes: dracoData.batchTableProperties || {}
223
- })
224
- });
225
- delete dracoOptions['3d-tiles'];
226
- _context3.next = 5;
227
- return parse(dracoData.buffer, _draco.DracoLoader, dracoOptions);
228
- case 5:
229
- data = _context3.sent;
230
- decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
231
- decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
232
- decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
233
- decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
234
- isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
235
- isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
236
- if (isQuantizedDraco) {
237
- quantization = data.POSITION.data.quantization;
238
- range = quantization.range;
239
- tile.quantizedVolumeScale = new _core.Vector3(range, range, range);
240
- tile.quantizedVolumeOffset = new _core.Vector3(quantization.minValues);
241
- tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
242
- tile.isQuantizedDraco = true;
243
- }
244
- if (isOctEncodedDraco) {
245
- tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
246
- tile.isOctEncodedDraco = true;
247
- }
248
- batchTableAttributes = {};
249
- if (dracoData.batchTableProperties) {
250
- for (_i = 0, _Object$keys = Object.keys(dracoData.batchTableProperties); _i < _Object$keys.length; _i++) {
251
- attributeName = _Object$keys[_i];
252
- if (data.attributes[attributeName] && data.attributes[attributeName].value) {
253
- batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;
254
- }
255
- }
256
- }
257
- tile.attributes = _objectSpread({
258
- positions: decodedPositions,
259
- colors: (0, _normalize3dTileColors.normalize3DTileColorAttribute)(tile, decodedColors, undefined),
260
- normals: decodedNormals,
261
- batchIds: decodedBatchIds
262
- }, batchTableAttributes);
263
- case 17:
264
- case "end":
265
- return _context3.stop();
172
+ async function loadDraco(tile, dracoData, options, context) {
173
+ const {
174
+ parse
175
+ } = context;
176
+ const dracoOptions = {
177
+ ...options,
178
+ draco: {
179
+ ...options.draco,
180
+ extraAttributes: dracoData.batchTableProperties || {}
181
+ }
182
+ };
183
+ delete dracoOptions['3d-tiles'];
184
+ const data = await parse(dracoData.buffer, _draco.DracoLoader, dracoOptions);
185
+ const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
186
+ const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
187
+ const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
188
+ const decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
189
+ const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
190
+ const isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
191
+ if (isQuantizedDraco) {
192
+ const quantization = data.POSITION.data.quantization;
193
+ const range = quantization.range;
194
+ tile.quantizedVolumeScale = new _core.Vector3(range, range, range);
195
+ tile.quantizedVolumeOffset = new _core.Vector3(quantization.minValues);
196
+ tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
197
+ tile.isQuantizedDraco = true;
198
+ }
199
+ if (isOctEncodedDraco) {
200
+ tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
201
+ tile.isOctEncodedDraco = true;
202
+ }
203
+ const batchTableAttributes = {};
204
+ if (dracoData.batchTableProperties) {
205
+ for (const attributeName of Object.keys(dracoData.batchTableProperties)) {
206
+ if (data.attributes[attributeName] && data.attributes[attributeName].value) {
207
+ batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;
266
208
  }
267
- }, _callee3);
268
- }));
269
- return _loadDraco.apply(this, arguments);
209
+ }
210
+ }
211
+ tile.attributes = {
212
+ positions: decodedPositions,
213
+ colors: (0, _normalize3dTileColors.normalize3DTileColorAttribute)(tile, decodedColors, undefined),
214
+ normals: decodedNormals,
215
+ batchIds: decodedBatchIds,
216
+ ...batchTableAttributes
217
+ };
270
218
  }
271
219
  //# sourceMappingURL=parse-3d-tile-point-cloud.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-point-cloud.js","names":["_draco","require","_math","_core","_tile3dFeatureTable","_interopRequireDefault","_tile3dBatchTable","_parse3dTileHeader","_parse3dTileTables","_normalize3dTileColors","_normalize3dTileNormals","_normalize3dTilePositions","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","parsePointCloud3DTile","_x","_x2","_x3","_x4","_x5","_parsePointCloud3DTile","_asyncToGenerator2","_regenerator","mark","_callee","tile","arrayBuffer","byteOffset","options","context","_parsePointCloudTable","featureTable","batchTable","wrap","_callee$","_context","prev","next","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","initializeTile","parsePointCloudTables","parseDraco","parsePositions","parseColors","parseNormals","abrupt","stop","attributes","positions","colors","normals","batchIds","isQuantized","isTranslucent","isRGB565","isOctEncoded16P","Tile3DFeatureTable","featureTableJson","featureTableBinary","pointsLength","getGlobalProperty","Number","isFinite","Error","featuresLength","pointCount","rtcCenter","GL","FLOAT","parseBatchIds","hasProperty","getPropertyArray","UNSIGNED_SHORT","quantizedRange","quantizedVolumeScale","quantizedVolumeOffset","normalize3DTilePositionAttribute","UNSIGNED_BYTE","normalize3DTileColorAttribute","constantRGBA","normalize3DTileNormalAttribute","batchFeatureLength","batchTableJson","batchTableBinary","Tile3DBatchTable","_x6","_x7","_x8","_x9","_x10","_parseDraco","_callee2","dracoBuffer","dracoFeatureTableProperties","dracoBatchTableProperties","batchTableDraco","featureTableDraco","dracoByteOffset","dracoByteLength","dracoData","_callee2$","_context2","extensions","properties","getExtension","byteLength","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","sent","_x11","_x12","_x13","_x14","_loadDraco","_callee3","parse","dracoOptions","data","decodedPositions","decodedColors","decodedNormals","decodedBatchIds","isQuantizedDraco","isOctEncodedDraco","quantization","range","batchTableAttributes","_i","_Object$keys","attributeName","_callee3$","_context3","draco","extraAttributes","DracoLoader","value","COLOR_0","Vector3","minValues","quantizationBits","octEncodedRange","toLowerCase","undefined"],"sources":["../../../../src/lib/parsers/parse-3d-tile-point-cloud.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {DracoLoader} from '@loaders.gl/draco';\nimport {GL} from '@loaders.gl/math';\nimport {Vector3} from '@math.gl/core';\n\nimport Tile3DFeatureTable from '../classes/tile-3d-feature-table';\nimport Tile3DBatchTable from '../classes/tile-3d-batch-table';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';\nimport {normalize3DTileColorAttribute} from './helpers/normalize-3d-tile-colors';\nimport {normalize3DTileNormalAttribute} from './helpers/normalize-3d-tile-normals';\nimport {normalize3DTilePositionAttribute} from './helpers/normalize-3d-tile-positions';\n\nexport async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n initializeTile(tile);\n\n const {featureTable, batchTable} = parsePointCloudTables(tile);\n\n await parseDraco(tile, featureTable, batchTable, options, context);\n\n parsePositions(tile, featureTable, options);\n parseColors(tile, featureTable, batchTable);\n parseNormals(tile, featureTable);\n\n return byteOffset;\n}\n\nfunction initializeTile(tile) {\n // Initialize point cloud tile defaults\n tile.attributes = {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n };\n tile.isQuantized = false;\n tile.isTranslucent = false;\n tile.isRGB565 = false;\n tile.isOctEncoded16P = false;\n}\n\nfunction parsePointCloudTables(tile) {\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n\n const pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');\n if (!Number.isFinite(pointsLength)) {\n throw new Error('POINTS_LENGTH must be defined');\n }\n featureTable.featuresLength = pointsLength;\n\n tile.featuresLength = pointsLength;\n tile.pointsLength = pointsLength;\n tile.pointCount = pointsLength;\n\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n\n const batchTable = parseBatchIds(tile, featureTable);\n\n return {featureTable, batchTable};\n}\n\nfunction parsePositions(tile, featureTable, options) {\n if (!tile.attributes.positions) {\n if (featureTable.hasProperty('POSITION')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n tile.isQuantized = true;\n tile.quantizedRange = (1 << 16) - 1;\n\n tile.quantizedVolumeScale = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_SCALE',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeScale) {\n throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');\n }\n\n tile.quantizedVolumeOffset = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_OFFSET',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeOffset) {\n throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');\n }\n\n tile.attributes.positions = normalize3DTilePositionAttribute(tile, positions, options);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n\nfunction parseColors(tile, featureTable, batchTable) {\n if (!tile.attributes.colors) {\n let colors = null;\n if (featureTable.hasProperty('RGBA')) {\n colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);\n tile.isTranslucent = true;\n } else if (featureTable.hasProperty('RGB')) {\n colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasProperty('RGB565')) {\n colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n\n tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);\n }\n\n if (featureTable.hasProperty('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n}\n\nfunction parseNormals(tile, featureTable) {\n if (!tile.attributes.normals) {\n let normals = null;\n if (featureTable.hasProperty('NORMAL')) {\n normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('NORMAL_OCT16P')) {\n normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n\n tile.attributes.normals = normalize3DTileNormalAttribute(tile, normals);\n }\n}\n\nfunction parseBatchIds(tile, featureTable) {\n let batchTable: Tile3DBatchTable | null = null;\n if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n\n if (tile.batchIds) {\n const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n if (!batchFeatureLength) {\n throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');\n }\n const {batchTableJson, batchTableBinary} = tile;\n batchTable = new Tile3DBatchTable(batchTableJson, batchTableBinary, batchFeatureLength);\n }\n }\n return batchTable;\n}\n\n// eslint-disable-next-line complexity\nasync function parseDraco(tile, featureTable, batchTable, options, context) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n const batchTableDraco =\n tile.batchTableJson &&\n tile.batchTableJson.extensions &&\n tile.batchTableJson.extensions['3DTILES_draco_point_compression'];\n if (batchTableDraco) {\n dracoBatchTableProperties = batchTableDraco.properties;\n }\n\n const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');\n if (featureTableDraco) {\n dracoFeatureTableProperties = featureTableDraco.properties;\n const dracoByteOffset = featureTableDraco.byteOffset;\n const dracoByteLength = featureTableDraco.byteLength;\n if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);\n\n tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);\n tile.hasColors =\n Number.isFinite(dracoFeatureTableProperties.RGB) ||\n Number.isFinite(dracoFeatureTableProperties.RGBA);\n tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);\n tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);\n tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);\n }\n\n if (!dracoBuffer) {\n return true;\n }\n\n const dracoData = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n return await loadDraco(tile, dracoData, options, context);\n}\n\n// eslint-disable-next-line complexity, max-statements\nexport async function loadDraco(tile, dracoData, options, context) {\n const {parse} = context;\n const dracoOptions = {\n ...options,\n draco: {\n ...options.draco,\n extraAttributes: dracoData.batchTableProperties || {}\n }\n };\n\n // The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n\n const data = await parse(dracoData.buffer, DracoLoader, dracoOptions);\n\n const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;\n const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;\n const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;\n const decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;\n const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;\n const isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;\n if (isQuantizedDraco) {\n // Draco quantization range == quantized volume scale - size in meters of the quantized volume\n // Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc\n const quantization = data.POSITION.data.quantization;\n const range = quantization.range;\n tile.quantizedVolumeScale = new Vector3(range, range, range);\n tile.quantizedVolumeOffset = new Vector3(quantization.minValues);\n tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;\n tile.isQuantizedDraco = true;\n }\n if (isOctEncodedDraco) {\n tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile.isOctEncodedDraco = true;\n }\n\n // Extra batch table attributes\n const batchTableAttributes = {};\n if (dracoData.batchTableProperties) {\n for (const attributeName of Object.keys(dracoData.batchTableProperties)) {\n if (data.attributes[attributeName] && data.attributes[attributeName].value) {\n batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;\n }\n }\n }\n\n tile.attributes = {\n positions: decodedPositions,\n colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),\n normals: decodedNormals,\n batchIds: decodedBatchIds,\n ...batchTableAttributes\n };\n}\n\n// TODO - this is the remaining code from Cesium's parser\n/*\n const batchTable = new Tile3DBatchTable(tile);\n\n // parseDracoBuffer(tile, featureTable, batchTable);\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n/*\n\n if (!tile.attributes.positions) {\n if (featureTable.hasProperty('POSITION')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n\n if (!tile.colors) {\n if (featureTable.hasProperty('RGBA')) {\n tile.colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);\n tile.isTranslucent = true;\n } else if (featureTable.hasProperty('RGB')) {\n tile.colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasPropertry('RGB565')) {\n tile.colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n }\n\n if (!tile.attributes.normals) {\n if (featureTable.getPropertry('NORMAL')) {\n tile.attributes.normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.getProperty('NORMAL_OCT16P')) {\n tile.attributes.normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n }\n\n if (!tile.batchIds) {\n if (featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n\n if (featureTable.getPropertry('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n\n if (tile.batchIds) {\n const batchLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n if (!defined(batchLength)) {\n throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');\n }\n\n if (defined(batchTableBinary)) {\n // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed\n batchTableBinary = new Uint8Array(batchTableBinary);\n }\n\n if (defined(pointCloud._batchTableLoaded)) {\n pointCloud._batchTableLoaded(batchLength, batchTableJson, batchTableBinary);\n }\n }\n\n // If points are not batched and there are per-point properties, use these properties for styling purposes\n var styleableProperties;\n if (!hasBatchIds && defined(batchTableBinary)) {\n tile.styleableProperties = Cesium3DTileBatchTable.getBinaryProperties(\n pointsLength,\n batchTableJson,\n batchTableBinary\n );\n }\n\n tile.draco = draco;\n}\n\n// Separate parsing and decoding of Draco\nexport function parseDracoBuffer(tile, featureTable, batchTable) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n\n const batchTableDraco = batchTable.getExtension('3DTILES_draco_point_compression');\n if (batchTableDraco) {\n dracoBatchTableProperties = batchTableDraco.properties;\n }\n\n const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');\n if (featureTableDraco) {\n dracoFeatureTableProperties = featureTableDraco.properties;\n const dracoByteOffset = featureTableDraco.byteOffset;\n const dracoByteLength = featureTableDraco.byteLength;\n if (!dracoFeatureTableProperties || !dracoByteOffset || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = arraySlice(\n featureTableBinary,\n dracoByteOffset,\n dracoByteOffset + dracoByteLength\n );\n tile.hasPositions = dracoFeatureTableProperties.POSITION;\n tile.hasColors = dracoFeatureTableProperties.RGB || dracoFeatureTableProperties.RGBA;\n tile.hasNormals = dracoFeatureTableProperties.NORMAL;\n tile.hasBatchIds = dracoFeatureTableProperties.BATCH_ID;\n tile.isTranslucent = dracoFeatureTableProperties.RGBA;\n }\n\n if (dracoBuffer) {\n tile.draco = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n tile.decodingState = DECODING_STATE.NEEDS_DECODE;\n }\n}\n\n/*\nfunction decodeDraco(tile, context) {\n if (tile.decodingState === DECODING_STATE.READY) {\n return false;\n }\n if (tile.decodingState === DECODING_STATE.NEEDS_DECODE) {\n var parsedContent = tile._parsedContent;\n var draco = parsedContent.draco;\n var decodePromise = DracoLoader.decodePointCloud(draco, context);\n if (defined(decodePromise)) {\n tile.decodingState = DECODING_STATE.DECODING;\n decodePromise.then(function(result) {\n tile.decodingState = DECODING_STATE.READY;\n var decodedPositions = defined(result.POSITION) ? result.POSITION.array : undefined;\n var decodedRgb = defined(result.RGB) ? result.RGB.array : undefined;\n var decodedRgba = defined(result.RGBA) ? result.RGBA.array : undefined;\n var decodedNormals = defined(result.NORMAL) ? result.NORMAL.array : undefined;\n var decodedBatchIds = defined(result.BATCH_ID) ? result.BATCH_ID.array : undefined;\n var isQuantizedDraco = defined(decodedPositions) && defined(result.POSITION.data.quantization);\n var isOctEncodedDraco = defined(decodedNormals) && defined(result.NORMAL.data.quantization);\n if (isQuantizedDraco) {\n // Draco quantization range == quantized volume scale - size in meters of the quantized volume\n // Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc\n var quantization = result.POSITION.data.quantization;\n var range = quantization.range;\n tile._quantizedVolumeScale = Cartesian3.fromElements(range, range, range);\n tile._quantizedVolumeOffset = Cartesian3.unpack(quantization.minValues);\n tile._quantizedRange = (1 << quantization.quantizationBits) - 1.0;\n tile._isQuantizedDraco = true;\n }\n if (isOctEncodedDraco) {\n tile._octEncodedRange = (1 << result.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile._isOctEncodedDraco = true;\n }\n var styleableProperties = parsedContent.styleableProperties;\n var batchTableProperties = draco.batchTableProperties;\n for (var name in batchTableProperties) {\n if (batchTableProperties.hasOwnProperty(name)) {\n var property = result[name];\n if (!defined(styleableProperties)) {\n styleableProperties = {};\n }\n styleableProperties[name] = {\n typedArray : property.array,\n componentCount : property.data.componentsPerAttribute\n };\n }\n }\n parsedContent.positions = defaultValue(decodedPositions, parsedContent.positions);\n parsedContent.colors = defaultValue(defaultValue(decodedRgba, decodedRgb), parsedContent.colors);\n parsedContent.normals = defaultValue(decodedNormals, parsedContent.normals);\n parsedContent.batchIds = defaultValue(decodedBatchIds, parsedContent.batchIds);\n parsedContent.styleableProperties = styleableProperties;\n }).otherwise(function(error) {\n tile.decodingState = DECODING_STATE.FAILED;\n tile._readyPromise.reject(error);\n });\n }\n }\n return true;\n}\n*/\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AAAuF,SAAAW,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OA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,IAAI,CAACnF,UAAU,CAAC+F,aAAa,CAAC,IAAIZ,IAAI,CAACnF,UAAU,CAAC+F,aAAa,CAAC,CAACM,KAAK,EAAE;gBAC1ET,oBAAoB,CAACG,aAAa,CAACY,WAAW,CAAC,CAAC,CAAC,GAAGxB,IAAI,CAACnF,UAAU,CAAC+F,aAAa,CAAC,CAACM,KAAK;cAC1F;YACF;UACF;UAEA7H,IAAI,CAACwB,UAAU,GAAAhD,aAAA;YACbiD,SAAS,EAAEmF,gBAAgB;YAC3BlF,MAAM,EAAE,IAAA6B,oDAA6B,EAACvD,IAAI,EAAE6G,aAAa,EAAEuB,SAAS,CAAC;YACrEzG,OAAO,EAAEmF,cAAc;YACvBlF,QAAQ,EAAEmF;UAAe,GACtBK,oBAAoB,CACxB;QAAC;QAAA;UAAA,OAAAK,SAAA,CAAAlG,IAAA;MAAA;IAAA,GAAAiF,QAAA;EAAA,CACH;EAAA,OAAAD,UAAA,CAAAhI,KAAA,OAAAI,SAAA;AAAA"}
1
+ {"version":3,"file":"parse-3d-tile-point-cloud.js","names":["_draco","require","_math","_core","_tile3dFeatureTable","_interopRequireDefault","_tile3dBatchTable","_parse3dTileHeader","_parse3dTileTables","_normalize3dTileColors","_normalize3dTileNormals","_normalize3dTilePositions","parsePointCloud3DTile","tile","arrayBuffer","byteOffset","options","context","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","initializeTile","featureTable","batchTable","parsePointCloudTables","parseDraco","parsePositions","parseColors","parseNormals","attributes","positions","colors","normals","batchIds","isQuantized","isTranslucent","isRGB565","isOctEncoded16P","Tile3DFeatureTable","featureTableJson","featureTableBinary","pointsLength","getGlobalProperty","Number","isFinite","Error","featuresLength","pointCount","rtcCenter","GL","FLOAT","parseBatchIds","hasProperty","getPropertyArray","UNSIGNED_SHORT","quantizedRange","quantizedVolumeScale","quantizedVolumeOffset","normalize3DTilePositionAttribute","UNSIGNED_BYTE","normalize3DTileColorAttribute","constantRGBA","normalize3DTileNormalAttribute","batchFeatureLength","batchTableJson","batchTableBinary","Tile3DBatchTable","dracoBuffer","dracoFeatureTableProperties","dracoBatchTableProperties","batchTableDraco","extensions","properties","featureTableDraco","getExtension","dracoByteOffset","dracoByteLength","byteLength","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","dracoData","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","parse","dracoOptions","draco","extraAttributes","data","DracoLoader","decodedPositions","value","decodedColors","COLOR_0","decodedNormals","decodedBatchIds","isQuantizedDraco","quantization","isOctEncodedDraco","range","Vector3","minValues","quantizationBits","octEncodedRange","batchTableAttributes","attributeName","Object","keys","toLowerCase","undefined"],"sources":["../../../../src/lib/parsers/parse-3d-tile-point-cloud.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {DracoLoader} from '@loaders.gl/draco';\nimport {GL} from '@loaders.gl/math';\nimport {Vector3} from '@math.gl/core';\n\nimport Tile3DFeatureTable from '../classes/tile-3d-feature-table';\nimport Tile3DBatchTable from '../classes/tile-3d-batch-table';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';\nimport {normalize3DTileColorAttribute} from './helpers/normalize-3d-tile-colors';\nimport {normalize3DTileNormalAttribute} from './helpers/normalize-3d-tile-normals';\nimport {normalize3DTilePositionAttribute} from './helpers/normalize-3d-tile-positions';\n\nexport async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n initializeTile(tile);\n\n const {featureTable, batchTable} = parsePointCloudTables(tile);\n\n await parseDraco(tile, featureTable, batchTable, options, context);\n\n parsePositions(tile, featureTable, options);\n parseColors(tile, featureTable, batchTable);\n parseNormals(tile, featureTable);\n\n return byteOffset;\n}\n\nfunction initializeTile(tile) {\n // Initialize point cloud tile defaults\n tile.attributes = {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n };\n tile.isQuantized = false;\n tile.isTranslucent = false;\n tile.isRGB565 = false;\n tile.isOctEncoded16P = false;\n}\n\nfunction parsePointCloudTables(tile) {\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n\n const pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');\n if (!Number.isFinite(pointsLength)) {\n throw new Error('POINTS_LENGTH must be defined');\n }\n featureTable.featuresLength = pointsLength;\n\n tile.featuresLength = pointsLength;\n tile.pointsLength = pointsLength;\n tile.pointCount = pointsLength;\n\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n\n const batchTable = parseBatchIds(tile, featureTable);\n\n return {featureTable, batchTable};\n}\n\nfunction parsePositions(tile, featureTable, options) {\n if (!tile.attributes.positions) {\n if (featureTable.hasProperty('POSITION')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n tile.isQuantized = true;\n tile.quantizedRange = (1 << 16) - 1;\n\n tile.quantizedVolumeScale = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_SCALE',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeScale) {\n throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');\n }\n\n tile.quantizedVolumeOffset = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_OFFSET',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeOffset) {\n throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');\n }\n\n tile.attributes.positions = normalize3DTilePositionAttribute(tile, positions, options);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n\nfunction parseColors(tile, featureTable, batchTable) {\n if (!tile.attributes.colors) {\n let colors = null;\n if (featureTable.hasProperty('RGBA')) {\n colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);\n tile.isTranslucent = true;\n } else if (featureTable.hasProperty('RGB')) {\n colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasProperty('RGB565')) {\n colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n\n tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);\n }\n\n if (featureTable.hasProperty('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n}\n\nfunction parseNormals(tile, featureTable) {\n if (!tile.attributes.normals) {\n let normals = null;\n if (featureTable.hasProperty('NORMAL')) {\n normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('NORMAL_OCT16P')) {\n normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n\n tile.attributes.normals = normalize3DTileNormalAttribute(tile, normals);\n }\n}\n\nfunction parseBatchIds(tile, featureTable) {\n let batchTable: Tile3DBatchTable | null = null;\n if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n\n if (tile.batchIds) {\n const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n if (!batchFeatureLength) {\n throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');\n }\n const {batchTableJson, batchTableBinary} = tile;\n batchTable = new Tile3DBatchTable(batchTableJson, batchTableBinary, batchFeatureLength);\n }\n }\n return batchTable;\n}\n\n// eslint-disable-next-line complexity\nasync function parseDraco(tile, featureTable, batchTable, options, context) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n const batchTableDraco =\n tile.batchTableJson &&\n tile.batchTableJson.extensions &&\n tile.batchTableJson.extensions['3DTILES_draco_point_compression'];\n if (batchTableDraco) {\n dracoBatchTableProperties = batchTableDraco.properties;\n }\n\n const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');\n if (featureTableDraco) {\n dracoFeatureTableProperties = featureTableDraco.properties;\n const dracoByteOffset = featureTableDraco.byteOffset;\n const dracoByteLength = featureTableDraco.byteLength;\n if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);\n\n tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);\n tile.hasColors =\n Number.isFinite(dracoFeatureTableProperties.RGB) ||\n Number.isFinite(dracoFeatureTableProperties.RGBA);\n tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);\n tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);\n tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);\n }\n\n if (!dracoBuffer) {\n return true;\n }\n\n const dracoData = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n return await loadDraco(tile, dracoData, options, context);\n}\n\n// eslint-disable-next-line complexity, max-statements\nexport async function loadDraco(tile, dracoData, options, context) {\n const {parse} = context;\n const dracoOptions = {\n ...options,\n draco: {\n ...options.draco,\n extraAttributes: dracoData.batchTableProperties || {}\n }\n };\n\n // The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n\n const data = await parse(dracoData.buffer, DracoLoader, dracoOptions);\n\n const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;\n const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;\n const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;\n const decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;\n const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;\n const isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;\n if (isQuantizedDraco) {\n // Draco quantization range == quantized volume scale - size in meters of the quantized volume\n // Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc\n const quantization = data.POSITION.data.quantization;\n const range = quantization.range;\n tile.quantizedVolumeScale = new Vector3(range, range, range);\n tile.quantizedVolumeOffset = new Vector3(quantization.minValues);\n tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;\n tile.isQuantizedDraco = true;\n }\n if (isOctEncodedDraco) {\n tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile.isOctEncodedDraco = true;\n }\n\n // Extra batch table attributes\n const batchTableAttributes = {};\n if (dracoData.batchTableProperties) {\n for (const attributeName of Object.keys(dracoData.batchTableProperties)) {\n if (data.attributes[attributeName] && data.attributes[attributeName].value) {\n batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;\n }\n }\n }\n\n tile.attributes = {\n positions: decodedPositions,\n colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),\n normals: decodedNormals,\n batchIds: decodedBatchIds,\n ...batchTableAttributes\n };\n}\n\n// TODO - this is the remaining code from Cesium's parser\n/*\n const batchTable = new Tile3DBatchTable(tile);\n\n // parseDracoBuffer(tile, featureTable, batchTable);\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n/*\n\n if (!tile.attributes.positions) {\n if (featureTable.hasProperty('POSITION')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n\n if (!tile.colors) {\n if (featureTable.hasProperty('RGBA')) {\n tile.colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);\n tile.isTranslucent = true;\n } else if (featureTable.hasProperty('RGB')) {\n tile.colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasPropertry('RGB565')) {\n tile.colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n }\n\n if (!tile.attributes.normals) {\n if (featureTable.getPropertry('NORMAL')) {\n tile.attributes.normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.getProperty('NORMAL_OCT16P')) {\n tile.attributes.normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n }\n\n if (!tile.batchIds) {\n if (featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n\n if (featureTable.getPropertry('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n\n if (tile.batchIds) {\n const batchLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n if (!defined(batchLength)) {\n throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');\n }\n\n if (defined(batchTableBinary)) {\n // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed\n batchTableBinary = new Uint8Array(batchTableBinary);\n }\n\n if (defined(pointCloud._batchTableLoaded)) {\n pointCloud._batchTableLoaded(batchLength, batchTableJson, batchTableBinary);\n }\n }\n\n // If points are not batched and there are per-point properties, use these properties for styling purposes\n var styleableProperties;\n if (!hasBatchIds && defined(batchTableBinary)) {\n tile.styleableProperties = Cesium3DTileBatchTable.getBinaryProperties(\n pointsLength,\n batchTableJson,\n batchTableBinary\n );\n }\n\n tile.draco = draco;\n}\n\n// Separate parsing and decoding of Draco\nexport function parseDracoBuffer(tile, featureTable, batchTable) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n\n const batchTableDraco = batchTable.getExtension('3DTILES_draco_point_compression');\n if (batchTableDraco) {\n dracoBatchTableProperties = batchTableDraco.properties;\n }\n\n const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');\n if (featureTableDraco) {\n dracoFeatureTableProperties = featureTableDraco.properties;\n const dracoByteOffset = featureTableDraco.byteOffset;\n const dracoByteLength = featureTableDraco.byteLength;\n if (!dracoFeatureTableProperties || !dracoByteOffset || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = arraySlice(\n featureTableBinary,\n dracoByteOffset,\n dracoByteOffset + dracoByteLength\n );\n tile.hasPositions = dracoFeatureTableProperties.POSITION;\n tile.hasColors = dracoFeatureTableProperties.RGB || dracoFeatureTableProperties.RGBA;\n tile.hasNormals = dracoFeatureTableProperties.NORMAL;\n tile.hasBatchIds = dracoFeatureTableProperties.BATCH_ID;\n tile.isTranslucent = dracoFeatureTableProperties.RGBA;\n }\n\n if (dracoBuffer) {\n tile.draco = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n tile.decodingState = DECODING_STATE.NEEDS_DECODE;\n }\n}\n\n/*\nfunction decodeDraco(tile, context) {\n if (tile.decodingState === DECODING_STATE.READY) {\n return false;\n }\n if (tile.decodingState === DECODING_STATE.NEEDS_DECODE) {\n var parsedContent = tile._parsedContent;\n var draco = parsedContent.draco;\n var decodePromise = DracoLoader.decodePointCloud(draco, context);\n if (defined(decodePromise)) {\n tile.decodingState = DECODING_STATE.DECODING;\n decodePromise.then(function(result) {\n tile.decodingState = DECODING_STATE.READY;\n var decodedPositions = defined(result.POSITION) ? result.POSITION.array : undefined;\n var decodedRgb = defined(result.RGB) ? result.RGB.array : undefined;\n var decodedRgba = defined(result.RGBA) ? result.RGBA.array : undefined;\n var decodedNormals = defined(result.NORMAL) ? result.NORMAL.array : undefined;\n var decodedBatchIds = defined(result.BATCH_ID) ? result.BATCH_ID.array : undefined;\n var isQuantizedDraco = defined(decodedPositions) && defined(result.POSITION.data.quantization);\n var isOctEncodedDraco = defined(decodedNormals) && defined(result.NORMAL.data.quantization);\n if (isQuantizedDraco) {\n // Draco quantization range == quantized volume scale - size in meters of the quantized volume\n // Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc\n var quantization = result.POSITION.data.quantization;\n var range = quantization.range;\n tile._quantizedVolumeScale = Cartesian3.fromElements(range, range, range);\n tile._quantizedVolumeOffset = Cartesian3.unpack(quantization.minValues);\n tile._quantizedRange = (1 << quantization.quantizationBits) - 1.0;\n tile._isQuantizedDraco = true;\n }\n if (isOctEncodedDraco) {\n tile._octEncodedRange = (1 << result.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile._isOctEncodedDraco = true;\n }\n var styleableProperties = parsedContent.styleableProperties;\n var batchTableProperties = draco.batchTableProperties;\n for (var name in batchTableProperties) {\n if (batchTableProperties.hasOwnProperty(name)) {\n var property = result[name];\n if (!defined(styleableProperties)) {\n styleableProperties = {};\n }\n styleableProperties[name] = {\n typedArray : property.array,\n componentCount : property.data.componentsPerAttribute\n };\n }\n }\n parsedContent.positions = defaultValue(decodedPositions, parsedContent.positions);\n parsedContent.colors = defaultValue(defaultValue(decodedRgba, decodedRgb), parsedContent.colors);\n parsedContent.normals = defaultValue(decodedNormals, parsedContent.normals);\n parsedContent.batchIds = defaultValue(decodedBatchIds, parsedContent.batchIds);\n parsedContent.styleableProperties = styleableProperties;\n }).otherwise(function(error) {\n tile.decodingState = DECODING_STATE.FAILED;\n tile._readyPromise.reject(error);\n });\n }\n }\n return true;\n}\n*/\n"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AAEO,eAAeW,qBAAqBA,CAACC,IAAI,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAE;EAC3FF,UAAU,GAAG,IAAAG,wCAAqB,EAACL,IAAI,EAAEC,WAAW,EAAEC,UAAU,CAAC;EACjEA,UAAU,GAAG,IAAAI,8CAA2B,EAACN,IAAI,EAAEC,WAAW,EAAEC,UAAU,CAAC;EACvEA,UAAU,GAAG,IAAAK,wCAAqB,EAACP,IAAI,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,CAAC;EAC1EK,cAAc,CAACR,IAAI,CAAC;EAEpB,MAAM;IAACS,YAAY;IAAEC;EAAU,CAAC,GAAGC,qBAAqB,CAACX,IAAI,CAAC;EAE9D,MAAMY,UAAU,CAACZ,IAAI,EAAES,YAAY,EAAEC,UAAU,EAAEP,OAAO,EAAEC,OAAO,CAAC;EAElES,cAAc,CAACb,IAAI,EAAES,YAAY,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C,CAACd,KAAK,EAAE;QAC1Ea,oBAAoB,CAACC,aAAa,CAACG,WAAW,CAAC,CAAC,CAAC,GAAGpB,IAAI,CAACrE,UAAU,CAACsF,aAAa,CAAC,CAACd,KAAK;MAC1F;IACF;EACF;EAEAxF,IAAI,CAACgB,UAAU,GAAG;IAChBC,SAAS,EAAEsE,gBAAgB;IAC3BrE,MAAM,EAAE,IAAA6B,oDAA6B,EAAC/C,IAAI,EAAEyF,aAAa,EAAEiB,SAAS,CAAC;IACrEvF,OAAO,EAAEwE,cAAc;IACvBvE,QAAQ,EAAEwE,eAAe;IACzB,GAAGS;EACL,CAAC;AACH"}
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.parse3DTile = parse3DTile;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
7
  var _constants = require("../constants");
11
8
  var _parseUtils = require("./helpers/parse-utils");
12
9
  var _parse3dTilePointCloud = require("./parse-3d-tile-point-cloud");
@@ -14,61 +11,26 @@ var _parse3dTileBatchedModel = require("./parse-3d-tile-batched-model");
14
11
  var _parse3dTileInstancedModel = require("./parse-3d-tile-instanced-model");
15
12
  var _parse3dTileComposite = require("./parse-3d-tile-composite");
16
13
  var _parse3dTileGltf = require("./parse-3d-tile-gltf");
17
- function parse3DTile(_x) {
18
- return _parse3DTile.apply(this, arguments);
19
- }
20
- function _parse3DTile() {
21
- _parse3DTile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
22
- var byteOffset,
23
- options,
24
- context,
25
- tile,
26
- _args = arguments;
27
- return _regenerator.default.wrap(function _callee$(_context) {
28
- while (1) switch (_context.prev = _context.next) {
29
- case 0:
30
- byteOffset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
31
- options = _args.length > 2 ? _args[2] : undefined;
32
- context = _args.length > 3 ? _args[3] : undefined;
33
- tile = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
34
- tile.byteOffset = byteOffset;
35
- tile.type = (0, _parseUtils.getMagicString)(arrayBuffer, byteOffset);
36
- _context.t0 = tile.type;
37
- _context.next = _context.t0 === _constants.TILE3D_TYPE.COMPOSITE ? 9 : _context.t0 === _constants.TILE3D_TYPE.BATCHED_3D_MODEL ? 12 : _context.t0 === _constants.TILE3D_TYPE.GLTF ? 15 : _context.t0 === _constants.TILE3D_TYPE.INSTANCED_3D_MODEL ? 18 : _context.t0 === _constants.TILE3D_TYPE.POINT_CLOUD ? 21 : 24;
38
- break;
39
- case 9:
40
- _context.next = 11;
41
- return (0, _parse3dTileComposite.parseComposite3DTile)(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
42
- case 11:
43
- return _context.abrupt("return", _context.sent);
44
- case 12:
45
- _context.next = 14;
46
- return (0, _parse3dTileBatchedModel.parseBatchedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
47
- case 14:
48
- return _context.abrupt("return", _context.sent);
49
- case 15:
50
- _context.next = 17;
51
- return (0, _parse3dTileGltf.parseGltf3DTile)(tile, arrayBuffer, options, context);
52
- case 17:
53
- return _context.abrupt("return", _context.sent);
54
- case 18:
55
- _context.next = 20;
56
- return (0, _parse3dTileInstancedModel.parseInstancedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
57
- case 20:
58
- return _context.abrupt("return", _context.sent);
59
- case 21:
60
- _context.next = 23;
61
- return (0, _parse3dTilePointCloud.parsePointCloud3DTile)(tile, arrayBuffer, byteOffset, options, context);
62
- case 23:
63
- return _context.abrupt("return", _context.sent);
64
- case 24:
65
- throw new Error("3DTileLoader: unknown type ".concat(tile.type));
66
- case 25:
67
- case "end":
68
- return _context.stop();
69
- }
70
- }, _callee);
71
- }));
72
- return _parse3DTile.apply(this, arguments);
14
+ async function parse3DTile(arrayBuffer) {
15
+ let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
16
+ let options = arguments.length > 2 ? arguments[2] : undefined;
17
+ let context = arguments.length > 3 ? arguments[3] : undefined;
18
+ let tile = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
19
+ tile.byteOffset = byteOffset;
20
+ tile.type = (0, _parseUtils.getMagicString)(arrayBuffer, byteOffset);
21
+ switch (tile.type) {
22
+ case _constants.TILE3D_TYPE.COMPOSITE:
23
+ return await (0, _parse3dTileComposite.parseComposite3DTile)(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
24
+ case _constants.TILE3D_TYPE.BATCHED_3D_MODEL:
25
+ return await (0, _parse3dTileBatchedModel.parseBatchedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
26
+ case _constants.TILE3D_TYPE.GLTF:
27
+ return await (0, _parse3dTileGltf.parseGltf3DTile)(tile, arrayBuffer, options, context);
28
+ case _constants.TILE3D_TYPE.INSTANCED_3D_MODEL:
29
+ return await (0, _parse3dTileInstancedModel.parseInstancedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
30
+ case _constants.TILE3D_TYPE.POINT_CLOUD:
31
+ return await (0, _parse3dTilePointCloud.parsePointCloud3DTile)(tile, arrayBuffer, byteOffset, options, context);
32
+ default:
33
+ throw new Error("3DTileLoader: unknown type ".concat(tile.type));
34
+ }
73
35
  }
74
36
  //# sourceMappingURL=parse-3d-tile.js.map