diff options
| author | Juan Linietsky | 2017-06-17 07:32:49 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-06-17 07:32:49 -0300 |
| commit | e11fae0bbf08377cae2a250f3c4766c21dfb22e5 (patch) | |
| tree | 4f58f52156ddf5110fba79175483842881b65e86 /servers/visual/visual_server_scene.cpp | |
| parent | 5fc3a9956eedcc421dd4435c10641f678a73815a (diff) | |
| download | godot-e11fae0bbf08377cae2a250f3c4766c21dfb22e5.tar.gz godot-e11fae0bbf08377cae2a250f3c4766c21dfb22e5.tar.zst godot-e11fae0bbf08377cae2a250f3c4766c21dfb22e5.zip | |
Diffstat (limited to 'servers/visual/visual_server_scene.cpp')
| -rw-r--r-- | servers/visual/visual_server_scene.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 352daa965..6d1f698a5 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -3323,6 +3323,36 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { } else { can_cast_shadows = false; } + } else if (p_instance->base_type == VS::INSTANCE_PARTICLES) { + + bool cast_shadows = false; + + int dp = VSG::storage->particles_get_draw_passes(p_instance->base); + + for (int i = 0; i < dp; i++) { + + RID mesh = VSG::storage->particles_get_draw_pass_mesh(p_instance->base, i); + + int sc = VSG::storage->mesh_get_surface_count(mesh); + for (int j = 0; j < sc; j++) { + + RID mat = VSG::storage->mesh_surface_get_material(mesh, j); + + if (!mat.is_valid()) { + cast_shadows = true; + break; + } + + if (VSG::storage->material_casts_shadows(mat)) { + cast_shadows = true; + break; + } + } + } + + if (!cast_shadows) { + can_cast_shadows = false; + } } } |
