summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-15 07:42:30 +0100
committerGitHub <noreply@github.com>2022-02-15 07:42:30 +0100
commitb3507ab0cdf25e470b1e4d977ed0bea32a305c1b (patch)
tree2d6509661a25d6fafb99a0765bcff0eb8cbca1fd /scene/resources
parentd02db6306ebcb57296dece3e8d990ae188b39aad (diff)
parentc10e97b604961700bba0f5c3b379e39a1f07acdf (diff)
Merge pull request #58100 from Calinou/environment-clamp-sky-contribution
Clamp environment light sky contribution to the [0.0; 1.0] range
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/environment.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index bf17a6ea97..82d8ad4444 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -155,7 +155,9 @@ float Environment::get_ambient_light_energy() const {
}
void Environment::set_ambient_light_sky_contribution(float p_ratio) {
- ambient_sky_contribution = p_ratio;
+ // Sky contribution values outside the [0.0; 1.0] range don't make sense and
+ // can result in negative colors.
+ ambient_sky_contribution = CLAMP(p_ratio, 0.0, 1.0);
_update_ambient_light();
}