@@ -198,10 +198,10 @@ @implementation CCShader {
198
198
BOOL _ownsProgram;
199
199
}
200
200
201
- // MARK: Uniform Setters:
201
+ // MARK: GL Uniform Setters:
202
202
203
- static CCUniformSetter
204
- SetFloat (NSString *name, GLint location)
203
+ static CCGLUniformSetter
204
+ GLUniformSetFloat (NSString *name, GLint location)
205
205
{
206
206
return ^(CCRenderer *renderer, NSDictionary *shaderUniforms, NSDictionary *globalShaderUniforms){
207
207
NSNumber *value = shaderUniforms[name] ?: globalShaderUniforms[name] ?: @(0.0 );
@@ -211,8 +211,8 @@ @implementation CCShader {
211
211
};
212
212
}
213
213
214
- static CCUniformSetter
215
- SetVec2 (NSString *name, GLint location)
214
+ static CCGLUniformSetter
215
+ GLUniformSetVec2 (NSString *name, GLint location)
216
216
{
217
217
NSString *textureName = nil ;
218
218
bool pixelSize = [name hasSuffix: @" PixelSize" ];
@@ -254,8 +254,8 @@ @implementation CCShader {
254
254
};
255
255
}
256
256
257
- static CCUniformSetter
258
- SetVec3 (NSString *name, GLint location)
257
+ static CCGLUniformSetter
258
+ GLUniformSetVec3 (NSString *name, GLint location)
259
259
{
260
260
return ^(CCRenderer *renderer, NSDictionary *shaderUniforms, NSDictionary *globalShaderUniforms){
261
261
NSValue *value = shaderUniforms[name] ?: globalShaderUniforms[name] ?: [NSValue valueWithGLKVector3: GLKVector3Make (0 .0f , 0 .0f , 0 .0f )];
@@ -267,8 +267,8 @@ @implementation CCShader {
267
267
};
268
268
}
269
269
270
- static CCUniformSetter
271
- SetVec4 (NSString *name, GLint location)
270
+ static CCGLUniformSetter
271
+ GLUniformSetVec4 (NSString *name, GLint location)
272
272
{
273
273
return ^(CCRenderer *renderer, NSDictionary *shaderUniforms, NSDictionary *globalShaderUniforms){
274
274
NSValue *value = shaderUniforms[name] ?: globalShaderUniforms[name] ?: [NSValue valueWithGLKVector4: GLKVector4Make (0 .0f , 0 .0f , 0 .0f , 1 .0f )];
@@ -287,8 +287,8 @@ @implementation CCShader {
287
287
};
288
288
}
289
289
290
- static CCUniformSetter
291
- SetMat4 (NSString *name, GLint location)
290
+ static CCGLUniformSetter
291
+ GLUniformSetMat4 (NSString *name, GLint location)
292
292
{
293
293
return ^(CCRenderer *renderer, NSDictionary *shaderUniforms, NSDictionary *globalShaderUniforms){
294
294
NSValue *value = shaderUniforms[name] ?: globalShaderUniforms[name] ?: [NSValue valueWithGLKMatrix4: GLKMatrix4Identity];
@@ -301,7 +301,7 @@ @implementation CCShader {
301
301
}
302
302
303
303
static NSDictionary *
304
- UniformSettersForProgram (GLuint program)
304
+ GLUniformSettersForProgram (GLuint program)
305
305
{
306
306
NSMutableDictionary *uniformSetters = [NSMutableDictionary dictionary ];
307
307
@@ -327,11 +327,11 @@ @implementation CCShader {
327
327
// Setup a block that is responsible for binding that uniform variable's value.
328
328
switch (type){
329
329
default : NSCAssert(NO , @" Uniform type not supported. (yet?)" );
330
- case GL_FLOAT: uniformSetters[name] = SetFloat (name, location); break ;
331
- case GL_FLOAT_VEC2: uniformSetters[name] = SetVec2 (name, location); break ;
332
- case GL_FLOAT_VEC3: uniformSetters[name] = SetVec3 (name, location); break ;
333
- case GL_FLOAT_VEC4: uniformSetters[name] = SetVec4 (name, location); break ;
334
- case GL_FLOAT_MAT4: uniformSetters[name] = SetMat4 (name, location); break ;
330
+ case GL_FLOAT: uniformSetters[name] = GLUniformSetFloat (name, location); break ;
331
+ case GL_FLOAT_VEC2: uniformSetters[name] = GLUniformSetVec2 (name, location); break ;
332
+ case GL_FLOAT_VEC3: uniformSetters[name] = GLUniformSetVec3 (name, location); break ;
333
+ case GL_FLOAT_VEC4: uniformSetters[name] = GLUniformSetVec4 (name, location); break ;
334
+ case GL_FLOAT_MAT4: uniformSetters[name] = GLUniformSetMat4 (name, location); break ;
335
335
case GL_SAMPLER_2D: {
336
336
// Sampler setters are handled a differently since the real work is binding the texture and not setting the uniform value.
337
337
uniformSetters[name] = ^(CCRenderer *renderer, NSDictionary *shaderUniforms, NSDictionary *globalShaderUniforms){
@@ -413,7 +413,7 @@ -(instancetype)initWithVertexShaderSource:(NSString *)vertexSource fragmentShade
413
413
414
414
CCGL_DEBUG_POP_GROUP_MARKER ();
415
415
416
- blockself = [blockself initWithGLProgram: program uniformSetters: UniformSettersForProgram (program) ownsProgram: YES ];
416
+ blockself = [blockself initWithGLProgram: program uniformSetters: GLUniformSettersForProgram (program) ownsProgram: YES ];
417
417
});
418
418
419
419
return blockself;
0 commit comments