diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-07-02 17:44:24 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-07-02 17:44:50 +0300 |
commit | 65bc59a56d0b5c2e012daf84de834fac2909cfc2 (patch) | |
tree | 436440738379ac07a4a4103eba30af9c33f7bf73 /source/blender/blenkernel/intern/particle_distribute.c | |
parent | 57c26453f8aa3ad49a8927f5e299dcab1f2c510b (diff) |
Fix T66340: Missing particles in Grid and Volume distribution.
This solution only alleviates the problem.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_distribute.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_distribute.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 070c3c7a566..96030b7361d 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -232,6 +232,9 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys) /* lets intersect the faces */ for (i = 0; i < totface; i++, mface++) { + ParticleData *pa1 = NULL, *pa2 = NULL; + bool isect1 = false, isect2 = false; + copy_v3_v3(v1, mvert[mface->v1].co); copy_v3_v3(v2, mvert[mface->v2].co); copy_v3_v3(v3, mvert[mface->v3].co); @@ -239,24 +242,37 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys) bool intersects_tri = isect_ray_tri_watertight_v3( co1, &isect_precalc, v1, v2, v3, &lambda, NULL); if (intersects_tri) { - if (from == PART_FROM_FACE) { - (pa + (int)(lambda * size[a]) * a0mul)->flag &= ~PARS_UNEXIST; - } - else { /* store number of intersections */ - (pa + (int)(lambda * size[a]) * a0mul)->hair_index++; - } + pa1 = (pa + (int)(lambda * size[a]) * a0mul); + isect1 = true; } if (mface->v4 && (!intersects_tri || from == PART_FROM_VOLUME)) { copy_v3_v3(v4, mvert[mface->v4].co); if (isect_ray_tri_watertight_v3(co1, &isect_precalc, v1, v3, v4, &lambda, NULL)) { - if (from == PART_FROM_FACE) { - (pa + (int)(lambda * size[a]) * a0mul)->flag &= ~PARS_UNEXIST; - } - else { - (pa + (int)(lambda * size[a]) * a0mul)->hair_index++; - } + pa2 = (pa + (int)(lambda * size[a]) * a0mul); + isect2 = true; + } + } + + if (pa1 == pa2) { + isect1 |= isect2; + } + else if (isect2) { + if (from == PART_FROM_FACE) { + pa2->flag &= ~PARS_UNEXIST; + } + else { /* store number of intersections */ + pa2->hair_index++; + } + } + + if (isect1) { + if (from == PART_FROM_FACE) { + pa1->flag &= ~PARS_UNEXIST; + } + else { /* store number of intersections */ + pa1->hair_index++; } } } |