Skip to content

Commit 7dd9bbb

Browse files
authored
Merge pull request #8398 from AnalyticalGraphicsInc/underEllipsoidCullingFix_Primitives
Make primitives/entities not cull when below ellipsoid but above terrain
2 parents 2ccd87b + b61bd2e commit 7dd9bbb

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Change Log
44
### 1.65.0 - 2019-01-02
55

66
##### Fixes :wrench:
7-
* Fix Geocoder auto-complete suggestions when hosted inside Web Components. [#8425](https://github.com/AnalyticalGraphicsInc/cesium/pull/8425)
7+
* Fixed Geocoder auto-complete suggestions when hosted inside Web Components. [#8425](https://github.com/AnalyticalGraphicsInc/cesium/pull/8425)
8+
* Fixed primitive culling when below the ellipsoid but above terrain. [#8398](https://github.com/AnalyticalGraphicsInc/cesium/pull/8398)
89

910
### 1.64.0 - 2019-12-02
1011

Source/Scene/FrameState.js

+8
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,14 @@ import SceneMode from './SceneMode.js';
391391
* @type {Cesium3DTilePassState}
392392
*/
393393
this.tilesetPassState = undefined;
394+
395+
/**
396+
* The minimum terrain height out of all rendered terrain tiles. Used to improve culling for objects underneath the ellipsoid but above terrain.
397+
*
398+
* @type {Number}
399+
* @default 0.0
400+
*/
401+
this.minimumTerrainHeight = 0.0;
394402
}
395403

396404
/**

Source/Scene/GlobeSurfaceTileProvider.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,10 @@ import TileSelectionResult from './TileSelectionResult.js';
420420
}
421421

422422
for (var tileIndex = 0, tileLength = tilesToRender.length; tileIndex < tileLength; ++tileIndex) {
423-
addDrawCommandsForTile(this, tilesToRender[tileIndex], frameState);
423+
var tile = tilesToRender[tileIndex];
424+
var tileBoundingRegion = tile.data.tileBoundingRegion;
425+
addDrawCommandsForTile(this, tile, frameState);
426+
frameState.minimumTerrainHeight = Math.min(frameState.minimumTerrainHeight, tileBoundingRegion.minimumHeight);
424427
}
425428
}
426429
};

Source/Scene/Scene.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,8 @@ import View from './View.js';
17111711
var globe = scene.globe;
17121712
if (scene._mode === SceneMode.SCENE3D && defined(globe) && globe.show) {
17131713
var ellipsoid = globe.ellipsoid;
1714-
scratchOccluderBoundingSphere.radius = ellipsoid.minimumRadius;
1714+
var minimumTerrainHeight = scene.frameState.minimumTerrainHeight;
1715+
scratchOccluderBoundingSphere.radius = ellipsoid.minimumRadius + minimumTerrainHeight;
17151716
scratchOccluder = Occluder.fromBoundingSphere(scratchOccluderBoundingSphere, scene.camera.positionWC, scratchOccluder);
17161717
return scratchOccluder;
17171718
}
@@ -1754,6 +1755,7 @@ import View from './View.js';
17541755
frameState.cullingVolume = camera.frustum.computeCullingVolume(camera.positionWC, camera.directionWC, camera.upWC);
17551756
frameState.occluder = getOccluder(this);
17561757
frameState.terrainExaggeration = this._terrainExaggeration;
1758+
frameState.minimumTerrainHeight = 0.0;
17571759
frameState.minimumDisableDepthTestDistance = this._minimumDisableDepthTestDistance;
17581760
frameState.invertClassification = this.invertClassification;
17591761
frameState.useLogDepth = this._logDepthBuffer && !(this.camera.frustum instanceof OrthographicFrustum || this.camera.frustum instanceof OrthographicOffCenterFrustum);

0 commit comments

Comments
 (0)