summaryrefslogtreecommitdiff
path: root/servers/rendering/storage
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-29 08:05:40 +0200
committerGitHub <noreply@github.com>2022-07-29 08:05:40 +0200
commit2bf8c4a6d0c553d450695d1988fac39df638ad9a (patch)
tree8b1a5f5e0e8997c041484912e967663aae9b474e /servers/rendering/storage
parentad280f44e358357386354bb8c58389d121aead38 (diff)
parentf579125eeb173055c608390524f280a328980acc (diff)
Merge pull request #63527 from BastiaanOlij/rework_environment
Restructure environment in render implementation
Diffstat (limited to 'servers/rendering/storage')
-rw-r--r--servers/rendering/storage/environment_storage.cpp769
-rw-r--r--servers/rendering/storage/environment_storage.h296
2 files changed, 1065 insertions, 0 deletions
diff --git a/servers/rendering/storage/environment_storage.cpp b/servers/rendering/storage/environment_storage.cpp
new file mode 100644
index 0000000000..1d4dc55e98
--- /dev/null
+++ b/servers/rendering/storage/environment_storage.cpp
@@ -0,0 +1,769 @@
+/*************************************************************************/
+/* environment_storage.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "environment_storage.h"
+
+uint64_t RendererEnvironmentStorage::auto_exposure_counter = 2;
+
+RID RendererEnvironmentStorage::environment_allocate() {
+ return environment_owner.allocate_rid();
+}
+
+void RendererEnvironmentStorage::environment_initialize(RID p_rid) {
+ environment_owner.initialize_rid(p_rid, Environment());
+}
+
+void RendererEnvironmentStorage::environment_free(RID p_rid) {
+ environment_owner.free(p_rid);
+}
+
+// Background
+
+void RendererEnvironmentStorage::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->background = p_bg;
+}
+
+void RendererEnvironmentStorage::environment_set_sky(RID p_env, RID p_sky) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->sky = p_sky;
+}
+
+void RendererEnvironmentStorage::environment_set_sky_custom_fov(RID p_env, float p_scale) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->sky_custom_fov = p_scale;
+}
+
+void RendererEnvironmentStorage::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->sky_orientation = p_orientation;
+}
+
+void RendererEnvironmentStorage::environment_set_bg_color(RID p_env, const Color &p_color) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->bg_color = p_color;
+}
+
+void RendererEnvironmentStorage::environment_set_bg_energy(RID p_env, float p_energy) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->bg_energy = p_energy;
+}
+
+void RendererEnvironmentStorage::environment_set_canvas_max_layer(RID p_env, int p_max_layer) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->canvas_max_layer = p_max_layer;
+}
+
+void RendererEnvironmentStorage::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->ambient_light = p_color;
+ env->ambient_source = p_ambient;
+ env->ambient_light_energy = p_energy;
+ env->ambient_sky_contribution = p_sky_contribution;
+ env->reflection_source = p_reflection_source;
+}
+
+RS::EnvironmentBG RendererEnvironmentStorage::environment_get_background(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RS::ENV_BG_CLEAR_COLOR);
+ return env->background;
+}
+
+RID RendererEnvironmentStorage::environment_get_sky(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RID());
+ return env->sky;
+}
+
+float RendererEnvironmentStorage::environment_get_sky_custom_fov(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->sky_custom_fov;
+}
+
+Basis RendererEnvironmentStorage::environment_get_sky_orientation(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Basis());
+ return env->sky_orientation;
+}
+
+Color RendererEnvironmentStorage::environment_get_bg_color(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Color());
+ return env->bg_color;
+}
+
+float RendererEnvironmentStorage::environment_get_bg_energy(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->bg_energy;
+}
+
+int RendererEnvironmentStorage::environment_get_canvas_max_layer(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0);
+ return env->canvas_max_layer;
+}
+
+RS::EnvironmentAmbientSource RendererEnvironmentStorage::environment_get_ambient_source(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RS::ENV_AMBIENT_SOURCE_BG);
+ return env->ambient_source;
+}
+
+Color RendererEnvironmentStorage::environment_get_ambient_light(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Color());
+ return env->ambient_light;
+}
+
+float RendererEnvironmentStorage::environment_get_ambient_light_energy(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->ambient_light_energy;
+}
+
+float RendererEnvironmentStorage::environment_get_ambient_sky_contribution(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->ambient_sky_contribution;
+}
+
+RS::EnvironmentReflectionSource RendererEnvironmentStorage::environment_get_reflection_source(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RS::ENV_REFLECTION_SOURCE_BG);
+ return env->reflection_source;
+}
+
+// Tonemap
+
+void RendererEnvironmentStorage::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->exposure = p_exposure;
+ env->tone_mapper = p_tone_mapper;
+ if (!env->auto_exposure && p_auto_exposure) {
+ env->auto_exposure_version = ++auto_exposure_counter;
+ }
+ env->auto_exposure = p_auto_exposure;
+ env->white = p_white;
+ env->min_luminance = p_min_luminance;
+ env->max_luminance = p_max_luminance;
+ env->auto_exp_speed = p_auto_exp_speed;
+ env->auto_exp_scale = p_auto_exp_scale;
+}
+
+RS::EnvironmentToneMapper RendererEnvironmentStorage::environment_get_tone_mapper(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RS::ENV_TONE_MAPPER_LINEAR);
+ return env->tone_mapper;
+}
+
+float RendererEnvironmentStorage::environment_get_exposure(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->exposure;
+}
+
+float RendererEnvironmentStorage::environment_get_white(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->white;
+}
+
+bool RendererEnvironmentStorage::environment_get_auto_exposure(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->auto_exposure;
+}
+
+float RendererEnvironmentStorage::environment_get_min_luminance(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.2);
+ return env->min_luminance;
+}
+
+float RendererEnvironmentStorage::environment_get_max_luminance(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 8.0);
+ return env->max_luminance;
+}
+
+float RendererEnvironmentStorage::environment_get_auto_exp_speed(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.2);
+ return env->auto_exp_speed;
+}
+
+float RendererEnvironmentStorage::environment_get_auto_exp_scale(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.5);
+ return env->auto_exp_scale;
+}
+
+uint64_t RendererEnvironmentStorage::environment_get_auto_exposure_version(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0);
+ return env->auto_exposure_version;
+}
+
+// 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) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->fog_enabled = p_enable;
+ env->fog_light_color = p_light_color;
+ env->fog_light_energy = p_light_energy;
+ env->fog_sun_scatter = p_sun_scatter;
+ env->fog_density = p_density;
+ env->fog_height = p_height;
+ env->fog_height_density = p_height_density;
+ env->fog_aerial_perspective = p_fog_aerial_perspective;
+}
+
+bool RendererEnvironmentStorage::environment_get_fog_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->fog_enabled;
+}
+
+Color RendererEnvironmentStorage::environment_get_fog_light_color(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Color(0.5, 0.6, 0.7));
+ return env->fog_light_color;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_light_energy(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->fog_light_energy;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_sun_scatter(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->fog_sun_scatter;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_density(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.001);
+ return env->fog_density;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_height(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->fog_height;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_height_density(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->fog_height_density;
+}
+
+float RendererEnvironmentStorage::environment_get_fog_aerial_perspective(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->fog_aerial_perspective;
+}
+
+// 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) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->volumetric_fog_enabled = p_enable;
+ env->volumetric_fog_density = p_density;
+ env->volumetric_fog_scattering = p_albedo;
+ env->volumetric_fog_emission = p_emission;
+ env->volumetric_fog_emission_energy = p_emission_energy;
+ env->volumetric_fog_anisotropy = p_anisotropy,
+ env->volumetric_fog_length = p_length;
+ env->volumetric_fog_detail_spread = p_detail_spread;
+ env->volumetric_fog_gi_inject = p_gi_inject;
+ 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;
+}
+
+bool RendererEnvironmentStorage::environment_get_volumetric_fog_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->volumetric_fog_enabled;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_density(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.01);
+ return env->volumetric_fog_density;
+}
+
+Color RendererEnvironmentStorage::environment_get_volumetric_fog_scattering(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Color(1, 1, 1));
+ return env->volumetric_fog_scattering;
+}
+
+Color RendererEnvironmentStorage::environment_get_volumetric_fog_emission(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Color(0, 0, 0));
+ return env->volumetric_fog_emission;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_emission_energy(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->volumetric_fog_emission_energy;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_anisotropy(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.2);
+ return env->volumetric_fog_anisotropy;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_length(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 64.0);
+ return env->volumetric_fog_length;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_detail_spread(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 2.0);
+ return env->volumetric_fog_detail_spread;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_gi_inject(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->volumetric_fog_gi_inject;
+}
+
+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);
+ return env->volumetric_fog_temporal_reprojection;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_temporal_reprojection_amount(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.9);
+ return env->volumetric_fog_temporal_reprojection_amount;
+}
+
+float RendererEnvironmentStorage::environment_get_volumetric_fog_ambient_inject(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->volumetric_fog_ambient_inject;
+}
+
+// GLOW
+
+void RendererEnvironmentStorage::environment_set_glow(RID p_env, bool p_enable, Vector<float> p_levels, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, float p_glow_map_strength, RID p_glow_map) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ ERR_FAIL_COND_MSG(p_levels.size() != 7, "Size of array of glow levels must be 7");
+ env->glow_enabled = p_enable;
+ env->glow_levels = p_levels;
+ env->glow_intensity = p_intensity;
+ env->glow_strength = p_strength;
+ env->glow_mix = p_mix;
+ env->glow_bloom = p_bloom_threshold;
+ env->glow_blend_mode = p_blend_mode;
+ env->glow_hdr_bleed_threshold = p_hdr_bleed_threshold;
+ env->glow_hdr_bleed_scale = p_hdr_bleed_scale;
+ env->glow_hdr_luminance_cap = p_hdr_luminance_cap;
+ env->glow_map_strength = p_glow_map_strength;
+ env->glow_map = p_glow_map;
+}
+
+bool RendererEnvironmentStorage::environment_get_glow_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->glow_enabled;
+}
+
+Vector<float> RendererEnvironmentStorage::environment_get_glow_levels(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, Vector<float>());
+ return env->glow_levels;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_intensity(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.8);
+ return env->glow_intensity;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_strength(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->glow_strength;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_bloom(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->glow_bloom;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_mix(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.01);
+ return env->glow_mix;
+}
+
+RS::EnvironmentGlowBlendMode RendererEnvironmentStorage::environment_get_glow_blend_mode(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT);
+ return env->glow_blend_mode;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_hdr_bleed_threshold(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->glow_hdr_bleed_threshold;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_hdr_luminance_cap(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 12.0);
+ return env->glow_hdr_luminance_cap;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_hdr_bleed_scale(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 2.0);
+ return env->glow_hdr_bleed_scale;
+}
+
+float RendererEnvironmentStorage::environment_get_glow_map_strength(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->glow_map_strength;
+}
+
+RID RendererEnvironmentStorage::environment_get_glow_map(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RID());
+ return env->glow_map;
+}
+
+// SSR
+
+void RendererEnvironmentStorage::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->ssr_enabled = p_enable;
+ env->ssr_max_steps = p_max_steps;
+ env->ssr_fade_in = p_fade_int;
+ env->ssr_fade_out = p_fade_out;
+ env->ssr_depth_tolerance = p_depth_tolerance;
+}
+
+bool RendererEnvironmentStorage::environment_get_ssr_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->ssr_enabled;
+}
+
+int RendererEnvironmentStorage::environment_get_ssr_max_steps(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 64);
+ return env->ssr_max_steps;
+}
+
+float RendererEnvironmentStorage::environment_get_ssr_fade_in(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.15);
+ return env->ssr_fade_in;
+}
+
+float RendererEnvironmentStorage::environment_get_ssr_fade_out(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 2.0);
+ return env->ssr_fade_out;
+}
+
+float RendererEnvironmentStorage::environment_get_ssr_depth_tolerance(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.2);
+ return env->ssr_depth_tolerance;
+}
+
+// SSAO
+
+void RendererEnvironmentStorage::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_power, float p_detail, float p_horizon, float p_sharpness, float p_light_affect, float p_ao_channel_affect) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->ssao_enabled = p_enable;
+ env->ssao_radius = p_radius;
+ env->ssao_intensity = p_intensity;
+ env->ssao_power = p_power;
+ env->ssao_detail = p_detail;
+ env->ssao_horizon = p_horizon;
+ env->ssao_sharpness = p_sharpness;
+ env->ssao_direct_light_affect = p_light_affect;
+ env->ssao_ao_channel_affect = p_ao_channel_affect;
+}
+
+bool RendererEnvironmentStorage::environment_get_ssao_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->ssao_enabled;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_radius(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->ssao_radius;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_intensity(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 2.0);
+ return env->ssao_intensity;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_power(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.5);
+ return env->ssao_power;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_detail(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.5);
+ return env->ssao_detail;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_horizon(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.06);
+ return env->ssao_horizon;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_sharpness(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.98);
+ return env->ssao_sharpness;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_direct_light_affect(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->ssao_direct_light_affect;
+}
+
+float RendererEnvironmentStorage::environment_get_ssao_ao_channel_affect(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.0);
+ return env->ssao_ao_channel_affect;
+}
+
+// SSIL
+
+void RendererEnvironmentStorage::environment_set_ssil(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_sharpness, float p_normal_rejection) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->ssil_enabled = p_enable;
+ env->ssil_radius = p_radius;
+ env->ssil_intensity = p_intensity;
+ env->ssil_sharpness = p_sharpness;
+ env->ssil_normal_rejection = p_normal_rejection;
+}
+
+bool RendererEnvironmentStorage::environment_get_ssil_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->ssil_enabled;
+}
+
+float RendererEnvironmentStorage::environment_get_ssil_radius(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 5.0);
+ return env->ssil_radius;
+}
+
+float RendererEnvironmentStorage::environment_get_ssil_intensity(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->ssil_intensity;
+}
+
+float RendererEnvironmentStorage::environment_get_ssil_sharpness(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.98);
+ return env->ssil_sharpness;
+}
+
+float RendererEnvironmentStorage::environment_get_ssil_normal_rejection(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->ssil_normal_rejection;
+}
+
+// SDFGI
+
+void RendererEnvironmentStorage::environment_set_sdfgi(RID p_env, bool p_enable, int p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, float p_bounce_feedback, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->sdfgi_enabled = p_enable;
+ env->sdfgi_cascades = p_cascades;
+ env->sdfgi_min_cell_size = p_min_cell_size;
+ env->sdfgi_use_occlusion = p_use_occlusion;
+ env->sdfgi_bounce_feedback = p_bounce_feedback;
+ env->sdfgi_read_sky_light = p_read_sky;
+ env->sdfgi_energy = p_energy;
+ env->sdfgi_normal_bias = p_normal_bias;
+ env->sdfgi_probe_bias = p_probe_bias;
+ env->sdfgi_y_scale = p_y_scale;
+}
+
+bool RendererEnvironmentStorage::environment_get_sdfgi_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->sdfgi_enabled;
+}
+
+int RendererEnvironmentStorage::environment_get_sdfgi_cascades(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 4);
+ return env->sdfgi_cascades;
+}
+
+float RendererEnvironmentStorage::environment_get_sdfgi_min_cell_size(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.2);
+ return env->sdfgi_min_cell_size;
+}
+
+bool RendererEnvironmentStorage::environment_get_sdfgi_use_occlusion(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->sdfgi_use_occlusion;
+}
+
+float RendererEnvironmentStorage::environment_get_sdfgi_bounce_feedback(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 0.5);
+ return env->sdfgi_bounce_feedback;
+}
+
+bool RendererEnvironmentStorage::environment_get_sdfgi_read_sky_light(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, true);
+ return env->sdfgi_read_sky_light;
+}
+
+float RendererEnvironmentStorage::environment_get_sdfgi_energy(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->sdfgi_energy;
+}
+
+float RendererEnvironmentStorage::environment_get_sdfgi_normal_bias(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.1);
+ return env->sdfgi_normal_bias;
+}
+
+float RendererEnvironmentStorage::environment_get_sdfgi_probe_bias(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.1);
+ return env->sdfgi_probe_bias;
+}
+
+RS::EnvironmentSDFGIYScale RendererEnvironmentStorage::environment_get_sdfgi_y_scale(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RS::ENV_SDFGI_Y_SCALE_75_PERCENT);
+ return env->sdfgi_y_scale;
+}
+
+// Adjustments
+
+void RendererEnvironmentStorage::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, bool p_use_1d_color_correction, RID p_color_correction) {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND(!env);
+ env->adjustments_enabled = p_enable;
+ env->adjustments_brightness = p_brightness;
+ env->adjustments_contrast = p_contrast;
+ env->adjustments_saturation = p_saturation;
+ env->use_1d_color_correction = p_use_1d_color_correction;
+ env->color_correction = p_color_correction;
+}
+
+bool RendererEnvironmentStorage::environment_get_adjustments_enabled(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->adjustments_enabled;
+}
+
+float RendererEnvironmentStorage::environment_get_adjustments_brightness(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->adjustments_brightness;
+}
+
+float RendererEnvironmentStorage::environment_get_adjustments_contrast(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->adjustments_contrast;
+}
+
+float RendererEnvironmentStorage::environment_get_adjustments_saturation(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, 1.0);
+ return env->adjustments_saturation;
+}
+
+bool RendererEnvironmentStorage::environment_get_use_1d_color_correction(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, false);
+ return env->use_1d_color_correction;
+}
+
+RID RendererEnvironmentStorage::environment_get_color_correction(RID p_env) const {
+ Environment *env = environment_owner.get_or_null(p_env);
+ ERR_FAIL_COND_V(!env, RID());
+ return env->color_correction;
+}
diff --git a/servers/rendering/storage/environment_storage.h b/servers/rendering/storage/environment_storage.h
new file mode 100644
index 0000000000..bd1c17deec
--- /dev/null
+++ b/servers/rendering/storage/environment_storage.h
@@ -0,0 +1,296 @@
+/*************************************************************************/
+/* environment_storage.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef ENVIRONMENT_STORAGE_H
+#define ENVIRONMENT_STORAGE_H
+
+#include "core/templates/rid_owner.h"
+#include "servers/rendering_server.h"
+
+class RendererEnvironmentStorage {
+private:
+ struct Environment {
+ // Note, we capture and store all environment parameters received from Godot here.
+ // Not all renderers support all effects and should just ignore the bits they don't support.
+
+ // Background
+ RS::EnvironmentBG background = RS::ENV_BG_CLEAR_COLOR;
+ RID sky;
+ float sky_custom_fov = 0.0;
+ Basis sky_orientation;
+ Color bg_color;
+ float bg_energy = 1.0;
+ int canvas_max_layer = 0;
+ RS::EnvironmentAmbientSource ambient_source = RS::ENV_AMBIENT_SOURCE_BG;
+ Color ambient_light;
+ float ambient_light_energy = 1.0;
+ float ambient_sky_contribution = 1.0;
+ RS::EnvironmentReflectionSource reflection_source = RS::ENV_REFLECTION_SOURCE_BG;
+
+ // Tonemap
+ RS::EnvironmentToneMapper tone_mapper;
+ float exposure = 1.0;
+ float white = 1.0;
+ bool auto_exposure = false;
+ float min_luminance = 0.2;
+ float max_luminance = 8.0;
+ float auto_exp_speed = 0.2;
+ float auto_exp_scale = 0.5;
+ uint64_t auto_exposure_version = 0;
+
+ // Fog
+ bool fog_enabled = false;
+ Color fog_light_color = Color(0.5, 0.6, 0.7);
+ float fog_light_energy = 1.0;
+ float fog_sun_scatter = 0.0;
+ float fog_density = 0.001;
+ float fog_height = 0.0;
+ float fog_height_density = 0.0; //can be negative to invert effect
+ float fog_aerial_perspective = 0.0;
+
+ // Volumetric Fog
+ bool volumetric_fog_enabled = false;
+ float volumetric_fog_density = 0.01;
+ Color volumetric_fog_scattering = Color(1, 1, 1);
+ Color volumetric_fog_emission = Color(0, 0, 0);
+ float volumetric_fog_emission_energy = 0.0;
+ float volumetric_fog_anisotropy = 0.2;
+ float volumetric_fog_length = 64.0;
+ float volumetric_fog_detail_spread = 2.0;
+ float volumetric_fog_gi_inject = 0.0;
+ bool volumetric_fog_temporal_reprojection = true;
+ float volumetric_fog_temporal_reprojection_amount = 0.9;
+ float volumetric_fog_ambient_inject = 0.0;
+
+ // Glow
+ bool glow_enabled = false;
+ Vector<float> glow_levels;
+ float glow_intensity = 0.8;
+ float glow_strength = 1.0;
+ float glow_bloom = 0.0;
+ float glow_mix = 0.01;
+ RS::EnvironmentGlowBlendMode glow_blend_mode = RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT;
+ float glow_hdr_bleed_threshold = 1.0;
+ float glow_hdr_luminance_cap = 12.0;
+ float glow_hdr_bleed_scale = 2.0;
+ float glow_map_strength = 0.0f; // 1.0f in GLES3 ??
+ RID glow_map = RID();
+
+ // SSR
+ bool ssr_enabled = false;
+ int ssr_max_steps = 64;
+ float ssr_fade_in = 0.15;
+ float ssr_fade_out = 2.0;
+ float ssr_depth_tolerance = 0.2;
+
+ // SSAO
+ bool ssao_enabled = false;
+ float ssao_radius = 1.0;
+ float ssao_intensity = 2.0;
+ float ssao_power = 1.5;
+ float ssao_detail = 0.5;
+ float ssao_horizon = 0.06;
+ float ssao_sharpness = 0.98;
+ float ssao_direct_light_affect = 0.0;
+ float ssao_ao_channel_affect = 0.0;
+
+ // SSIL
+ bool ssil_enabled = false;
+ float ssil_radius = 5.0;
+ float ssil_intensity = 1.0;
+ float ssil_sharpness = 0.98;
+ float ssil_normal_rejection = 1.0;
+
+ // SDFGI
+ bool sdfgi_enabled = false;
+ int sdfgi_cascades = 4;
+ float sdfgi_min_cell_size = 0.2;
+ bool sdfgi_use_occlusion = false;
+ float sdfgi_bounce_feedback = 0.5;
+ bool sdfgi_read_sky_light = true;
+ float sdfgi_energy = 1.0;
+ float sdfgi_normal_bias = 1.1;
+ float sdfgi_probe_bias = 1.1;
+ RS::EnvironmentSDFGIYScale sdfgi_y_scale = RS::ENV_SDFGI_Y_SCALE_75_PERCENT;
+
+ // Adjustments
+ bool adjustments_enabled = false;
+ float adjustments_brightness = 1.0f;
+ float adjustments_contrast = 1.0f;
+ float adjustments_saturation = 1.0f;
+ bool use_1d_color_correction = false;
+ RID color_correction = RID();
+ };
+
+ static uint64_t auto_exposure_counter;
+
+ mutable RID_Owner<Environment, true> environment_owner;
+
+public:
+ RID environment_allocate();
+ void environment_initialize(RID p_rid);
+ void environment_free(RID p_rid);
+
+ bool is_environment(RID p_environment) const {
+ return environment_owner.owns(p_environment);
+ }
+
+ // Background
+ void environment_set_background(RID p_env, RS::EnvironmentBG p_bg);
+ void environment_set_sky(RID p_env, RID p_sky);
+ void environment_set_sky_custom_fov(RID p_env, float p_scale);
+ void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
+ void environment_set_bg_color(RID p_env, const Color &p_color);
+ void environment_set_bg_energy(RID p_env, float p_energy);
+ void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
+ void environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient = RS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, RS::EnvironmentReflectionSource p_reflection_source = RS::ENV_REFLECTION_SOURCE_BG);
+// FIXME: Disabled during Vulkan refactoring, should be ported.
+#if 0
+ void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id);
+#endif
+
+ RS::EnvironmentBG environment_get_background(RID p_env) const;
+ RID environment_get_sky(RID p_env) const;
+ float environment_get_sky_custom_fov(RID p_env) const;
+ Basis environment_get_sky_orientation(RID p_env) const;
+ Color environment_get_bg_color(RID p_env) const;
+ float environment_get_bg_energy(RID p_env) const;
+ int environment_get_canvas_max_layer(RID p_env) const;
+ RS::EnvironmentAmbientSource environment_get_ambient_source(RID p_env) const;
+ Color environment_get_ambient_light(RID p_env) const;
+ float environment_get_ambient_light_energy(RID p_env) const;
+ float environment_get_ambient_sky_contribution(RID p_env) const;
+ RS::EnvironmentReflectionSource environment_get_reflection_source(RID p_env) const;
+
+ // Tonemap
+ void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
+ RS::EnvironmentToneMapper environment_get_tone_mapper(RID p_env) const;
+ float environment_get_exposure(RID p_env) const;
+ float environment_get_white(RID p_env) const;
+ bool environment_get_auto_exposure(RID p_env) const;
+ float environment_get_min_luminance(RID p_env) const;
+ float environment_get_max_luminance(RID p_env) const;
+ float environment_get_auto_exp_speed(RID p_env) const;
+ float environment_get_auto_exp_scale(RID p_env) const;
+ uint64_t environment_get_auto_exposure_version(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);
+ 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_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);
+ 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;
+ Color environment_get_volumetric_fog_emission(RID p_env) const;
+ float environment_get_volumetric_fog_emission_energy(RID p_env) const;
+ float environment_get_volumetric_fog_anisotropy(RID p_env) const;
+ 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;
+ 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;
+
+ // GLOW
+ void environment_set_glow(RID p_env, bool p_enable, Vector<float> p_levels, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, float p_glow_map_strength, RID p_glow_map);
+ bool environment_get_glow_enabled(RID p_env) const;
+ Vector<float> environment_get_glow_levels(RID p_env) const;
+ float environment_get_glow_intensity(RID p_env) const;
+ float environment_get_glow_strength(RID p_env) const;
+ float environment_get_glow_bloom(RID p_env) const;
+ float environment_get_glow_mix(RID p_env) const;
+ RS::EnvironmentGlowBlendMode environment_get_glow_blend_mode(RID p_env) const;
+ float environment_get_glow_hdr_bleed_threshold(RID p_env) const;
+ float environment_get_glow_hdr_luminance_cap(RID p_env) const;
+ float environment_get_glow_hdr_bleed_scale(RID p_env) const;
+ float environment_get_glow_map_strength(RID p_env) const;
+ RID environment_get_glow_map(RID p_env) const;
+
+ // SSR
+ void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance);
+ bool environment_get_ssr_enabled(RID p_env) const;
+ int environment_get_ssr_max_steps(RID p_env) const;
+ float environment_get_ssr_fade_in(RID p_env) const;
+ float environment_get_ssr_fade_out(RID p_env) const;
+ float environment_get_ssr_depth_tolerance(RID p_env) const;
+
+ // SSAO
+ void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_power, float p_detail, float p_horizon, float p_sharpness, float p_light_affect, float p_ao_channel_affect);
+ bool environment_get_ssao_enabled(RID p_env) const;
+ float environment_get_ssao_radius(RID p_env) const;
+ float environment_get_ssao_intensity(RID p_env) const;
+ float environment_get_ssao_power(RID p_env) const;
+ float environment_get_ssao_detail(RID p_env) const;
+ float environment_get_ssao_horizon(RID p_env) const;
+ float environment_get_ssao_sharpness(RID p_env) const;
+ float environment_get_ssao_direct_light_affect(RID p_env) const;
+ float environment_get_ssao_ao_channel_affect(RID p_env) const;
+
+ // SSIL
+ void environment_set_ssil(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_sharpness, float p_normal_rejection);
+ bool environment_get_ssil_enabled(RID p_env) const;
+ float environment_get_ssil_radius(RID p_env) const;
+ float environment_get_ssil_intensity(RID p_env) const;
+ float environment_get_ssil_sharpness(RID p_env) const;
+ float environment_get_ssil_normal_rejection(RID p_env) const;
+
+ // SDFGI
+ void environment_set_sdfgi(RID p_env, bool p_enable, int p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, float p_bounce_feedback, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias);
+ bool environment_get_sdfgi_enabled(RID p_env) const;
+ int environment_get_sdfgi_cascades(RID p_env) const;
+ float environment_get_sdfgi_min_cell_size(RID p_env) const;
+ bool environment_get_sdfgi_use_occlusion(RID p_env) const;
+ float environment_get_sdfgi_bounce_feedback(RID p_env) const;
+ bool environment_get_sdfgi_read_sky_light(RID p_env) const;
+ float environment_get_sdfgi_energy(RID p_env) const;
+ float environment_get_sdfgi_normal_bias(RID p_env) const;
+ float environment_get_sdfgi_probe_bias(RID p_env) const;
+ RS::EnvironmentSDFGIYScale environment_get_sdfgi_y_scale(RID p_env) const;
+
+ // Adjustment
+ void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, bool p_use_1d_color_correction, RID p_color_correction);
+ bool environment_get_adjustments_enabled(RID p_env) const;
+ float environment_get_adjustments_brightness(RID p_env) const;
+ float environment_get_adjustments_contrast(RID p_env) const;
+ float environment_get_adjustments_saturation(RID p_env) const;
+ bool environment_get_use_1d_color_correction(RID p_env) const;
+ RID environment_get_color_correction(RID p_env) const;
+};
+
+#endif // ENVIRONMENT_STORAGE_H