Skip to content

Commit

Permalink
Only set shadow texture size if configured by the user in the SDForma…
Browse files Browse the repository at this point in the history
…t file (#642)

Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
azeey authored and iche033 committed Sep 25, 2024
1 parent ce5315c commit f615a04
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ find_package(gz-cmake4 REQUIRED)
set(CMAKE_CXX_STANDARD 17)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
gz_configure_project(VERSION_SUFFIX pre1)
gz_configure_project(VERSION_SUFFIX)

#============================================================================
# Set project-specific options
Expand Down
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

1. **Baseline:** this includes all changes from 8.3.0 and earlier.

1. Only set shadow texture size if configured by the user in the SDFormat file
* [Pull request #642](https://github.com/gazebosim/gz-gui/pull/642)

1. Miscellaneous documentation fixes
* [Pull request #640](https://github.com/gazebosim/gz-gui/pull/640)
* [Pull request #639](https://github.com/gazebosim/gz-gui/pull/639)
* [Pull request #638](https://github.com/gazebosim/gz-gui/pull/638)

1. Update badges for ionic gz-gui9
* [Pull request #636](https://github.com/gazebosim/gz-gui/pull/636)

Expand Down
7 changes: 4 additions & 3 deletions src/plugins/minimal_scene/MinimalScene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <texture_size> to '"
<< this->directionalLightTextureSize
<< *this->directionalLightTextureSize
<< "'. Using default texture size of "
<< scene->ShadowTextureSize(rendering::LightType::DIRECTIONAL)
<< std::endl;
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/minimal_scene/MinimalScene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <string>
#include <memory>
#include <optional>

#include <gz/common/KeyEvent.hh>
#include <gz/common/MouseEvent.hh>
Expand Down Expand Up @@ -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<unsigned int> directionalLightTextureSize;

/// \brief Horizontal FOV of the camera;
public: math::Angle cameraHFOV = math::Angle(M_PI * 0.5);
Expand Down

0 comments on commit f615a04

Please sign in to comment.