diff --git a/apps/openmw/mwrender/terrainmaterial.cpp b/apps/openmw/mwrender/terrainmaterial.cpp index a066a9bed..ae04306f6 100644 --- a/apps/openmw/mwrender/terrainmaterial.cpp +++ b/apps/openmw/mwrender/terrainmaterial.cpp @@ -42,11 +42,13 @@ namespace MWRender Ogre::MaterialPtr TerrainMaterial::Profile::generate(const Ogre::Terrain* terrain) { const Ogre::String& matName = terrain->getMaterialName(); + + sh::Factory::getInstance().destroyMaterialInstance (matName); + Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(matName); if (!mat.isNull()) Ogre::MaterialManager::getSingleton().remove(matName); - mMaterial = sh::Factory::getInstance().createMaterialInstance (matName); mMaterial->setProperty ("allow_fixed_function", sh::makeProperty(new sh::BooleanValue(false))); @@ -54,6 +56,11 @@ namespace MWRender createPass(); return Ogre::MaterialManager::getSingleton().getByName(matName); + + /* + Ogre::MaterialPtr m = Ogre::MaterialManager::getSingleton().create(matName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); + return m; + */ } int TerrainMaterial::Profile::getLayersPerPass () const