diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-05-07 16:18:25 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 16:18:25 -0300 |
commit | 3051bb8a81858b3cbb26f760e572a44a8668c155 (patch) | |
tree | 615fe257952e8fca3a89e0040b094e2498b74586 /scene | |
parent | 6d46f73ec3e3eadaf25927633bdc0aa1eaca93ab (diff) | |
parent | 9c307d4b6c4bf4dc70835e7539158db5922b0d2c (diff) |
Merge pull request #17845 from JFonS/disable_spatial_shadows
Added flag on SpatialMaterial to disable shadows
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/material.cpp | 6 | ||||
-rw-r--r-- | scene/resources/material.h | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index a83ef198fb..1282ce767a 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -387,10 +387,12 @@ void SpatialMaterial::_update_shader() { if (flags[FLAG_USE_VERTEX_LIGHTING]) { code += ",vertex_lighting"; } - if (flags[FLAG_TRIPLANAR_USE_WORLD] && (flags[FLAG_UV1_USE_TRIPLANAR] || flags[FLAG_UV2_USE_TRIPLANAR])) { code += ",world_vertex_coords"; } + if (flags[FLAG_DONT_RECEIVE_SHADOWS]) { + code += ",shadows_disabled"; + } code += ";\n"; code += "uniform vec4 albedo : hint_color;\n"; @@ -1849,6 +1851,7 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_world_triplanar"), "set_flag", "get_flag", FLAG_TRIPLANAR_USE_WORLD); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_albedo_tex_force_srgb"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_FORCE_SRGB); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_do_not_receive_shadows"), "set_flag", "get_flag", FLAG_DONT_RECEIVE_SHADOWS); ADD_GROUP("Vertex Color", "vertex_color"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_use_as_albedo"), "set_flag", "get_flag", FLAG_ALBEDO_FROM_VERTEX_COLOR); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR); @@ -2038,6 +2041,7 @@ void SpatialMaterial::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_USE_ALPHA_SCISSOR); BIND_ENUM_CONSTANT(FLAG_TRIPLANAR_USE_WORLD); BIND_ENUM_CONSTANT(FLAG_ALBEDO_TEXTURE_FORCE_SRGB); + BIND_ENUM_CONSTANT(FLAG_DONT_RECEIVE_SHADOWS); BIND_ENUM_CONSTANT(FLAG_MAX); BIND_ENUM_CONSTANT(DIFFUSE_BURLEY); diff --git a/scene/resources/material.h b/scene/resources/material.h index 2c297cda41..ce733bfb8d 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -188,6 +188,7 @@ public: FLAG_EMISSION_ON_UV2, FLAG_USE_ALPHA_SCISSOR, FLAG_ALBEDO_TEXTURE_FORCE_SRGB, + FLAG_DONT_RECEIVE_SHADOWS, FLAG_MAX }; @@ -236,7 +237,7 @@ private: uint64_t blend_mode : 2; uint64_t depth_draw_mode : 2; uint64_t cull_mode : 2; - uint64_t flags : 14; + uint64_t flags : 15; uint64_t detail_blend_mode : 2; uint64_t diffuse_mode : 3; uint64_t specular_mode : 2; |