Skip to content

Commit

Permalink
Merge pull request #564 from twpayne/frame-index
Browse files Browse the repository at this point in the history
Frame index
  • Loading branch information
twpayne committed Apr 18, 2013
2 parents bc9f702 + 75bc61c commit 8735829
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ol/framestate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ goog.require('ol.layer.LayerState');
* coordinateToPixelMatrix: goog.vec.Mat4.Number,
* extent: (null|ol.Extent),
* focus: ol.Coordinate,
* index: number,
* layersArray: Array.<ol.layer.Layer>,
* layerStates: Object.<number, ol.layer.LayerState>,
* logos: Object.<string, boolean>,
Expand Down
7 changes: 7 additions & 0 deletions src/ol/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ ol.Map = function(options) {
*/
this.pixelToCoordinateMatrix_ = goog.vec.Mat4.createNumber();

/**
* @private
* @type {number}
*/
this.frameIndex_ = 0;

/**
* @private
* @type {?ol.FrameState}
Expand Down Expand Up @@ -804,6 +810,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
coordinateToPixelMatrix: this.coordinateToPixelMatrix_,
extent: null,
focus: goog.isNull(this.focus_) ? view2DState.center : this.focus_,
index: this.frameIndex_++,
layersArray: layersArray,
layerStates: layerStates,
logos: {},
Expand Down
4 changes: 2 additions & 2 deletions src/ol/renderer/webgl/webglmaprenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) {
textureCacheEntry = /** @type {?ol.renderer.webgl.TextureCacheEntry} */
(this.textureCache_.peekLast());
if (goog.isNull(textureCacheEntry)) {
if (+this.textureCache_.peekLastKey() == frameState.time) {
if (+this.textureCache_.peekLastKey() == frameState.index) {
break;
} else {
--this.textureCacheFrameMarkerCount_;
Expand Down Expand Up @@ -521,7 +521,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {

this.focus_ = frameState.focus;

this.textureCache_.set(frameState.time.toString(), null);
this.textureCache_.set(frameState.index.toString(), null);
++this.textureCacheFrameMarkerCount_;

goog.array.forEach(frameState.layersArray, function(layer) {
Expand Down

0 comments on commit 8735829

Please sign in to comment.