small improved

This commit is contained in:
Perfare 2018-12-24 17:38:12 +08:00
parent 54ed3971a2
commit 7f13c90189

View File

@ -478,47 +478,31 @@ namespace AssetStudio
bool hasTexture = false; bool hasTexture = false;
for each (ImportedMaterialTexture^ texture in mat->Textures) for each (ImportedMaterialTexture^ texture in mat->Textures)
{
auto pTexture = ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList));
if (pTexture != NULL)
{ {
if (texture->Dest == 0) if (texture->Dest == 0)
{ {
FbxFileTexture* pTextureDiffuse = ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList)); LinkTexture(texture, pTexture, pMat->Diffuse);
if (pTextureDiffuse != NULL)
{
LinkTexture(texture, pTextureDiffuse, pMat->Diffuse);
hasTexture = true; hasTexture = true;
} }
}
else if (texture->Dest == 1) else if (texture->Dest == 1)
{ {
FbxFileTexture* pTextureNormalMap = ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList)); LinkTexture(texture, pTexture, pMat->NormalMap);
if (pTextureNormalMap != NULL)
{
LinkTexture(texture, pTextureNormalMap, pMat->NormalMap);
hasTexture = true; hasTexture = true;
} }
}
else if (texture->Dest == 2) else if (texture->Dest == 2)
{ {
FbxFileTexture* pTextureSpecular = ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList)); LinkTexture(texture, pTexture, pMat->Specular);
if (pTextureSpecular != NULL)
{
LinkTexture(texture, pTextureSpecular, pMat->Specular);
hasTexture = true; hasTexture = true;
} }
}
else if (texture->Dest == 3) else if (texture->Dest == 3)
{ {
FbxFileTexture* pTextureBump = ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList)); LinkTexture(texture, pTexture, pMat->Bump);
if (pTextureBump != NULL)
{
LinkTexture(texture, pTextureBump, pMat->Bump);
hasTexture = true; hasTexture = true;
} }
} }
else
{
ExportTexture(ImportedHelpers::FindTexture(texture->Name, imported->TextureList));
}
} }
if (hasTexture) if (hasTexture)