obj.cpp: loadMaterials parameter

metadata
Wenzel Jakob 2014-05-20 01:15:15 +02:00
parent f25841b7e3
commit c9afd23278
1 changed files with 7 additions and 1 deletions

View File

@ -65,6 +65,9 @@ MTS_NAMESPACE_BEGIN
* \parameter{collapse}{\Boolean}{ * \parameter{collapse}{\Boolean}{
* Collapse all meshes into a single shape \default{\code{false}} * Collapse all meshes into a single shape \default{\code{false}}
* } * }
* \parameter{loadMaterials}{\Boolean}{
* \mbox{Import materials from a \code{mtl} file, if it exists?\default{\code{true}}}
* }
* } * }
* \renderings{ * \renderings{
* \label{fig:rungholt} * \label{fig:rungholt}
@ -213,6 +216,9 @@ public:
/* Object-space -> World-space transformation */ /* Object-space -> World-space transformation */
Transform objectToWorld = props.getTransform("toWorld", Transform()); Transform objectToWorld = props.getTransform("toWorld", Transform());
/* Import materials from a MTL file, if any? */
bool loadMaterials = props.getBoolean("loadMaterials", true);
/* Load the geometry */ /* Load the geometry */
Log(EInfo, "Loading geometry from \"%s\" ..", path.filename().string().c_str()); Log(EInfo, "Loading geometry from \"%s\" ..", path.filename().string().c_str());
fs::ifstream is(path); fs::ifstream is(path);
@ -336,7 +342,7 @@ public:
m_meshes[i]->rebuildTopology(maxSmoothAngle); m_meshes[i]->rebuildTopology(maxSmoothAngle);
} }
if (!materialLibrary.empty()) if (!materialLibrary.empty() && loadMaterials)
loadMaterialLibrary(fileResolver, materialLibrary); loadMaterialLibrary(fileResolver, materialLibrary);
Log(EInfo, "Done with \"%s\" (took %i ms)", path.filename().string().c_str(), timer->getMilliseconds()); Log(EInfo, "Done with \"%s\" (took %i ms)", path.filename().string().c_str(), timer->getMilliseconds());