Code: Select all
bool CreateDetailMap(ITexture *sourceText, ITexture *targetText)
{
if(sourceText->getColorFormat() != targetText->getColorFormat())
return false;
if(sourceText->getOriginalSize() != targetText->getOriginalSize())
return false;
if(sourceText->getColorFormat() == ECF_A8R8G8B8)
{
unsigned int* sdata = (unsigned int*)sourceText->lock(true,0);
unsigned int* tdata = (unsigned int*)targetText->lock(false,0);
if(*sdata != 0 && *tdata != 0)
{
memmove(tdata,sdata,sizeof(unsigned int) * sourceText->getOriginalSize().getArea());
}
sourceText->unlock();
targetText->unlock();
}
return true;
}