Utility: Add MTL exporting
Former-commit-id: cceef7a11d10cc235bd06655a7c5b10ee1cfdec6 [formerly e68c9322634c9a3f93771d941ae581f24dc98116] Former-commit-id: 1a117f7cd11d869c1fb179cba54254c9ec6924f2
This commit is contained in:
@@ -49,8 +49,8 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
MTLParser materialParser(file);
|
||||
if (!materialParser.Parse())
|
||||
MTLParser materialParser;
|
||||
if (!materialParser.Parse(file))
|
||||
{
|
||||
NazaraError("MTL parser failed");
|
||||
return false;
|
||||
@@ -90,13 +90,31 @@ namespace Nz
|
||||
data.SetParameter(MaterialData::SpecularColor, specularColor);
|
||||
|
||||
if (!mtlMat->alphaMap.IsEmpty())
|
||||
data.SetParameter(MaterialData::AlphaTexturePath, baseDir + mtlMat->alphaMap);
|
||||
{
|
||||
String fullPath = mtlMat->alphaMap;
|
||||
if (!Nz::File::IsAbsolute(fullPath))
|
||||
fullPath.Prepend(baseDir);
|
||||
|
||||
data.SetParameter(MaterialData::AlphaTexturePath, fullPath);
|
||||
}
|
||||
|
||||
if (!mtlMat->diffuseMap.IsEmpty())
|
||||
data.SetParameter(MaterialData::DiffuseTexturePath, baseDir + mtlMat->diffuseMap);
|
||||
{
|
||||
String fullPath = mtlMat->diffuseMap;
|
||||
if (!Nz::File::IsAbsolute(fullPath))
|
||||
fullPath.Prepend(baseDir);
|
||||
|
||||
data.SetParameter(MaterialData::DiffuseTexturePath, fullPath);
|
||||
}
|
||||
|
||||
if (!mtlMat->specularMap.IsEmpty())
|
||||
data.SetParameter(MaterialData::SpecularTexturePath, baseDir + mtlMat->specularMap);
|
||||
{
|
||||
String fullPath = mtlMat->specularMap;
|
||||
if (!Nz::File::IsAbsolute(fullPath))
|
||||
fullPath.Prepend(baseDir);
|
||||
|
||||
data.SetParameter(MaterialData::SpecularTexturePath, fullPath);
|
||||
}
|
||||
|
||||
// If we either have an alpha value or an alpha map, let's configure the material for transparency
|
||||
if (alphaValue != 255 || !mtlMat->alphaMap.IsEmpty())
|
||||
|
||||
Reference in New Issue
Block a user