mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-15 04:39:03 +00:00
update librw; gl cleanup
This commit is contained in:
parent
c3af33f97d
commit
a4412e8d63
2 changed files with 15 additions and 71 deletions
|
@ -91,13 +91,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB(atomic);
|
lightingCB(atomic);
|
||||||
|
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(header);
|
||||||
glBindVertexArray(header->vao);
|
|
||||||
#else
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
|
||||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
@ -137,9 +131,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||||
setTexture(1, nil);
|
setTexture(1, nil);
|
||||||
|
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(header);
|
||||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -210,13 +202,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB(atomic);
|
lightingCB(atomic);
|
||||||
|
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(header);
|
||||||
glBindVertexArray(header->vao);
|
|
||||||
#else
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
|
||||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
@ -254,9 +240,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
inst++;
|
inst++;
|
||||||
}
|
}
|
||||||
setTexture(1, nil);
|
setTexture(1, nil);
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(header);
|
||||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -318,13 +302,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
|
|
||||||
Material *m;
|
Material *m;
|
||||||
|
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(header);
|
||||||
glBindVertexArray(header->vao);
|
|
||||||
#else
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
|
||||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
@ -367,9 +345,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||||
SetRenderState(DESTBLEND, BLENDINVSRCALPHA);
|
SetRenderState(DESTBLEND, BLENDINVSRCALPHA);
|
||||||
|
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(header);
|
||||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -453,13 +429,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB(atomic);
|
lightingCB(atomic);
|
||||||
|
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(header);
|
||||||
glBindVertexArray(header->vao);
|
|
||||||
#else
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
|
||||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
@ -482,9 +452,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
drawInst(header, inst);
|
drawInst(header, inst);
|
||||||
inst++;
|
inst++;
|
||||||
}
|
}
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(header);
|
||||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -504,13 +472,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||||
lightingCB(atomic);
|
lightingCB(atomic);
|
||||||
|
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(header);
|
||||||
glBindVertexArray(header->vao);
|
|
||||||
#else
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
|
||||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
@ -531,9 +493,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
drawInst(header, inst);
|
drawInst(header, inst);
|
||||||
inst++;
|
inst++;
|
||||||
}
|
}
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(header);
|
||||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -696,13 +656,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
if(!setupDone){
|
if(!setupDone){
|
||||||
defaultShader->use();
|
defaultShader->use();
|
||||||
setWorldMatrix(&building->matrix);
|
setWorldMatrix(&building->matrix);
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(building->instHeader);
|
||||||
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
|
|
||||||
setLights(&lights);
|
setLights(&lights);
|
||||||
setupDone = true;
|
setupDone = true;
|
||||||
}
|
}
|
||||||
|
@ -713,9 +667,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
|
||||||
drawInst(building->instHeader, inst);
|
drawInst(building->instHeader, inst);
|
||||||
}
|
}
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(building->instHeader);
|
||||||
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
|
||||||
#endif
|
|
||||||
if(defer)
|
if(defer)
|
||||||
numBlendInsts[pass]++;
|
numBlendInsts[pass]++;
|
||||||
}
|
}
|
||||||
|
@ -754,13 +706,7 @@ RenderBlendPass(int pass)
|
||||||
for(i = 0; i < numBlendInsts[pass]; i++){
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
BuildingInst *building = &blendInsts[pass][i];
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
#ifdef RW_GL_USE_VAOS
|
setupVertexInput(building->instHeader);
|
||||||
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
|
|
||||||
setWorldMatrix(&building->matrix);
|
setWorldMatrix(&building->matrix);
|
||||||
if(building->lighting)
|
if(building->lighting)
|
||||||
lights.ambient = pAmbient->color;
|
lights.ambient = pAmbient->color;
|
||||||
|
@ -782,9 +728,7 @@ RenderBlendPass(int pass)
|
||||||
|
|
||||||
drawInst(building->instHeader, inst);
|
drawInst(building->instHeader, inst);
|
||||||
}
|
}
|
||||||
#ifndef RW_GL_USE_VAOS
|
teardownVertexInput(building->instHeader);
|
||||||
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
vendor/librw
vendored
2
vendor/librw
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit c2defffca391a865af77146dffe762419066af74
|
Subproject commit 576d211cbd76bfef43f33f2f837c0f392dbe86fe
|
Loading…
Reference in a new issue