I am going thru the code line by line, just to familiarize myself with the base code in preparation for development. In general i love it, it's very easy to read
but i did find something that confused me a little, a double test...
Code:
if( Modules::config().wireframeMode && !Modules::config().debugViewMode )
{
glDisable( GL_CULL_FACE );
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
map< int, NodeRegEntry >::const_iterator itr = Modules::sceneMan()._registry.begin();
while( itr != Modules::sceneMan()._registry.end() )
{
if( itr->second.renderFunc != 0x0 )
(*itr->second.renderFunc)( shaderContext, theClass, debugView, frust1, frust2, order, occSet );
++itr;
}
if( Modules::config().wireframeMode && !Modules::config().debugViewMode )
{
glEnable( GL_CULL_FACE );
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
taking a second look, it is clear why it's there, it enables the debug mode, however... wouldn't it be easier to use something like this?
Code:
map< int, NodeRegEntry >::const_iterator itr = Modules::sceneMan()._registry.begin();
if( Modules::config().wireframeMode && !Modules::config().debugViewMode )
{ //Render Scene in wireframe mode
glDisable( GL_CULL_FACE );
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
while( itr != Modules::sceneMan()._registry.end() )
{
if( itr->second.renderFunc != 0x0 )
(*itr->second.renderFunc)( shaderContext, theClass, debugView, frust1, frust2, order, occSet );
++itr;
}
glEnable( GL_CULL_FACE );
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
else{
//Render scene in regular mode.
while( itr != Modules::sceneMan()._registry.end() )
{
if( itr->second.renderFunc != 0x0 )
(*itr->second.renderFunc)( shaderContext, theClass, debugView, frust1, frust2, order, occSet );
++itr;
}
}
and avoid the double test? Well i guess that one less test is not very relevant (performance wise) since it's only going to be tested once. But witch version do you think is more readable?