- Minor code improvements, replaced if-else block by switch.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4981 dfc29bdd-3216-0410-991c-e03cc46cb475
master
nadro 2014-10-27 18:19:19 +00:00
parent 7ac215ee11
commit dbee39e634
1 changed files with 30 additions and 20 deletions

View File

@ -33,19 +33,25 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
setDebugName("COGLES2MaterialRenderer"); setDebugName("COGLES2MaterialRenderer");
#endif #endif
if (baseMaterial == EMT_TRANSPARENT_VERTEX_ALPHA || baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL || switch (baseMaterial)
baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA ||
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA)
{ {
case EMT_TRANSPARENT_VERTEX_ALPHA:
case EMT_TRANSPARENT_ALPHA_CHANNEL:
case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
Alpha = true; Alpha = true;
} break;
else if (baseMaterial == EMT_TRANSPARENT_ADD_COLOR || baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR || case EMT_TRANSPARENT_ADD_COLOR:
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR) case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
{ case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
FixedBlending = true; FixedBlending = true;
} break;
else if (baseMaterial == EMT_ONETEXTURE_BLEND) case EMT_ONETEXTURE_BLEND:
Blending = true; Blending = true;
break;
default:
break;
}
if (CallBack) if (CallBack)
CallBack->grab(); CallBack->grab();
@ -59,19 +65,25 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
E_MATERIAL_TYPE baseMaterial, s32 userData) E_MATERIAL_TYPE baseMaterial, s32 userData)
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData) : Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData)
{ {
if (baseMaterial == EMT_TRANSPARENT_VERTEX_ALPHA || baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL || switch (baseMaterial)
baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL_REF || baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA ||
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA)
{ {
case EMT_TRANSPARENT_VERTEX_ALPHA:
case EMT_TRANSPARENT_ALPHA_CHANNEL:
case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
Alpha = true; Alpha = true;
} break;
else if (baseMaterial == EMT_TRANSPARENT_ADD_COLOR || baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR || case EMT_TRANSPARENT_ADD_COLOR:
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR) case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
{ case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
FixedBlending = true; FixedBlending = true;
} break;
else if (baseMaterial == EMT_ONETEXTURE_BLEND) case EMT_ONETEXTURE_BLEND:
Blending = true; Blending = true;
break;
default:
break;
}
if (CallBack) if (CallBack)
CallBack->grab(); CallBack->grab();
@ -137,8 +149,6 @@ void COGLES2MaterialRenderer::init(s32& outMaterialTypeNr,
bool COGLES2MaterialRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) bool COGLES2MaterialRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
{ {
Driver->setTextureRenderStates(Driver->getCurrentMaterial(), false);
if (CallBack && Program) if (CallBack && Program)
CallBack->OnSetConstants(this, UserData); CallBack->OnSetConstants(this, UserData);