diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/environment.cpp | 68 | ||||
-rw-r--r-- | scene/resources/environment.h | 29 | ||||
-rw-r--r-- | scene/resources/material.cpp | 8 | ||||
-rw-r--r-- | scene/resources/material.h | 2 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 7 |
5 files changed, 87 insertions, 27 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 4c6fa7c8a1..910a2ad2fd 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -377,7 +377,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, ssao_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); _change_notify(); } @@ -389,7 +389,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, ssao_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); } float Environment::get_ssao_radius() const { @@ -399,7 +399,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, ssao_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); } float Environment::get_ssao_intensity() const { @@ -410,7 +410,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, ssao_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); } float Environment::get_ssao_radius2() const { @@ -420,7 +420,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, ssao_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); } float Environment::get_ssao_intensity2() const { @@ -430,7 +430,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, ssao_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); } float Environment::get_ssao_bias() const { @@ -440,7 +440,7 @@ 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, ssao_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); } float Environment::get_ssao_direct_light_affect() const { @@ -450,7 +450,7 @@ float Environment::get_ssao_direct_light_affect() const { 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, ssao_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); } Color Environment::get_ssao_color() const { @@ -458,16 +458,38 @@ Color Environment::get_ssao_color() const { return ssao_color; } -void Environment::set_ssao_blur(bool p_enable) { +void Environment::set_ssao_blur(SSAOBlur p_blur) { - ssao_blur = 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, ssao_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); } -bool Environment::is_ssao_blur_enabled() const { +Environment::SSAOBlur Environment::get_ssao_blur() const { return ssao_blur; } +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); +} + +Environment::SSAOQuality Environment::get_ssao_quality() const { + + return ssao_quality; +} + +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); +} + +float Environment::get_ssao_edge_sharpness() const { + + return ssao_edge_sharpness; +} + void Environment::set_glow_enabled(bool p_enabled) { glow_enabled = p_enabled; @@ -988,8 +1010,14 @@ void Environment::_bind_methods() { 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); - ClassDB::bind_method(D_METHOD("set_ssao_blur", "enabled"), &Environment::set_ssao_blur); - ClassDB::bind_method(D_METHOD("is_ssao_blur_enabled"), &Environment::is_ssao_blur_enabled); + ClassDB::bind_method(D_METHOD("set_ssao_blur", "mode"), &Environment::set_ssao_blur); + ClassDB::bind_method(D_METHOD("get_ssao_blur"), &Environment::get_ssao_blur); + + ClassDB::bind_method(D_METHOD("set_ssao_quality", "quality"), &Environment::set_ssao_quality); + ClassDB::bind_method(D_METHOD("get_ssao_quality"), &Environment::get_ssao_quality); + + ClassDB::bind_method(D_METHOD("set_ssao_edge_sharpness", "edge_sharpness"), &Environment::set_ssao_edge_sharpness); + ClassDB::bind_method(D_METHOD("get_ssao_edge_sharpness"), &Environment::get_ssao_edge_sharpness); ADD_GROUP("SSAO", "ssao_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_enabled"), "set_ssao_enabled", "is_ssao_enabled"); @@ -1000,7 +1028,9 @@ void Environment::_bind_methods() { 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::COLOR, "ssao_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ssao_color", "get_ssao_color"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_blur"), "set_ssao_blur", "is_ssao_blur_enabled"); + 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"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_edge_sharpness", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_ssao_edge_sharpness", "get_ssao_edge_sharpness"); ClassDB::bind_method(D_METHOD("set_dof_blur_far_enabled", "enabled"), &Environment::set_dof_blur_far_enabled); ClassDB::bind_method(D_METHOD("is_dof_blur_far_enabled"), &Environment::is_dof_blur_far_enabled); @@ -1134,6 +1164,10 @@ void Environment::_bind_methods() { BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_LOW); BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_MEDIUM); BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_HIGH); + + BIND_ENUM_CONSTANT(SSAO_QUALITY_LOW); + BIND_ENUM_CONSTANT(SSAO_QUALITY_MEDIUM); + BIND_ENUM_CONSTANT(SSAO_QUALITY_HIGH); } Environment::Environment() { @@ -1179,7 +1213,9 @@ Environment::Environment() { ssao_intensity2 = 1; ssao_bias = 0.01; ssao_direct_light_affect = false; - ssao_blur = true; + ssao_blur = SSAO_BLUR_3x3; + set_ssao_edge_sharpness(4); + set_ssao_quality(SSAO_QUALITY_LOW); glow_enabled = false; glow_levels = (1 << 2) | (1 << 4); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 5909846074..418949a6ad 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -71,6 +71,19 @@ public: DOF_BLUR_QUALITY_HIGH, }; + enum SSAOBlur { + SSAO_BLUR_DISABLED, + SSAO_BLUR_1x1, + SSAO_BLUR_2x2, + SSAO_BLUR_3x3 + }; + + enum SSAOQuality { + SSAO_QUALITY_LOW, + SSAO_QUALITY_MEDIUM, + SSAO_QUALITY_HIGH + }; + private: RID environment; @@ -114,7 +127,9 @@ private: float ssao_bias; float ssao_direct_light_affect; Color ssao_color; - bool ssao_blur; + SSAOBlur ssao_blur; + float ssao_edge_sharpness; + SSAOQuality ssao_quality; bool glow_enabled; int glow_levels; @@ -261,8 +276,14 @@ public: void set_ssao_color(const Color &p_color); Color get_ssao_color() const; - void set_ssao_blur(bool p_enable); - bool is_ssao_blur_enabled() const; + void set_ssao_blur(SSAOBlur p_blur); + SSAOBlur get_ssao_blur() const; + + void set_ssao_quality(SSAOQuality p_quality); + SSAOQuality get_ssao_quality() const; + + void set_ssao_edge_sharpness(float p_edge_sharpness); + float get_ssao_edge_sharpness() const; void set_glow_enabled(bool p_enabled); bool is_glow_enabled() const; @@ -370,5 +391,7 @@ VARIANT_ENUM_CAST(Environment::BGMode) VARIANT_ENUM_CAST(Environment::ToneMapper) VARIANT_ENUM_CAST(Environment::GlowBlendMode) VARIANT_ENUM_CAST(Environment::DOFBlurQuality) +VARIANT_ENUM_CAST(Environment::SSAOQuality) +VARIANT_ENUM_CAST(Environment::SSAOBlur) #endif // ENVIRONMENT_H diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 898a594498..b22a019319 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -377,7 +377,7 @@ void SpatialMaterial::_update_shader() { case DIFFUSE_TOON: code += ",diffuse_toon"; break; } switch (specular_mode) { - case SPECULAR_SCHLICK_GGX: code += ",specular_schlick_ggx"; break; + case SPECULAR_GGX: code += ",specular_ggx"; break; case SPECULAR_BLINN: code += ",specular_blinn"; break; case SPECULAR_PHONG: code += ",specular_phong"; break; case SPECULAR_TOON: code += ",specular_toon"; break; @@ -1819,7 +1819,7 @@ void SpatialMaterial::_bind_methods() { ADD_GROUP("Parameters", "params_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Burley,Lambert,Lambert Wrap,Oren Nayar,Toon"), "set_diffuse_mode", "get_diffuse_mode"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "SchlickGGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "GGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_depth_draw_mode", PROPERTY_HINT_ENUM, "Opaque Only,Always,Never,Opaque Pre-Pass"), "set_depth_draw_mode", "get_depth_draw_mode"); @@ -2006,7 +2006,7 @@ void SpatialMaterial::_bind_methods() { BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR); BIND_ENUM_CONSTANT(DIFFUSE_TOON); - BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX); + BIND_ENUM_CONSTANT(SPECULAR_GGX); BIND_ENUM_CONSTANT(SPECULAR_BLINN); BIND_ENUM_CONSTANT(SPECULAR_PHONG); BIND_ENUM_CONSTANT(SPECULAR_TOON); @@ -2087,7 +2087,7 @@ SpatialMaterial::SpatialMaterial() flags[i] = 0; } diffuse_mode = DIFFUSE_LAMBERT; - specular_mode = SPECULAR_SCHLICK_GGX; + specular_mode = SPECULAR_GGX; for (int i = 0; i < FEATURE_MAX; i++) { features[i] = false; diff --git a/scene/resources/material.h b/scene/resources/material.h index 2425f1a174..942fb42363 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -193,7 +193,7 @@ public: }; enum SpecularMode { - SPECULAR_SCHLICK_GGX, + SPECULAR_GGX, SPECULAR_BLINN, SPECULAR_PHONG, SPECULAR_TOON, diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index c202fad1a4..467f059fd3 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -78,11 +78,11 @@ void Texture::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_MIPMAPS); BIND_ENUM_CONSTANT(FLAG_REPEAT); BIND_ENUM_CONSTANT(FLAG_FILTER); - BIND_ENUM_CONSTANT(FLAG_VIDEO_SURFACE); BIND_ENUM_CONSTANT(FLAGS_DEFAULT); BIND_ENUM_CONSTANT(FLAG_ANISOTROPIC_FILTER); BIND_ENUM_CONSTANT(FLAG_CONVERT_TO_LINEAR); BIND_ENUM_CONSTANT(FLAG_MIRRORED_REPEAT); + BIND_ENUM_CONSTANT(FLAG_VIDEO_SURFACE); } Texture::Texture() { @@ -1324,10 +1324,8 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("get_width"), &CubeMap::get_width); ClassDB::bind_method(D_METHOD("get_height"), &CubeMap::get_height); - //ClassDB::bind_method(D_METHOD("get_rid"),&CubeMap::get_rid); ClassDB::bind_method(D_METHOD("set_flags", "flags"), &CubeMap::set_flags); ClassDB::bind_method(D_METHOD("get_flags"), &CubeMap::get_flags); - ClassDB::bind_method(D_METHOD("set_side", "side", "image"), &CubeMap::set_side); ClassDB::bind_method(D_METHOD("get_side", "side"), &CubeMap::get_side); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &CubeMap::set_storage); @@ -1335,6 +1333,9 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &CubeMap::set_lossy_storage_quality); ClassDB::bind_method(D_METHOD("get_lossy_storage_quality"), &CubeMap::get_lossy_storage_quality); + ADD_PROPERTY(PropertyInfo(Variant::INT, "storage_mode", PROPERTY_HINT_ENUM, "Raw,Lossy Compressed,Lossless Compressed"), "set_storage", "get_storage"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "lossy_storage_quality"), "set_lossy_storage_quality", "get_lossy_storage_quality"); + BIND_ENUM_CONSTANT(STORAGE_RAW); BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSY); BIND_ENUM_CONSTANT(STORAGE_COMPRESS_LOSSLESS); |