From 90523fc3d5ab585a832d30373d27b6582fad215d Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 25 Sep 2014 22:24:47 +0800 Subject: [PATCH] fix light check --- cocos/3d/CCSprite3D.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 48c8cc0207..53b6aa2ec4 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -528,10 +528,9 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) bool usingLight = false; Color4F ambient(0.f, 0.f, 0.f, 1.f); for (const auto light : lights) { - if (((unsigned short)light->getLightFlag() & _lightMask) > 0) - { - usingLight = true; - } + usingLight = ((unsigned short)light->getLightFlag() & _lightMask) > 0; + if (usingLight) + break; } if (usingLight != _shaderUsingLight) genGLProgramState();