Merge pull request #564 from twpayne/frame-index

Frame index
This commit is contained in:
Tom Payne
2013-04-18 06:16:30 -07:00
3 changed files with 10 additions and 2 deletions

View File

@@ -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>,

View File

@@ -168,6 +168,12 @@ ol.Map = function(options) {
*/
this.pixelToCoordinateMatrix_ = goog.vec.Mat4.createNumber();
/**
* @private
* @type {number}
*/
this.frameIndex_ = 0;
/**
* @private
* @type {?ol.FrameState}
@@ -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: {},

View File

@@ -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_;
@@ -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) {