Add lightmap debug view

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9737 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-09-04 19:17:32 +00:00
parent c457505f9f
commit 42e4c34aac

View File

@@ -32,6 +32,8 @@
#include <SMaterial.h>
#include <IMeshBuffer.h>
const bool LIGHTMAP_VISUALISATION = false;
MaterialManager *material_manager=0;
MaterialManager::MaterialManager()
@@ -74,6 +76,24 @@ void MaterialManager::setAllMaterialFlags(video::ITexture* t,
if (m_materials[i]->getTexFname()==image)
{
m_materials[i]->setMaterialProperties(&(mb->getMaterial()));
// ---- lightmap debug
if (LIGHTMAP_VISUALISATION && mb->getVertexType() == video::EVT_2TCOORDS)
{
video::S3DVertex2TCoords* coords = (video::S3DVertex2TCoords*)mb->getVertices();
for (unsigned int v=0; v<mb->getVertexCount(); v++)
{
core::vector2d<f32> tmp = coords[v].TCoords2;
coords[v].TCoords2 = coords[v].TCoords;
coords[v].TCoords = tmp;
}
video::ITexture* tmp = mb->getMaterial().getTexture(0);
mb->getMaterial().setTexture(0, mb->getMaterial().getTexture(1));
mb->getMaterial().setTexture(1, tmp);
}
// --------------------
return;
}
} // for i