Skip to content

Commit

Permalink
pickPositionCacheDirty added
Browse files Browse the repository at this point in the history
  • Loading branch information
ateshuseyin committed Apr 14, 2017
1 parent 3f7f48d commit b7037d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Change Log
### 1.33 - 2017-05-01

* Added `disableDepthTestDistance` to billboards, points and labels. This sets the distance to the camera where the depth test will be disabled. Setting it to zero (the default) will alwasy enable the depth test. Setting it to `Number.POSITVE_INFINITY` will never enabled the depth test. Also added `scene.minimumDisableDepthTestDistance` to change the default value from zero. [#5166](https://github.com/AnalyticalGraphicsInc/cesium/pull/5166)
* `Scene.pickPosition` now caches results per frame to increase performance [#5117](https://github.com/AnalyticalGraphicsInc/cesium/issues/5117)


### 1.32 - 2017-04-03

Expand Down Expand Up @@ -33,7 +35,6 @@ Change Log
* Fixed a bug in `Quaternion.fromHeadingPitchRoll` that made it erroneously throw an exception when passed individual angles in an unminified / debug build.
* Fixed a bug that caused an exception in `CesiumInspectorViewModel` when using the NW / NE / SW / SE / Parent buttons to navigate to a terrain tile that is not yet loaded.
* `QuadtreePrimitive` now uses `frameState.afterRender` to fire `tileLoadProgressEvent` [#3450](https://github.com/AnalyticalGraphicsInc/cesium/issues/3450)
* `Scene.pickPosition` now caches results per frame to increase performance [#5117](https://github.com/AnalyticalGraphicsInc/cesium/issues/5117)

### 1.31 - 2017-03-01

Expand Down
8 changes: 6 additions & 2 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ define([
this._cameraMovedTime = undefined;

this._pickPositionCache = {};
this._pickPositionCacheDirty = false;

this._minimumDisableDepthTestDistance = 0.0;

Expand Down Expand Up @@ -2550,7 +2551,7 @@ define([
var scratchEyeTranslation = new Cartesian3();

function render(scene, time) {
scene._pickPositionCache = {}; //clean cache
scene._pickPositionCacheDirty = true;

if (!defined(time)) {
time = JulianDate.now();
Expand Down Expand Up @@ -2985,7 +2986,10 @@ define([

var cacheKey = windowPosition.toString();

if (this._pickPositionCache.hasOwnProperty(cacheKey)){
if(this._pickPositionCacheDirty){
this._pickPositionCache = {};
this._pickPositionCacheDirty = false;
} else if (this._pickPositionCache.hasOwnProperty(cacheKey)){
return Cartesian3.clone(this._pickPositionCache[cacheKey], result);
}

Expand Down

0 comments on commit b7037d0

Please sign in to comment.