mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
gl3 lighting callback
This commit is contained in:
parent
c0a5e0961d
commit
d7406e30fb
@ -193,7 +193,7 @@ void
|
|||||||
matfxRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
matfxRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
||||||
{
|
{
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB();
|
lightingCB(!!(atomic->geometry->flags & Geometry::NORMALS));
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||||
|
@ -41,7 +41,7 @@ disableAttribPointers(AttribDesc *attribDescs, int32 numAttribs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lightingCB(void)
|
lightingCB(bool32 normals)
|
||||||
{
|
{
|
||||||
World *world;
|
World *world;
|
||||||
RGBAf ambLight = { 0.0, 0.0, 0.0, 1.0 };
|
RGBAf ambLight = { 0.0, 0.0, 0.0, 1.0 };
|
||||||
@ -51,7 +51,9 @@ lightingCB(void)
|
|||||||
// only unpositioned lights right now
|
// only unpositioned lights right now
|
||||||
FORLIST(lnk, world->directionalLights){
|
FORLIST(lnk, world->directionalLights){
|
||||||
Light *l = Light::fromWorld(lnk);
|
Light *l = Light::fromWorld(lnk);
|
||||||
if(l->getType() == Light::DIRECTIONAL){
|
if(normals &&
|
||||||
|
l->getType() == Light::DIRECTIONAL &&
|
||||||
|
l->getFlags() & Light::LIGHTATOMICS){
|
||||||
if(n >= MAX_LIGHTS)
|
if(n >= MAX_LIGHTS)
|
||||||
continue;
|
continue;
|
||||||
setLight(n++, l);
|
setLight(n++, l);
|
||||||
@ -75,7 +77,7 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
|||||||
GLfloat surfProps[4];
|
GLfloat surfProps[4];
|
||||||
|
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB();
|
lightingCB(!!(atomic->geometry->flags & Geometry::NORMALS));
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||||
|
@ -243,7 +243,7 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
|||||||
GLfloat surfProps[4];
|
GLfloat surfProps[4];
|
||||||
|
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB();
|
lightingCB(!!(atomic->geometry->flags & Geometry::NORMALS));
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||||
|
@ -153,7 +153,7 @@ public:
|
|||||||
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header);
|
void defaultInstanceCB(Geometry *geo, InstanceDataHeader *header);
|
||||||
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
|
void defaultUninstanceCB(Geometry *geo, InstanceDataHeader *header);
|
||||||
void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header);
|
void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header);
|
||||||
void lightingCB(void);
|
void lightingCB(bool32 normals);
|
||||||
|
|
||||||
ObjPipeline *makeDefaultPipeline(void);
|
ObjPipeline *makeDefaultPipeline(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user