From ccbfc05b96c80fbfb0379fd68a678b000afdeaff Mon Sep 17 00:00:00 2001 From: 2youyouo2 <501251991@qq.com> Date: Mon, 27 Mar 2017 15:28:23 +0800 Subject: [PATCH] fixed matrix stack update state --- cocos2d/kazmath/gl/mat4stack.js | 6 ++++++ cocos2d/kazmath/gl/matrix.js | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cocos2d/kazmath/gl/mat4stack.js b/cocos2d/kazmath/gl/mat4stack.js index 8e2089e0bb..58059665c9 100644 --- a/cocos2d/kazmath/gl/mat4stack.js +++ b/cocos2d/kazmath/gl/mat4stack.js @@ -50,11 +50,17 @@ proto.push = function(item) { this.stack.push(this.top); this.top = new cc.math.Matrix4(item); //this.top = this._getFromPool(item); + this.update(); }; proto.pop = function() { //this._putInPool(this.top); this.top = this.stack.pop(); + this.update(); +}; + +proto.update = function () { + this.lastUpdated ++; }; proto.release = function(){ diff --git a/cocos2d/kazmath/gl/matrix.js b/cocos2d/kazmath/gl/matrix.js index db7e2fc653..3aa868815d 100644 --- a/cocos2d/kazmath/gl/matrix.js +++ b/cocos2d/kazmath/gl/matrix.js @@ -106,7 +106,6 @@ math.glMatrixMode = function (mode) { throw new Error("Invalid matrix mode specified"); //TODO: Proper error handling break; } - cc.current_stack.lastUpdated = cc.director.getTotalFrames(); }; math.glLoadIdentity = function () {