Skip to content

Commit

Permalink
Add Scene-level control for vertical exaggeration
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeshurun Hembd committed Dec 1, 2023
1 parent 3796fd3 commit e79b31b
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions packages/engine/Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,24 @@ function Scene(options) {
*/
this.nearToFarDistance2D = 1.75e6;

/**
* The vertical exaggeration of the scene.
* When set to 1.0, no exaggeration is applied.
*
* @type {number}
* @default 1.0
*/
this.verticalExaggeration = 1.0;

/**
* The reference height for vertical exaggeration of the scene.
* When set to 0.0, the exaggeration is applied relative to the ellipsoid surface.
*
* @type {number}
* @default 0.0
*/
this.verticalExaggerationRelativeHeight = 0.0;

/**
* This property is for debugging only; it is not for production use.
* <p>
Expand Down Expand Up @@ -1880,9 +1898,12 @@ Scene.prototype.updateFrameState = function () {
frameState.cameraUnderground = this._cameraUnderground;
frameState.globeTranslucencyState = this._globeTranslucencyState;

if (defined(this.globe)) {
frameState.verticalExaggeration = this.globe.terrainExaggeration;
frameState.verticalExaggerationRelativeHeight = this.globe.terrainExaggerationRelativeHeight;
frameState.verticalExaggeration = this.verticalExaggeration;
frameState.verticalExaggerationRelativeHeight = this.verticalExaggerationRelativeHeight;
if (defined(this.globe && this.verticalExaggeration !== 1.0)) {
// Update terrain exaggeration to match the rest of the scene
this.globe.terrainExaggeration = this.verticalExaggeration;
this.globe.terrainExaggerationRelativeHeight = this.verticalExaggerationRelativeHeight;
}

if (
Expand Down

0 comments on commit e79b31b

Please sign in to comment.