Skip to content

Commit

Permalink
Fix failing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeshurun Hembd committed Nov 29, 2023
1 parent ce217d4 commit 1f60eee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/engine/Source/Core/VerticalExaggeration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Cartesian3 from "./Cartesian3.js";
import DeveloperError from "./DeveloperError.js";
import defined from "./defined.js";

/**
* @private
Expand Down Expand Up @@ -29,6 +30,12 @@ const scratchCartographic = new Cartesian3();

/**
* Scales a position by exaggeration.
*
* @param {Cartesian3} position The position.
* @param {Ellipsoid} ellipsoid The ellipsoid.
* @param {number} verticalExaggeration A scalar used to exaggerate the terrain. If the value is 1.0 there will be no effect.
* @param {number} verticalExaggerationRelativeHeight The height relative to which terrain is exaggerated. If the value is 0.0 terrain will be exaggerated relative to the ellipsoid surface.
* @param {Cartesian3} [result] The object onto which to store the result.
*/
VerticalExaggeration.getPosition = function (
position,
Expand All @@ -41,6 +48,10 @@ VerticalExaggeration.getPosition = function (
position,
scratchCartographic
);
// If the position is too near the center of the ellipsoid, exaggeration is undefined.
if (!defined(cartographic)) {
return Cartesian3.clone(position, result);
}
const newHeight = VerticalExaggeration.getHeight(
cartographic.height,
verticalExaggeration,
Expand Down
6 changes: 6 additions & 0 deletions packages/engine/Source/Scene/Cesium3DTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,9 @@ Cesium3DTile.prototype.createBoundingVolume = function (

const { box, region, sphere } = boundingVolumeHeader;
if (defined(box)) {
if (this._verticalExaggeration === 1.0) {
return createBox(box, transform, result);
}
const exaggeratedCorners = OrientedBoundingBox.unpack(
box,
0,
Expand Down Expand Up @@ -1841,6 +1844,9 @@ Cesium3DTile.prototype.createBoundingVolume = function (
);
}
if (defined(sphere)) {
if (this._verticalExaggeration === 1.0) {
return createSphere(sphere, transform, result);
}
const boundingSphere = BoundingSphere.unpack(
sphere,
0,
Expand Down

0 comments on commit 1f60eee

Please sign in to comment.