File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 36
36
cc . math . Matrix4Stack = function ( top , stack ) {
37
37
this . top = top ;
38
38
this . stack = stack || [ ] ;
39
+ this . lastUpdated = 0 ;
39
40
//this._matrixPool = []; // use pool in next version
40
41
} ;
41
42
cc . km_mat4_stack = cc . math . Matrix4Stack ;
Original file line number Diff line number Diff line change 106
106
throw new Error ( "Invalid matrix mode specified" ) ; //TODO: Proper error handling
107
107
break ;
108
108
}
109
+ cc . current_stack . lastUpdated = cc . director . getTotalFrames ( ) ;
109
110
} ;
110
111
111
112
cc . kmGLLoadIdentity = function ( ) {
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ cc.GLProgram = cc.Class.extend(/** @lends cc.GLProgram# */{
39
39
_uniforms : null ,
40
40
_hashForUniforms : null ,
41
41
_usesTime : false ,
42
+ _projectionUpdated : - 1 ,
42
43
43
44
// Uniform cache
44
45
_updateUniformLocation : function ( location ) {
@@ -684,8 +685,12 @@ cc.GLProgram = cc.Class.extend(/** @lends cc.GLProgram# */{
684
685
this . _glContext . uniformMatrix4fv ( this . _uniforms [ cc . UNIFORM_PMATRIX_S ] , false , cc . projection_matrix_stack . top . mat ) ;
685
686
} ,
686
687
687
- _updateProjectionUniform : function ( ) {
688
- this . _glContext . uniformMatrix4fv ( this . _uniforms [ cc . UNIFORM_PMATRIX_S ] , false , cc . projection_matrix_stack . top . mat ) ;
688
+ _updateProjectionUniform : function ( ) {
689
+ var stack = cc . projection_matrix_stack ;
690
+ if ( stack . lastUpdated !== this . _projectionUpdated ) {
691
+ this . _glContext . uniformMatrix4fv ( this . _uniforms [ cc . UNIFORM_PMATRIX_S ] , false , stack . top . mat ) ;
692
+ this . _projectionUpdated = stack . lastUpdated ;
693
+ }
689
694
} ,
690
695
691
696
/**
You can’t perform that action at this time.
0 commit comments