@cesium/engine 7.0.0 → 8.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.
- package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-23UFSGND.js} +7 -7
- package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2A75IWRS.js} +7 -7
- package/Build/Workers/{chunk-VRGFV2UO.js → chunk-2FRVPMCS.js} +10 -10
- package/Build/Workers/{chunk-46UD5ABS.js → chunk-2FWRMUTY.js} +4 -4
- package/Build/Workers/{chunk-DTAIXKTO.js → chunk-2UPKWTMJ.js} +6 -6
- package/Build/Workers/{chunk-6VJVYK2V.js → chunk-34FXV7D7.js} +2 -2
- package/Build/Workers/{chunk-ODW7WYM4.js → chunk-3VAZEH7M.js} +2 -2
- package/Build/Workers/{chunk-U2VCRRQW.js → chunk-4DO5W5XZ.js} +6 -6
- package/Build/Workers/{chunk-VK3EJHWI.js → chunk-4H7PY4U5.js} +2 -2
- package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-5QULIR53.js} +4 -4
- package/Build/Workers/{chunk-JY5YEZFA.js → chunk-7TC63SJW.js} +8 -8
- package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-7ZFGPDJA.js} +4 -4
- package/Build/Workers/{chunk-FP6GYBFX.js → chunk-A5DWLWCY.js} +10 -10
- package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-BBWDMCVU.js} +1 -1
- package/Build/Workers/{chunk-WZU2YLWG.js → chunk-BG4UCVXN.js} +3 -3
- package/Build/Workers/{chunk-5WQ523AW.js → chunk-BIKA3NRA.js} +5 -5
- package/Build/Workers/{chunk-PTQQUQC3.js → chunk-BROJAZRZ.js} +13 -13
- package/Build/Workers/{chunk-YUCVWAY6.js → chunk-DDUQAJ4P.js} +7 -7
- package/Build/Workers/{chunk-2HJWSU7B.js → chunk-EERJKOAF.js} +4 -4
- package/Build/Workers/{chunk-LZGHD6NY.js → chunk-EG6PTBY2.js} +15 -15
- package/Build/Workers/{chunk-IX2JCCNM.js → chunk-EHWHNOEX.js} +1 -1
- package/Build/Workers/{chunk-NKPBIX7F.js → chunk-F3YA3Y2Z.js} +1 -1
- package/Build/Workers/{chunk-L2ZN645J.js → chunk-F4HFJMGM.js} +6 -6
- package/Build/Workers/{chunk-F6SE42BK.js → chunk-FJKNFAKQ.js} +15 -472
- package/Build/Workers/{chunk-PNBGBETF.js → chunk-FNIRWHJB.js} +10 -10
- package/Build/Workers/{chunk-RAEV7K66.js → chunk-FZRIVR7Y.js} +5 -5
- package/Build/Workers/{chunk-AIPU2VSX.js → chunk-G43QFN4Q.js} +6 -6
- package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-GATZHF3K.js} +2 -2
- package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-GRC2ZTAF.js} +14 -14
- package/Build/Workers/{chunk-5YLJ77FF.js → chunk-HU6N6EXB.js} +10 -10
- package/Build/Workers/{chunk-4EBHOMFX.js → chunk-I46ZRR5W.js} +17 -17
- package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-JURN7NPV.js} +17 -17
- package/Build/Workers/{chunk-JCNXK6EL.js → chunk-KKCR2YOP.js} +11 -11
- package/Build/Workers/{chunk-S6SKF6DT.js → chunk-LPR3YNP2.js} +5 -5
- package/Build/Workers/{chunk-UDO6BFSF.js → chunk-M7ERACJJ.js} +13 -13
- package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-MDWEGWPA.js} +10 -10
- package/Build/Workers/{chunk-72SANQJV.js → chunk-OGXZVPPM.js} +9 -5
- package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-PGSJK77E.js} +6 -6
- package/Build/Workers/{chunk-GEJTYLCO.js → chunk-PPH7OFP3.js} +5 -5
- package/Build/Workers/{chunk-OVLG3FRS.js → chunk-SH5USDPI.js} +6 -6
- package/Build/Workers/{chunk-6HZQPRUS.js → chunk-SOWMRMWA.js} +1 -1
- package/Build/Workers/{chunk-JXDC723O.js → chunk-STW2DGFI.js} +2 -2
- package/Build/Workers/{chunk-5HDYHG3F.js → chunk-T3XIFPYR.js} +13 -13
- package/Build/Workers/chunk-TTUZP4BO.js +501 -0
- package/Build/Workers/{chunk-7XEAYGZK.js → chunk-UEXTBDBE.js} +10 -10
- package/Build/Workers/{chunk-GV56Q4LU.js → chunk-VOXYEYJT.js} +11 -11
- package/Build/Workers/{chunk-NY3K4IM3.js → chunk-X4356LRH.js} +12 -12
- package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-XGI5BXZY.js} +2 -2
- package/Build/Workers/{chunk-UAEW6HKG.js → chunk-Y2ME2IJV.js} +13 -13
- package/Build/Workers/{chunk-XWXM2O2R.js → chunk-Y5UQJLYE.js} +6 -6
- package/Build/Workers/{chunk-QZAD5O7I.js → chunk-YJEBABKH.js} +7 -7
- package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YWTJ2B4B.js} +1 -1
- package/Build/Workers/{chunk-R5X4OQT4.js → chunk-Z3TIFFGF.js} +7 -7
- package/Build/Workers/{chunk-WBQCVXR3.js → chunk-ZT7KWISZ.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -28
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +32 -31
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/Transforms.js +3 -0
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/Entity.js +20 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Camera.js +46 -4
- package/Source/Scene/Cesium3DTileset.js +44 -6
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/FrameState.js +5 -0
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/Model/pickModel.js +25 -7
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -2
- package/Source/Scene/Scene.js +126 -42
- package/Source/Scene/ScreenSpaceCameraController.js +21 -7
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/VoxelBoxShape.js +76 -0
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +114 -43
- package/Source/Scene/VoxelEllipsoidShape.js +158 -116
- package/Source/Scene/VoxelPrimitive.js +3 -1
- package/Source/Scene/VoxelRenderResources.js +3 -0
- package/Source/Scene/VoxelShape.js +13 -0
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +2 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
- package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
- package/Source/Shaders/Voxels/VoxelFS.js +39 -1
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
- package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +296 -11
- package/index.js +102 -94
- package/package.json +1 -1
package/Source/Scene/Picking.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
250
|
-
const
|
|
251
|
-
const frameState = scene.frameState;
|
|
260
|
+
const { context, frameState, defaultView } = scene;
|
|
261
|
+
const { viewport, pickFramebuffer } = defaultView;
|
|
252
262
|
|
|
253
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
305
|
+
passState = pickFramebuffer.begin(scratchRectangle, viewport);
|
|
298
306
|
|
|
299
307
|
scene.updateAndExecuteCommands(passState, scratchColorZero);
|
|
300
308
|
scene.resolveFramebuffers(passState);
|
|
301
309
|
|
|
302
|
-
const object =
|
|
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
|
|
310
|
-
const
|
|
311
|
-
const environmentState = scene.environmentState;
|
|
396
|
+
const { defaultView, context, frameState, environmentState } = scene;
|
|
397
|
+
const { viewport, pickDepthFramebuffer } = defaultView;
|
|
312
398
|
|
|
313
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
|
386
|
-
const
|
|
387
|
-
const uniformState = context.uniformState;
|
|
467
|
+
const { context, frameState, camera, defaultView } = scene;
|
|
468
|
+
const { uniformState } = context;
|
|
388
469
|
|
|
389
|
-
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
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 (
|
|
1177
|
+
if (
|
|
1178
|
+
(defined(geometry._workerName) && defined(geometry._workerPath)) ||
|
|
1179
|
+
(!defined(geometry._workerName) && !defined(geometry._workerPath))
|
|
1180
|
+
) {
|
|
1178
1181
|
throw new DeveloperError(
|
|
1179
|
-
"_workerName
|
|
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
|
}
|
package/Source/Scene/Scene.js
CHANGED
|
@@ -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 =
|
|
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
|
|
2285
|
-
const
|
|
2286
|
-
const frameState = scene.frameState;
|
|
2287
|
-
const us = context.uniformState;
|
|
2291
|
+
const { camera, context, frameState } = scene;
|
|
2292
|
+
const { uniformState } = context;
|
|
2288
2293
|
|
|
2289
|
-
|
|
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
|
-
|
|
2308
|
-
|
|
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
|
-
|
|
2414
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2710
|
+
uniformState.updateFrustum(frustum);
|
|
2706
2711
|
|
|
2707
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 &&
|
|
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.
|
|
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
|
-
|
|
3745
|
-
primitive.
|
|
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
|
-
|
|
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;
|