Skip to content

Commit

Permalink
Fix finding PBR materials (#575)
Browse files Browse the repository at this point in the history
Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
  • Loading branch information
2 people authored and chapulina committed Jul 23, 2021
1 parent 5d224b8 commit 892d71e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/rendering/SceneManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
std::string roughnessMap = metal->RoughnessMap();
if (!roughnessMap.empty())
{
std::string fullPath = common::findFile(roughnessMap);
std::string fullPath = common::findFile(
asFullPath(roughnessMap, _material.FilePath()));
if (!fullPath.empty())
material->SetRoughnessMap(fullPath);
else
Expand All @@ -493,7 +494,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
std::string metalnessMap = metal->MetalnessMap();
if (!metalnessMap.empty())
{
std::string fullPath = common::findFile(metalnessMap);
std::string fullPath = common::findFile(
asFullPath(metalnessMap, _material.FilePath()));
if (!fullPath.empty())
material->SetMetalnessMap(fullPath);
else
Expand All @@ -511,7 +513,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
std::string albedoMap = workflow->AlbedoMap();
if (!albedoMap.empty())
{
std::string fullPath = common::findFile(albedoMap);
std::string fullPath = common::findFile(
asFullPath(albedoMap, _material.FilePath()));
if (!fullPath.empty())
{
material->SetTexture(fullPath);
Expand All @@ -524,7 +527,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
std::string normalMap = workflow->NormalMap();
if (!normalMap.empty())
{
std::string fullPath = common::findFile(normalMap);
std::string fullPath = common::findFile(
asFullPath(normalMap, _material.FilePath()));
if (!fullPath.empty())
material->SetNormalMap(fullPath);
else
Expand All @@ -536,7 +540,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
std::string environmentMap = workflow->EnvironmentMap();
if (!environmentMap.empty())
{
std::string fullPath = common::findFile(environmentMap);
std::string fullPath = common::findFile(
asFullPath(environmentMap, _material.FilePath()));
if (!fullPath.empty())
material->SetEnvironmentMap(fullPath);
else
Expand All @@ -547,7 +552,8 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
std::string emissiveMap = workflow->EmissiveMap();
if (!emissiveMap.empty())
{
std::string fullPath = common::findFile(emissiveMap);
std::string fullPath = common::findFile(
asFullPath(emissiveMap, _material.FilePath()));
if (!fullPath.empty())
material->SetEmissiveMap(fullPath);
else
Expand Down

0 comments on commit 892d71e

Please sign in to comment.