Use the material controller manager for effects with overridden texture

actorid
scrawl 11 years ago
parent d262d9e6b0
commit 6400f23ab0

@ -1046,17 +1046,12 @@ void Animation::addEffect(const std::string &model, int effectId, bool loop, con
for(size_t i = 0;i < params.mObjects->mParticles.size(); ++i)
{
Ogre::ParticleSystem* partSys = params.mObjects->mParticles[i];
sh::Factory::getInstance()._ensureMaterial(partSys->getMaterialName(), "Default");
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(partSys->getMaterialName());
static int count = 0;
Ogre::String materialName = "openmw/" + Ogre::StringConverter::toString(count++);
// TODO: destroy when effect is removed
Ogre::MaterialPtr newMat = mat->clone(materialName);
partSys->setMaterialName(materialName);
for (int t=0; t<newMat->getNumTechniques(); ++t)
Ogre::MaterialPtr mat = params.mObjects->mMaterialControllerMgr.getWritableMaterial(partSys);
for (int t=0; t<mat->getNumTechniques(); ++t)
{
Ogre::Technique* tech = newMat->getTechnique(t);
Ogre::Technique* tech = mat->getTechnique(t);
for (int p=0; p<tech->getNumPasses(); ++p)
{
Ogre::Pass* pass = tech->getPass(p);

Loading…
Cancel
Save