mirror of
https://github.com/godotengine/godot.git
synced 2024-11-28 23:22:38 +00:00
Added ability for SSAO to affect AO textures too
This commit is contained in:
parent
2dc738ce27
commit
7fc2367508
@ -54,9 +54,13 @@
|
||||
#define _COMMA_10 ,
|
||||
#define _COMMA_11 ,
|
||||
#define _COMMA_12 ,
|
||||
#define _COMMA_13 ,
|
||||
|
||||
// 1-based comma separated list of ITEMs
|
||||
#define COMMA_SEP_LIST(ITEM, LENGTH) _COMMA_SEP_LIST_##LENGTH(ITEM)
|
||||
#define _COMMA_SEP_LIST_13(ITEM) \
|
||||
_COMMA_SEP_LIST_12(ITEM) \
|
||||
, ITEM(13)
|
||||
#define _COMMA_SEP_LIST_12(ITEM) \
|
||||
_COMMA_SEP_LIST_11(ITEM) \
|
||||
, ITEM(12)
|
||||
@ -97,6 +101,9 @@
|
||||
|
||||
// 1-based semicolon separated list of ITEMs
|
||||
#define SEMIC_SEP_LIST(ITEM, LENGTH) _SEMIC_SEP_LIST_##LENGTH(ITEM)
|
||||
#define _SEMIC_SEP_LIST_13(ITEM) \
|
||||
_SEMIC_SEP_LIST_12(ITEM); \
|
||||
ITEM(13)
|
||||
#define _SEMIC_SEP_LIST_12(ITEM) \
|
||||
_SEMIC_SEP_LIST_11(ITEM); \
|
||||
ITEM(12)
|
||||
@ -137,6 +144,9 @@
|
||||
|
||||
// 1-based space separated list of ITEMs
|
||||
#define SPACE_SEP_LIST(ITEM, LENGTH) _SPACE_SEP_LIST_##LENGTH(ITEM)
|
||||
#define _SPACE_SEP_LIST_13(ITEM) \
|
||||
_SPACE_SEP_LIST_12(ITEM) \
|
||||
ITEM(13)
|
||||
#define _SPACE_SEP_LIST_12(ITEM) \
|
||||
_SPACE_SEP_LIST_11(ITEM) \
|
||||
ITEM(12)
|
||||
@ -262,7 +272,7 @@
|
||||
ss->sem->wait(); \
|
||||
}
|
||||
|
||||
#define MAX_CMD_PARAMS 12
|
||||
#define MAX_CMD_PARAMS 13
|
||||
|
||||
class CommandQueueMT {
|
||||
|
||||
@ -290,15 +300,15 @@ class CommandQueueMT {
|
||||
};
|
||||
|
||||
DECL_CMD(0)
|
||||
SPACE_SEP_LIST(DECL_CMD, 12)
|
||||
SPACE_SEP_LIST(DECL_CMD, 13)
|
||||
|
||||
/* comands that return */
|
||||
DECL_CMD_RET(0)
|
||||
SPACE_SEP_LIST(DECL_CMD_RET, 12)
|
||||
SPACE_SEP_LIST(DECL_CMD_RET, 13)
|
||||
|
||||
/* commands that don't return but sync */
|
||||
DECL_CMD_SYNC(0)
|
||||
SPACE_SEP_LIST(DECL_CMD_SYNC, 12)
|
||||
SPACE_SEP_LIST(DECL_CMD_SYNC, 13)
|
||||
|
||||
/***** BASE *******/
|
||||
|
||||
@ -432,15 +442,15 @@ class CommandQueueMT {
|
||||
public:
|
||||
/* NORMAL PUSH COMMANDS */
|
||||
DECL_PUSH(0)
|
||||
SPACE_SEP_LIST(DECL_PUSH, 12)
|
||||
SPACE_SEP_LIST(DECL_PUSH, 13)
|
||||
|
||||
/* PUSH AND RET COMMANDS */
|
||||
DECL_PUSH_AND_RET(0)
|
||||
SPACE_SEP_LIST(DECL_PUSH_AND_RET, 12)
|
||||
SPACE_SEP_LIST(DECL_PUSH_AND_RET, 13)
|
||||
|
||||
/* PUSH AND RET SYNC COMMANDS*/
|
||||
DECL_PUSH_AND_SYNC(0)
|
||||
SPACE_SEP_LIST(DECL_PUSH_AND_SYNC, 12)
|
||||
SPACE_SEP_LIST(DECL_PUSH_AND_SYNC, 13)
|
||||
|
||||
void wait_and_flush_one() {
|
||||
ERR_FAIL_COND(!sync);
|
||||
|
@ -144,7 +144,7 @@ void RasterizerSceneGLES2::environment_set_fog(RID p_env, bool p_enable, float p
|
||||
void RasterizerSceneGLES2::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) {
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect,float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, VS::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) {
|
||||
|
@ -212,7 +212,7 @@ public:
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect,float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, VS::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);
|
||||
|
||||
|
@ -896,7 +896,7 @@ void RasterizerSceneGLES3::environment_set_ssr(RID p_env, bool p_enable, int p_m
|
||||
env->ssr_roughness = p_roughness;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
@ -908,6 +908,7 @@ void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float
|
||||
env->ssao_intensity2 = p_intensity2;
|
||||
env->ssao_bias = p_bias;
|
||||
env->ssao_light_affect = p_light_affect;
|
||||
env->ssao_ao_channel_affect = p_ao_channel_affect;
|
||||
env->ssao_color = p_color;
|
||||
env->ssao_filter = p_blur;
|
||||
env->ssao_quality = p_quality;
|
||||
@ -2507,6 +2508,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
|
||||
|
||||
state.env_radiance_data.ambient_contribution = env->ambient_sky_contribution;
|
||||
state.ubo_data.ambient_occlusion_affect_light = env->ssao_light_affect;
|
||||
state.ubo_data.ambient_occlusion_affect_ssao = env->ssao_ao_channel_affect;
|
||||
|
||||
//fog
|
||||
|
||||
|
@ -140,6 +140,7 @@ public:
|
||||
float reflection_multiplier;
|
||||
float subsurface_scatter_width;
|
||||
float ambient_occlusion_affect_light;
|
||||
float ambient_occlusion_affect_ssao;
|
||||
|
||||
uint32_t fog_depth_enabled;
|
||||
float fog_depth_begin;
|
||||
@ -151,6 +152,7 @@ public:
|
||||
float fog_height_max;
|
||||
float fog_height_curve;
|
||||
// make sure this struct is padded to be a multiple of 16 bytes for webgl
|
||||
float pad[3];
|
||||
|
||||
} ubo_data;
|
||||
|
||||
@ -385,6 +387,7 @@ public:
|
||||
float ssao_radius2;
|
||||
float ssao_bias;
|
||||
float ssao_light_affect;
|
||||
float ssao_ao_channel_affect;
|
||||
Color ssao_color;
|
||||
VS::EnvironmentSSAOQuality ssao_quality;
|
||||
float ssao_bilateral_sharpness;
|
||||
@ -465,6 +468,7 @@ public:
|
||||
ssao_radius2 = 0.0;
|
||||
ssao_bias = 0.01;
|
||||
ssao_light_affect = 0;
|
||||
ssao_ao_channel_affect = 0;
|
||||
ssao_filter = VS::ENV_SSAO_BLUR_3x3;
|
||||
ssao_quality = VS::ENV_SSAO_QUALITY_LOW;
|
||||
ssao_bilateral_sharpness = 4;
|
||||
@ -543,7 +547,7 @@ public:
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, VS::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);
|
||||
|
||||
|
@ -90,6 +90,7 @@ layout(std140) uniform SceneData { //ubo:0
|
||||
mediump float reflection_multiplier;
|
||||
mediump float subsurface_scatter_width;
|
||||
mediump float ambient_occlusion_affect_light;
|
||||
mediump float ambient_occlusion_affect_ao_channel;
|
||||
|
||||
bool fog_depth_enabled;
|
||||
highp float fog_depth_begin;
|
||||
@ -670,6 +671,7 @@ layout(std140) uniform SceneData {
|
||||
mediump float reflection_multiplier;
|
||||
mediump float subsurface_scatter_width;
|
||||
mediump float ambient_occlusion_affect_light;
|
||||
mediump float ambient_occlusion_affect_ao_channel;
|
||||
|
||||
bool fog_depth_enabled;
|
||||
highp float fog_depth_begin;
|
||||
@ -2128,18 +2130,16 @@ FRAGMENT_SHADER_CODE
|
||||
|
||||
#else
|
||||
|
||||
#if defined(ENABLE_AO)
|
||||
|
||||
float ambient_scale=0.0; // AO is supplied by material
|
||||
#else
|
||||
//approximate ambient scale for SSAO, since we will lack full ambient
|
||||
float max_emission=max(emission.r,max(emission.g,emission.b));
|
||||
float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b));
|
||||
float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b));
|
||||
float total_ambient = max_ambient+max_diffuse+max_emission;
|
||||
float ambient_scale = (total_ambient>0.0) ? (max_ambient+ambient_occlusion_affect_light*max_diffuse)/total_ambient : 0.0;
|
||||
#endif //ENABLE_AO
|
||||
|
||||
#if defined(ENABLE_AO)
|
||||
ambient_scale=mix(0.0,ambient_scale,ambient_occlusion_affect_ao_channel);
|
||||
#endif
|
||||
diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale);
|
||||
specular_buffer=vec4(specular_light,metallic);
|
||||
|
||||
|
@ -378,7 +378,7 @@ bool Environment::is_ssr_rough() const {
|
||||
void Environment::set_ssao_enabled(bool p_enable) {
|
||||
|
||||
ssao_enabled = p_enable;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
_change_notify();
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ bool Environment::is_ssao_enabled() const {
|
||||
void Environment::set_ssao_radius(float p_radius) {
|
||||
|
||||
ssao_radius = p_radius;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
float Environment::get_ssao_radius() const {
|
||||
|
||||
@ -400,7 +400,7 @@ float Environment::get_ssao_radius() const {
|
||||
void Environment::set_ssao_intensity(float p_intensity) {
|
||||
|
||||
ssao_intensity = p_intensity;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
|
||||
float Environment::get_ssao_intensity() const {
|
||||
@ -411,7 +411,7 @@ float Environment::get_ssao_intensity() const {
|
||||
void Environment::set_ssao_radius2(float p_radius) {
|
||||
|
||||
ssao_radius2 = p_radius;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
float Environment::get_ssao_radius2() const {
|
||||
|
||||
@ -421,7 +421,7 @@ float Environment::get_ssao_radius2() const {
|
||||
void Environment::set_ssao_intensity2(float p_intensity) {
|
||||
|
||||
ssao_intensity2 = p_intensity;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
float Environment::get_ssao_intensity2() const {
|
||||
|
||||
@ -431,7 +431,7 @@ float Environment::get_ssao_intensity2() const {
|
||||
void Environment::set_ssao_bias(float p_bias) {
|
||||
|
||||
ssao_bias = p_bias;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
float Environment::get_ssao_bias() const {
|
||||
|
||||
@ -441,17 +441,27 @@ float Environment::get_ssao_bias() const {
|
||||
void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) {
|
||||
|
||||
ssao_direct_light_affect = p_direct_light_affect;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
float Environment::get_ssao_direct_light_affect() const {
|
||||
|
||||
return ssao_direct_light_affect;
|
||||
}
|
||||
|
||||
void Environment::set_ssao_ao_channel_affect(float p_ao_channel_affect) {
|
||||
|
||||
ssao_ao_channel_affect = p_ao_channel_affect;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
float Environment::get_ssao_ao_channel_affect() const {
|
||||
|
||||
return ssao_ao_channel_affect;
|
||||
}
|
||||
|
||||
void Environment::set_ssao_color(const Color &p_color) {
|
||||
|
||||
ssao_color = p_color;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
|
||||
Color Environment::get_ssao_color() const {
|
||||
@ -462,7 +472,7 @@ Color Environment::get_ssao_color() const {
|
||||
void Environment::set_ssao_blur(SSAOBlur p_blur) {
|
||||
|
||||
ssao_blur = p_blur;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
Environment::SSAOBlur Environment::get_ssao_blur() const {
|
||||
|
||||
@ -472,7 +482,7 @@ Environment::SSAOBlur Environment::get_ssao_blur() const {
|
||||
void Environment::set_ssao_quality(SSAOQuality p_quality) {
|
||||
|
||||
ssao_quality = p_quality;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
|
||||
Environment::SSAOQuality Environment::get_ssao_quality() const {
|
||||
@ -483,7 +493,7 @@ Environment::SSAOQuality Environment::get_ssao_quality() const {
|
||||
void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) {
|
||||
|
||||
ssao_edge_sharpness = p_edge_sharpness;
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
|
||||
}
|
||||
|
||||
float Environment::get_ssao_edge_sharpness() const {
|
||||
@ -1008,6 +1018,9 @@ void Environment::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_ssao_direct_light_affect", "amount"), &Environment::set_ssao_direct_light_affect);
|
||||
ClassDB::bind_method(D_METHOD("get_ssao_direct_light_affect"), &Environment::get_ssao_direct_light_affect);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ssao_ao_channel_affect", "amount"), &Environment::set_ssao_ao_channel_affect);
|
||||
ClassDB::bind_method(D_METHOD("get_ssao_ao_channel_affect"), &Environment::get_ssao_ao_channel_affect);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ssao_color", "color"), &Environment::set_ssao_color);
|
||||
ClassDB::bind_method(D_METHOD("get_ssao_color"), &Environment::get_ssao_color);
|
||||
|
||||
@ -1028,6 +1041,7 @@ void Environment::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity2", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_intensity2", "get_ssao_intensity2");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_ao_channel_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_ao_channel_affect", "get_ssao_ao_channel_affect");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ssao_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ssao_color", "get_ssao_color");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_ssao_quality", "get_ssao_quality");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_blur", PROPERTY_HINT_ENUM, "Disabled,1x1,2x2,3x3"), "set_ssao_blur", "get_ssao_blur");
|
||||
@ -1220,6 +1234,7 @@ Environment::Environment() {
|
||||
ssao_intensity2 = 1;
|
||||
ssao_bias = 0.01;
|
||||
ssao_direct_light_affect = 0.0;
|
||||
ssao_ao_channel_affect = 0.0;
|
||||
ssao_blur = SSAO_BLUR_3x3;
|
||||
set_ssao_edge_sharpness(4);
|
||||
set_ssao_quality(SSAO_QUALITY_LOW);
|
||||
|
@ -127,6 +127,7 @@ private:
|
||||
float ssao_intensity2;
|
||||
float ssao_bias;
|
||||
float ssao_direct_light_affect;
|
||||
float ssao_ao_channel_affect;
|
||||
Color ssao_color;
|
||||
SSAOBlur ssao_blur;
|
||||
float ssao_edge_sharpness;
|
||||
@ -274,6 +275,9 @@ public:
|
||||
void set_ssao_direct_light_affect(float p_direct_light_affect);
|
||||
float get_ssao_direct_light_affect() const;
|
||||
|
||||
void set_ssao_ao_channel_affect(float p_ao_channel_affect);
|
||||
float get_ssao_ao_channel_affect() const;
|
||||
|
||||
void set_ssao_color(const Color &p_color);
|
||||
Color get_ssao_color() const;
|
||||
|
||||
|
@ -810,3 +810,12 @@
|
||||
server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define FUNC13(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13) \
|
||||
virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13) { \
|
||||
if (Thread::get_caller_id() != server_thread) { \
|
||||
command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
|
||||
} else { \
|
||||
server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
|
||||
} \
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0;
|
||||
|
||||
virtual 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 p_roughness) = 0;
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, VS::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) = 0;
|
||||
|
||||
|
@ -139,6 +139,8 @@ public:
|
||||
void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); }
|
||||
#define BIND12(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
|
||||
void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); }
|
||||
#define BIND13(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12, m_type13) \
|
||||
void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12, m_type13 arg13) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); }
|
||||
|
||||
//from now on, calls forwarded to this singleton
|
||||
#define BINDBASE VSG::storage
|
||||
@ -489,7 +491,7 @@ public:
|
||||
BIND2(environment_set_canvas_max_layer, RID, int)
|
||||
BIND4(environment_set_ambient_light, RID, const Color &, float, float)
|
||||
BIND7(environment_set_ssr, RID, bool, int, float, float, float, bool)
|
||||
BIND12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
|
||||
BIND13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
|
||||
|
||||
BIND6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
|
||||
BIND6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
|
||||
|
@ -416,7 +416,7 @@ public:
|
||||
FUNC2(environment_set_canvas_max_layer, RID, int)
|
||||
FUNC4(environment_set_ambient_light, RID, const Color &, float, float)
|
||||
FUNC7(environment_set_ssr, RID, bool, int, float, float, float, bool)
|
||||
FUNC12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
|
||||
FUNC13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
|
||||
|
||||
FUNC6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
|
||||
FUNC6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
|
||||
|
@ -719,7 +719,7 @@ public:
|
||||
ENV_SSAO_BLUR_3x3,
|
||||
};
|
||||
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
|
||||
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0;
|
||||
virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user