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 32
32
this . _textureAtlas = null ;
33
33
this . _colorUnmodified = cc . color . WHITE ;
34
34
this . _colorF32Array = null ;
35
- this . _uniformColor = null ;
36
35
37
36
this . _matrix = new cc . math . Matrix4 ( ) ;
38
37
this . _matrix . identity ( ) ;
39
38
40
39
//shader stuff
41
40
this . _shaderProgram = cc . shaderCache . programForKey ( cc . SHADER_POSITION_TEXTURE_UCOLOR ) ;
42
- this . _uniformColor = cc . _renderContext . getUniformLocation ( this . _shaderProgram . getProgram ( ) , "u_color" ) ;
43
41
} ;
44
42
45
43
var proto = cc . AtlasNode . WebGLRenderCmd . prototype = Object . create ( cc . Node . WebGLRenderCmd . prototype ) ;
71
69
this . _glProgramState . apply ( this . _matrix ) ;
72
70
73
71
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 ) ;
76
74
this . _textureAtlas . drawNumberOfQuads ( node . quadsToDraw , 0 ) ;
77
75
}
78
76
} ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ cc.GridBase = cc.Class.extend(/** @lends cc.GridBase# */{
39
39
_step : null ,
40
40
_grabber : null ,
41
41
_isTextureFlipped : false ,
42
- _shaderProgram : null ,
42
+ _glProgramState : null ,
43
43
_directorProjection : 0 ,
44
44
45
45
_dirty : false ,
@@ -62,7 +62,7 @@ cc.GridBase = cc.Class.extend(/** @lends cc.GridBase# */{
62
62
this . _step = cc . p ( 0 , 0 ) ;
63
63
this . _grabber = null ;
64
64
this . _isTextureFlipped = false ;
65
- this . _shaderProgram = null ;
65
+ this . _glProgramState = null ;
66
66
this . _directorProjection = 0 ;
67
67
this . _dirty = false ;
68
68
@@ -227,7 +227,7 @@ cc.GridBase = cc.Class.extend(/** @lends cc.GridBase# */{
227
227
if ( ! this . _grabber )
228
228
return false ;
229
229
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 ) ) ;
231
231
this . calculateVertexPoints ( ) ;
232
232
return true ;
233
233
} ,
Original file line number Diff line number Diff line change 24
24
THE SOFTWARE.
25
25
****************************************************************************/
26
26
27
- // @TODO add floatv and intv methods, that take arrays
28
- // and float1..4 methods, which take arguments.
29
-
30
27
var types =
31
28
{
32
29
GL_FLOAT : 0 ,
@@ -122,8 +119,8 @@ cc.UniformValue = cc.Class.extend({
122
119
this . _value [ 1 ] , this . _value [ 2 ] ) ;
123
120
break ;
124
121
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 ] ) ;
127
124
break ;
128
125
case types . GL_FLOAT_MAT4 :
129
126
this . _glprogram . setUniformLocationWithMatrix4fv ( this . _uniform . location , this . _value ) ;
@@ -136,7 +133,7 @@ cc.UniformValue = cc.Class.extend({
136
133
cc . glBindTexture2DN ( this . _value , this . _textureId ) ;
137
134
break ;
138
135
default :
139
- cc . Assert ( false , "Unsupported type" ) ;
136
+ ;
140
137
}
141
138
} ,
142
139
} ) ;
You can’t perform that action at this time.
0 commit comments