Fix: qnan detection code. Appearently I fooled myself when I wrote this.

Fix: MDLLoader does not reset texture array properly when textures are substituted by plain colors. This caused crashes in ~aiScene or heap corruption.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@677 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2010-04-13 17:34:55 +00:00
parent da87178a25
commit 906c45eeeb
3 changed files with 78 additions and 26 deletions

View File

@@ -101,7 +101,8 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture* pcTexture)
{
if (*pcTexel != *(pcTexel-1))
{
pcTexel = NULL;break;
pcTexel = NULL;
break;
}
++pcTexel;
}
@@ -458,7 +459,10 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char* szData,
delete[] pc;
}
}
else delete pcNew;
else {
pcNew->pcData = NULL;
delete pcNew;
}
return;
}
@@ -638,7 +642,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
// opacity like this .... ARRRGGHH!
clrTemp.r = pcMatIn->Ambient.a;
AI_SWAP4(clrTemp.r);
if (is_not_qnan(clrTexture.r))clrTemp.r *= clrTexture.a;
if (is_not_qnan(clrTexture.r)) {
clrTemp.r *= clrTexture.a;
}
pcMatOut->AddProperty<float>(&clrTemp.r,1,AI_MATKEY_OPACITY);
// read phong power