diff --git a/CHANGES.md b/CHANGES.md index 1cec70b4d301..fcfed6c146b1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ Change Log * Fixed `getPickRay` in 2D. [#2480](https://github.com/AnalyticalGraphicsInc/cesium/issues/2480) * Fixed `Globe.pick` for 2D and Columbus View [#6859](https://github.com/AnalyticalGraphicsInc/cesium/pull/6859) * Fixed imagery layer feature picking in 2D and Columbus view [#6859](https://github.com/AnalyticalGraphicsInc/cesium/pull/6859) +* Fixed intermittent ground clamping issues for all entity types that use a height reference [#6930](https://github.com/AnalyticalGraphicsInc/cesium/pull/6930) * Fixed bug that caused a new `ClippingPlaneCollection` to be created every frame when used with a model entity [#6872](https://github.com/AnalyticalGraphicsInc/cesium/pull/6872) * Improved `Plane` entities so they are better aligned with the globe surface [#6887](https://github.com/AnalyticalGraphicsInc/cesium/pull/6887) * Fixed crash when rendering translucent objects when all shadow maps in the scene set `fromLightSource` to false. [#6883](https://github.com/AnalyticalGraphicsInc/cesium/pull/6883) diff --git a/Source/Scene/QuadtreePrimitive.js b/Source/Scene/QuadtreePrimitive.js index 475051cb1c70..39ec5703e3d3 100644 --- a/Source/Scene/QuadtreePrimitive.js +++ b/Source/Scene/QuadtreePrimitive.js @@ -770,8 +770,11 @@ define([ var scratchRay = new Ray(); var scratchCartographic = new Cartographic(); var scratchPosition = new Cartesian3(); + var scratchArray = []; function updateHeights(primitive, frameState) { + var tryNextFrame = scratchArray; + tryNextFrame.length = 0; var tilesToUpdateHeights = primitive._tileToUpdateHeights; var terrainProvider = primitive._tileProvider.terrainProvider; @@ -782,14 +785,20 @@ define([ var mode = frameState.mode; var projection = frameState.mapProjection; var ellipsoid = projection.ellipsoid; + var i; while (tilesToUpdateHeights.length > 0) { var tile = tilesToUpdateHeights[0]; + if (tile.state !== QuadtreeTileLoadState.DONE) { + tryNextFrame.push(tile); + tilesToUpdateHeights.shift(); + primitive._lastTileIndex = 0; + continue; + } var customData = tile.customData; var customDataLength = customData.length; var timeSliceMax = false; - var i; for (i = primitive._lastTileIndex; i < customDataLength; ++i) { var data = customData[i]; @@ -869,6 +878,9 @@ define([ tilesToUpdateHeights.shift(); } } + for (i = 0; i < tryNextFrame.length; i++) { + tilesToUpdateHeights.push(tryNextFrame[i]); + } } function createRenderCommandsForSelectedTiles(primitive, frameState) {