Allow vertex colors to be used with lightmaps

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12564 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-03-17 23:06:37 +00:00
parent 82ce55b443
commit 7a81d37f69
2 changed files with 28 additions and 0 deletions

View File

@ -864,6 +864,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
fprintf(stderr, "WARNING: track uses deprecated texture <%s>\n", m_texname.c_str());
}
int modes = 0;
if (m_alpha_testing)
@ -1094,6 +1095,19 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
m->MaterialType = (E_MATERIAL_TYPE)material_type;
}
// Modify lightmap materials so that vertex colors are taken into account.
// But disable lighting because we assume all lighting is already part
// of the lightmap
if (m->MaterialType == video::EMT_LIGHTMAP)
{
m->MaterialType = video::EMT_LIGHTMAP_LIGHTING;
m->AmbientColor = video::SColor(255, 255, 255, 255);
m->DiffuseColor = video::SColor(255, 255, 255, 255);
m->EmissiveColor = video::SColor(255, 255, 255, 255);
m->SpecularColor = video::SColor(255, 255, 255, 255);
}
if (m_graphical_effect == GE_BUBBLE && mb != NULL)
{
IVideoDriver* video_driver = irr_driver->getVideoDriver();

View File

@ -119,6 +119,20 @@ void MaterialManager::setAllMaterialFlags(video::ITexture* t,
mb->getMaterial().FogEnable = World::getWorld()->getTrack()->isFogEnabled();
}
// Modify lightmap materials so that vertex colors are taken into account.
// But disable lighting because we assume all lighting is already part
// of the lightmap
if (mb->getMaterial().MaterialType == video::EMT_LIGHTMAP)
{
mb->getMaterial().MaterialType = video::EMT_LIGHTMAP_LIGHTING;
mb->getMaterial().AmbientColor = video::SColor(255, 255, 255, 255);
mb->getMaterial().DiffuseColor = video::SColor(255, 255, 255, 255);
mb->getMaterial().EmissiveColor = video::SColor(255, 255, 255, 255);
mb->getMaterial().SpecularColor = video::SColor(255, 255, 255, 255);
}
//if (UserConfigParams::m_fullscreen_antialiasing)
// mb->getMaterial().AntiAliasing = video::EAAM_LINE_SMOOTH;