diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-14 17:13:35 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-14 17:13:35 +0200 |
commit | c58c50831b8b19a9e276c88c91a47f6b2ee6001a (patch) | |
tree | 494401008e24462d6b52c7fc0da5c17bccb8c3cd /drivers/gles3 | |
parent | 75eb8ad51022765a9cf80ed7edc2bcc6287d09da (diff) | |
parent | b758658405c6d25f6be3c020083c18da4b5cb1db (diff) | |
download | redot-engine-c58c50831b8b19a9e276c88c91a47f6b2ee6001a.tar.gz |
Merge pull request #93107 from clayjohn/GLES-sky-ambient
Ensure sky reflection is updated when ambient mode is set to background
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 3b21d88945..9ea030bbd4 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2398,6 +2398,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_ float bg_energy_multiplier = environment_get_bg_energy_multiplier(render_data.environment); bg_energy_multiplier *= environment_get_bg_intensity(render_data.environment); RS::EnvironmentReflectionSource reflection_source = environment_get_reflection_source(render_data.environment); + RS::EnvironmentAmbientSource ambient_source = environment_get_ambient_source(render_data.environment); if (render_data.camera_attributes.is_valid()) { bg_energy_multiplier *= RSG::camera_attributes->camera_attributes_get_exposure_normalization_factor(render_data.camera_attributes); @@ -2438,8 +2439,13 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_ } } + bool sky_reflections = reflection_source == RS::ENV_REFLECTION_SOURCE_SKY; + sky_reflections |= reflection_source == RS::ENV_REFLECTION_SOURCE_BG && bg_mode == RS::ENV_BG_SKY; + bool sky_ambient = ambient_source == RS::ENV_AMBIENT_SOURCE_SKY; + sky_ambient |= ambient_source == RS::ENV_AMBIENT_SOURCE_BG && bg_mode == RS::ENV_BG_SKY; + // setup sky if used for ambient, reflections, or background - if (draw_sky || draw_sky_fog_only || (reflection_source == RS::ENV_REFLECTION_SOURCE_BG && bg_mode == RS::ENV_BG_SKY) || reflection_source == RS::ENV_REFLECTION_SOURCE_SKY || environment_get_ambient_source(render_data.environment) == RS::ENV_AMBIENT_SOURCE_SKY) { + if (draw_sky || draw_sky_fog_only || sky_reflections || sky_ambient) { RENDER_TIMESTAMP("Setup Sky"); Projection projection = render_data.cam_projection; if (is_reflection_probe) { @@ -2453,7 +2459,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_ _setup_sky(&render_data, *render_data.lights, projection, render_data.cam_transform, screen_size); if (environment_get_sky(render_data.environment).is_valid()) { - if (environment_get_reflection_source(render_data.environment) == RS::ENV_REFLECTION_SOURCE_SKY || environment_get_ambient_source(render_data.environment) == RS::ENV_AMBIENT_SOURCE_SKY || (environment_get_reflection_source(render_data.environment) == RS::ENV_REFLECTION_SOURCE_BG && environment_get_background(render_data.environment) == RS::ENV_BG_SKY)) { + if (sky_reflections || sky_ambient) { _update_sky_radiance(render_data.environment, projection, render_data.cam_transform, sky_energy_multiplier); } } else { |