@cesium/engine 7.0.0 → 9.0.0

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 (200) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +1 -5
  2. package/Build/Workers/{chunk-7XEAYGZK.js → chunk-24YTYWNB.js} +10 -10
  3. package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2632RVPI.js} +7 -7
  4. package/Build/Workers/chunk-2KACWKS4.js +501 -0
  5. package/Build/Workers/{chunk-QZAD5O7I.js → chunk-2XPLH3JY.js} +7 -7
  6. package/Build/Workers/{chunk-JY5YEZFA.js → chunk-2ZBL3MVO.js} +8 -8
  7. package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-3NCVAGDA.js} +14 -14
  8. package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-5R6VWLMH.js} +6 -6
  9. package/Build/Workers/{chunk-PTQQUQC3.js → chunk-5TIV3L26.js} +13 -13
  10. package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-6WF3KIF5.js} +10 -10
  11. package/Build/Workers/{chunk-5WQ523AW.js → chunk-73FKKY52.js} +5 -5
  12. package/Build/Workers/{chunk-F6SE42BK.js → chunk-7COR472O.js} +15 -472
  13. package/Build/Workers/{chunk-72SANQJV.js → chunk-ADOVHYWO.js} +9 -5
  14. package/Build/Workers/{chunk-5YLJ77FF.js → chunk-BCU2LH5T.js} +12 -11
  15. package/Build/Workers/{chunk-4EBHOMFX.js → chunk-C3XBUYBO.js} +17 -17
  16. package/Build/Workers/{chunk-IX2JCCNM.js → chunk-C6OI26DR.js} +1 -1
  17. package/Build/Workers/{chunk-2HJWSU7B.js → chunk-CO35JNNE.js} +4 -4
  18. package/Build/Workers/{chunk-OVLG3FRS.js → chunk-DGDUKCJJ.js} +6 -6
  19. package/Build/Workers/{chunk-DTAIXKTO.js → chunk-DPUSFA7S.js} +6 -6
  20. package/Build/Workers/{chunk-R5X4OQT4.js → chunk-E6WXPSJS.js} +7 -7
  21. package/Build/Workers/{chunk-VK3EJHWI.js → chunk-EOXYZ34O.js} +2 -2
  22. package/Build/Workers/{chunk-RAEV7K66.js → chunk-EPKE7GE3.js} +5 -5
  23. package/Build/Workers/{chunk-GV56Q4LU.js → chunk-GFA4SMXV.js} +11 -11
  24. package/Build/Workers/{chunk-NKPBIX7F.js → chunk-GXUXEOE2.js} +1 -1
  25. package/Build/Workers/{chunk-NY3K4IM3.js → chunk-HBQPB6IH.js} +12 -12
  26. package/Build/Workers/{chunk-6HZQPRUS.js → chunk-I37B3MZ2.js} +1 -1
  27. package/Build/Workers/{chunk-VRGFV2UO.js → chunk-L4BW3RUA.js} +10 -10
  28. package/Build/Workers/{chunk-6VJVYK2V.js → chunk-LAQP3SCC.js} +2 -2
  29. package/Build/Workers/{chunk-PNBGBETF.js → chunk-LQJ5FFFR.js} +10 -10
  30. package/Build/Workers/{chunk-UAEW6HKG.js → chunk-M2AYBTNH.js} +13 -13
  31. package/Build/Workers/{chunk-YUCVWAY6.js → chunk-MWV7IZK4.js} +7 -7
  32. package/Build/Workers/{chunk-JXDC723O.js → chunk-N4KXMWQU.js} +2 -2
  33. package/Build/Workers/{chunk-XWXM2O2R.js → chunk-NP2GYYE5.js} +6 -6
  34. package/Build/Workers/{chunk-GEJTYLCO.js → chunk-NZWNZA6S.js} +5 -5
  35. package/Build/Workers/{chunk-LZGHD6NY.js → chunk-P2YAAMT2.js} +15 -15
  36. package/Build/Workers/{chunk-S6SKF6DT.js → chunk-P4XKB3QZ.js} +5 -5
  37. package/Build/Workers/{chunk-U2VCRRQW.js → chunk-PXB7T27O.js} +6 -6
  38. package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-QCQUZGXI.js} +4 -4
  39. package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-QKBGRKKG.js} +4 -4
  40. package/Build/Workers/{chunk-ODW7WYM4.js → chunk-RMOEYCZW.js} +2 -2
  41. package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-RSJXEO2A.js} +2 -2
  42. package/Build/Workers/{chunk-UDO6BFSF.js → chunk-RV7ZOSS6.js} +13 -13
  43. package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-SE4PXOEA.js} +17 -17
  44. package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-SS4ESNE3.js} +2 -2
  45. package/Build/Workers/{chunk-AIPU2VSX.js → chunk-TJBU6GML.js} +6 -6
  46. package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-TZORKRNK.js} +1 -1
  47. package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-VR5RBW52.js} +7 -7
  48. package/Build/Workers/{chunk-FP6GYBFX.js → chunk-WHUSTDIB.js} +10 -10
  49. package/Build/Workers/{chunk-5HDYHG3F.js → chunk-X2F6BEPY.js} +13 -13
  50. package/Build/Workers/{chunk-WZU2YLWG.js → chunk-X6XOMPWL.js} +3 -3
  51. package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YDVSBWEO.js} +1 -1
  52. package/Build/Workers/{chunk-46UD5ABS.js → chunk-YV4H2Y7M.js} +4 -4
  53. package/Build/Workers/{chunk-WBQCVXR3.js → chunk-Z7FQLK6N.js} +4 -4
  54. package/Build/Workers/{chunk-L2ZN645J.js → chunk-ZNVSKMQ2.js} +6 -6
  55. package/Build/Workers/{chunk-JCNXK6EL.js → chunk-ZYPTP7GS.js} +11 -11
  56. package/Build/Workers/combineGeometry.js +24 -23
  57. package/Build/Workers/createBoxGeometry.js +18 -17
  58. package/Build/Workers/createBoxOutlineGeometry.js +16 -15
  59. package/Build/Workers/createCircleGeometry.js +26 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +19 -18
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
  63. package/Build/Workers/createCorridorGeometry.js +29 -28
  64. package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
  65. package/Build/Workers/createCylinderGeometry.js +20 -19
  66. package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
  67. package/Build/Workers/createEllipseGeometry.js +26 -25
  68. package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
  69. package/Build/Workers/createEllipsoidGeometry.js +19 -18
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
  71. package/Build/Workers/createFrustumGeometry.js +18 -17
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
  73. package/Build/Workers/createGeometry.js +54 -33
  74. package/Build/Workers/createGroundPolylineGeometry.js +22 -21
  75. package/Build/Workers/createPlaneGeometry.js +16 -15
  76. package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
  77. package/Build/Workers/createPolygonGeometry.js +33 -32
  78. package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
  79. package/Build/Workers/createPolylineGeometry.js +25 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
  82. package/Build/Workers/createRectangleGeometry.js +27 -26
  83. package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +23 -22
  85. package/Build/Workers/createSphereGeometry.js +19 -18
  86. package/Build/Workers/createSphereOutlineGeometry.js +18 -17
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  89. package/Build/Workers/createVectorTileGeometries.js +24 -23
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +22 -21
  92. package/Build/Workers/createVectorTilePolylines.js +14 -14
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +22 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
  96. package/Build/Workers/createWallGeometry.js +24 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +23 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +601 -92
  101. package/Build/Workers/transcodeKTX2.js +7 -7
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
  104. package/Source/Core/Check.d.ts +127 -0
  105. package/Source/Core/Check.js +0 -1
  106. package/Source/Core/Ellipsoid.js +6 -0
  107. package/Source/Core/Geometry.js +1 -1
  108. package/Source/Core/IntersectionTests.js +6 -3
  109. package/Source/Core/Ion.js +1 -1
  110. package/Source/Core/PixelFormat.js +5 -0
  111. package/Source/Core/PolygonGeometry.js +1 -1
  112. package/Source/Core/Transforms.js +3 -0
  113. package/Source/Core/VerticalExaggeration.js +2 -1
  114. package/Source/Core/srgbToLinear.js +32 -0
  115. package/Source/DataSources/CzmlDataSource.js +51 -23
  116. package/Source/DataSources/DataSourceDisplay.js +27 -0
  117. package/Source/DataSources/Entity.js +20 -2
  118. package/Source/DataSources/GeometryUpdaterSet.js +114 -0
  119. package/Source/DataSources/GeometryVisualizer.js +19 -83
  120. package/Source/Renderer/Context.js +10 -0
  121. package/Source/Renderer/ContextLimits.js +2 -0
  122. package/Source/Renderer/demodernizeShader.js +4 -1
  123. package/Source/Scene/ArcGisMapService.js +1 -1
  124. package/Source/Scene/Axis.js +12 -7
  125. package/Source/Scene/Billboard.js +32 -0
  126. package/Source/Scene/BillboardCollection.js +1 -1
  127. package/Source/Scene/BingMapsImageryProvider.js +4 -0
  128. package/Source/Scene/Camera.js +46 -4
  129. package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
  130. package/Source/Scene/Cesium3DTileset.js +10 -7
  131. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
  132. package/Source/Scene/FrameState.js +5 -0
  133. package/Source/Scene/Globe.js +0 -67
  134. package/Source/Scene/GlobeTranslucencyState.js +1 -1
  135. package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
  136. package/Source/Scene/I3SDataProvider.js +270 -53
  137. package/Source/Scene/I3SDecoder.js +8 -1
  138. package/Source/Scene/I3SFeature.js +2 -5
  139. package/Source/Scene/I3SField.js +136 -31
  140. package/Source/Scene/I3SGeometry.js +70 -2
  141. package/Source/Scene/I3SLayer.js +55 -10
  142. package/Source/Scene/I3SNode.js +175 -18
  143. package/Source/Scene/I3SStatistics.js +94 -0
  144. package/Source/Scene/I3SSublayer.js +176 -0
  145. package/Source/Scene/I3SSymbology.js +337 -0
  146. package/Source/Scene/KeyframeNode.js +1 -1
  147. package/Source/Scene/Label.js +33 -0
  148. package/Source/Scene/LabelCollection.js +2 -1
  149. package/Source/Scene/Model/pickModel.js +25 -7
  150. package/Source/Scene/PickFramebuffer.js +37 -2
  151. package/Source/Scene/Picking.js +113 -39
  152. package/Source/Scene/Primitive.js +6 -5
  153. package/Source/Scene/Scene.js +126 -42
  154. package/Source/Scene/ScreenSpaceCameraController.js +21 -7
  155. package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
  156. package/Source/Scene/SpatialNode.js +12 -19
  157. package/Source/Scene/StructuralMetadata.js +1 -1
  158. package/Source/Scene/VoxelBoxShape.js +67 -6
  159. package/Source/Scene/VoxelCell.js +273 -0
  160. package/Source/Scene/VoxelCylinderShape.js +117 -163
  161. package/Source/Scene/VoxelEllipsoidShape.js +255 -304
  162. package/Source/Scene/VoxelPrimitive.js +109 -15
  163. package/Source/Scene/VoxelRenderResources.js +12 -3
  164. package/Source/Scene/VoxelShape.js +7 -4
  165. package/Source/Scene/VoxelTraversal.js +76 -54
  166. package/Source/Scene/buildVoxelDrawCommands.js +23 -0
  167. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
  168. package/Source/Scene/processVoxelProperties.js +3 -0
  169. package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
  170. package/Source/Shaders/Voxels/IntersectBox.js +21 -47
  171. package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
  172. package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
  173. package/Source/Shaders/Voxels/IntersectCylinder.glsl +76 -203
  174. package/Source/Shaders/Voxels/IntersectCylinder.js +76 -203
  175. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +220 -229
  176. package/Source/Shaders/Voxels/IntersectEllipsoid.js +220 -229
  177. package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
  178. package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
  179. package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
  180. package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
  181. package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
  182. package/Source/Shaders/Voxels/Megatexture.js +1 -2
  183. package/Source/Shaders/Voxels/Octree.glsl +14 -9
  184. package/Source/Shaders/Voxels/Octree.js +14 -9
  185. package/Source/Shaders/Voxels/VoxelFS.glsl +128 -40
  186. package/Source/Shaders/Voxels/VoxelFS.js +128 -40
  187. package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
  188. package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
  189. package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
  190. package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
  191. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +64 -40
  192. package/Source/Shaders/Voxels/convertUvToCylinder.js +64 -40
  193. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +100 -91
  194. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +100 -91
  195. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  196. package/Source/Workers/createGeometry.js +40 -11
  197. package/Source/Workers/decodeI3S.js +720 -94
  198. package/index.d.ts +542 -40
  199. package/index.js +75 -66
  200. package/package.json +2 -2
@@ -236,30 +236,38 @@ let scratchRectangle = new BoundingRectangle(
236
236
  const scratchPosition = new Cartesian2();
237
237
  const scratchColorZero = new Color(0.0, 0.0, 0.0, 0.0);
238
238
 
239
+ /**
240
+ * Returns an object with a <code>primitive</code> property that contains the first (top) primitive in the scene
241
+ * at a particular window coordinate or undefined if nothing is at the location. Other properties may
242
+ * potentially be set depending on the type of primitive and may be used to further identify the picked object.
243
+ * <p>
244
+ * When a feature of a 3D Tiles tileset is picked, <code>pick</code> returns a {@link Cesium3DTileFeature} object.
245
+ * </p>
246
+ * @param {Scene} scene
247
+ * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
248
+ * @param {number} [width=3] Width of the pick rectangle.
249
+ * @param {number} [height=3] Height of the pick rectangle.
250
+ * @returns {object} Object containing the picked primitive.
251
+ */
239
252
  Picking.prototype.pick = function (scene, windowPosition, width, height) {
240
253
  //>>includeStart('debug', pragmas.debug);
241
- if (!defined(windowPosition)) {
242
- throw new DeveloperError("windowPosition is undefined.");
243
- }
254
+ Check.defined("windowPosition", windowPosition);
244
255
  //>>includeEnd('debug');
245
256
 
246
257
  scratchRectangleWidth = defaultValue(width, 3.0);
247
258
  scratchRectangleHeight = defaultValue(height, scratchRectangleWidth);
248
259
 
249
- const context = scene.context;
250
- const us = context.uniformState;
251
- const frameState = scene.frameState;
260
+ const { context, frameState, defaultView } = scene;
261
+ const { viewport, pickFramebuffer } = defaultView;
252
262
 
253
- const view = scene.defaultView;
254
- scene.view = view;
263
+ scene.view = defaultView;
255
264
 
256
- const viewport = view.viewport;
257
265
  viewport.x = 0;
258
266
  viewport.y = 0;
259
267
  viewport.width = context.drawingBufferWidth;
260
268
  viewport.height = context.drawingBufferHeight;
261
269
 
262
- let passState = view.passState;
270
+ let passState = defaultView.passState;
263
271
  passState.viewport = BoundingRectangle.clone(viewport, passState.viewport);
264
272
 
265
273
  const drawingBufferPosition = SceneTransforms.transformWindowToDrawingBuffer(
@@ -282,7 +290,7 @@ Picking.prototype.pick = function (scene, windowPosition, width, height) {
282
290
  frameState.passes.pick = true;
283
291
  frameState.tilesetPassState = pickTilesetPassState;
284
292
 
285
- us.update(frameState);
293
+ context.uniformState.update(frameState);
286
294
 
287
295
  scene.updateEnvironment();
288
296
 
@@ -294,32 +302,108 @@ Picking.prototype.pick = function (scene, windowPosition, width, height) {
294
302
  (scratchRectangleHeight - 1.0) * 0.5;
295
303
  scratchRectangle.width = scratchRectangleWidth;
296
304
  scratchRectangle.height = scratchRectangleHeight;
297
- passState = view.pickFramebuffer.begin(scratchRectangle, view.viewport);
305
+ passState = pickFramebuffer.begin(scratchRectangle, viewport);
298
306
 
299
307
  scene.updateAndExecuteCommands(passState, scratchColorZero);
300
308
  scene.resolveFramebuffers(passState);
301
309
 
302
- const object = view.pickFramebuffer.end(scratchRectangle);
310
+ const object = pickFramebuffer.end(scratchRectangle);
303
311
  context.endFrame();
304
312
  return object;
305
313
  };
306
314
 
315
+ /**
316
+ * Returns an object with information about the voxel sample rendered at
317
+ * a particular window coordinate. Returns <code>undefined</code> if there is no
318
+ * voxel at that position.
319
+ *
320
+ * @param {Scene} scene
321
+ * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
322
+ * @param {number} [width=3] Width of the pick rectangle.
323
+ * @param {number} [height=3] Height of the pick rectangle.
324
+ * @returns {object|undefined} Object containing the picked primitive.
325
+ */
326
+ Picking.prototype.pickVoxelCoordinate = function (
327
+ scene,
328
+ windowPosition,
329
+ width,
330
+ height
331
+ ) {
332
+ //>>includeStart('debug', pragmas.debug);
333
+ Check.defined("windowPosition", windowPosition);
334
+ //>>includeEnd('debug');
335
+
336
+ scratchRectangleWidth = defaultValue(width, 3.0);
337
+ scratchRectangleHeight = defaultValue(height, scratchRectangleWidth);
338
+
339
+ const { context, frameState, defaultView } = scene;
340
+ const { viewport, pickFramebuffer } = defaultView;
341
+
342
+ scene.view = defaultView;
343
+
344
+ viewport.x = 0;
345
+ viewport.y = 0;
346
+ viewport.width = context.drawingBufferWidth;
347
+ viewport.height = context.drawingBufferHeight;
348
+
349
+ let passState = defaultView.passState;
350
+ passState.viewport = BoundingRectangle.clone(viewport, passState.viewport);
351
+
352
+ const drawingBufferPosition = SceneTransforms.transformWindowToDrawingBuffer(
353
+ scene,
354
+ windowPosition,
355
+ scratchPosition
356
+ );
357
+
358
+ scene.jobScheduler.disableThisFrame();
359
+
360
+ scene.updateFrameState();
361
+ frameState.cullingVolume = getPickCullingVolume(
362
+ scene,
363
+ drawingBufferPosition,
364
+ scratchRectangleWidth,
365
+ scratchRectangleHeight,
366
+ viewport
367
+ );
368
+ frameState.invertClassification = false;
369
+ frameState.passes.pickVoxel = true;
370
+ frameState.tilesetPassState = pickTilesetPassState;
371
+
372
+ context.uniformState.update(frameState);
373
+
374
+ scene.updateEnvironment();
375
+
376
+ scratchRectangle.x =
377
+ drawingBufferPosition.x - (scratchRectangleWidth - 1.0) * 0.5;
378
+ scratchRectangle.y =
379
+ scene.drawingBufferHeight -
380
+ drawingBufferPosition.y -
381
+ (scratchRectangleHeight - 1.0) * 0.5;
382
+ scratchRectangle.width = scratchRectangleWidth;
383
+ scratchRectangle.height = scratchRectangleHeight;
384
+ passState = pickFramebuffer.begin(scratchRectangle, viewport);
385
+
386
+ scene.updateAndExecuteCommands(passState, scratchColorZero);
387
+ scene.resolveFramebuffers(passState);
388
+
389
+ const voxelInfo = pickFramebuffer.readVoxelInfo(scratchRectangle);
390
+ context.endFrame();
391
+ return voxelInfo;
392
+ };
393
+
307
394
  function renderTranslucentDepthForPick(scene, drawingBufferPosition) {
308
395
  // PERFORMANCE_IDEA: render translucent only and merge with the previous frame
309
- const context = scene.context;
310
- const frameState = scene.frameState;
311
- const environmentState = scene.environmentState;
396
+ const { defaultView, context, frameState, environmentState } = scene;
397
+ const { viewport, pickDepthFramebuffer } = defaultView;
312
398
 
313
- const view = scene.defaultView;
314
- scene.view = view;
399
+ scene.view = defaultView;
315
400
 
316
- const viewport = view.viewport;
317
401
  viewport.x = 0;
318
402
  viewport.y = 0;
319
403
  viewport.width = context.drawingBufferWidth;
320
404
  viewport.height = context.drawingBufferHeight;
321
405
 
322
- let passState = view.passState;
406
+ let passState = defaultView.passState;
323
407
  passState.viewport = BoundingRectangle.clone(viewport, passState.viewport);
324
408
 
325
409
  scene.clearPasses(frameState.passes);
@@ -336,7 +420,7 @@ function renderTranslucentDepthForPick(scene, drawingBufferPosition) {
336
420
 
337
421
  scene.updateEnvironment();
338
422
  environmentState.renderTranslucentDepthForPick = true;
339
- passState = view.pickDepthFramebuffer.update(
423
+ passState = pickDepthFramebuffer.update(
340
424
  context,
341
425
  drawingBufferPosition,
342
426
  viewport
@@ -363,9 +447,7 @@ Picking.prototype.pickPositionWorldCoordinates = function (
363
447
  }
364
448
 
365
449
  //>>includeStart('debug', pragmas.debug);
366
- if (!defined(windowPosition)) {
367
- throw new DeveloperError("windowPosition is undefined.");
368
- }
450
+ Check.defined("windowPosition", windowPosition);
369
451
  if (!scene.context.depthTexture) {
370
452
  throw new DeveloperError(
371
453
  "Picking from the depth buffer is not supported. Check pickPositionSupported."
@@ -382,12 +464,10 @@ Picking.prototype.pickPositionWorldCoordinates = function (
382
464
  return Cartesian3.clone(this._pickPositionCache[cacheKey], result);
383
465
  }
384
466
 
385
- const frameState = scene.frameState;
386
- const context = scene.context;
387
- const uniformState = context.uniformState;
467
+ const { context, frameState, camera, defaultView } = scene;
468
+ const { uniformState } = context;
388
469
 
389
- const view = scene.defaultView;
390
- scene.view = view;
470
+ scene.view = defaultView;
391
471
 
392
472
  const drawingBufferPosition = SceneTransforms.transformWindowToDrawingBuffer(
393
473
  scene,
@@ -403,8 +483,6 @@ Picking.prototype.pickPositionWorldCoordinates = function (
403
483
  }
404
484
  drawingBufferPosition.y = scene.drawingBufferHeight - drawingBufferPosition.y;
405
485
 
406
- const camera = scene.camera;
407
-
408
486
  // Create a working frustum from the original camera frustum.
409
487
  let frustum;
410
488
  if (defined(camera.frustum.fov)) {
@@ -417,7 +495,7 @@ Picking.prototype.pickPositionWorldCoordinates = function (
417
495
  frustum = camera.frustum.clone(scratchOrthographicOffCenterFrustum);
418
496
  }
419
497
 
420
- const frustumCommandsList = view.frustumCommandsList;
498
+ const frustumCommandsList = defaultView.frustumCommandsList;
421
499
  const numFrustums = frustumCommandsList.length;
422
500
  for (let i = 0; i < numFrustums; ++i) {
423
501
  const pickDepth = this.getPickDepth(scene, i);
@@ -636,9 +714,7 @@ function updateOffscreenCameraFromRay(picking, ray, width, camera) {
636
714
  function updateMostDetailedRayPick(picking, scene, rayPick) {
637
715
  const frameState = scene.frameState;
638
716
 
639
- const ray = rayPick.ray;
640
- const width = rayPick.width;
641
- const tilesets = rayPick.tilesets;
717
+ const { ray, width, tilesets } = rayPick;
642
718
 
643
719
  const camera = picking._pickOffscreenView.camera;
644
720
  const cullingVolume = updateOffscreenCameraFromRay(
@@ -682,8 +758,7 @@ Picking.prototype.updateMostDetailedRayPicks = function (scene) {
682
758
  };
683
759
 
684
760
  function getTilesets(primitives, objectsToExclude, tilesets) {
685
- const length = primitives.length;
686
- for (let i = 0; i < length; ++i) {
761
+ for (let i = 0; i < primitives.length; ++i) {
687
762
  const primitive = primitives.get(i);
688
763
  if (primitive.show) {
689
764
  if (defined(primitive.isCesium3DTileset)) {
@@ -745,9 +820,8 @@ function getRayIntersection(
745
820
  requirePosition,
746
821
  mostDetailed
747
822
  ) {
748
- const context = scene.context;
823
+ const { context, frameState } = scene;
749
824
  const uniformState = context.uniformState;
750
- const frameState = scene.frameState;
751
825
 
752
826
  const view = picking._pickOffscreenView;
753
827
  scene.view = view;
@@ -1174,15 +1174,19 @@ function loadAsynchronous(primitive, frameState) {
1174
1174
  instanceIds.push(instances[i].id);
1175
1175
 
1176
1176
  //>>includeStart('debug', pragmas.debug);
1177
- if (!defined(geometry._workerName)) {
1177
+ if (
1178
+ (defined(geometry._workerName) && defined(geometry._workerPath)) ||
1179
+ (!defined(geometry._workerName) && !defined(geometry._workerPath))
1180
+ ) {
1178
1181
  throw new DeveloperError(
1179
- "_workerName must be defined for asynchronous geometry."
1182
+ "Must define either _workerName or _workerPath for asynchronous geometry."
1180
1183
  );
1181
1184
  }
1182
1185
  //>>includeEnd('debug');
1183
1186
 
1184
1187
  subTasks.push({
1185
1188
  moduleName: geometry._workerName,
1189
+ modulePath: geometry._workerPath,
1186
1190
  geometry: geometry,
1187
1191
  });
1188
1192
  }
@@ -2511,9 +2515,6 @@ function setReady(primitive, frameState, state, error) {
2511
2515
  primitive._ready =
2512
2516
  primitive._state === PrimitiveState.COMPLETE ||
2513
2517
  primitive._state === PrimitiveState.FAILED;
2514
- if (!defined(error)) {
2515
- return true;
2516
- }
2517
2518
  });
2518
2519
  }
2519
2520
  export default Primitive;
@@ -73,6 +73,8 @@ import SunPostProcess from "./SunPostProcess.js";
73
73
  import TweenCollection from "./TweenCollection.js";
74
74
  import View from "./View.js";
75
75
  import DebugInspector from "./DebugInspector.js";
76
+ import VoxelCell from "./VoxelCell.js";
77
+ import VoxelPrimitive from "./VoxelPrimitive.js";
76
78
 
77
79
  const requestRenderAfterFrame = function (scene) {
78
80
  return function () {
@@ -167,10 +169,11 @@ function Scene(options) {
167
169
  this._groundPrimitives = new PrimitiveCollection();
168
170
 
169
171
  this._globeHeight = undefined;
170
- this._globeHeightDirty = undefined;
172
+ this._globeHeightDirty = true;
171
173
  this._cameraUnderground = false;
174
+ this._removeUpdateHeightCallback = undefined;
172
175
 
173
- this._logDepthBuffer = context.fragmentDepth;
176
+ this._logDepthBuffer = Scene.defaultLogDepthBuffer && context.fragmentDepth;
174
177
  this._logDepthBufferDirty = true;
175
178
 
176
179
  this._tweens = new TweenCollection();
@@ -732,6 +735,12 @@ function Scene(options) {
732
735
  this.initializeFrame();
733
736
  }
734
737
 
738
+ /**
739
+ * Use this to set the default value for {@link Scene#logarithmicDepthBuffer} in newly constructed Scenes
740
+ * This property relies on fragmentDepth being supported.
741
+ */
742
+ Scene.defaultLogDepthBuffer = true;
743
+
735
744
  function updateGlobeListeners(scene, globe) {
736
745
  for (let i = 0; i < scene._removeGlobeCallbacks.length; ++i) {
737
746
  scene._removeGlobeCallbacks[i]();
@@ -750,11 +759,6 @@ function updateGlobeListeners(scene, globe) {
750
759
  requestRenderAfterFrame(scene)
751
760
  )
752
761
  );
753
- removeGlobeCallbacks.push(
754
- globe.tileLoadProgressEvent.addEventListener(() => {
755
- scene._globeHeightDirty = true;
756
- })
757
- );
758
762
  }
759
763
  scene._removeGlobeCallbacks = removeGlobeCallbacks;
760
764
  }
@@ -1866,10 +1870,12 @@ function getOccluder(scene) {
1866
1870
 
1867
1871
  /**
1868
1872
  * @private
1873
+ * @param {FrameState.Passes} passes
1869
1874
  */
1870
1875
  Scene.prototype.clearPasses = function (passes) {
1871
1876
  passes.render = false;
1872
1877
  passes.pick = false;
1878
+ passes.pickVoxel = false;
1873
1879
  passes.depth = false;
1874
1880
  passes.postProcess = false;
1875
1881
  passes.offscreen = false;
@@ -2128,6 +2134,7 @@ function executeCommand(command, scene, context, passState, debugFramebuffer) {
2128
2134
  const passes = frameState.passes;
2129
2135
  if (
2130
2136
  !passes.pick &&
2137
+ !passes.pickVoxel &&
2131
2138
  !passes.depth &&
2132
2139
  scene._hdr &&
2133
2140
  defined(command.derivedCommands) &&
@@ -2281,12 +2288,10 @@ const scratchOrthographicFrustum = new OrthographicFrustum();
2281
2288
  const scratchOrthographicOffCenterFrustum = new OrthographicOffCenterFrustum();
2282
2289
 
2283
2290
  function executeCommands(scene, passState) {
2284
- const camera = scene.camera;
2285
- const context = scene.context;
2286
- const frameState = scene.frameState;
2287
- const us = context.uniformState;
2291
+ const { camera, context, frameState } = scene;
2292
+ const { uniformState } = context;
2288
2293
 
2289
- us.updateCamera(camera);
2294
+ uniformState.updateCamera(camera);
2290
2295
 
2291
2296
  // Create a working frustum from the original camera frustum.
2292
2297
  let frustum;
@@ -2304,11 +2309,11 @@ function executeCommands(scene, passState) {
2304
2309
  // early-z, but we would have to draw it in each frustum
2305
2310
  frustum.near = camera.frustum.near;
2306
2311
  frustum.far = camera.frustum.far;
2307
- us.updateFrustum(frustum);
2308
- us.updatePass(Pass.ENVIRONMENT);
2312
+ uniformState.updateFrustum(frustum);
2313
+ uniformState.updatePass(Pass.ENVIRONMENT);
2309
2314
 
2310
2315
  const passes = frameState.passes;
2311
- const picking = passes.pick;
2316
+ const picking = passes.pick || passes.pickVoxel;
2312
2317
  const environmentState = scene._environmentState;
2313
2318
  const view = scene._view;
2314
2319
  const renderTranslucentDepthForPick =
@@ -2410,8 +2415,8 @@ function executeCommands(scene, passState) {
2410
2415
  camera.position.z = height2D - frustumCommands.near + 1.0;
2411
2416
  frustum.far = Math.max(1.0, frustumCommands.far - frustumCommands.near);
2412
2417
  frustum.near = 1.0;
2413
- us.update(frameState);
2414
- us.updateFrustum(frustum);
2418
+ uniformState.update(frameState);
2419
+ uniformState.updateFrustum(frustum);
2415
2420
  } else {
2416
2421
  // Avoid tearing artifacts between adjacent frustums in the opaque passes
2417
2422
  frustum.near =
@@ -2419,7 +2424,7 @@ function executeCommands(scene, passState) {
2419
2424
  ? frustumCommands.near * scene.opaqueFrustumNearOffset
2420
2425
  : frustumCommands.near;
2421
2426
  frustum.far = frustumCommands.far;
2422
- us.updateFrustum(frustum);
2427
+ uniformState.updateFrustum(frustum);
2423
2428
  }
2424
2429
 
2425
2430
  clearDepth.execute(context, passState);
@@ -2428,7 +2433,7 @@ function executeCommands(scene, passState) {
2428
2433
  clearStencil.execute(context, passState);
2429
2434
  }
2430
2435
 
2431
- us.updatePass(Pass.GLOBE);
2436
+ uniformState.updatePass(Pass.GLOBE);
2432
2437
  let commands = frustumCommands.commands[Pass.GLOBE];
2433
2438
  let length = frustumCommands.indices[Pass.GLOBE];
2434
2439
 
@@ -2453,7 +2458,7 @@ function executeCommands(scene, passState) {
2453
2458
 
2454
2459
  // Draw terrain classification
2455
2460
  if (!environmentState.renderTranslucentDepthForPick) {
2456
- us.updatePass(Pass.TERRAIN_CLASSIFICATION);
2461
+ uniformState.updatePass(Pass.TERRAIN_CLASSIFICATION);
2457
2462
  commands = frustumCommands.commands[Pass.TERRAIN_CLASSIFICATION];
2458
2463
  length = frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION];
2459
2464
 
@@ -2487,7 +2492,7 @@ function executeCommands(scene, passState) {
2487
2492
  // Common/fastest path. Draw 3D Tiles and classification normally.
2488
2493
 
2489
2494
  // Draw 3D Tiles
2490
- us.updatePass(Pass.CESIUM_3D_TILE);
2495
+ uniformState.updatePass(Pass.CESIUM_3D_TILE);
2491
2496
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2492
2497
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2493
2498
  for (j = 0; j < length; ++j) {
@@ -2509,7 +2514,7 @@ function executeCommands(scene, passState) {
2509
2514
 
2510
2515
  // Draw classifications. Modifies 3D Tiles color.
2511
2516
  if (!environmentState.renderTranslucentDepthForPick) {
2512
- us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2517
+ uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2513
2518
  commands =
2514
2519
  frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2515
2520
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION];
@@ -2557,7 +2562,7 @@ function executeCommands(scene, passState) {
2557
2562
  passState.framebuffer = scene._invertClassification._fbo.framebuffer;
2558
2563
 
2559
2564
  // Draw normally
2560
- us.updatePass(Pass.CESIUM_3D_TILE);
2565
+ uniformState.updatePass(Pass.CESIUM_3D_TILE);
2561
2566
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2562
2567
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2563
2568
  for (j = 0; j < length; ++j) {
@@ -2575,7 +2580,7 @@ function executeCommands(scene, passState) {
2575
2580
  }
2576
2581
 
2577
2582
  // Set stencil
2578
- us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW);
2583
+ uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW);
2579
2584
  commands =
2580
2585
  frustumCommands.commands[
2581
2586
  Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW
@@ -2601,7 +2606,7 @@ function executeCommands(scene, passState) {
2601
2606
  }
2602
2607
 
2603
2608
  // Draw style over classification.
2604
- us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2609
+ uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2605
2610
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2606
2611
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2607
2612
  for (j = 0; j < length; ++j) {
@@ -2613,13 +2618,13 @@ function executeCommands(scene, passState) {
2613
2618
  clearStencil.execute(context, passState);
2614
2619
  }
2615
2620
 
2616
- us.updatePass(Pass.VOXELS);
2621
+ uniformState.updatePass(Pass.VOXELS);
2617
2622
  commands = frustumCommands.commands[Pass.VOXELS];
2618
2623
  length = frustumCommands.indices[Pass.VOXELS];
2619
2624
  commands.length = length;
2620
2625
  executeVoxelCommands(scene, executeCommand, passState, commands);
2621
2626
 
2622
- us.updatePass(Pass.OPAQUE);
2627
+ uniformState.updatePass(Pass.OPAQUE);
2623
2628
  commands = frustumCommands.commands[Pass.OPAQUE];
2624
2629
  length = frustumCommands.indices[Pass.OPAQUE];
2625
2630
  for (j = 0; j < length; ++j) {
@@ -2629,7 +2634,7 @@ function executeCommands(scene, passState) {
2629
2634
  if (index !== 0 && scene.mode !== SceneMode.SCENE2D) {
2630
2635
  // Do not overlap frustums in the translucent pass to avoid blending artifacts
2631
2636
  frustum.near = frustumCommands.near;
2632
- us.updateFrustum(frustum);
2637
+ uniformState.updateFrustum(frustum);
2633
2638
  }
2634
2639
 
2635
2640
  let invertClassification;
@@ -2643,7 +2648,7 @@ function executeCommands(scene, passState) {
2643
2648
  invertClassification = scene._invertClassification;
2644
2649
  }
2645
2650
 
2646
- us.updatePass(Pass.TRANSLUCENT);
2651
+ uniformState.updatePass(Pass.TRANSLUCENT);
2647
2652
  commands = frustumCommands.commands[Pass.TRANSLUCENT];
2648
2653
  commands.length = frustumCommands.indices[Pass.TRANSLUCENT];
2649
2654
  executeTranslucentCommands(
@@ -2702,9 +2707,9 @@ function executeCommands(scene, passState) {
2702
2707
  ? frustumCommands.near * scene.opaqueFrustumNearOffset
2703
2708
  : frustumCommands.near;
2704
2709
  frustum.far = frustumCommands.far;
2705
- us.updateFrustum(frustum);
2710
+ uniformState.updateFrustum(frustum);
2706
2711
 
2707
- us.updatePass(Pass.GLOBE);
2712
+ uniformState.updatePass(Pass.GLOBE);
2708
2713
  commands = frustumCommands.commands[Pass.GLOBE];
2709
2714
  length = frustumCommands.indices[Pass.GLOBE];
2710
2715
 
@@ -2732,21 +2737,21 @@ function executeCommands(scene, passState) {
2732
2737
  depthPlane.execute(context, passState);
2733
2738
  }
2734
2739
 
2735
- us.updatePass(Pass.CESIUM_3D_TILE);
2740
+ uniformState.updatePass(Pass.CESIUM_3D_TILE);
2736
2741
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2737
2742
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2738
2743
  for (j = 0; j < length; ++j) {
2739
2744
  executeIdCommand(commands[j], scene, context, passState);
2740
2745
  }
2741
2746
 
2742
- us.updatePass(Pass.OPAQUE);
2747
+ uniformState.updatePass(Pass.OPAQUE);
2743
2748
  commands = frustumCommands.commands[Pass.OPAQUE];
2744
2749
  length = frustumCommands.indices[Pass.OPAQUE];
2745
2750
  for (j = 0; j < length; ++j) {
2746
2751
  executeIdCommand(commands[j], scene, context, passState);
2747
2752
  }
2748
2753
 
2749
- us.updatePass(Pass.TRANSLUCENT);
2754
+ uniformState.updatePass(Pass.TRANSLUCENT);
2750
2755
  commands = frustumCommands.commands[Pass.TRANSLUCENT];
2751
2756
  length = frustumCommands.indices[Pass.TRANSLUCENT];
2752
2757
  for (j = 0; j < length; ++j) {
@@ -3337,7 +3342,10 @@ function updateShadowMaps(scene) {
3337
3342
  const length = shadowMaps.length;
3338
3343
 
3339
3344
  const shadowsEnabled =
3340
- length > 0 && !frameState.passes.pick && scene.mode === SceneMode.SCENE3D;
3345
+ length > 0 &&
3346
+ !frameState.passes.pick &&
3347
+ !frameState.passes.pickVoxel &&
3348
+ scene.mode === SceneMode.SCENE3D;
3341
3349
  if (shadowsEnabled !== frameState.shadowState.shadowsEnabled) {
3342
3350
  // Update derived commands when shadowsEnabled changes
3343
3351
  ++frameState.shadowState.lastDirtyTime;
@@ -3401,7 +3409,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3401
3409
  const view = scene._view;
3402
3410
 
3403
3411
  const passes = scene._frameState.passes;
3404
- const picking = passes.pick;
3412
+ const picking = passes.pick || passes.pickVoxel;
3405
3413
  if (defined(view.globeDepth)) {
3406
3414
  view.globeDepth.picking = picking;
3407
3415
  }
@@ -3662,7 +3670,7 @@ Scene.prototype.getHeight = function (cartographic, heightReference) {
3662
3670
  if (
3663
3671
  !primitive.isCesium3DTileset ||
3664
3672
  !primitive.show ||
3665
- primitive.disableCollision
3673
+ !primitive.enableCollision
3666
3674
  ) {
3667
3675
  continue;
3668
3676
  }
@@ -3741,8 +3749,8 @@ Scene.prototype.updateHeight = function (
3741
3749
  const createPrimitiveEventListener = (primitive) => {
3742
3750
  if (
3743
3751
  ignore3dTiles ||
3744
- !primitive.isCesium3DTileset ||
3745
- primitive.disableCollision
3752
+ primitive.isDestroyed() ||
3753
+ !primitive.isCesium3DTileset
3746
3754
  ) {
3747
3755
  return;
3748
3756
  }
@@ -3768,11 +3776,12 @@ Scene.prototype.updateHeight = function (
3768
3776
  );
3769
3777
  const removeRemovedListener = this.primitives.primitiveRemoved.addEventListener(
3770
3778
  (primitive) => {
3771
- if (!primitive.isCesium3DTileset) {
3779
+ if (primitive.isDestroyed() || !primitive.isCesium3DTileset) {
3772
3780
  return;
3773
3781
  }
3774
-
3775
- tilesetRemoveCallbacks[primitive.id]();
3782
+ if (defined(tilesetRemoveCallbacks[primitive.id])) {
3783
+ tilesetRemoveCallbacks[primitive.id]();
3784
+ }
3776
3785
  delete tilesetRemoveCallbacks[primitive.id];
3777
3786
  }
3778
3787
  );
@@ -3828,8 +3837,25 @@ Scene.prototype.initializeFrame = function () {
3828
3837
  this._tweens.update();
3829
3838
 
3830
3839
  if (this._globeHeightDirty) {
3840
+ if (defined(this._removeUpdateHeightCallback)) {
3841
+ this._removeUpdateHeightCallback();
3842
+ this._removeUpdateHeightCallback = undefined;
3843
+ }
3844
+
3831
3845
  this._globeHeight = getGlobeHeight(this);
3832
3846
  this._globeHeightDirty = false;
3847
+
3848
+ const cartographic = this.camera.positionCartographic;
3849
+ this._removeUpdateHeightCallback = this.updateHeight(
3850
+ cartographic,
3851
+ (updatedCartographic) => {
3852
+ if (this.isDestroyed()) {
3853
+ return;
3854
+ }
3855
+
3856
+ this._globeHeight = updatedCartographic.height;
3857
+ }
3858
+ );
3833
3859
  }
3834
3860
  this._cameraUnderground = isCameraUnderground(this);
3835
3861
  this._globeTranslucencyState.update(this);
@@ -4145,6 +4171,59 @@ Scene.prototype.pick = function (windowPosition, width, height) {
4145
4171
  return this._picking.pick(this, windowPosition, width, height);
4146
4172
  };
4147
4173
 
4174
+ /**
4175
+ * Returns a {@link VoxelCell} for the voxel sample rendered at a particular window coordinate,
4176
+ * or undefined if no voxel is rendered at that position.
4177
+ *
4178
+ * @example
4179
+ * On left click, report the value of the "color" property at that voxel sample.
4180
+ * handler.setInputAction(function(movement) {
4181
+ * const voxelCell = scene.pickVoxel(movement.position);
4182
+ * if (defined(voxelCell)) {
4183
+ * console.log(voxelCell.getProperty("color"));
4184
+ * }
4185
+ * }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
4186
+ *
4187
+ * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4188
+ * @param {number} [width=3] Width of the pick rectangle.
4189
+ * @param {number} [height=3] Height of the pick rectangle.
4190
+ * @returns {VoxelCell|undefined} Information about the voxel cell rendered at the picked position.
4191
+ *
4192
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
4193
+ */
4194
+ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4195
+ const pickedObject = this.pick(windowPosition, width, height);
4196
+ if (!defined(pickedObject)) {
4197
+ return;
4198
+ }
4199
+ const voxelPrimitive = pickedObject.primitive;
4200
+ if (!(voxelPrimitive instanceof VoxelPrimitive)) {
4201
+ return;
4202
+ }
4203
+ const voxelCoordinate = this._picking.pickVoxelCoordinate(
4204
+ this,
4205
+ windowPosition,
4206
+ width,
4207
+ height
4208
+ );
4209
+ // Look up the keyframeNode containing this picked cell
4210
+ const tileIndex = 255 * voxelCoordinate[0] + voxelCoordinate[1];
4211
+ const keyframeNode = voxelPrimitive._traversal.findKeyframeNode(tileIndex);
4212
+ if (!defined(keyframeNode)) {
4213
+ // The tile rendered at the pick position has since been discarded by
4214
+ // a traversal update
4215
+ return;
4216
+ }
4217
+ // Look up the metadata for the picked cell
4218
+ const sampleIndex = 255 * voxelCoordinate[2] + voxelCoordinate[3];
4219
+ return VoxelCell.fromKeyframeNode(
4220
+ voxelPrimitive,
4221
+ tileIndex,
4222
+ sampleIndex,
4223
+ keyframeNode
4224
+ );
4225
+ };
4226
+
4148
4227
  /**
4149
4228
  * Returns the cartesian position reconstructed from the depth buffer and window position.
4150
4229
  * The returned position is in world coordinates. Used internally by camera functions to
@@ -4738,6 +4817,11 @@ Scene.prototype.destroy = function () {
4738
4817
  }
4739
4818
  this._removeGlobeCallbacks.length = 0;
4740
4819
 
4820
+ if (defined(this._removeUpdateHeightCallback)) {
4821
+ this._removeUpdateHeightCallback();
4822
+ this._removeUpdateHeightCallback = undefined;
4823
+ }
4824
+
4741
4825
  return destroyObject(this);
4742
4826
  };
4743
4827
  export default Scene;