diff --git a/src/plugins/minimal_scene/MinimalScene.cc b/src/plugins/minimal_scene/MinimalScene.cc index aa34a15a7..6479d69c1 100644 --- a/src/plugins/minimal_scene/MinimalScene.cc +++ b/src/plugins/minimal_scene/MinimalScene.cc @@ -762,11 +762,12 @@ std::string GzRenderer::Initialize(RenderThreadRhi &_rhi) scene->SetSkyEnabled(true); } - if (!scene->SetShadowTextureSize(rendering::LightType::DIRECTIONAL, - this->directionalLightTextureSize)) + if (this->directionalLightTextureSize.has_value() && + !scene->SetShadowTextureSize(rendering::LightType::DIRECTIONAL, + *this->directionalLightTextureSize)) { gzerr << "Unable to set directional light shadow to '" - << this->directionalLightTextureSize + << *this->directionalLightTextureSize << "'. Using default texture size of " << scene->ShadowTextureSize(rendering::LightType::DIRECTIONAL) << std::endl; diff --git a/src/plugins/minimal_scene/MinimalScene.hh b/src/plugins/minimal_scene/MinimalScene.hh index 46a7b7e40..ee61b96a9 100644 --- a/src/plugins/minimal_scene/MinimalScene.hh +++ b/src/plugins/minimal_scene/MinimalScene.hh @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -240,7 +241,7 @@ namespace gz::gui::plugins public: bool skyEnable = false; /// \brief Shadow texture size for directional light - public: unsigned int directionalLightTextureSize = 2048u; + public: std::optional directionalLightTextureSize; /// \brief Horizontal FOV of the camera; public: math::Angle cameraHFOV = math::Angle(M_PI * 0.5);