diff --git a/CHANGES.md b/CHANGES.md index 092123855b1b..a736fca57985 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,9 +3,6 @@ Change Log ### 1.45 - 2018-05-01 -##### Breaking Changes :mega: -* `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. - ##### Additions :tada: * Added option `logarithmicDepthBuffer` to `Scene`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) * When a log depth buffer is supported, the frustum near and far planes default to `0.1` and `1e10` respectively. @@ -22,6 +19,7 @@ Change Log * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) * Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) + ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) * Added ability to invoke `sampleTerrain` from node.js to enable offline terrain sampling diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index 915ca86bc001..50b48178c9d3 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -2574,13 +2574,10 @@ define([ var scratchProj = new Cartesian3(); /** - * Return the signed distance from the camera to the front of the bounding sphere. - *

- * Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. - *

+ * Return the distance from the camera to the front of the bounding sphere. * * @param {BoundingSphere} boundingSphere The bounding sphere in world coordinates. - * @returns {Number} The signed distance to the bounding sphere. + * @returns {Number} The distance to the bounding sphere. */ Camera.prototype.distanceToBoundingSphere = function(boundingSphere) { //>>includeStart('debug', pragmas.debug); @@ -2590,10 +2587,8 @@ define([ //>>includeEnd('debug'); var toCenter = Cartesian3.subtract(this.positionWC, boundingSphere.center, scratchToCenter); - var distance = -Cartesian3.dot(toCenter, this.directionWC); - var proj = Cartesian3.multiplyByScalar(this.directionWC, distance, scratchProj); - var unsignedDistance = Math.max(0.0, Cartesian3.magnitude(proj) - boundingSphere.radius); - return distance < 0.0 ? -unsignedDistance : unsignedDistance; + var proj = Cartesian3.multiplyByScalar(this.directionWC, Cartesian3.dot(toCenter, this.directionWC), scratchProj); + return Math.max(0.0, Cartesian3.magnitude(proj) - boundingSphere.radius); }; var scratchPixelSize = new Cartesian2(); @@ -2620,9 +2615,6 @@ define([ //>>includeEnd('debug'); var distance = this.distanceToBoundingSphere(boundingSphere); - if (distance < 0.0) { - return 0.0; - } var pixelSize = this.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, scratchPixelSize); return Math.max(pixelSize.x, pixelSize.y); };