Skip to content

Commit 55803eb

Browse files
author
Thayer J Andrews
committed
CCEffectLighting - Fix exception when specular exponent == 0.0
1 parent 16e5b30 commit 55803eb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cocos2d/CCEffectLighting.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,13 @@ -(void)buildRenderPasses
252252
}
253253

254254
pass.shaderUniforms[weakSelf.uniformTranslationTable[@"u_globalAmbientColor"]] = [NSValue valueWithGLKVector4:globalAmbientColor];
255-
pass.shaderUniforms[weakSelf.uniformTranslationTable[@"u_specularExponent"]] = [NSNumber numberWithFloat:weakSelf.shininess];
256-
pass.shaderUniforms[weakSelf.uniformTranslationTable[@"u_specularColor"]] = [NSValue valueWithGLKVector4:weakSelf.specularColor.glkVector4];
257-
255+
256+
if (self.needsSpecular)
257+
{
258+
pass.shaderUniforms[weakSelf.uniformTranslationTable[@"u_specularExponent"]] = [NSNumber numberWithFloat:weakSelf.shininess];
259+
pass.shaderUniforms[weakSelf.uniformTranslationTable[@"u_specularColor"]] = [NSValue valueWithGLKVector4:weakSelf.specularColor.glkVector4];
260+
}
261+
258262
} copy]];
259263

260264
self.renderPasses = @[pass0];

0 commit comments

Comments
 (0)