diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-01 23:52:34 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-01 23:52:34 +0200 |
commit | d63c6fc46351532d02a283d041fd98ad9278022f (patch) | |
tree | 06a6a04b6754a1da94693e04359232ccf084e610 /servers/rendering/storage | |
parent | 4cca7bd97778dd01637ddb6fd3dbb32e6d37db0b (diff) | |
parent | 699e9f79669ce4759e4e899f68051cb36e5ee7ba (diff) |
Merge pull request #60185 from Calinou/environment-fog-and-sky-affect
Diffstat (limited to 'servers/rendering/storage')
-rw-r--r-- | servers/rendering/storage/environment_storage.cpp | 18 | ||||
-rw-r--r-- | servers/rendering/storage/environment_storage.h | 8 |
2 files changed, 22 insertions, 4 deletions
diff --git a/servers/rendering/storage/environment_storage.cpp b/servers/rendering/storage/environment_storage.cpp index 19cb067025..9b1842f1d9 100644 --- a/servers/rendering/storage/environment_storage.cpp +++ b/servers/rendering/storage/environment_storage.cpp @@ -205,7 +205,7 @@ float RendererEnvironmentStorage::environment_get_white(RID p_env) const { // Fog -void RendererEnvironmentStorage::environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_fog_aerial_perspective) { +void RendererEnvironmentStorage::environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_fog_aerial_perspective, float p_sky_affect) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); env->fog_enabled = p_enable; @@ -216,6 +216,7 @@ void RendererEnvironmentStorage::environment_set_fog(RID p_env, bool p_enable, c env->fog_height = p_height; env->fog_height_density = p_height_density; env->fog_aerial_perspective = p_fog_aerial_perspective; + env->fog_sky_affect = p_sky_affect; } bool RendererEnvironmentStorage::environment_get_fog_enabled(RID p_env) const { @@ -266,9 +267,15 @@ float RendererEnvironmentStorage::environment_get_fog_aerial_perspective(RID p_e return env->fog_aerial_perspective; } +float RendererEnvironmentStorage::environment_get_fog_sky_affect(RID p_env) const { + Environment *env = environment_owner.get_or_null(p_env); + ERR_FAIL_COND_V(!env, 0.0); + return env->fog_sky_affect; +} + // Volumetric Fog -void RendererEnvironmentStorage::environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject) { +void RendererEnvironmentStorage::environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject, float p_sky_affect) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); env->volumetric_fog_enabled = p_enable; @@ -283,6 +290,7 @@ void RendererEnvironmentStorage::environment_set_volumetric_fog(RID p_env, bool env->volumetric_fog_temporal_reprojection = p_temporal_reprojection; env->volumetric_fog_temporal_reprojection_amount = p_temporal_reprojection_amount; env->volumetric_fog_ambient_inject = p_ambient_inject; + env->volumetric_fog_sky_affect = p_sky_affect; } bool RendererEnvironmentStorage::environment_get_volumetric_fog_enabled(RID p_env) const { @@ -339,6 +347,12 @@ float RendererEnvironmentStorage::environment_get_volumetric_fog_gi_inject(RID p return env->volumetric_fog_gi_inject; } +float RendererEnvironmentStorage::environment_get_volumetric_fog_sky_affect(RID p_env) const { + Environment *env = environment_owner.get_or_null(p_env); + ERR_FAIL_COND_V(!env, 0.0); + return env->volumetric_fog_sky_affect; +} + bool RendererEnvironmentStorage::environment_get_volumetric_fog_temporal_reprojection(RID p_env) const { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND_V(!env, true); diff --git a/servers/rendering/storage/environment_storage.h b/servers/rendering/storage/environment_storage.h index 2821d299a8..17bde94902 100644 --- a/servers/rendering/storage/environment_storage.h +++ b/servers/rendering/storage/environment_storage.h @@ -66,6 +66,7 @@ private: float fog_light_energy = 1.0; float fog_sun_scatter = 0.0; float fog_density = 0.01; + float fog_sky_affect = 1.0; float fog_height = 0.0; float fog_height_density = 0.0; //can be negative to invert effect float fog_aerial_perspective = 0.0; @@ -81,6 +82,7 @@ private: float volumetric_fog_detail_spread = 2.0; float volumetric_fog_gi_inject = 1.0; float volumetric_fog_ambient_inject = 0.0; + float volumetric_fog_sky_affect = 1.0; bool volumetric_fog_temporal_reprojection = true; float volumetric_fog_temporal_reprojection_amount = 0.9; @@ -190,18 +192,19 @@ public: float environment_get_white(RID p_env) const; // Fog - void environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_aerial_perspective); + void environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_aerial_perspective, float p_sky_affect); bool environment_get_fog_enabled(RID p_env) const; Color environment_get_fog_light_color(RID p_env) const; float environment_get_fog_light_energy(RID p_env) const; float environment_get_fog_sun_scatter(RID p_env) const; float environment_get_fog_density(RID p_env) const; + float environment_get_fog_sky_affect(RID p_env) const; float environment_get_fog_height(RID p_env) const; float environment_get_fog_height_density(RID p_env) const; float environment_get_fog_aerial_perspective(RID p_env) const; // Volumetric Fog - void environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject); + void environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject, float p_sky_affect); bool environment_get_volumetric_fog_enabled(RID p_env) const; float environment_get_volumetric_fog_density(RID p_env) const; Color environment_get_volumetric_fog_scattering(RID p_env) const; @@ -211,6 +214,7 @@ public: float environment_get_volumetric_fog_length(RID p_env) const; float environment_get_volumetric_fog_detail_spread(RID p_env) const; float environment_get_volumetric_fog_gi_inject(RID p_env) const; + float environment_get_volumetric_fog_sky_affect(RID p_env) const; bool environment_get_volumetric_fog_temporal_reprojection(RID p_env) const; float environment_get_volumetric_fog_temporal_reprojection_amount(RID p_env) const; float environment_get_volumetric_fog_ambient_inject(RID p_env) const; |