Skip to content

Commit 58d38c8

Browse files
author
Thayer J Andrews
committed
CCEffectLighting - Directional lighting fix
Normalize the directional light vector after transforming it into the node's tangent space.
1 parent 7d57810 commit 58d38c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cocos2d/CCEffectLighting.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ -(void)buildRenderPasses
193193
GLKVector4 lightVector = GLKVector4Make(0.0f, 0.0f, 0.0f, 0.0f);
194194
if (light.type == CCLightDirectional)
195195
{
196-
lightVector = GLKMatrix4MultiplyVector4(lightNodeToEffectNode, GLKVector4Make(0.0f, 1.0f, 1.0f, 0.0f));
196+
lightVector = GLKVector4Normalize(GLKMatrix4MultiplyVector4(lightNodeToEffectNode, GLKVector4Make(0.0f, 1.0f, 1.0f, 0.0f)));
197197
}
198198
else
199199
{

0 commit comments

Comments
 (0)