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:
parent
8f69c51b24
commit
643e7651e0
@ -4,6 +4,7 @@
|
||||
#include <OgreRenderTexture.h>
|
||||
#include <OgreSubEntity.h>
|
||||
#include <OgreEntity.h>
|
||||
#include <OgreTechnique.h>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <extern/shiny/Main/Factory.hpp>
|
||||
@ -100,7 +101,16 @@ namespace Render
|
||||
return m->getTechnique(1);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user