A few formatting fixes
This commit is contained in:
parent
9446a9166d
commit
7ca069e63e
|
@ -1203,18 +1203,23 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
||||||
modelunit_to_3d_units_factor );
|
modelunit_to_3d_units_factor );
|
||||||
|
|
||||||
// Get the list of model files for this model
|
// Get the list of model files for this model
|
||||||
for (auto& sM : module->Models ())
|
for( auto& sM : module->Models () )
|
||||||
{
|
|
||||||
if( !sM.m_Filename.empty() )
|
|
||||||
{
|
{
|
||||||
|
if( sM.m_Filename.empty() )
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check if the model is present in our cache map
|
// Check if the model is present in our cache map
|
||||||
auto cache_i = m_3dmodel_map.find( sM.m_Filename );
|
auto cache_i = m_3dmodel_map.find( sM.m_Filename );
|
||||||
if( cache_i != m_3dmodel_map.end() )
|
|
||||||
{
|
if( cache_i == m_3dmodel_map.end() )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( const C_OGL_3DMODEL *modelPtr = cache_i->second )
|
if( const C_OGL_3DMODEL *modelPtr = cache_i->second )
|
||||||
{
|
{
|
||||||
if( ( (!aRenderTransparentOnly) && modelPtr->Have_opaque() && (sM.m_Opacity >= 1.0 ) ) ||
|
bool opaque = sM.m_Opacity >= 1.0;
|
||||||
( aRenderTransparentOnly && ( modelPtr->Have_transparent() || (sM.m_Opacity < 1.0 ) ) ) )
|
|
||||||
|
if( ( !aRenderTransparentOnly && modelPtr->Have_opaque() && opaque ) ||
|
||||||
|
( aRenderTransparentOnly && ( modelPtr->Have_transparent() || !opaque ) ) )
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
|
@ -1222,9 +1227,12 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
||||||
// values have changed. cache the matrix somewhere.
|
// values have changed. cache the matrix somewhere.
|
||||||
glm::mat4 mtx( 1 );
|
glm::mat4 mtx( 1 );
|
||||||
mtx = glm::translate( mtx, { sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z } );
|
mtx = glm::translate( mtx, { sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z } );
|
||||||
mtx = glm::rotate( mtx, glm::radians( (float)-sM.m_Rotation.z ), { 0.0f, 0.0f, 1.0f } );
|
mtx = glm::rotate(
|
||||||
mtx = glm::rotate( mtx, glm::radians( (float)-sM.m_Rotation.y ), { 0.0f, 1.0f, 0.0f } );
|
mtx, glm::radians( (float) -sM.m_Rotation.z ), { 0.0f, 0.0f, 1.0f } );
|
||||||
mtx = glm::rotate( mtx, glm::radians( (float)-sM.m_Rotation.x ), { 1.0f, 0.0f, 0.0f } );
|
mtx = glm::rotate(
|
||||||
|
mtx, glm::radians( (float) -sM.m_Rotation.y ), { 0.0f, 1.0f, 0.0f } );
|
||||||
|
mtx = glm::rotate(
|
||||||
|
mtx, glm::radians( (float) -sM.m_Rotation.x ), { 1.0f, 0.0f, 0.0f } );
|
||||||
mtx = glm::scale( mtx, { sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z } );
|
mtx = glm::scale( mtx, { sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z } );
|
||||||
glMultMatrixf( glm::value_ptr( mtx ) );
|
glMultMatrixf( glm::value_ptr( mtx ) );
|
||||||
|
|
||||||
|
@ -1254,8 +1262,6 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1335,7 +1335,7 @@ void C3D_RENDER_RAYTRACING::load_3D_models()
|
||||||
|
|
||||||
while( sM != eM )
|
while( sM != eM )
|
||||||
{
|
{
|
||||||
if( ( (float)sM->m_Opacity > FLT_EPSILON ) &&
|
if( ( static_cast<float>( sM->m_Opacity ) > FLT_EPSILON ) &&
|
||||||
( sM->m_Show && !sM->m_Filename.empty() ) )
|
( sM->m_Show && !sM->m_Filename.empty() ) )
|
||||||
{
|
{
|
||||||
// get it from cache
|
// get it from cache
|
||||||
|
|
|
@ -208,6 +208,7 @@ void OGL_DrawBackground( const SFVEC3F &aTopColor, const SFVEC3F &aBotColor )
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OGL_ResetTextureStateDefaults()
|
void OGL_ResetTextureStateDefaults()
|
||||||
{
|
{
|
||||||
glActiveTexture( GL_TEXTURE0 );
|
glActiveTexture( GL_TEXTURE0 );
|
||||||
|
@ -218,5 +219,5 @@ void OGL_ResetTextureStateDefaults()
|
||||||
|
|
||||||
const SFVEC4F zero = SFVEC4F( 0.0f );
|
const SFVEC4F zero = SFVEC4F( 0.0f );
|
||||||
|
|
||||||
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, (const float*)&zero.x );
|
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, static_cast<const float*>( &zero.x ) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue