Skip to content

Commit

Permalink
Allow applications to control terrain adjustment suspension
Browse files Browse the repository at this point in the history
In sandcastle, can be tested with:


var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var globe = scene.globe;

var controller = scene.screenSpaceCameraController;
controller.minimumZoomDistance = 3000;

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
    url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles'
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;

setInterval(function() {
    var carto = Cesium.Cartographic.fromCartesian(scene.camera.position);
    console.log(carto.height - globe.getHeight(carto));
}, 10);

scene.camera.enableTerrainAdjustmentWhenLoading = true;
  • Loading branch information
gberaudo committed Dec 22, 2017
1 parent 9178af1 commit e14da77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -13,6 +13,7 @@ Change Log
* Fixed globe materials when `Globe.enableLighting` was `false`. [#6042](https://github.com/AnalyticalGraphicsInc/cesium/issues/6042)
* Fixed shader compilation failure on pick when globe materials were enabled. [#6039](https://github.com/AnalyticalGraphicsInc/cesium/issues/6039)
* Fixed crash when `invertClassification` was enabled, the invert color had an alpha less than `1.0`, and the window was resized. [#6046](https://github.com/AnalyticalGraphicsInc/cesium/issues/6046)
* Added `Camera.enableTerrainAdjustmentWhenLoading` to enable/disable suspension of camera position adjustment when terrain is loading [#5999](https://github.com/AnalyticalGraphicsInc/cesium/issues/5999).

### 1.40 - 2017-12-01

Expand Down
10 changes: 9 additions & 1 deletion Source/Scene/Camera.js
Expand Up @@ -199,6 +199,14 @@ define([
*/
this.maximumZoomFactor = 1.5;

/**
* Allows or disallows camera position adjustment while terrain is loading.
* When <code>false</code> the camera position will only be adjusted when all terrain has been loaded.
* @type {Boolean}
* @default false
*/
this.enableTerrainAdjustmentWhenLoading = false;

this._moveStart = new Event();
this._moveEnd = new Event();

Expand Down Expand Up @@ -367,7 +375,7 @@ define([
var minimumCollisionTerrainHeight = screenSpaceCameraController.minimumCollisionTerrainHeight;
var minimumZoomDistance = screenSpaceCameraController.minimumZoomDistance;

if (this._suspendTerrainAdjustment || !enableCollisionDetection) {
if ((!this.enableTerrainAdjustmentWhenLoading && this._suspendTerrainAdjustment) || !enableCollisionDetection) {
return;
}

Expand Down

0 comments on commit e14da77

Please sign in to comment.