Browse Source

update librw; gl cleanup

lcs
aap 2 years ago
parent
commit
73612215d8
  1. 108
      src/extras/custompipes_gl.cpp
  2. 2
      vendor/librw

108
src/extras/custompipes_gl.cpp

@ -111,13 +111,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -111,13 +111,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -167,9 +161,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -167,9 +161,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDSRCALPHA);
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
void
@ -200,13 +192,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea @@ -200,13 +192,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -251,9 +237,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea @@ -251,9 +237,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea
setTexture(1, nil);
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
static void
@ -310,13 +294,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -310,13 +294,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -357,9 +335,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -357,9 +335,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDSRCALPHA);
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
void
@ -455,13 +431,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -455,13 +431,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -494,9 +464,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -494,9 +464,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
drawInst(header, inst);
inst++;
}
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
void
@ -564,13 +532,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -564,13 +532,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
Material *m;
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -608,9 +570,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -608,9 +570,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDSRCALPHA);
SetRenderState(DESTBLEND, BLENDINVSRCALPHA);
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
void
@ -693,13 +653,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -693,13 +653,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -722,9 +676,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -722,9 +676,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
drawInst(header, inst);
inst++;
}
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
static void
@ -743,13 +695,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -743,13 +695,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(header->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
setAttribPointers(header->attribDesc, header->numAttribs);
#endif
setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@ -770,9 +716,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -770,9 +716,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
drawInst(header, inst);
inst++;
}
#ifndef RW_GL_USE_VAOS
disableAttribPointers(header->attribDesc, header->numAttribs);
#endif
teardownVertexInput(header);
}
void
@ -938,13 +882,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass) @@ -938,13 +882,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
else
CustomPipes::leedsWorldShader->use();
setWorldMatrix(&building->matrix);
#ifdef RW_GL_USE_VAOS
glBindVertexArray(building->instHeader->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
#endif
setupVertexInput(building->instHeader);
CustomPipes::uploadWorldLights();
@ -965,9 +903,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass) @@ -965,9 +903,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
drawInst(building->instHeader, inst);
}
#ifndef RW_GL_USE_VAOS
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
#endif
teardownVertexInput(building->instHeader);
if(defer)
numBlendInsts[pass]++;
}
@ -1010,13 +946,7 @@ RenderBlendPass(int pass) @@ -1010,13 +946,7 @@ RenderBlendPass(int pass)
for(i = 0; i < numBlendInsts[pass]; i++){
BuildingInst *building = &blendInsts[pass][i];
#ifdef RW_GL_USE_VAOS
glBindVertexArray(building->instHeader->vao);
#else
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
#endif
setupVertexInput(building->instHeader);
setWorldMatrix(&building->matrix);
InstanceData *inst = building->instHeader->inst;
@ -1041,9 +971,7 @@ RenderBlendPass(int pass) @@ -1041,9 +971,7 @@ RenderBlendPass(int pass)
drawInst(building->instHeader, inst);
}
#ifndef RW_GL_USE_VAOS
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
#endif
teardownVertexInput(building->instHeader);
}
}
}

2
vendor/librw vendored

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 41ae7b9b61c6736b34269df0f0350d1b5bcff4df
Subproject commit 576d211cbd76bfef43f33f2f837c0f392dbe86fe
Loading…
Cancel
Save