@loaders.gl/3d-tiles 3.4.0-alpha.2 → 3.4.0-alpha.4

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 (170) hide show
  1. package/dist/dist.min.js +217 -52
  2. package/dist/es5/cesium-ion-loader.js +23 -27
  3. package/dist/es5/cesium-ion-loader.js.map +1 -1
  4. package/dist/es5/index.js.map +1 -1
  5. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +0 -2
  6. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  7. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +0 -6
  8. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  9. package/dist/es5/lib/classes/tile-3d-batch-table.js +2 -19
  10. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -1
  11. package/dist/es5/lib/classes/tile-3d-feature-table.js +1 -4
  12. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -1
  13. package/dist/es5/lib/constants.js +0 -2
  14. package/dist/es5/lib/constants.js.map +1 -1
  15. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +0 -5
  16. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -1
  17. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +0 -2
  18. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -1
  19. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +0 -3
  20. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -1
  21. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +0 -3
  22. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -1
  23. package/dist/es5/lib/encoders/encode-3d-tile.js +0 -1
  24. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -1
  25. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +0 -3
  26. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -1
  27. package/dist/es5/lib/ion/ion.js +109 -117
  28. package/dist/es5/lib/ion/ion.js.map +1 -1
  29. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -3
  30. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  31. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  32. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -3
  33. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  34. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +117 -130
  35. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  36. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +34 -42
  37. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  38. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +0 -3
  39. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -1
  40. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +93 -100
  41. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  42. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +0 -5
  43. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -1
  44. package/dist/es5/lib/parsers/helpers/parse-utils.js +0 -2
  45. package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -1
  46. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +14 -16
  47. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  48. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +24 -27
  49. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  50. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +12 -14
  51. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  52. package/dist/es5/lib/parsers/parse-3d-tile-header.js +149 -156
  53. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
  54. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +10 -22
  55. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  56. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +111 -119
  57. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  58. package/dist/es5/lib/parsers/parse-3d-tile.js +41 -44
  59. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -1
  60. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +0 -2
  61. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -1
  62. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +0 -3
  63. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -1
  64. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +1 -3
  65. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -1
  66. package/dist/es5/lib/utils/s2/converters/s2-to-region.js +0 -2
  67. package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -1
  68. package/dist/es5/lib/utils/s2/index.js.map +1 -1
  69. package/dist/es5/lib/utils/s2/s2-geometry-functions.js +0 -2
  70. package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -1
  71. package/dist/es5/lib/utils/s2/s2-token-functions.js +0 -5
  72. package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -1
  73. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +0 -2
  74. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -1
  75. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +0 -10
  76. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -1
  77. package/dist/es5/lib/utils/version.js +1 -1
  78. package/dist/es5/lib/utils/version.js.map +1 -1
  79. package/dist/es5/tile-3d-subtree-loader.js.map +1 -1
  80. package/dist/es5/tile-3d-writer.js.map +1 -1
  81. package/dist/es5/tiles-3d-loader.js +59 -65
  82. package/dist/es5/tiles-3d-loader.js.map +1 -1
  83. package/dist/esm/bundle.js +0 -1
  84. package/dist/esm/bundle.js.map +1 -1
  85. package/dist/esm/cesium-ion-loader.js +0 -2
  86. package/dist/esm/cesium-ion-loader.js.map +1 -1
  87. package/dist/esm/index.js +0 -4
  88. package/dist/esm/index.js.map +1 -1
  89. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +0 -1
  90. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  91. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +0 -7
  92. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  93. package/dist/esm/lib/classes/tile-3d-batch-table.js +0 -13
  94. package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -1
  95. package/dist/esm/lib/classes/tile-3d-feature-table.js +0 -3
  96. package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -1
  97. package/dist/esm/lib/constants.js +0 -3
  98. package/dist/esm/lib/constants.js.map +1 -1
  99. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +0 -8
  100. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -1
  101. package/dist/esm/lib/encoders/encode-3d-tile-composite.js +0 -4
  102. package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -1
  103. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +0 -6
  104. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -1
  105. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +0 -5
  106. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -1
  107. package/dist/esm/lib/encoders/encode-3d-tile.js +0 -2
  108. package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -1
  109. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +0 -3
  110. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -1
  111. package/dist/esm/lib/ion/ion.js +0 -9
  112. package/dist/esm/lib/ion/ion.js.map +1 -1
  113. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -4
  114. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  115. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  116. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -4
  117. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  118. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +0 -13
  119. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  120. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +1 -8
  121. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  122. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +0 -4
  123. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -1
  124. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +0 -6
  125. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  126. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +0 -6
  127. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -1
  128. package/dist/esm/lib/parsers/helpers/parse-utils.js +0 -4
  129. package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -1
  130. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +0 -3
  131. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  132. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +0 -6
  133. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  134. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  135. package/dist/esm/lib/parsers/parse-3d-tile-header.js +0 -5
  136. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
  137. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +0 -12
  138. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  139. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +0 -6
  140. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  141. package/dist/esm/lib/parsers/parse-3d-tile.js +0 -4
  142. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -1
  143. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +0 -2
  144. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -1
  145. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +0 -3
  146. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -1
  147. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +1 -3
  148. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -1
  149. package/dist/esm/lib/utils/s2/converters/s2-to-region.js +0 -3
  150. package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -1
  151. package/dist/esm/lib/utils/s2/index.js +0 -2
  152. package/dist/esm/lib/utils/s2/index.js.map +1 -1
  153. package/dist/esm/lib/utils/s2/s2-geometry-functions.js +0 -4
  154. package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -1
  155. package/dist/esm/lib/utils/s2/s2-token-functions.js +0 -6
  156. package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -1
  157. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +0 -3
  158. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -1
  159. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +0 -12
  160. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -1
  161. package/dist/esm/lib/utils/version.js +1 -2
  162. package/dist/esm/lib/utils/version.js.map +1 -1
  163. package/dist/esm/tile-3d-subtree-loader.js +0 -1
  164. package/dist/esm/tile-3d-subtree-loader.js.map +1 -1
  165. package/dist/esm/tile-3d-writer.js +0 -1
  166. package/dist/esm/tile-3d-writer.js.map +1 -1
  167. package/dist/esm/tiles-3d-loader.js +0 -1
  168. package/dist/esm/tiles-3d-loader.js.map +1 -1
  169. package/dist/lib/parsers/parse-3d-tile-batched-model.js +1 -1
  170. package/package.json +7 -7
@@ -28,25 +28,23 @@ function _parsePointCloud3DTile() {
28
28
  _parsePointCloud3DTile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tile, arrayBuffer, byteOffset, options, context) {
29
29
  var _parsePointCloudTable, featureTable, batchTable;
30
30
  return _regenerator.default.wrap(function _callee$(_context) {
31
- while (1) {
32
- switch (_context.prev = _context.next) {
33
- case 0:
34
- byteOffset = (0, _parse3dTileHeader.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
35
- byteOffset = (0, _parse3dTileTables.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset);
36
- byteOffset = (0, _parse3dTileTables.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
37
- initializeTile(tile);
38
- _parsePointCloudTable = parsePointCloudTables(tile), featureTable = _parsePointCloudTable.featureTable, batchTable = _parsePointCloudTable.batchTable;
39
- _context.next = 7;
40
- return parseDraco(tile, featureTable, batchTable, options, context);
41
- case 7:
42
- parsePositions(tile, featureTable, options);
43
- parseColors(tile, featureTable, batchTable);
44
- parseNormals(tile, featureTable);
45
- return _context.abrupt("return", byteOffset);
46
- case 11:
47
- case "end":
48
- return _context.stop();
49
- }
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();
50
48
  }
51
49
  }, _callee);
52
50
  }));
@@ -150,7 +148,6 @@ function parseBatchIds(tile, featureTable) {
150
148
  }
151
149
  return batchTable;
152
150
  }
153
-
154
151
  function parseDraco(_x6, _x7, _x8, _x9, _x10) {
155
152
  return _parseDraco.apply(this, arguments);
156
153
  }
@@ -158,55 +155,53 @@ function _parseDraco() {
158
155
  _parseDraco = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(tile, featureTable, batchTable, options, context) {
159
156
  var dracoBuffer, dracoFeatureTableProperties, dracoBatchTableProperties, batchTableDraco, featureTableDraco, dracoByteOffset, dracoByteLength, dracoData;
160
157
  return _regenerator.default.wrap(function _callee2$(_context2) {
161
- while (1) {
162
- switch (_context2.prev = _context2.next) {
163
- case 0:
164
- batchTableDraco = tile.batchTableJson && tile.batchTableJson.extensions && tile.batchTableJson.extensions['3DTILES_draco_point_compression'];
165
- if (batchTableDraco) {
166
- dracoBatchTableProperties = batchTableDraco.properties;
167
- }
168
- featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');
169
- if (!featureTableDraco) {
170
- _context2.next = 15;
171
- break;
172
- }
173
- dracoFeatureTableProperties = featureTableDraco.properties;
174
- dracoByteOffset = featureTableDraco.byteOffset;
175
- dracoByteLength = featureTableDraco.byteLength;
176
- if (!(!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength)) {
177
- _context2.next = 9;
178
- break;
179
- }
180
- throw new Error('Draco properties, byteOffset, and byteLength must be defined');
181
- case 9:
182
- dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
183
- tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
184
- tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
185
- tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
186
- tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);
187
- tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);
188
- case 15:
189
- if (dracoBuffer) {
190
- _context2.next = 17;
191
- break;
192
- }
193
- return _context2.abrupt("return", true);
194
- case 17:
195
- dracoData = {
196
- buffer: dracoBuffer,
197
- properties: _objectSpread(_objectSpread({}, dracoFeatureTableProperties), dracoBatchTableProperties),
198
- featureTableProperties: dracoFeatureTableProperties,
199
- batchTableProperties: dracoBatchTableProperties,
200
- dequantizeInShader: false
201
- };
202
- _context2.next = 20;
203
- return loadDraco(tile, dracoData, options, context);
204
- case 20:
205
- return _context2.abrupt("return", _context2.sent);
206
- case 21:
207
- case "end":
208
- return _context2.stop();
209
- }
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();
210
205
  }
211
206
  }, _callee2);
212
207
  }));
