diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /scene/resources/environment.cpp | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) | |
download | redot-engine-07bc4e2f96f8f47991339654ff4ab16acc19d44f.tar.gz |
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
-o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
-o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```
This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.
This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.
Part of #33027.
Diffstat (limited to 'scene/resources/environment.cpp')
-rw-r--r-- | scene/resources/environment.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 87d070db6f..5356b5bea2 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -57,26 +57,32 @@ void Environment::set_sky_custom_fov(float p_scale) { bg_sky_custom_fov = p_scale; RS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale); } + void Environment::set_bg_color(const Color &p_color) { bg_color = p_color; RS::get_singleton()->environment_set_bg_color(environment, p_color); } + void Environment::set_bg_energy(float p_energy) { bg_energy = p_energy; RS::get_singleton()->environment_set_bg_energy(environment, p_energy); } + void Environment::set_canvas_max_layer(int p_max_layer) { bg_canvas_max_layer = p_max_layer; RS::get_singleton()->environment_set_canvas_max_layer(environment, p_max_layer); } + void Environment::set_ambient_light_color(const Color &p_color) { ambient_color = p_color; RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } + void Environment::set_ambient_light_energy(float p_energy) { ambient_energy = p_energy; RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } + void Environment::set_ambient_light_sky_contribution(float p_energy) { ambient_sky_contribution = p_energy; RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); @@ -98,10 +104,12 @@ void Environment::set_ambient_source(AmbientSource p_source) { Environment::AmbientSource Environment::get_ambient_source() const { return ambient_source; } + void Environment::set_reflection_source(ReflectionSource p_source) { reflection_source = p_source; RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } + Environment::ReflectionSource Environment::get_reflection_source() const { return reflection_source; } @@ -109,6 +117,7 @@ Environment::ReflectionSource Environment::get_reflection_source() const { Environment::BGMode Environment::get_background() const { return bg_mode; } + Ref<Sky> Environment::get_sky() const { return bg_sky; } @@ -129,21 +138,27 @@ Vector3 Environment::get_sky_rotation() const { Color Environment::get_bg_color() const { return bg_color; } + float Environment::get_bg_energy() const { return bg_energy; } + int Environment::get_canvas_max_layer() const { return bg_canvas_max_layer; } + Color Environment::get_ambient_light_color() const { return ambient_color; } + float Environment::get_ambient_light_energy() const { return ambient_energy; } + float Environment::get_ambient_light_sky_contribution() const { return ambient_sky_contribution; } + int Environment::get_camera_feed_id() const { return camera_feed_id; } @@ -170,6 +185,7 @@ void Environment::set_tonemap_white(float p_white) { tonemap_white = p_white; RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } + float Environment::get_tonemap_white() const { return tonemap_white; } @@ -179,6 +195,7 @@ void Environment::set_tonemap_auto_exposure(bool p_enabled) { RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); _change_notify(); } + bool Environment::get_tonemap_auto_exposure() const { return tonemap_auto_exposure; } @@ -187,6 +204,7 @@ void Environment::set_tonemap_auto_exposure_max(float p_auto_exposure_max) { tonemap_auto_exposure_max = p_auto_exposure_max; RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } + float Environment::get_tonemap_auto_exposure_max() const { return tonemap_auto_exposure_max; } @@ -195,6 +213,7 @@ void Environment::set_tonemap_auto_exposure_min(float p_auto_exposure_min) { tonemap_auto_exposure_min = p_auto_exposure_min; RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } + float Environment::get_tonemap_auto_exposure_min() const { return tonemap_auto_exposure_min; } @@ -203,6 +222,7 @@ void Environment::set_tonemap_auto_exposure_speed(float p_auto_exposure_speed) { tonemap_auto_exposure_speed = p_auto_exposure_speed; RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } + float Environment::get_tonemap_auto_exposure_speed() const { return tonemap_auto_exposure_speed; } @@ -211,6 +231,7 @@ void Environment::set_tonemap_auto_exposure_grey(float p_auto_exposure_grey) { tonemap_auto_exposure_grey = p_auto_exposure_grey; RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } + float Environment::get_tonemap_auto_exposure_grey() const { return tonemap_auto_exposure_grey; } @@ -229,6 +250,7 @@ void Environment::set_adjustment_brightness(float p_brightness) { adjustment_brightness = p_brightness; RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } + float Environment::get_adjustment_brightness() const { return adjustment_brightness; } @@ -237,6 +259,7 @@ void Environment::set_adjustment_contrast(float p_contrast) { adjustment_contrast = p_contrast; RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } + float Environment::get_adjustment_contrast() const { return adjustment_contrast; } @@ -245,6 +268,7 @@ void Environment::set_adjustment_saturation(float p_saturation) { adjustment_saturation = p_saturation; RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } + float Environment::get_adjustment_saturation() const { return adjustment_saturation; } @@ -253,6 +277,7 @@ void Environment::set_adjustment_color_correction(const Ref<Texture2D> &p_ramp) adjustment_color_correction = p_ramp; RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } + Ref<Texture2D> Environment::get_adjustment_color_correction() const { return adjustment_color_correction; } @@ -352,6 +377,7 @@ void Environment::set_ssr_max_steps(int p_steps) { ssr_max_steps = p_steps; RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } + int Environment::get_ssr_max_steps() const { return ssr_max_steps; } @@ -360,6 +386,7 @@ void Environment::set_ssr_fade_in(float p_fade_in) { ssr_fade_in = p_fade_in; RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } + float Environment::get_ssr_fade_in() const { return ssr_fade_in; } @@ -368,6 +395,7 @@ void Environment::set_ssr_fade_out(float p_fade_out) { ssr_fade_out = p_fade_out; RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } + float Environment::get_ssr_fade_out() const { return ssr_fade_out; } @@ -376,6 +404,7 @@ void Environment::set_ssr_depth_tolerance(float p_depth_tolerance) { ssr_depth_tolerance = p_depth_tolerance; RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance); } + float Environment::get_ssr_depth_tolerance() const { return ssr_depth_tolerance; } @@ -394,6 +423,7 @@ void Environment::set_ssao_radius(float p_radius) { ssao_radius = p_radius; RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } + float Environment::get_ssao_radius() const { return ssao_radius; } @@ -411,6 +441,7 @@ void Environment::set_ssao_bias(float p_bias) { ssao_bias = p_bias; RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } + float Environment::get_ssao_bias() const { return ssao_bias; } @@ -419,6 +450,7 @@ void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) { ssao_direct_light_affect = p_direct_light_affect; RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } + float Environment::get_ssao_direct_light_affect() const { return ssao_direct_light_affect; } @@ -427,6 +459,7 @@ void Environment::set_ssao_ao_channel_affect(float p_ao_channel_affect) { ssao_ao_channel_affect = p_ao_channel_affect; RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } + float Environment::get_ssao_ao_channel_affect() const { return ssao_ao_channel_affect; } @@ -444,6 +477,7 @@ void Environment::set_ssao_blur(SSAOBlur p_blur) { ssao_blur = p_blur; RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } + Environment::SSAOBlur Environment::get_ssao_blur() const { return ssao_blur; } @@ -477,6 +511,7 @@ void Environment::set_glow_level(int p_level, bool p_enabled) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + bool Environment::is_glow_level_enabled(int p_level) const { ERR_FAIL_INDEX_V(p_level, RS::MAX_GLOW_LEVELS, false); @@ -488,6 +523,7 @@ void Environment::set_glow_intensity(float p_intensity) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_intensity() const { return glow_intensity; } @@ -496,6 +532,7 @@ void Environment::set_glow_strength(float p_strength) { glow_strength = p_strength; RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_strength() const { return glow_strength; } @@ -504,6 +541,7 @@ void Environment::set_glow_mix(float p_mix) { glow_mix = p_mix; RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_mix() const { return glow_mix; } @@ -513,6 +551,7 @@ void Environment::set_glow_bloom(float p_threshold) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_bloom() const { return glow_bloom; } @@ -523,6 +562,7 @@ void Environment::set_glow_blend_mode(GlowBlendMode p_mode) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); _change_notify(); } + Environment::GlowBlendMode Environment::get_glow_blend_mode() const { return glow_blend_mode; } @@ -532,6 +572,7 @@ void Environment::set_glow_hdr_bleed_threshold(float p_threshold) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_hdr_bleed_threshold() const { return glow_hdr_bleed_threshold; } @@ -541,6 +582,7 @@ void Environment::set_glow_hdr_luminance_cap(float p_amount) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_hdr_luminance_cap() const { return glow_hdr_luminance_cap; } @@ -550,6 +592,7 @@ void Environment::set_glow_hdr_bleed_scale(float p_scale) { RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap); } + float Environment::get_glow_hdr_bleed_scale() const { return glow_hdr_bleed_scale; } @@ -568,6 +611,7 @@ void Environment::set_fog_color(const Color &p_color) { fog_color = p_color; RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); } + Color Environment::get_fog_color() const { return fog_color; } @@ -576,6 +620,7 @@ void Environment::set_fog_sun_color(const Color &p_color) { fog_sun_color = p_color; RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); } + Color Environment::get_fog_sun_color() const { return fog_sun_color; } @@ -584,6 +629,7 @@ void Environment::set_fog_sun_amount(float p_amount) { fog_sun_amount = p_amount; RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); } + float Environment::get_fog_sun_amount() const { return fog_sun_amount; } @@ -592,6 +638,7 @@ void Environment::set_fog_depth_enabled(bool p_enabled) { fog_depth_enabled = p_enabled; RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } + bool Environment::is_fog_depth_enabled() const { return fog_depth_enabled; } @@ -600,6 +647,7 @@ void Environment::set_fog_depth_begin(float p_distance) { fog_depth_begin = p_distance; RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } + float Environment::get_fog_depth_begin() const { return fog_depth_begin; } @@ -617,6 +665,7 @@ void Environment::set_fog_depth_curve(float p_curve) { fog_depth_curve = p_curve; RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } + float Environment::get_fog_depth_curve() const { return fog_depth_curve; } @@ -625,6 +674,7 @@ void Environment::set_fog_transmit_enabled(bool p_enabled) { fog_transmit_enabled = p_enabled; RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } + bool Environment::is_fog_transmit_enabled() const { return fog_transmit_enabled; } @@ -633,6 +683,7 @@ void Environment::set_fog_transmit_curve(float p_curve) { fog_transmit_curve = p_curve; RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } + float Environment::get_fog_transmit_curve() const { return fog_transmit_curve; } @@ -641,6 +692,7 @@ void Environment::set_fog_height_enabled(bool p_enabled) { fog_height_enabled = p_enabled; RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } + bool Environment::is_fog_height_enabled() const { return fog_height_enabled; } @@ -649,6 +701,7 @@ void Environment::set_fog_height_min(float p_distance) { fog_height_min = p_distance; RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } + float Environment::get_fog_height_min() const { return fog_height_min; } @@ -657,6 +710,7 @@ void Environment::set_fog_height_max(float p_distance) { fog_height_max = p_distance; RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } + float Environment::get_fog_height_max() const { return fog_height_max; } @@ -665,6 +719,7 @@ void Environment::set_fog_height_curve(float p_distance) { fog_height_curve = p_distance; RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } + float Environment::get_fog_height_curve() const { return fog_height_curve; } @@ -1092,6 +1147,7 @@ void CameraEffects::set_dof_blur_far_distance(float p_distance) { dof_blur_far_distance = p_distance; RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } + float CameraEffects::get_dof_blur_far_distance() const { return dof_blur_far_distance; } @@ -1100,6 +1156,7 @@ void CameraEffects::set_dof_blur_far_transition(float p_distance) { dof_blur_far_transition = p_distance; RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } + float CameraEffects::get_dof_blur_far_transition() const { return dof_blur_far_transition; } @@ -1136,6 +1193,7 @@ void CameraEffects::set_dof_blur_amount(float p_amount) { dof_blur_amount = p_amount; RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } + float CameraEffects::get_dof_blur_amount() const { return dof_blur_amount; } |