Render from the normal loops.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 888812e72d
commit eabc209303

@ -549,6 +549,7 @@ void CDriverGL3::setupPass(uint pass)
// All others materials do not require multi pass. // All others materials do not require multi pass.
default: return; default: return;
} }
} }
// *************************************************************************** // ***************************************************************************

@ -201,33 +201,6 @@ namespace NL3D
setUniformMatrix4fv( mvpIndex, 1, false, mat.get() ); setUniformMatrix4fv( mvpIndex, 1, false, mat.get() );
} }
switch( mat.getShader() )
{
case CMaterial::Normal:
setupNormalPass();
break;
case CMaterial::LightMap:
beginLightMapMultiPass();
setupLightMapPass( 0 );
break;
case CMaterial::Specular:
beginSpecularMultiPass();
setupSpecularPass( 0 );
break;
}
if( !p->validate( log ) )
{
vp = NULL;
pp = NULL;
delete p;
p = NULL;
nlinfo( "%s", log.c_str() );
return false;
}
#endif #endif
return true; return true;
@ -235,17 +208,6 @@ namespace NL3D
void CDriverGL3::releaseProgram() void CDriverGL3::releaseProgram()
{ {
switch( _CurrentMaterial->getShader() )
{
case CMaterial::LightMap:
endLightMapMultiPass();
break;
case CMaterial::Specular:
endSpecularMultiPass();
break;
}
delete p; delete p;
p = NULL; p = NULL;
vp = NULL; vp = NULL;

@ -214,6 +214,10 @@ bool CDriverGL3::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
if ( !setupMaterial(mat) || _LastIB._Values == NULL ) if ( !setupMaterial(mat) || _LastIB._Values == NULL )
return false; return false;
#ifdef GLSL
setupProgram( mat );
#endif
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true; if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
// render primitives. // render primitives.
//============================== //==============================
@ -256,10 +260,6 @@ bool CDriverGL3::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
bool CDriverGL3::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris) bool CDriverGL3::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)
{ {
#ifdef GLSL
return renderTriangles2( mat, firstIndex, ntris );
#endif
H_AUTO_OGL(CDriverGL3_renderTriangles); H_AUTO_OGL(CDriverGL3_renderTriangles);
// update matrix and Light in OpenGL if needed // update matrix and Light in OpenGL if needed
@ -269,7 +269,9 @@ bool CDriverGL3::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris
if ( !setupMaterial(mat) || _LastIB._Values == NULL ) if ( !setupMaterial(mat) || _LastIB._Values == NULL )
return false; return false;
#ifdef GLSL
setupProgram( mat ); setupProgram( mat );
#endif
refreshTexMatrices(); refreshTexMatrices();
@ -363,6 +365,10 @@ bool CDriverGL3::renderRawPoints(CMaterial& mat, uint32 startIndex, uint32 numPo
if ( !setupMaterial(mat) ) if ( !setupMaterial(mat) )
return false; return false;
#ifdef GLSL
setupProgram( mat );
#endif
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true; if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
// render primitives. // render primitives.
//============================== //==============================
@ -404,6 +410,10 @@ bool CDriverGL3::renderRawLines(CMaterial& mat, uint32 startIndex, uint32 numLin
if ( !setupMaterial(mat) ) if ( !setupMaterial(mat) )
return false; return false;
#ifdef GLSL
setupProgram( mat );
#endif
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true; if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
// render primitives. // render primitives.
//============================== //==============================
@ -445,7 +455,9 @@ bool CDriverGL3::renderRawTriangles(CMaterial& mat, uint32 startIndex, uint32 nu
if ( !setupMaterial(mat) ) if ( !setupMaterial(mat) )
return false; return false;
#ifdef GLSL
setupProgram( mat ); setupProgram( mat );
#endif
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true; if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
// render primitives. // render primitives.
@ -491,9 +503,11 @@ bool CDriverGL3::renderRawQuads(CMaterial& mat, uint32 startIndex, uint32 numQua
if ( !setupMaterial(mat) ) if ( !setupMaterial(mat) )
return false; return false;
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true; #ifdef GLSL
setupProgram( mat ); setupProgram( mat );
#endif
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
const uint32 QUAD_BATCH_SIZE = 2048; const uint32 QUAD_BATCH_SIZE = 2048;
static GLshort defaultIndices[QUAD_BATCH_SIZE * 6]; static GLshort defaultIndices[QUAD_BATCH_SIZE * 6];

Loading…
Cancel
Save