Delete already added terrain textures

florinudrea

03-04-2009 16:29:34

Hi guys I'm new here, I'm using ETL and I have a question : Is there a method to delete already added textures.
I try to call ET::SplattingMaterial::setSplattingTextures method with the new textures list(from which I removed one texture) but the result was a black area in place of the removed texture. Maybe it is something else that I didn't do or I did something wrong, so any help will be very appreciated. Thank you in advance.

I also write and call function deleteTexture in SplattingManager class but the result was the same.

void SplattingManager::deleteTexture(const Ogre::String& texture)
{
if (mTexChanMap.find(texture) == mTexChanMap.end())
return;

// find old texture channel
unsigned int chan = mTexChanMap[texture];
// delete old texture
mTexChanMap.erase(texture);

// change textures in vector
for(int i = 0; i < mTextures.size(); i++)
{
if(mTextures == texture)
{
mTextures.clear();
break;
}
}

mDirtyRects[chan] = Rect(mGridWidth, mGridHeight, 0, 0);
}

I write the function this way because to replace one texture with another I write the SplattingManager::replaceTexture function in a same way and it's work.

void SplattingManager::replaceTexture(const Ogre::String& oldTexture, const Ogre::String& newTexture)
{
if (mTexChanMap.find(oldTexture) == mTexChanMap.end())
return;

// find old texture channel
unsigned int chan = mTexChanMap[oldTexture];
// delete old texture
mTexChanMap.erase(oldTexture);
// add new texture
mTexChanMap[newTexture] = chan;

// change textures in vector
for(int i = 0; i < mTextures.size(); i++)
{
if(mTextures == oldTexture)
{
mTextures = newTexture;
break;
}
}
}

I'm not sure if all this helps but i try to give you guys as much information as I can.