diff --git a/CHANGES.md b/CHANGES.md
index 8676fa10f7ed..4b0d5d7cd63f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,14 @@
Change Log
==========
+### 1.54 - 2019-02-01
+
+##### Deprecated :hourglass_flowing_sand:
+* `Scene.clampToHeight` now takes an optional `width` argument before the `result` argument. The previous function definition will no longer work in 1.56. [#7287](https://github.com/AnalyticalGraphicsInc/cesium/pull/7287)
+
+##### Additions :tada:
+* Added the ability to specify the width of the intersection volume for `Scene.sampleHeight`, `Scene.clampToHeight`, `Scene.sampleHeightMostDetailed`, and `Scene.clampToHeightMostDetailed`. [#7287](https://github.com/AnalyticalGraphicsInc/cesium/pull/7287)
+
### 1.53 - 2019-01-02
##### Additions :tada:
diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js
index 0ad7115a8ab6..ba3ec49fc12e 100644
--- a/Source/Scene/Cesium3DTileset.js
+++ b/Source/Scene/Cesium3DTileset.js
@@ -1973,7 +1973,7 @@ define([
var passes = frameState.passes;
var isRender = passes.render;
var isPick = passes.pick;
- var isAsync = passes.async;
+ var isAsync = passes.asynchronous;
var statistics = tileset._statistics;
statistics.clear();
diff --git a/Source/Scene/FrameState.js b/Source/Scene/FrameState.js
index b2297b39d959..ddb9518c662a 100644
--- a/Source/Scene/FrameState.js
+++ b/Source/Scene/FrameState.js
@@ -187,11 +187,11 @@ define([
offscreen : false,
/**
- * true
if the primitive should update for an async pass, false
otherwise.
+ * true
if the primitive should update for an asynchronous pass, false
otherwise.
* @type {Boolean}
* @default false
*/
- async : false
+ asynchronous : false
};
/**
diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js
index 31da36b54cfa..2e8e2c058281 100644
--- a/Source/Scene/Scene.js
+++ b/Source/Scene/Scene.js
@@ -172,8 +172,9 @@ define([
};
};
- function AsyncRayPick(ray, primitives) {
+ function AsyncRayPick(ray, width, primitives) {
this.ray = ray;
+ this.width = width;
this.primitives = primitives;
this.ready = false;
this.deferred = when.defer();
@@ -777,10 +778,11 @@ define([
camera.frustum.far = 10000000000.0;
}
+ var pickOffscreenDefaultWidth = 0.1;
var pickOffscreenViewport = new BoundingRectangle(0, 0, 1, 1);
var pickOffscreenCamera = new Camera(this);
pickOffscreenCamera.frustum = new OrthographicFrustum({
- width: 0.01,
+ width: pickOffscreenDefaultWidth,
aspectRatio: 1.0,
near: 0.1
});
@@ -788,6 +790,11 @@ define([
this._view = new View(this, camera, viewport);
this._pickOffscreenView = new View(this, pickOffscreenCamera, pickOffscreenViewport);
+ /**
+ * @private
+ */
+ this.pickOffscreenDefaultWidth = pickOffscreenDefaultWidth;
+
this._defaultView = new View(this, camera, viewport);
this._view = this._defaultView;
@@ -1694,7 +1701,7 @@ define([
passes.depth = false;
passes.postProcess = false;
passes.offscreen = false;
- passes.async = false;
+ passes.asynchronous = false;
}
function updateFrameNumber(scene, frameNumber, time) {
@@ -3798,7 +3805,7 @@ define([
var scratchRight = new Cartesian3();
var scratchUp = new Cartesian3();
- function updateCameraFromRay(ray, camera) {
+ function updateOffscreenCameraFromRay(scene, ray, width, camera) {
var direction = ray.direction;
var orthogonalAxis = Cartesian3.mostOrthogonalAxis(direction, scratchRight);
var right = Cartesian3.cross(direction, orthogonalAxis, scratchRight);
@@ -3808,6 +3815,8 @@ define([
camera.direction = direction;
camera.up = up;
camera.right = right;
+
+ camera.frustum.width = defaultValue(width, scene.pickOffscreenDefaultWidth);
}
function updateAsyncRayPick(scene, asyncRayPick) {
@@ -3819,13 +3828,14 @@ define([
scene._view = view;
var ray = asyncRayPick.ray;
+ var width = asyncRayPick.width;
var primitives = asyncRayPick.primitives;
- updateCameraFromRay(ray, view.camera);
+ updateOffscreenCameraFromRay(scene, ray, width, view.camera);
updateFrameState(scene);
frameState.passes.offscreen = true;
- frameState.passes.async = true;
+ frameState.passes.asynchronous = true;
uniformState.update(frameState);
@@ -3844,7 +3854,7 @@ define([
}
}
- // Ignore commands pushed during async pass
+ // Ignore commands pushed during asynchronous pass
commandList.length = commandsLength;
scene._view = scene._defaultView;
@@ -3866,7 +3876,7 @@ define([
}
}
- function launchAsyncRayPick(scene, ray, objectsToExclude, callback) {
+ function launchAsyncRayPick(scene, ray, objectsToExclude, width, callback) {
var asyncPrimitives = [];
var primitives = scene.primitives;
var length = primitives.length;
@@ -3882,7 +3892,7 @@ define([
return when.resolve(callback());
}
- var asyncRayPick = new AsyncRayPick(ray, asyncPrimitives);
+ var asyncRayPick = new AsyncRayPick(ray, width, asyncPrimitives);
scene._asyncRayPicks.push(asyncRayPick);
return asyncRayPick.promise.then(function() {
return callback();
@@ -3898,7 +3908,7 @@ define([
(objectsToExclude.indexOf(object.id) > -1);
}
- function getRayIntersection(scene, ray, objectsToExclude, requirePosition, async) {
+ function getRayIntersection(scene, ray, objectsToExclude, width, requirePosition, asynchronous) {
var context = scene._context;
var uniformState = context.uniformState;
var frameState = scene._frameState;
@@ -3906,7 +3916,7 @@ define([
var view = scene._pickOffscreenView;
scene._view = view;
- updateCameraFromRay(ray, view.camera);
+ updateOffscreenCameraFromRay(scene, ray, width, view.camera);
scratchRectangle = BoundingRectangle.clone(view.viewport, scratchRectangle);
@@ -3918,7 +3928,7 @@ define([
frameState.invertClassification = false;
frameState.passes.pick = true;
frameState.passes.offscreen = true;
- frameState.passes.async = async;
+ frameState.passes.asynchronous = asynchronous;
uniformState.update(frameState);
@@ -3957,22 +3967,22 @@ define([
}
}
- function getRayIntersections(scene, ray, limit, objectsToExclude, requirePosition, async) {
+ function getRayIntersections(scene, ray, limit, objectsToExclude, width, requirePosition, asynchronous) {
var pickCallback = function() {
- return getRayIntersection(scene, ray, objectsToExclude, requirePosition, async);
+ return getRayIntersection(scene, ray, objectsToExclude, width, requirePosition, asynchronous);
};
return drillPick(limit, pickCallback);
}
- function pickFromRay(scene, ray, objectsToExclude, requirePosition, async) {
- var results = getRayIntersections(scene, ray, 1, objectsToExclude, requirePosition, async);
+ function pickFromRay(scene, ray, objectsToExclude, width, requirePosition, asynchronous) {
+ var results = getRayIntersections(scene, ray, 1, objectsToExclude, width, requirePosition, asynchronous);
if (results.length > 0) {
return results[0];
}
}
- function drillPickFromRay(scene, ray, limit, objectsToExclude, requirePosition, async) {
- return getRayIntersections(scene, ray, limit, objectsToExclude, requirePosition, async);
+ function drillPickFromRay(scene, ray, limit, objectsToExclude, width, requirePosition, asynchronous) {
+ return getRayIntersections(scene, ray, limit, objectsToExclude, width, requirePosition, asynchronous);
}
/**
@@ -3989,18 +3999,19 @@ define([
*
* @param {Ray} ray The ray.
* @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to exclude from the ray intersection.
+ * @param {Number} [width=0.1] Width of the intersection volume in meters.
* @returns {Object} An object containing the object and position of the first intersection.
*
* @exception {DeveloperError} Ray intersections are only supported in 3D mode.
*/
- Scene.prototype.pickFromRay = function(ray, objectsToExclude) {
+ Scene.prototype.pickFromRay = function(ray, objectsToExclude, width) {
//>>includeStart('debug', pragmas.debug);
Check.defined('ray', ray);
if (this._mode !== SceneMode.SCENE3D) {
throw new DeveloperError('Ray intersections are only supported in 3D mode.');
}
//>>includeEnd('debug');
- return pickFromRay(this, ray, objectsToExclude, false, false);
+ return pickFromRay(this, ray, objectsToExclude, width, false, false);
};
/**
@@ -4019,18 +4030,19 @@ define([
* @param {Ray} ray The ray.
* @param {Number} [limit=Number.MAX_VALUE] If supplied, stop finding intersections after this many intersections.
* @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to exclude from the ray intersection.
+ * @param {Number} [width=0.1] Width of the intersection volume in meters.
* @returns {Object[]} List of objects containing the object and position of each intersection.
*
* @exception {DeveloperError} Ray intersections are only supported in 3D mode.
*/
- Scene.prototype.drillPickFromRay = function(ray, limit, objectsToExclude) {
+ Scene.prototype.drillPickFromRay = function(ray, limit, objectsToExclude, width) {
//>>includeStart('debug', pragmas.debug);
Check.defined('ray', ray);
if (this._mode !== SceneMode.SCENE3D) {
throw new DeveloperError('Ray intersections are only supported in 3D mode.');
}
//>>includeEnd('debug');
- return drillPickFromRay(this, ray, limit, objectsToExclude, false, false);
+ return drillPickFromRay(this, ray, limit, objectsToExclude, width,false, false);
};
/**
@@ -4041,11 +4053,12 @@ define([
*
* @param {Ray} ray The ray.
* @param {Object[]} [objectsToExclude] A list of primitives, entities, or 3D Tiles features to exclude from the ray intersection.
+ * @param {Number} [width=0.1] Width of the intersection volume in meters.
* @returns {Promise.