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

actorid
Chris Robinson 12 years ago
parent 8f69c51b24
commit 643e7651e0

@ -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;
} }

Loading…
Cancel
Save