Clamp environment light sky contribution to the [0.0; 1.0] range
The value is already clamped in the editor, but it wasn't being
clamped when the value was set via code. Values outside the [0.0; 1.0]
range can result in broken rendering.
(cherry picked from commit 08128351a5
)
This commit is contained in:
parent
8af41b1c58
commit
2c174cbc0a
|
@ -62,7 +62,8 @@
|
|||
The ambient light's energy. The higher the value, the stronger the light.
|
||||
</member>
|
||||
<member name="ambient_light_sky_contribution" type="float" setter="set_ambient_light_sky_contribution" getter="get_ambient_light_sky_contribution" default="1.0">
|
||||
Defines the amount of light that the sky brings on the scene. A value of 0 means that the sky's light emission has no effect on the scene illumination, thus all ambient illumination is provided by the ambient light. On the contrary, a value of 1 means that all the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene.
|
||||
Defines the amount of light that the sky brings on the scene. A value of [code]0.0[/code] means that the sky's light emission has no effect on the scene illumination, thus all ambient illumination is provided by the ambient light. On the contrary, a value of [code]1.0[/code] means that [i]all[/i] the light that affects the scene is provided by the sky, thus the ambient light parameter has no effect on the scene.
|
||||
[b]Note:[/b] [member ambient_light_sky_contribution] is internally clamped between [code]0.0[/code] and [code]1.0[/code] (inclusive).
|
||||
</member>
|
||||
<member name="auto_exposure_enabled" type="bool" setter="set_tonemap_auto_exposure" getter="get_tonemap_auto_exposure" default="false">
|
||||
If [code]true[/code], enables the tonemapping auto exposure mode of the scene renderer. If [code]true[/code], the renderer will automatically determine the exposure setting to adapt to the scene's illumination and the observed light.
|
||||
|
|
|
@ -96,7 +96,9 @@ void Environment::set_ambient_light_energy(float p_energy) {
|
|||
VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_sky_contribution);
|
||||
}
|
||||
void Environment::set_ambient_light_sky_contribution(float p_energy) {
|
||||
ambient_sky_contribution = p_energy;
|
||||
// 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_energy, 0.0, 1.0);
|
||||
VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, ambient_energy, ambient_sky_contribution);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue