forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'cc9cii/crash-fix-cg-shader'
This commit is contained in:
commit
ecf3d52b46
1 changed files with 8 additions and 3 deletions
|
@ -55,6 +55,9 @@ namespace Terrain
|
||||||
mVertexData->vertexBufferBinding->setBinding(2, uvBuffer);
|
mVertexData->vertexBufferBinding->setBinding(2, uvBuffer);
|
||||||
mVertexData->vertexBufferBinding->setBinding(3, colourBuffer);
|
mVertexData->vertexBufferBinding->setBinding(3, colourBuffer);
|
||||||
|
|
||||||
|
// Assign a default material in case terrain material fails to be created
|
||||||
|
mMaterial = Ogre::MaterialManager::getSingleton().getByName("BaseWhite");
|
||||||
|
|
||||||
mIndexData = OGRE_NEW Ogre::IndexData();
|
mIndexData = OGRE_NEW Ogre::IndexData();
|
||||||
mIndexData->indexStart = 0;
|
mIndexData->indexStart = 0;
|
||||||
}
|
}
|
||||||
|
@ -67,11 +70,13 @@ namespace Terrain
|
||||||
|
|
||||||
Chunk::~Chunk()
|
Chunk::~Chunk()
|
||||||
{
|
{
|
||||||
|
if (!mMaterial.isNull())
|
||||||
|
{
|
||||||
#if TERRAIN_USE_SHADER
|
#if TERRAIN_USE_SHADER
|
||||||
sh::Factory::getInstance().destroyMaterialInstance(mMaterial->getName());
|
sh::Factory::getInstance().destroyMaterialInstance(mMaterial->getName());
|
||||||
#endif
|
#endif
|
||||||
Ogre::MaterialManager::getSingleton().remove(mMaterial->getName());
|
Ogre::MaterialManager::getSingleton().remove(mMaterial->getName());
|
||||||
|
}
|
||||||
OGRE_DELETE mVertexData;
|
OGRE_DELETE mVertexData;
|
||||||
OGRE_DELETE mIndexData;
|
OGRE_DELETE mIndexData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue