diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-15 10:27:29 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-15 10:27:29 +0100 |
commit | 64d7ce2a6e0f6d11fda94ad4d2783e8152ebe660 (patch) | |
tree | f17989d119e9f1b85f31876db18f0f41bbb2bfab /drivers | |
parent | 7ef8583fc58a08d4b058efa0c21421071f6f6b92 (diff) | |
parent | 4abf47f407d45289c4900e3025013f452f563c86 (diff) |
Merge pull request #68628 from clayjohn/shadows
Implement is_animated and casts_shadows
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 10 | ||||
-rw-r--r-- | drivers/gles3/storage/material_storage.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 2d6a793c9e..aaf223df1d 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -3421,6 +3421,8 @@ void SceneShaderData::set_code(const String &p_code) { vertex_input_mask |= uses_bones << 9; vertex_input_mask |= uses_weights << 10; uses_screen_texture_mipmaps = gen_code.uses_screen_texture_mipmaps; + uses_vertex_time = gen_code.uses_vertex_time; + uses_fragment_time = gen_code.uses_fragment_time; #if 0 print_line("**compiling shader:"); @@ -3541,11 +3543,15 @@ bool SceneShaderData::is_parameter_texture(const StringName &p_param) const { } bool SceneShaderData::is_animated() const { - return false; + return (uses_fragment_time && uses_discard) || (uses_vertex_time && uses_vertex); } bool SceneShaderData::casts_shadows() const { - return false; + bool has_read_screen_alpha = uses_screen_texture || uses_depth_texture || uses_normal_texture; + bool has_base_alpha = (uses_alpha && !uses_alpha_clip) || has_read_screen_alpha; + bool has_alpha = has_base_alpha || uses_blend_alpha; + + return !has_alpha || (uses_depth_pre_pass && !(depth_draw == DEPTH_DRAW_DISABLED || depth_test == DEPTH_TEST_DISABLED)); } Variant SceneShaderData::get_default_parameter(const StringName &p_parameter) const { diff --git a/drivers/gles3/storage/material_storage.h b/drivers/gles3/storage/material_storage.h index 24d9a0fee1..9ebfc3097c 100644 --- a/drivers/gles3/storage/material_storage.h +++ b/drivers/gles3/storage/material_storage.h @@ -318,6 +318,8 @@ struct SceneShaderData : public ShaderData { bool uses_depth_texture; bool uses_normal_texture; bool uses_time; + bool uses_vertex_time; + bool uses_fragment_time; bool writes_modelview_or_projection; bool uses_world_coordinates; bool uses_tangent; |