Environment: Refactor code for readability + more
- Makes all boolean setters/getters consistent. - Fixes bug where `glow_hdr_bleed_scale` was not used. - Split CameraEffects to their own source file. - Reorder all Environment method and properties declarations, definitions and bindings to be consistent with each other and with the order of property bindings. - Bind missing enum values added with SDFGI. - Remove unused SDFGI enhance_ssr boolean. - Sync doc changes after SDFGI merge and other misc changes.
This commit is contained in:
parent
719609522a
commit
372136fe75
41 changed files with 1638 additions and 1453 deletions
|
|
@ -181,7 +181,7 @@ bool DisplayServer::screen_is_kept_on() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &) {
|
||||
DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
|
||||
ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server.");
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ void DisplayServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_window_list"), &DisplayServer::get_window_list);
|
||||
ClassDB::bind_method(D_METHOD("get_window_at_screen_position", "position"), &DisplayServer::get_window_at_screen_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("create_sub_window", "mode", "rect"), &DisplayServer::create_sub_window, DEFVAL(Rect2i()));
|
||||
ClassDB::bind_method(D_METHOD("create_sub_window", "mode", "flags", "rect"), &DisplayServer::create_sub_window, DEFVAL(Rect2i()));
|
||||
ClassDB::bind_method(D_METHOD("delete_sub_window", "window_id"), &DisplayServer::delete_sub_window);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("window_set_title", "title", "window_id"), &DisplayServer::window_set_title, DEFVAL(MAIN_WINDOW_ID));
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ public:
|
|||
WINDOW_FLAG_NO_FOCUS_BIT = (1 << WINDOW_FLAG_NO_FOCUS)
|
||||
};
|
||||
|
||||
virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i & = Rect2i());
|
||||
virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i());
|
||||
virtual void delete_sub_window(WindowID p_id);
|
||||
|
||||
virtual WindowID get_window_at_screen_position(const Point2i &p_position) const = 0;
|
||||
|
|
|
|||
|
|
@ -32,10 +32,9 @@
|
|||
#define RASTERIZER_H
|
||||
|
||||
#include "core/math/camera_matrix.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#include "core/pair.h"
|
||||
#include "core/self_list.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class RasterizerScene {
|
||||
public:
|
||||
|
|
@ -96,7 +95,7 @@ public:
|
|||
|
||||
virtual void environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size) = 0;
|
||||
|
||||
virtual void environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, bool p_enhance_ssr, float p_energy, float p_normal_bias, float p_probe_bias) = 0;
|
||||
virtual void environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) = 0;
|
||||
|
||||
virtual void environment_set_sdfgi_ray_count(RS::EnvironmentSDFGIRayCount p_ray_count) = 0;
|
||||
virtual void environment_set_sdfgi_frames_to_converge(RS::EnvironmentSDFGIFramesToConverge p_frames) = 0;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/project_settings.h"
|
||||
#include "rasterizer_rd.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
|
||||
uint64_t RasterizerSceneRD::auto_exposure_counter = 2;
|
||||
|
||||
void get_vogel_disk(float *r_kernel, int p_sample_count) {
|
||||
|
|
@ -2826,7 +2827,7 @@ void RasterizerSceneRD::environment_glow_set_use_bicubic_upscale(bool p_enable)
|
|||
glow_bicubic_upscale = p_enable;
|
||||
}
|
||||
|
||||
void RasterizerSceneRD::environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, bool p_enhance_ssr, float p_energy, float p_normal_bias, float p_probe_bias) {
|
||||
void RasterizerSceneRD::environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) {
|
||||
Environent *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
|
|
@ -2836,7 +2837,6 @@ void RasterizerSceneRD::environment_set_sdfgi(RID p_env, bool p_enable, RS::Envi
|
|||
env->sdfgi_use_occlusion = p_use_occlusion;
|
||||
env->sdfgi_use_multibounce = p_use_multibounce;
|
||||
env->sdfgi_read_sky_light = p_read_sky;
|
||||
env->sdfgi_enhance_ssr = p_enhance_ssr;
|
||||
env->sdfgi_energy = p_energy;
|
||||
env->sdfgi_normal_bias = p_normal_bias;
|
||||
env->sdfgi_probe_bias = p_probe_bias;
|
||||
|
|
|
|||
|
|
@ -689,7 +689,6 @@ private:
|
|||
bool sdfgi_use_occlusion = false;
|
||||
bool sdfgi_use_multibounce = false;
|
||||
bool sdfgi_read_sky_light = false;
|
||||
bool sdfgi_enhance_ssr = false;
|
||||
float sdfgi_energy = 1.0;
|
||||
float sdfgi_normal_bias = 1.1;
|
||||
float sdfgi_probe_bias = 1.1;
|
||||
|
|
@ -1290,7 +1289,7 @@ public:
|
|||
bool environment_is_ssr_enabled(RID p_env) const;
|
||||
bool environment_is_sdfgi_enabled(RID p_env) const;
|
||||
|
||||
virtual void environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, bool p_enhance_ssr, float p_energy, float p_normal_bias, float p_probe_bias);
|
||||
virtual void environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias);
|
||||
virtual void environment_set_sdfgi_ray_count(RS::EnvironmentSDFGIRayCount p_ray_count);
|
||||
virtual void environment_set_sdfgi_frames_to_converge(RS::EnvironmentSDFGIFramesToConverge p_frames);
|
||||
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ void RenderingDevice::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("shader_get_vertex_input_attribute_mask", "shader"), &RenderingDevice::shader_get_vertex_input_attribute_mask);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("uniform_buffer_create", "size_bytes", "data"), &RenderingDevice::uniform_buffer_create, DEFVAL(Vector<uint8_t>()));
|
||||
ClassDB::bind_method(D_METHOD("storage_buffer_create", "size_bytes", "data"), &RenderingDevice::storage_buffer_create, DEFVAL(Vector<uint8_t>()), DEFVAL(0));
|
||||
ClassDB::bind_method(D_METHOD("storage_buffer_create", "size_bytes", "data", "usage"), &RenderingDevice::storage_buffer_create, DEFVAL(Vector<uint8_t>()), DEFVAL(0));
|
||||
ClassDB::bind_method(D_METHOD("texture_buffer_create", "size_bytes", "format", "data"), &RenderingDevice::texture_buffer_create, DEFVAL(Vector<uint8_t>()));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("uniform_set_create", "uniforms", "shader", "shader_set"), &RenderingDevice::_uniform_set_create);
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ public:
|
|||
BIND7(environment_set_fog_depth, RID, bool, float, float, float, bool, float)
|
||||
BIND5(environment_set_fog_height, RID, bool, float, float, float)
|
||||
|
||||
BIND12(environment_set_sdfgi, RID, bool, EnvironmentSDFGICascades, float, EnvironmentSDFGIYScale, bool, bool, bool, bool, float, float, float)
|
||||
BIND11(environment_set_sdfgi, RID, bool, EnvironmentSDFGICascades, float, EnvironmentSDFGIYScale, bool, bool, bool, float, float, float)
|
||||
BIND1(environment_set_sdfgi_ray_count, EnvironmentSDFGIRayCount)
|
||||
BIND1(environment_set_sdfgi_frames_to_converge, EnvironmentSDFGIFramesToConverge)
|
||||
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@ public:
|
|||
|
||||
FUNC2(environment_set_ssao_quality, EnvironmentSSAOQuality, bool)
|
||||
|
||||
FUNC12(environment_set_sdfgi, RID, bool, EnvironmentSDFGICascades, float, EnvironmentSDFGIYScale, bool, bool, bool, bool, float, float, float)
|
||||
FUNC11(environment_set_sdfgi, RID, bool, EnvironmentSDFGICascades, float, EnvironmentSDFGIYScale, bool, bool, bool, float, float, float)
|
||||
FUNC1(environment_set_sdfgi_ray_count, EnvironmentSDFGIRayCount)
|
||||
FUNC1(environment_set_sdfgi_frames_to_converge, EnvironmentSDFGIFramesToConverge)
|
||||
|
||||
|
|
|
|||
|
|
@ -1995,6 +1995,10 @@ void RenderingServer::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(LIGHT_PARAM_TRANSMITTANCE_BIAS);
|
||||
BIND_ENUM_CONSTANT(LIGHT_PARAM_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(LIGHT_BAKE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(LIGHT_BAKE_DYNAMIC);
|
||||
BIND_ENUM_CONSTANT(LIGHT_BAKE_STATIC);
|
||||
|
||||
BIND_ENUM_CONSTANT(LIGHT_OMNI_SHADOW_DUAL_PARABOLOID);
|
||||
BIND_ENUM_CONSTANT(LIGHT_OMNI_SHADOW_CUBE);
|
||||
|
||||
|
|
@ -2008,6 +2012,10 @@ void RenderingServer::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ONCE);
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ALWAYS);
|
||||
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_AMBIENT_DISABLED);
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_AMBIENT_ENVIRONMENT);
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_AMBIENT_COLOR);
|
||||
|
||||
BIND_ENUM_CONSTANT(DECAL_TEXTURE_ALBEDO);
|
||||
BIND_ENUM_CONSTANT(DECAL_TEXTURE_NORMAL);
|
||||
BIND_ENUM_CONSTANT(DECAL_TEXTURE_ORM);
|
||||
|
|
@ -2374,7 +2382,7 @@ RenderingServer::RenderingServer() {
|
|||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/ssao/quality", PropertyInfo(Variant::INT, "rendering/quality/ssao/quality", PROPERTY_HINT_ENUM, "Low (Fast),Medium (Average),High (Slow),Ultra (Slower)"));
|
||||
GLOBAL_DEF("rendering/quality/ssao/half_size", false);
|
||||
|
||||
GLOBAL_DEF("rendering/quality/screen_filters/screen_space_roughness_limiter_enable", true);
|
||||
GLOBAL_DEF("rendering/quality/screen_filters/screen_space_roughness_limiter_enabled", true);
|
||||
GLOBAL_DEF("rendering/quality/screen_filters/screen_space_roughness_limiter_amount", 0.25);
|
||||
GLOBAL_DEF("rendering/quality/screen_filters/screen_space_roughness_limiter_limit", 0.18);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/screen_filters/screen_space_roughness_limiter_amount", PropertyInfo(Variant::FLOAT, "rendering/quality/screen_filters/screen_space_roughness_limiter_amount", PROPERTY_HINT_RANGE, "0.01,4.0,0.01"));
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ public:
|
|||
enum LightDirectionalShadowMode {
|
||||
LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL,
|
||||
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS,
|
||||
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS
|
||||
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS,
|
||||
};
|
||||
|
||||
virtual void light_directional_set_shadow_mode(RID p_light, LightDirectionalShadowMode p_mode) = 0;
|
||||
|
|
@ -437,7 +437,6 @@ public:
|
|||
enum LightDirectionalShadowDepthRangeMode {
|
||||
LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE,
|
||||
LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED,
|
||||
|
||||
};
|
||||
|
||||
virtual void light_directional_set_shadow_depth_range_mode(RID p_light, LightDirectionalShadowDepthRangeMode p_range_mode) = 0;
|
||||
|
|
@ -457,7 +456,7 @@ public:
|
|||
enum ReflectionProbeAmbientMode {
|
||||
REFLECTION_PROBE_AMBIENT_DISABLED,
|
||||
REFLECTION_PROBE_AMBIENT_ENVIRONMENT,
|
||||
REFLECTION_PROBE_AMBIENT_COLOR
|
||||
REFLECTION_PROBE_AMBIENT_COLOR,
|
||||
};
|
||||
|
||||
virtual void reflection_probe_set_ambient_mode(RID p_probe, ReflectionProbeAmbientMode p_mode) = 0;
|
||||
|
|
@ -608,16 +607,6 @@ public:
|
|||
virtual void camera_set_camera_effects(RID p_camera, RID p_camera_effects) = 0;
|
||||
virtual void camera_set_use_vertical_aspect(RID p_camera, bool p_enable) = 0;
|
||||
|
||||
/*
|
||||
enum ParticlesCollisionMode {
|
||||
PARTICLES_COLLISION_NONE,
|
||||
PARTICLES_COLLISION_TEXTURE,
|
||||
PARTICLES_COLLISION_CUBEMAP,
|
||||
};
|
||||
|
||||
virtual void particles_set_collision(RID p_particles,ParticlesCollisionMode p_mode,const Transform&, p_xform,const RID p_depth_tex,const RID p_normal_tex)=0;
|
||||
*/
|
||||
|
||||
/* VIEWPORT TARGET API */
|
||||
|
||||
virtual RID viewport_create() = 0;
|
||||
|
|
@ -844,7 +833,7 @@ public:
|
|||
ENV_SDFGI_Y_SCALE_50_PERCENT
|
||||
};
|
||||
|
||||
virtual void environment_set_sdfgi(RID p_env, bool p_enable, EnvironmentSDFGICascades p_cascades, float p_min_cell_size, EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, bool p_enhance_ssr, float p_energy, float p_normal_bias, float p_probe_bias) = 0;
|
||||
virtual void environment_set_sdfgi(RID p_env, bool p_enable, EnvironmentSDFGICascades p_cascades, float p_min_cell_size, EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) = 0;
|
||||
|
||||
enum EnvironmentSDFGIRayCount {
|
||||
ENV_SDFGI_RAY_COUNT_8,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue