From 8a4691231a625e29f9470f4b92541099811d4d9d Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 17 Oct 2023 16:38:13 +0900 Subject: [PATCH] Let we use default white IBL image even environment info not exist When we use ModelNode without model url, we don't follow environment map load task. So default IBL texture can be 'empty'. In this case, the PBR shader what dali use default, might do some strange behaviour. To guard this cases, let we make all Dali::Scene3D::Model use non-empty default textures. Change-Id: I47cd1f5b89f812b2a35c5f4cb5dfb1084b5760a3 Signed-off-by: Eunki, Hong --- dali-scene3d/internal/controls/model/model-impl.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dali-scene3d/internal/controls/model/model-impl.cpp b/dali-scene3d/internal/controls/model/model-impl.cpp index 1823476..315a368 100644 --- a/dali-scene3d/internal/controls/model/model-impl.cpp +++ b/dali-scene3d/internal/controls/model/model-impl.cpp @@ -31,6 +31,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -762,6 +763,9 @@ void Model::OnInitialize() { // Make ParentOrigin as Center. Self().SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + + mDefaultDiffuseTexture = ImageResourceLoader::GetEmptyTextureWhiteRGB(); + mDefaultSpecularTexture = ImageResourceLoader::GetEmptyTextureWhiteRGB(); } void Model::OnSceneConnection(int depth) @@ -1094,8 +1098,14 @@ void Model::OnModelLoadComplete() ResetCameraParameters(); if(!resources.mEnvironmentMaps.empty()) { - mDefaultDiffuseTexture = resources.mEnvironmentMaps.front().second.mDiffuse; - mDefaultSpecularTexture = resources.mEnvironmentMaps.front().second.mSpecular; + if(resources.mEnvironmentMaps.front().second.mDiffuse) + { + mDefaultDiffuseTexture = resources.mEnvironmentMaps.front().second.mDiffuse; + } + if(resources.mEnvironmentMaps.front().second.mSpecular) + { + mDefaultSpecularTexture = resources.mEnvironmentMaps.front().second.mSpecular; + } } if(mShadowMapTexture) -- 2.7.4