Apply alpha mask in constructor, not every time. Apart from being faster it uses less RAM.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8390 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-04-20 01:53:25 +00:00
parent 20198bd92c
commit 221b784680

View File

@ -256,6 +256,11 @@ void Material::install(bool is_full_path)
m_texture = irr_driver->getTexture(full_path,
isPreMul(), isPreDiv());
if (m_mask.size() > 0)
{
m_texture = irr_driver->applyMask(m_texture, m_mask);
}
// now set the name to the basename, so that all tests work as expected
m_texname = StringUtils::getBasename(m_texname);
} // install
@ -396,12 +401,6 @@ void Material::setMaterialProperties(video::SMaterial *m) const
{
int modes = 0;
if (m_mask.size() > 0)
{
video::ITexture* newtex = irr_driver->applyMask(m->getTexture(0), m_mask);
if (newtex) m->setTexture(0, newtex);
}
if (m_alpha_testing)
{
// Note: if EMT_TRANSPARENT_ALPHA_CHANNEL is used, you have to use