Merge remote-tracking branch 'origin/master' into HEAD

This commit is contained in:
Rahul Sheth
2021-07-07 16:35:29 -04:00
78 changed files with 2740 additions and 696 deletions

View File

@@ -105,14 +105,13 @@ void ExportScenePbrt (
} // end of namespace Assimp
// Constructor
PbrtExporter::PbrtExporter (
const aiScene* pScene, IOSystem* pIOSystem,
const std::string path, const std::string file)
: mScene(pScene),
mIOSystem(pIOSystem),
mPath(path),
mFile(file)
{
PbrtExporter::PbrtExporter(
const aiScene *pScene, IOSystem *pIOSystem,
const std::string &path, const std::string &file) :
mScene(pScene),
mIOSystem(pIOSystem),
mPath(path),
mFile(file) {
// Export embedded textures.
if (mScene->mNumTextures > 0)
if (!mIOSystem->CreateDirectory("textures"))
@@ -209,12 +208,12 @@ void PbrtExporter::WriteMetaData() {
aiString* value =
static_cast<aiString*>(pMetaData->mValues[i].mData);
std::string svalue = value->C_Str();
std::size_t found = svalue.find_first_of("\n");
std::size_t found = svalue.find_first_of('\n');
mOutput << "\n";
while (found != std::string::npos) {
mOutput << "# " << svalue.substr(0, found) << "\n";
svalue = svalue.substr(found + 1);
found = svalue.find_first_of("\n");
found = svalue.find_first_of('\n');
}
mOutput << "# " << svalue << "\n";
break;
@@ -595,8 +594,8 @@ void PbrtExporter::WriteMaterial(int m) {
}
mOutput << "\n";
auto White = [](aiColor3D c) { return c.r == 1 && c.g == 1 && c.b == 1; };
auto Black = [](aiColor3D c) { return c.r == 0 && c.g == 0 && c.b == 0; };
auto White = [](const aiColor3D &c) { return c.r == 1 && c.g == 1 && c.b == 1; };
auto Black = [](const aiColor3D &c) { return c.r == 0 && c.g == 0 && c.b == 0; };
aiColor3D diffuse, specular, transparency;
bool constantDiffuse = (material->Get(AI_MATKEY_COLOR_DIFFUSE, diffuse) == AI_SUCCESS &&