diff options
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index b0b9372b74c..e66fa86c4b1 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -391,6 +391,7 @@ static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVH // get visibility of a wind ray static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, EffectorData *efd, EffectedPoint *point) { + const int raycast_flag = BVH_RAYCAST_DEFAULT & ~(BVH_RAYCAST_WATERTIGHT); ListBase *colls = colliders; ColliderCache *col; float norm[3], len = 0.0; @@ -422,7 +423,10 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect hit.dist = len + FLT_EPSILON; /* check if the way is blocked */ - if (BLI_bvhtree_ray_cast(collmd->bvhtree, point->loc, norm, 0.0f, &hit, eff_tri_ray_hit, NULL)>=0) { + if (BLI_bvhtree_ray_cast_ex( + collmd->bvhtree, point->loc, norm, 0.0f, &hit, + eff_tri_ray_hit, NULL, raycast_flag) != -1) + { absorption= col->ob->pd->absorption; /* visibility is only between 0 and 1, calculated from 1-absorption */ @@ -506,7 +510,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU if (falloff == 0.0f) break; - madd_v3_v3v3fl(temp, efd->vec_to_point, efd->nor, -fac); + madd_v3_v3v3fl(temp, efd->vec_to_point2, efd->nor, -fac); r_fac= len_v3(temp); falloff*= falloff_func_rad(eff->pd, r_fac); break; @@ -683,10 +687,10 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin } static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step) { - if (eff->pd->shape == PFIELD_SHAPE_POINTS) { - efd->index = p; + *p = 0; + efd->index = p; - *p = 0; + if (eff->pd->shape == PFIELD_SHAPE_POINTS) { *tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1; if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) { @@ -695,9 +699,6 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin } } else if (eff->psys) { - efd->index = p; - - *p = 0; *tot = eff->psys->totpart; if (eff->pd->forcefield == PFIELD_CHARGE) { @@ -723,7 +724,6 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin } } else { - *p = 0; *tot = 1; } } |