diff --git a/src/gl/gl3matfx.cpp b/src/gl/gl3matfx.cpp index 38705c5..51aa60f 100644 --- a/src/gl/gl3matfx.cpp +++ b/src/gl/gl3matfx.cpp @@ -193,7 +193,7 @@ void matfxRenderCB(Atomic *atomic, InstanceDataHeader *header) { setWorldMatrix(atomic->getFrame()->getLTM()); - lightingCB(); + lightingCB(!!(atomic->geometry->flags & Geometry::NORMALS)); glBindBuffer(GL_ARRAY_BUFFER, header->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo); diff --git a/src/gl/gl3render.cpp b/src/gl/gl3render.cpp index 8f5c68b..ad819df 100644 --- a/src/gl/gl3render.cpp +++ b/src/gl/gl3render.cpp @@ -41,7 +41,7 @@ disableAttribPointers(AttribDesc *attribDescs, int32 numAttribs) } void -lightingCB(void) +lightingCB(bool32 normals) { World *world; RGBAf ambLight = { 0.0, 0.0, 0.0, 1.0 }; @@ -51,7 +51,9 @@ lightingCB(void) // only unpositioned lights right now FORLIST(lnk, world->directionalLights){ Light *l = Light::fromWorld(lnk); - if(l->getType() == Light::DIRECTIONAL){ + if(normals && + l->getType() == Light::DIRECTIONAL && + l->getFlags() & Light::LIGHTATOMICS){ if(n >= MAX_LIGHTS) continue; setLight(n++, l); @@ -75,7 +77,7 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header) GLfloat surfProps[4]; setWorldMatrix(atomic->getFrame()->getLTM()); - lightingCB(); + lightingCB(!!(atomic->geometry->flags & Geometry::NORMALS)); glBindBuffer(GL_ARRAY_BUFFER, header->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo); diff --git a/src/gl/gl3skin.cpp b/src/gl/gl3skin.cpp index 3f588a2..30b0aae 100644 --- a/src/gl/gl3skin.cpp +++ b/src/gl/gl3skin.cpp @@ -243,7 +243,7 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header) GLfloat surfProps[4]; setWorldMatrix(atomic->getFrame()->getLTM()); - lightingCB(); + lightingCB(!!(atomic->geometry->flags & Geometry::NORMALS)); glBindBuffer(GL_ARRAY_BUFFER, header->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo); diff --git a/src/gl/rwgl3.h b/src/gl/rwgl3.h index bfbaa6a..446e685 100644 --- a/src/gl/rwgl3.h +++ b/src/gl/rwgl3.h @@ -153,7 +153,7 @@ public: void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header); void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header); void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header); -void lightingCB(void); +void lightingCB(bool32 normals); ObjPipeline *makeDefaultPipeline(void);