mirror of https://github.com/aap/librw.git
gl3 lighting callback
This commit is contained in:
parent
c0a5e0961d
commit
d7406e30fb
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue