]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Fixed transparency (qer_trans) not working on models
authorWilli Schinmeyer <willi@schinmeyer.de>
Fri, 4 May 2012 08:32:48 +0000 (10:32 +0200)
committerWilli Schinmeyer <willi@schinmeyer.de>
Fri, 4 May 2012 08:32:48 +0000 (10:32 +0200)
plugins/model/cpicosurface.cpp

index da88eb58a6ad6d518ed0661d5af513d1c938305b..470623fa65670aeb7124f7267a4e853e86b00f6c 100644 (file)
@@ -48,12 +48,18 @@ void CPicoSurface::Draw( int state, IShader *pShader, int rflags ){
 
        if ( !( rflags & ( DRAW_RF_SEL_OUTLINE | DRAW_RF_SEL_FILL | DRAW_RF_XY ) ) ) {
                if ( state & DRAW_GL_TEXTURE_2D ) {
+                       bool bTrans = ( pShader->getFlags() & QER_TRANS ) == QER_TRANS;
+                       bool bDrawBlend = ( state & DRAW_GL_BLEND ) == DRAW_GL_BLEND;
+                       //only draw transparent stuff when in transparent stuff pass and vice versa
+                       if(bTrans != bDrawBlend) {
+                               return;
+                       }
                        g_QglTable.m_pfn_qglBindTexture( GL_TEXTURE_2D, pShader->getTexture()->texture_number );
                        if ( ( rflags & DRAW_RF_CAM ) && ( pShader->getFlags() & QER_ALPHAFUNC ) ) {
                                int nFunc = 0;
                                float fRef = 0.f;
 
-                               g_QglTable.m_pfn_qglColor4f( 1.f, 1.f, 1.f, 1.f ); // identity
+                               g_QglTable.m_pfn_qglColor4f( 1.f, 1.f, 1.f, pShader->getTrans() ); // transparency
 
                                g_QglTable.m_pfn_qglEnable( GL_ALPHA_TEST );