@@ -219,58 +214,55 @@ function _loadDraco() {
219
214
  _loadDraco = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(tile, dracoData, options, context) {
220
215
  var parse, dracoOptions, data, decodedPositions, decodedColors, decodedNormals, decodedBatchIds, isQuantizedDraco, isOctEncodedDraco, quantization, range, batchTableAttributes, _i, _Object$keys, attributeName;
221
216
  return _regenerator.default.wrap(function _callee3$(_context3) {
222
- while (1) {
223
- switch (_context3.prev = _context3.next) {
224
- case 0:
225
- parse = context.parse;
226
- dracoOptions = _objectSpread(_objectSpread({}, options), {}, {
227
- draco: _objectSpread(_objectSpread({}, options.draco), {}, {
228
- extraAttributes: dracoData.batchTableProperties || {}
229
- })
230
- });
231
- delete dracoOptions['3d-tiles'];
232
- _context3.next = 5;
233
- return parse(dracoData.buffer, _draco.DracoLoader, dracoOptions);
234
- case 5:
235
- data = _context3.sent;
236
- decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
237
- decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
238
- decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
239
- decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;
240
- isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;
241
- isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;
242
- if (isQuantizedDraco) {
243
- quantization = data.POSITION.data.quantization;
244
- range = quantization.range;
245
- tile.quantizedVolumeScale = new _core.Vector3(range, range, range);
246
- tile.quantizedVolumeOffset = new _core.Vector3(quantization.minValues);
247
- tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;
248
- tile.isQuantizedDraco = true;
249
- }
250
- if (isOctEncodedDraco) {
251
- tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;
252
- tile.isOctEncodedDraco = true;
253
- }
254
-
255
- batchTableAttributes = {};
256
- if (dracoData.batchTableProperties) {
257
- for (_i = 0, _Object$keys = Object.keys(dracoData.batchTableProperties); _i < _Object$keys.length; _i++) {
258
- attributeName = _Object$keys[_i];
259
- if (data.attributes[attributeName] && data.attributes[attributeName].value) {
260
- batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;
261
- }
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;
262
254
  }
263
255
  }
264
- tile.attributes = _objectSpread({
265
- positions: decodedPositions,
266
- colors: (0, _normalize3dTileColors.normalize3DTileColorAttribute)(tile, decodedColors, undefined),
267
- normals: decodedNormals,
268
- batchIds: decodedBatchIds
269
- }, batchTableAttributes);
270
- case 17:
271
- case "end":
272
- return _context3.stop();
273
- }
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();
274
266
  }
275
267
  }, _callee3);
276
268
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-point-cloud.js","names":["parsePointCloud3DTile","tile","arrayBuffer","byteOffset","options","context","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","initializeTile","parsePointCloudTables","featureTable","batchTable","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","batchTableDraco","extensions","dracoBatchTableProperties","properties","featureTableDraco","getExtension","dracoFeatureTableProperties","dracoByteOffset","dracoByteLength","byteLength","dracoBuffer","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","dracoData","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","parse","dracoOptions","draco","extraAttributes","DracoLoader","data","decodedPositions","value","decodedColors","COLOR_0","decodedNormals","decodedBatchIds","isQuantizedDraco","quantization","isOctEncodedDraco","range","Vector3","minValues","quantizationBits","octEncodedRange","batchTableAttributes","Object","keys","attributeName","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;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAuF;AAAA;AAAA,SAEjEA,qBAAqB;EAAA;AAAA;AAAA;EAAA,mFAApC,iBAAqCC,IAAI,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO;IAAA;IAAA;MAAA;QAAA;UAAA;YACzFF,UAAU,GAAG,IAAAG,wCAAqB,EAACL,IAAI,EAA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,YAAY,CAACI,SAAS,CAAC;cAChElG,IAAI,CAAC0C,cAAc,GAAG,CAAC,CAAC,IAAIoD,YAAY,CAACK,gBAAgB,IAAI,GAAG;cAChEnG,IAAI,CAAC6F,gBAAgB,GAAG,IAAI;YAC9B;YACA,IAAIE,iBAAiB,EAAE;cACrB/F,IAAI,CAACoG,eAAe,GAAG,CAAC,CAAC,IAAId,IAAI,CAACd,MAAM,CAACc,IAAI,CAACQ,YAAY,CAACK,gBAAgB,IAAI,GAAG;cAClFnG,IAAI,CAAC+F,iBAAiB,GAAG,IAAI;YAC/B;;YAGMM,oBAAoB,GAAG,CAAC,CAAC;YAC/B,IAAI1B,SAAS,CAACG,oBAAoB,EAAE;cAClC,4BAA4BwB,MAAM,CAACC,IAAI,CAAC5B,SAAS,CAACG,oBAAoB,CAAC,kCAAE;gBAA9D0B,aAAa;gBACtB,IAAIlB,IAAI,CAACtE,UAAU,CAACwF,aAAa,CAAC,IAAIlB,IAAI,CAACtE,UAAU,CAACwF,aAAa,CAAC,CAAChB,KAAK,EAAE;kBAC1Ea,oBAAoB,CAACG,aAAa,CAACC,WAAW,EAAE,CAAC,GAAGnB,IAAI,CAACtE,UAAU,CAACwF,aAAa,CAAC,CAAChB,KAAK;gBAC1F;cACF;YACF;YAEAxF,IAAI,CAACgB,UAAU;cACbC,SAAS,EAAEsE,gBAAgB;cAC3BrE,MAAM,EAAE,IAAA6B,oDAA6B,EAAC/C,IAAI,EAAEyF,aAAa,EAAEiB,SAAS,CAAC;cACrEvF,OAAO,EAAEwE,cAAc;cACvBvE,QAAQ,EAAEwE;YAAe,GACtBS,oBAAoB,CACxB;UAAC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACH;EAAA;AAAA"}
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,G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jI,IAAI,CAACiH,iBAAiB,GAAG,IAAI;UAC/B;UAGMG,oBAAoB,GAAG,CAAC,CAAC;UAC/B,IAAIxC,SAAS,CAACmB,oBAAoB,EAAE;YAClC,KAAAsB,EAAA,MAAAC,YAAA,GAA4BvJ,MAAM,CAACD,IAAI,CAAC8G,SAAS,CAACmB,oBAAoB,CAAC,EAAAsB,EAAA,GAAAC,YAAA,CAAA1I,MAAA,EAAAyI,EAAA,IAAE;cAA9DE,aAAa,GAAAD,YAAA,CAAAD,EAAA;cACtB,IAAIV,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"}
@@ -25,50 +25,47 @@ function _parse3DTile() {
25
25
  tile,
26
26
  _args = arguments;
27
27
  return _regenerator.default.wrap(function _callee$(_context) {
28
- while (1) {
29
- switch (_context.prev = _context.next) {
30
- case 0:
31
- byteOffset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
32
- options = _args.length > 2 ? _args[2] : undefined;
33
- context = _args.length > 3 ? _args[3] : undefined;
34
- tile = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
35
- tile.byteOffset = byteOffset;
36
- tile.type = (0, _parseUtils.getMagicString)(arrayBuffer, byteOffset);
37
-
38
- _context.t0 = tile.type;
39
- _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;
40
- break;
41
- case 9:
42
- _context.next = 11;
43
- return (0, _parse3dTileComposite.parseComposite3DTile)(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
44
- case 11:
45
- return _context.abrupt("return", _context.sent);
46
- case 12:
47
- _context.next = 14;
48
- return (0, _parse3dTileBatchedModel.parseBatchedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
49
- case 14:
50
- return _context.abrupt("return", _context.sent);
51
- case 15:
52
- _context.next = 17;
53
- return (0, _parse3dTileGltf.parseGltf3DTile)(tile, arrayBuffer, options, context);
54
- case 17:
55
- return _context.abrupt("return", _context.sent);
56
- case 18:
57
- _context.next = 20;
58
- return (0, _parse3dTileInstancedModel.parseInstancedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
59
- case 20:
60
- return _context.abrupt("return", _context.sent);
61
- case 21:
62
- _context.next = 23;
63
- return (0, _parse3dTilePointCloud.parsePointCloud3DTile)(tile, arrayBuffer, byteOffset, options, context);
64
- case 23:
65
- return _context.abrupt("return", _context.sent);
66
- case 24:
67
- throw new Error("3DTileLoader: unknown type ".concat(tile.type));
68
- case 25:
69
- case "end":
70
- return _context.stop();
71
- }
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();
72
69
  }
73
70
  }, _callee);
74
71
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile.js","names":["parse3DTile","arrayBuffer","byteOffset","options","context","tile","type","getMagicString","TILE3D_TYPE","COMPOSITE","BATCHED_3D_MODEL","GLTF","INSTANCED_3D_MODEL","POINT_CLOUD","parseComposite3DTile","parseBatchedModel3DTile","parseGltf3DTile","parseInstancedModel3DTile","parsePointCloud3DTile","Error"],"sources":["../../../../src/lib/parsers/parse-3d-tile.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 {TILE3D_TYPE} from '../constants';\nimport {getMagicString} from './helpers/parse-utils';\n\nimport {parsePointCloud3DTile} from './parse-3d-tile-point-cloud';\nimport {parseBatchedModel3DTile} from './parse-3d-tile-batched-model';\nimport {parseInstancedModel3DTile} from './parse-3d-tile-instanced-model';\nimport {parseComposite3DTile} from './parse-3d-tile-composite';\nimport {parseGltf3DTile} from './parse-3d-tile-gltf';\n\n// Extracts\nexport async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {\n // @ts-expect-error\n tile.byteOffset = byteOffset;\n // @ts-expect-error\n tile.type = getMagicString(arrayBuffer, byteOffset);\n\n // @ts-expect-error\n switch (tile.type) {\n case TILE3D_TYPE.COMPOSITE:\n // Note: We pass this function as argument so that embedded tiles can be parsed recursively\n return await parseComposite3DTile(\n tile,\n arrayBuffer,\n byteOffset,\n options,\n context,\n parse3DTile\n );\n\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.GLTF:\n return await parseGltf3DTile(tile, arrayBuffer, options, context);\n\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.POINT_CLOUD:\n return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n default:\n // @ts-expect-error\n throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line\n }\n}\n"],"mappings":";;;;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,CAACC,IAAI,EAAG;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAE/D;EAAA;AAAA"}
1
+ {"version":3,"file":"parse-3d-tile.js","names":["_constants","require","_parseUtils","_parse3dTilePointCloud","_parse3dTileBatchedModel","_parse3dTileInstancedModel","_parse3dTileComposite","_parse3dTileGltf","parse3DTile","_x","_parse3DTile","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","byteOffset","options","context","tile","_args","wrap","_callee$","_context","prev","next","length","undefined","type","getMagicString","t0","TILE3D_TYPE","COMPOSITE","BATCHED_3D_MODEL","GLTF","INSTANCED_3D_MODEL","POINT_CLOUD","parseComposite3DTile","abrupt","sent","parseBatchedModel3DTile","parseGltf3DTile","parseInstancedModel3DTile","parsePointCloud3DTile","Error","concat","stop"],"sources":["../../../../src/lib/parsers/parse-3d-tile.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 {TILE3D_TYPE} from '../constants';\nimport {getMagicString} from './helpers/parse-utils';\n\nimport {parsePointCloud3DTile} from './parse-3d-tile-point-cloud';\nimport {parseBatchedModel3DTile} from './parse-3d-tile-batched-model';\nimport {parseInstancedModel3DTile} from './parse-3d-tile-instanced-model';\nimport {parseComposite3DTile} from './parse-3d-tile-composite';\nimport {parseGltf3DTile} from './parse-3d-tile-gltf';\n\n// Extracts\nexport async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {\n // @ts-expect-error\n tile.byteOffset = byteOffset;\n // @ts-expect-error\n tile.type = getMagicString(arrayBuffer, byteOffset);\n\n // @ts-expect-error\n switch (tile.type) {\n case TILE3D_TYPE.COMPOSITE:\n // Note: We pass this function as argument so that embedded tiles can be parsed recursively\n return await parseComposite3DTile(\n tile,\n arrayBuffer,\n byteOffset,\n options,\n context,\n parse3DTile\n );\n\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.GLTF:\n return await parseGltf3DTile(tile, arrayBuffer, options, context);\n\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.POINT_CLOUD:\n return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n default:\n // @ts-expect-error\n throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line\n }\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,wBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AAAqD,SAG/BO,WAAWA,CAAAC,EAAA;EAAA,OAAAC,YAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,aAAA;EAAAA,YAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA1B,SAAAC,QAA2BC,WAAW;IAAA,IAAAC,UAAA;MAAAC,OAAA;MAAAC,OAAA;MAAAC,IAAA;MAAAC,KAAA,GAAAX,SAAA;IAAA,OAAAG,YAAA,CAAAD,OAAA,CAAAU,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAET,UAAU,GAAAI,KAAA,CAAAM,MAAA,QAAAN,KAAA,QAAAO,SAAA,GAAAP,KAAA,MAAG,CAAC;UAAEH,OAAO,GAAAG,KAAA,CAAAM,MAAA,OAAAN,KAAA,MAAAO,SAAA;UAAET,OAAO,GAAAE,KAAA,CAAAM,MAAA,OAAAN,KAAA,MAAA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iB,oDAAyB,EAACvB,IAAI,EAAEJ,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,CAAC;QAAA;UAAA,OAAAK,QAAA,CAAAe,MAAA,WAAAf,QAAA,CAAAgB,IAAA;QAAA;UAAAhB,QAAA,CAAAE,IAAA;UAAA,OAG1E,IAAAkB,4CAAqB,EAACxB,IAAI,EAAEJ,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,CAAC;QAAA;UAAA,OAAAK,QAAA,CAAAe,MAAA,WAAAf,QAAA,CAAAgB,IAAA;QAAA;UAAA,MAI7E,IAAIK,KAAK,+BAAAC,MAAA,CAA+B1B,IAAI,CAACS,IAAI,CAAE,CAAC;QAAA;QAAA;UAAA,OAAAL,QAAA,CAAAuB,IAAA;MAAA;IAAA,GAAAhC,OAAA;EAAA,CAE/D;EAAA,OAAAP,YAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
@@ -17,14 +17,12 @@ function convertS2BoundingVolumetoOBB(s2VolumeInfo) {
17
17
  maximumHeight: s2VolumeInfo.maximumHeight
18
18
  };
19
19
  var corners = (0, _index.getS2OrientedBoundingBoxCornerPoints)(token, heightInfo);
20
-
21
20
  var center = (0, _index.getS2LngLat)(token);
22
21
  var centerLng = center[0];
23
22
  var centerLat = center[1];
24
23
  var point = _geospatial.Ellipsoid.WGS84.cartographicToCartesian([centerLng, centerLat, heightInfo.maximumHeight]);
25
24
  var centerPointAdditional = new _core.Vector3(point[0], point[1], point[2]);
26
25
  corners.push(centerPointAdditional);
27
-
28
26
  var obb = (0, _culling.makeOrientedBoundingBoxFromPoints)(corners);
29
27
  var box = [].concat((0, _toConsumableArray2.default)(obb.center), (0, _toConsumableArray2.default)(obb.halfAxes));
30
28
  return box;
@@ -1 +1 @@
1
- {"version":3,"file":"s2-corners-to-obb.js","names":["convertS2BoundingVolumetoOBB","s2VolumeInfo","token","heightInfo","minimumHeight","maximumHeight","corners","getS2OrientedBoundingBoxCornerPoints","center","getS2LngLat","centerLng","centerLat","point","Ellipsoid","WGS84","cartographicToCartesian","centerPointAdditional","Vector3","push","obb","makeOrientedBoundingBoxFromPoints","box","halfAxes"],"sources":["../../../../../src/lib/utils/obb/s2-corners-to-obb.ts"],"sourcesContent":["import {Vector3} from '@math.gl/core';\nimport {OrientedBoundingBox, makeOrientedBoundingBoxFromPoints} from '@math.gl/culling';\n\nimport type {S2HeightInfo} from '../../utils/s2/index';\nimport {getS2OrientedBoundingBoxCornerPoints} from '../../utils/s2/index';\n\nimport {getS2LngLat} from '../../utils/s2/index';\nimport {Ellipsoid} from '@math.gl/geospatial';\n\nexport type S2VolumeInfo = {\n /** S2 key or token */\n token: string;\n /** minimum height in meters */\n minimumHeight: number;\n /** maximum height in meters */\n maximumHeight: number;\n};\n\n/**\n * Converts S2VolumeInfo to OrientedBoundingBox\n * @param {S2VolumeInfo} s2VolumeInfo - s2 volume to convert\n * @returns Oriented Bounding Box of type Box\n */\nexport function convertS2BoundingVolumetoOBB(s2VolumeInfo: S2VolumeInfo): number[] {\n const token: string = s2VolumeInfo.token;\n const heightInfo: S2HeightInfo = {\n minimumHeight: s2VolumeInfo.minimumHeight,\n maximumHeight: s2VolumeInfo.maximumHeight\n };\n\n const corners: Vector3[] = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);\n\n // Add a point that doesn't allow the box dive under the Earth\n\n const center = getS2LngLat(token);\n const centerLng: number = center[0];\n const centerLat: number = center[1];\n const point = Ellipsoid.WGS84.cartographicToCartesian([\n centerLng,\n centerLat,\n heightInfo.maximumHeight\n ]);\n const centerPointAdditional = new Vector3(point[0], point[1], point[2]);\n corners.push(centerPointAdditional);\n\n // corners should be an array of Vector3 (XYZ)\n const obb: OrientedBoundingBox = makeOrientedBoundingBoxFromPoints(corners);\n const box: number[] = [...obb.center, ...obb.halfAxes];\n\n return box;\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AAGA;AAGA;AAgBO,SAASA,4BAA4B,CAACC,YAA0B,EAAY;EACjF,IAAMC,KAAa,GAAGD,YAAY,CAACC,KAAK;EACxC,IAAMC,UAAwB,GAAG;IAC/BC,aAAa,EAAEH,YAAY,CAACG,aAAa;IACzCC,aAAa,EAAEJ,YAAY,CAACI;EAC9B,CAAC;EAED,IAAMC,OAAkB,GAAG,IAAAC,2CAAoC,EAACL,KAAK,EAAEC,UAAU,CAAC;;EAIlF,IAAMK,MAAM,GAAG,IAAAC,kBAAW,EAACP,KAAK,CAAC;EACjC,IAAMQ,SAAiB,GAAGF,MAAM,CAAC,CAAC,CAAC;EACnC,IAAMG,SAAiB,GAAGH,MAAM,CAAC,CAAC,CAAC;EACnC,IAAMI,KAAK,GAAGC,qBAAS,CAACC,KAAK,CAACC,uBAAuB,CAAC,CACpDL,SAAS,EACTC,SAAS,EACTR,UAAU,CAACE,aAAa,CACzB,CAAC;EACF,IAAMW,qBAAqB,GAAG,IAAIC,aAAO,CAACL,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,CAAC;EACvEN,OAAO,CAACY,IAAI,CAACF,qBAAqB,CAAC;;EAGnC,IAAMG,GAAwB,GAAG,IAAAC,0CAAiC,EAACd,OAAO,CAAC;EAC3E,IAAMe,GAAa,8CAAOF,GAAG,CAACX,MAAM,oCAAKW,GAAG,CAACG,QAAQ,EAAC;EAEtD,OAAOD,GAAG;AACZ"}
1
+ {"version":3,"file":"s2-corners-to-obb.js","names":["_core","require","_culling","_index","_geospatial","convertS2BoundingVolumetoOBB","s2VolumeInfo","token","heightInfo","minimumHeight","maximumHeight","corners","getS2OrientedBoundingBoxCornerPoints","center","getS2LngLat","centerLng","centerLat","point","Ellipsoid","WGS84","cartographicToCartesian","centerPointAdditional","Vector3","push","obb","makeOrientedBoundingBoxFromPoints","box","concat","_toConsumableArray2","default","halfAxes"],"sources":["../../../../../src/lib/utils/obb/s2-corners-to-obb.ts"],"sourcesContent":["import {Vector3} from '@math.gl/core';\nimport {OrientedBoundingBox, makeOrientedBoundingBoxFromPoints} from '@math.gl/culling';\n\nimport type {S2HeightInfo} from '../../utils/s2/index';\nimport {getS2OrientedBoundingBoxCornerPoints} from '../../utils/s2/index';\n\nimport {getS2LngLat} from '../../utils/s2/index';\nimport {Ellipsoid} from '@math.gl/geospatial';\n\nexport type S2VolumeInfo = {\n /** S2 key or token */\n token: string;\n /** minimum height in meters */\n minimumHeight: number;\n /** maximum height in meters */\n maximumHeight: number;\n};\n\n/**\n * Converts S2VolumeInfo to OrientedBoundingBox\n * @param {S2VolumeInfo} s2VolumeInfo - s2 volume to convert\n * @returns Oriented Bounding Box of type Box\n */\nexport function convertS2BoundingVolumetoOBB(s2VolumeInfo: S2VolumeInfo): number[] {\n const token: string = s2VolumeInfo.token;\n const heightInfo: S2HeightInfo = {\n minimumHeight: s2VolumeInfo.minimumHeight,\n maximumHeight: s2VolumeInfo.maximumHeight\n };\n\n const corners: Vector3[] = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);\n\n // Add a point that doesn't allow the box dive under the Earth\n\n const center = getS2LngLat(token);\n const centerLng: number = center[0];\n const centerLat: number = center[1];\n const point = Ellipsoid.WGS84.cartographicToCartesian([\n centerLng,\n centerLat,\n heightInfo.maximumHeight\n ]);\n const centerPointAdditional = new Vector3(point[0], point[1], point[2]);\n corners.push(centerPointAdditional);\n\n // corners should be an array of Vector3 (XYZ)\n const obb: OrientedBoundingBox = makeOrientedBoundingBoxFromPoints(corners);\n const box: number[] = [...obb.center, ...obb.halfAxes];\n\n return box;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AAgBO,SAASI,4BAA4BA,CAACC,YAA0B,EAAY;EACjF,IAAMC,KAAa,GAAGD,YAAY,CAACC,KAAK;EACxC,IAAMC,UAAwB,GAAG;IAC/BC,aAAa,EAAEH,YAAY,CAACG,aAAa;IACzCC,aAAa,EAAEJ,YAAY,CAACI;EAC9B,CAAC;EAED,IAAMC,OAAkB,GAAG,IAAAC,2CAAoC,EAACL,KAAK,EAAEC,UAAU,CAAC;EAIlF,IAAMK,MAAM,GAAG,IAAAC,kBAAW,EAACP,KAAK,CAAC;EACjC,IAAMQ,SAAiB,GAAGF,MAAM,CAAC,CAAC,CAAC;EACnC,IAAMG,SAAiB,GAAGH,MAAM,CAAC,CAAC,CAAC;EACnC,IAAMI,KAAK,GAAGC,qBAAS,CAACC,KAAK,CAACC,uBAAuB,CAAC,CACpDL,SAAS,EACTC,SAAS,EACTR,UAAU,CAACE,aAAa,CACzB,CAAC;EACF,IAAMW,qBAAqB,GAAG,IAAIC,aAAO,CAACL,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,CAAC;EACvEN,OAAO,CAACY,IAAI,CAACF,qBAAqB,CAAC;EAGnC,IAAMG,GAAwB,GAAG,IAAAC,0CAAiC,EAACd,OAAO,CAAC;EAC3E,IAAMe,GAAa,MAAAC,MAAA,KAAAC,mBAAA,CAAAC,OAAA,EAAOL,GAAG,CAACX,MAAM,OAAAe,mBAAA,CAAAC,OAAA,EAAKL,GAAG,CAACM,QAAQ,EAAC;EAEtD,OAAOJ,GAAG;AACZ"}
@@ -6,13 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getS2BoundaryFlatFromS2Cell = getS2BoundaryFlatFromS2Cell;
7
7
  var _s2Geometry = require("../s2geometry/s2-geometry");
8
8
  var MAX_RESOLUTION = 100;
9
-
10
9
  function getS2BoundaryFlatFromS2Cell(s2cell) {
11
10
  var face = s2cell.face,
12
11
  ij = s2cell.ij,
13
12
  level = s2cell.level;
14
13
  var offsets = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]];
15
-
16
14
  var resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));
17
15
  var result = new Float64Array(4 * resolution * 2 + 2);
18
16
  var ptIndex = 0;
@@ -29,7 +27,6 @@ function getS2BoundaryFlatFromS2Cell(s2cell) {
29
27
  var uv = (0, _s2Geometry.STToUV)(st);
30
28
  var xyz = (0, _s2Geometry.FaceUVToXYZ)(face, uv);
31
29
  var lngLat = (0, _s2Geometry.XYZToLngLat)(xyz);
32
-
33
30
  if (Math.abs(lngLat[1]) > 89.999) {
34
31
  lngLat[0] = prevLng;
35
32
  }