summaryrefslogtreecommitdiffstats
path: root/servers/rendering/storage
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/storage')
-rw-r--r--servers/rendering/storage/environment_storage.cpp37
-rw-r--r--servers/rendering/storage/environment_storage.h15
2 files changed, 50 insertions, 2 deletions
diff --git a/servers/rendering/storage/environment_storage.cpp b/servers/rendering/storage/environment_storage.cpp
index 0234f52ca1..ec26e36509 100644
--- a/servers/rendering/storage/environment_storage.cpp
+++ b/servers/rendering/storage/environment_storage.cpp
@@ -205,10 +205,11 @@ 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, float p_sky_affect) {
+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, RS::EnvironmentFogMode p_mode) {
Environment *env = environment_owner.get_or_null(p_env);
ERR_FAIL_NULL(env);
env->fog_enabled = p_enable;
+ env->fog_mode = p_mode;
env->fog_light_color = p_light_color;
env->fog_light_energy = p_light_energy;
env->fog_sun_scatter = p_sun_scatter;
@@ -225,6 +226,12 @@ bool RendererEnvironmentStorage::environment_get_fog_enabled(RID p_env) const {
return env->fog_enabled;
}
+RS::EnvironmentFogMode RendererEnvironmentStorage::environment_get_fog_mode(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_NULL_V(env, RS::ENV_FOG_MODE_EXPONENTIAL);
+ return env->fog_mode;
+}
+
Color RendererEnvironmentStorage::environment_get_fog_light_color(RID p_env) const {
Environment *env = environment_owner.get_or_null(p_env);
ERR_FAIL_NULL_V(env, Color(0.5, 0.6, 0.7));
@@ -273,6 +280,34 @@ float RendererEnvironmentStorage::environment_get_fog_sky_affect(RID p_env) cons
return env->fog_sky_affect;
}
+// Depth Fog
+
+void RendererEnvironmentStorage::environment_set_fog_depth(RID p_env, float p_curve, float p_begin, float p_end) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_NULL(env);
+ env->fog_depth_curve = p_curve;
+ env->fog_depth_begin = p_begin;
+ env->fog_depth_end = p_end;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_depth_curve(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_NULL_V(env, 0.0);
+ return env->fog_depth_curve;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_depth_begin(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_NULL_V(env, 0.0);
+ return env->fog_depth_begin;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_depth_end(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_NULL_V(env, 0.0);
+ return env->fog_depth_end;
+}
+
// 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, float p_sky_affect) {
diff --git a/servers/rendering/storage/environment_storage.h b/servers/rendering/storage/environment_storage.h
index d677dfc57b..c077e093da 100644
--- a/servers/rendering/storage/environment_storage.h
+++ b/servers/rendering/storage/environment_storage.h
@@ -62,6 +62,7 @@ private:
// Fog
bool fog_enabled = false;
+ RS::EnvironmentFogMode fog_mode = RS::EnvironmentFogMode::ENV_FOG_MODE_EXPONENTIAL;
Color fog_light_color = Color(0.518, 0.553, 0.608);
float fog_light_energy = 1.0;
float fog_sun_scatter = 0.0;
@@ -71,6 +72,11 @@ private:
float fog_height_density = 0.0; //can be negative to invert effect
float fog_aerial_perspective = 0.0;
+ // Depth Fog
+ float fog_depth_curve = 1.0;
+ float fog_depth_begin = 10.0;
+ float fog_depth_end = 100.0;
+
// Volumetric Fog
bool volumetric_fog_enabled = false;
float volumetric_fog_density = 0.01;
@@ -192,8 +198,9 @@ 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, float p_sky_affect);
+ 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, RS::EnvironmentFogMode p_mode);
bool environment_get_fog_enabled(RID p_env) const;
+ RS::EnvironmentFogMode environment_get_fog_mode(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;
@@ -203,6 +210,12 @@ public:
float environment_get_fog_height_density(RID p_env) const;
float environment_get_fog_aerial_perspective(RID p_env) const;
+ // Depth Fog
+ void environment_set_fog_depth(RID p_env, float p_curve, float p_begin, float p_end);
+ float environment_get_fog_depth_curve(RID p_env) const;
+ float environment_get_fog_depth_begin(RID p_env) const;
+ float environment_get_fog_depth_end(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, float p_sky_affect);
bool environment_get_volumetric_fog_enabled(RID p_env) const;