1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-10 21:40:15 +00:00

Use a null material for non-SubEntities in the selection buffer

This commit is contained in:
Chris Robinson 2013-08-04 18:31:12 -07:00
parent 8f69c51b24
commit 643e7651e0

View File

@ -4,6 +4,7 @@
#include <OgreRenderTexture.h> #include <OgreRenderTexture.h>
#include <OgreSubEntity.h> #include <OgreSubEntity.h>
#include <OgreEntity.h> #include <OgreEntity.h>
#include <OgreTechnique.h>
#include <stdexcept> #include <stdexcept>
#include <extern/shiny/Main/Factory.hpp> #include <extern/shiny/Main/Factory.hpp>
@ -100,7 +101,16 @@ namespace Render
return m->getTechnique(1); return m->getTechnique(1);
} }
else else
throw std::runtime_error("selectionbuffer only works with entities"); {
m = Ogre::MaterialManager::getSingleton().getByName("NullMaterial");
if(m.isNull())
{
m = Ogre::MaterialManager::getSingleton().create("NullMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
m->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true);
m->getTechnique(0)->getPass(0)->setDepthFunction(Ogre::CMPF_ALWAYS_FAIL);
}
return m->getTechnique(0);
}
} }
return NULL; return NULL;
} }