File tree Expand file tree Collapse file tree 3 files changed +8
-13
lines changed Expand file tree Collapse file tree 3 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 3232 this . _textureAtlas = null ;
3333 this . _colorUnmodified = cc . color . WHITE ;
3434 this . _colorF32Array = null ;
35- this . _uniformColor = null ;
3635
3736 this . _matrix = new cc . math . Matrix4 ( ) ;
3837 this . _matrix . identity ( ) ;
3938
4039 //shader stuff
4140 this . _shaderProgram = cc . shaderCache . programForKey ( cc . SHADER_POSITION_TEXTURE_UCOLOR ) ;
42- this . _uniformColor = cc . _renderContext . getUniformLocation ( this . _shaderProgram . getProgram ( ) , "u_color" ) ;
4341 } ;
4442
4543 var proto = cc . AtlasNode . WebGLRenderCmd . prototype = Object . create ( cc . Node . WebGLRenderCmd . prototype ) ;
7169 this . _glProgramState . apply ( this . _matrix ) ;
7270
7371 cc . glBlendFunc ( node . _blendFunc . src , node . _blendFunc . dst ) ;
74- if ( this . _uniformColor && this . _colorF32Array ) {
75- context . uniform4fv ( this . _uniformColor , this . _colorF32Array ) ;
72+ if ( this . _colorF32Array ) {
73+ this . _glProgramState . setUniformVec4v ( "u_color" , this . _colorF32Array ) ;
7674 this . _textureAtlas . drawNumberOfQuads ( node . quadsToDraw , 0 ) ;
7775 }
7876 } ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ cc.GridBase = cc.Class.extend(/** @lends cc.GridBase# */{
3939 _step : null ,
4040 _grabber : null ,
4141 _isTextureFlipped : false ,
42- _shaderProgram : null ,
42+ _glProgramState : null ,
4343 _directorProjection : 0 ,
4444
4545 _dirty : false ,
@@ -62,7 +62,7 @@ cc.GridBase = cc.Class.extend(/** @lends cc.GridBase# */{
6262 this . _step = cc . p ( 0 , 0 ) ;
6363 this . _grabber = null ;
6464 this . _isTextureFlipped = false ;
65- this . _shaderProgram = null ;
65+ this . _glProgramState = null ;
6666 this . _directorProjection = 0 ;
6767 this . _dirty = false ;
6868
@@ -227,7 +227,7 @@ cc.GridBase = cc.Class.extend(/** @lends cc.GridBase# */{
227227 if ( ! this . _grabber )
228228 return false ;
229229 this . _grabber . grab ( this . _texture ) ;
230- this . _shaderProgram = cc . shaderCache . programForKey ( cc . SHADER_POSITION_TEXTURE ) ;
230+ this . _glProgramState = cc . GLProgramState . getOrCreateWithGLProgram ( cc . shaderCache . programForKey ( cc . SHADER_POSITION_TEXTURE ) ) ;
231231 this . calculateVertexPoints ( ) ;
232232 return true ;
233233 } ,
Original file line number Diff line number Diff line change 2424 THE SOFTWARE.
2525 ****************************************************************************/
2626
27- // @TODO add floatv and intv methods, that take arrays
28- // and float1..4 methods, which take arguments.
29-
3027var types =
3128 {
3229 GL_FLOAT : 0 ,
@@ -122,8 +119,8 @@ cc.UniformValue = cc.Class.extend({
122119 this . _value [ 1 ] , this . _value [ 2 ] ) ;
123120 break ;
124121 case types . GL_FLOAT_VEC4 :
125- this . _glprogram . setUniformLocationWith3f ( this . _uniform . location , this . _value [ 0 ] ,
126- this . _value [ 1 ] , this . _value [ 2 ] ) ;
122+ this . _glprogram . setUniformLocationWith4f ( this . _uniform . location , this . _value [ 0 ] ,
123+ this . _value [ 1 ] , this . _value [ 2 ] , this . _value [ 3 ] ) ;
127124 break ;
128125 case types . GL_FLOAT_MAT4 :
129126 this . _glprogram . setUniformLocationWithMatrix4fv ( this . _uniform . location , this . _value ) ;
@@ -136,7 +133,7 @@ cc.UniformValue = cc.Class.extend({
136133 cc . glBindTexture2DN ( this . _value , this . _textureId ) ;
137134 break ;
138135 default :
139- cc . Assert ( false , "Unsupported type" ) ;
136+ ;
140137 }
141138 } ,
142139} ) ;
You can’t perform that action at this time.
0 commit comments