diff options
author | Jeroen Bakker <jbakker> | 2020-05-14 13:42:52 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2020-05-14 13:43:14 +0300 |
commit | 80fffba132c58c0c4187b2905f7700f4597aa5c2 (patch) | |
tree | 3b543e62e9b466bc57246a31eadb74808fb9740f /source | |
parent | a88316b4a6e93bdda210ec050928fd2e2eee0d5e (diff) |
Fix T76729: Particle Hair Get Occluded by Overlays
When using an external render engine Blender will still draw an OpenGL
depth buffer for the overlay engine to work correctly. Particle systems
were ignored, what lead to occluded hair and other artifacts.
Reviewed By: Clément Foucault
Differential Revision: https://developer.blender.org/D7730
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/external/external_engine.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index ee4bd58ab80..7dddbd07623 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -25,10 +25,12 @@ #include "DRW_render.h" +#include "DNA_modifier_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" #include "BKE_object.h" +#include "BKE_particle.h" #include "ED_screen.h" @@ -166,6 +168,24 @@ static void external_cache_populate(void *vedata, Object *ob) return; } + if (ob->type == OB_MESH && ob->modifiers.first != NULL) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { + if (md->type != eModifierType_ParticleSystem) { + continue; + } + ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; + if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { + continue; + } + ParticleSettings *part = psys->part; + const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as; + + if (draw_as == PART_DRAW_PATH) { + struct GPUBatch *hairs = DRW_cache_particles_get_hair(ob, psys, NULL); + DRW_shgroup_call(stl->g_data->depth_shgrp, hairs, NULL); + } + } + } struct GPUBatch *geom = DRW_cache_object_surface_get(ob); if (geom) { /* Depth Prepass */ |