Skip to content

Commit 3942903

Browse files
author
Thayer J Andrews
committed
CCEffectLighting - Specular GLSL compilation fix
1 parent a2bf755 commit 3942903

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cocos2d/CCEffectLighting.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ +(NSMutableArray *)buildFragmentFunctionsWithLights:(NSArray*)lights normalMap:(
155155
[effectBody appendFormat:@"lightDist = length(v_tangentSpaceLightDir%lu.xyz);\n", (unsigned long)lightIndex];
156156
[effectBody appendFormat:@"falloffTerm = max(0.0, (1.0 - lightDist * u_lightFalloff%lu));\n", (unsigned long)lightIndex];
157157
[effectBody appendFormat:@"lightColor = u_lightColor%lu * falloffTerm;\n", (unsigned long)lightIndex];
158-
[effectBody appendFormat:@"lightSpecularColor = u_lightSpecularColor%lu * falloffTerm;\n", (unsigned long)lightIndex];
158+
if (needsSpecular)
159+
{
160+
[effectBody appendFormat:@"lightSpecularColor = u_lightSpecularColor%lu * falloffTerm;\n", (unsigned long)lightIndex];
161+
}
159162
}
160163
[effectBody appendString:@"diffuseTerm = max(0.0, dot(tangentSpaceNormal, tangentSpaceLightDir));\n"];
161164
[effectBody appendString:@"diffuseSum += lightColor * diffuseTerm;\n"];

0 commit comments

Comments
 (0)