Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GroundPrimitive clipping issue #3709

Merged
merged 4 commits into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Change Log
* Fix issue with billboard collections that have at least one billboard with an aligned axis and at least one billboard without an aligned axis. [#3318](https://github.com/AnalyticalGraphicsInc/cesium/issues/3318)
* Fix a race condition that would cause the terrain to continue loading and unloading or cause a crash when changing terrain providers. [#3690](https://github.com/AnalyticalGraphicsInc/cesium/issues/3690)
* All external urls are now https by default to make Cesium work better with non-server-based applications. [#3650](https://github.com/AnalyticalGraphicsInc/cesium/issues/3650)
* Fix issue where the `GroundPrimitive` volume was being clipped by the far plane. [#3706](https://github.com/AnalyticalGraphicsInc/cesium/issues/3706)

### 1.19 - 2016-03-01

Expand Down
7 changes: 2 additions & 5 deletions Source/Scene/GroundPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,9 @@ define([

GroundPrimitive._maxHeight = undefined;
GroundPrimitive._minHeight = undefined;
GroundPrimitive._minOBBHeight = undefined;

GroundPrimitive._maxTerrainHeight = 9000.0;
GroundPrimitive._minTerrainHeight = -100000.0;
GroundPrimitive._minOBBTerrainHeight = -11500.0;

function computeMaximumHeight(granularity, ellipsoid) {
var r = ellipsoid.maximumRadius;
Expand Down Expand Up @@ -540,15 +538,15 @@ define([

// Use an oriented bounding box by default, but switch to a bounding sphere if bounding box creation would fail.
if (rectangle.width < CesiumMath.PI) {
var obb = OrientedBoundingBox.fromRectangle(rectangle, GroundPrimitive._maxHeight, GroundPrimitive._minOBBHeight, ellipsoid);
var obb = OrientedBoundingBox.fromRectangle(rectangle, GroundPrimitive._maxHeight, GroundPrimitive._minHeight, ellipsoid);
primitive._boundingVolumes.push(obb);
} else {
primitive._boundingVolumes.push(BoundingSphere.fromEncodedCartesianVertices(highPositions, lowPositions));
}

if (!frameState.scene3DOnly) {
var projection = frameState.mapProjection;
var boundingVolume = BoundingSphere.fromRectangleWithHeights2D(rectangle, projection, GroundPrimitive._maxHeight, GroundPrimitive._minOBBHeight);
var boundingVolume = BoundingSphere.fromRectangleWithHeights2D(rectangle, projection, GroundPrimitive._maxHeight, GroundPrimitive._minHeight);
Cartesian3.fromElements(boundingVolume.center.z, boundingVolume.center.x, boundingVolume.center.y, boundingVolume.center);

primitive._boundingVolumes2D.push(boundingVolume);
Expand Down Expand Up @@ -812,7 +810,6 @@ define([
var exaggeration = frameState.terrainExaggeration;
GroundPrimitive._maxHeight = GroundPrimitive._maxTerrainHeight * exaggeration;
GroundPrimitive._minHeight = GroundPrimitive._minTerrainHeight * exaggeration;
GroundPrimitive._minOBBHeight = GroundPrimitive._minOBBTerrainHeight * exaggeration;
}

if (!defined(this._primitive)) {
Expand Down