Factorize displace and glow state changes.

This commit is contained in:
Vincent Lejeune
2014-01-29 02:08:52 +01:00
parent 4c7ba19642
commit a9258500b8
2 changed files with 12 additions and 17 deletions

View File

@@ -649,6 +649,11 @@ void IrrDriver::renderGlow(video::SOverrideMaterial &overridemat,
glStencilFunc(GL_ALWAYS, 1, ~0);
glEnable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
for (u32 i = 0; i < glowcount; i++)
{
const GlowData &dat = glows[i];
@@ -949,6 +954,11 @@ void IrrDriver::renderDisplacement(video::SOverrideMaterial &overridemat,
const int displacingcount = m_displacing.size();
irr_driver->setPhase(DISPLACEMENT_PASS);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
for (int i = 0; i < displacingcount; i++)
{

View File

@@ -640,10 +640,7 @@ void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatr
void STKMesh::drawGlow(const GLMesh &mesh)
{
ColorizeProvider * const cb = (ColorizeProvider *)irr_driver->getCallback(ES_COLORIZE);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
@@ -654,17 +651,12 @@ void STKMesh::drawGlow(const GLMesh &mesh)
glBindVertexArray(mesh.vao_glow_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void STKMesh::drawDisplace(const GLMesh &mesh)
{
DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
@@ -678,8 +670,6 @@ void STKMesh::drawDisplace(const GLMesh &mesh)
glBindVertexArray(mesh.vao_displace_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void STKMesh::drawTransparent(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
@@ -703,11 +693,6 @@ void STKMesh::drawSolid(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
{
windDir = getWind();
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
computeMVP(ModelViewProjectionMatrix);
computeTIMV(TransposeInverseModelView);