diff options
author | Luca Rood <dev@lucarood.com> | 2016-12-03 19:05:56 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2016-12-04 23:01:46 +0300 |
commit | b18f83bcf404fee98713fd2eba82570efb53f13e (patch) | |
tree | 90b152a0be0394f38f4413f149682c5bff18725d /source/blender/blenkernel/intern/effect.c | |
parent | dfca1e14605f4318c8e20acead4a06c38d3d435b (diff) |
Fix T50141: Nabla zero division on texture force field
This sets forces to zero, when Nabla is zero and a grayscale texture is
used or texture mode is Gradient or Curl.
Nabla equal to zero was causing a zero division, and forces ended up
being set to `nan`.
Reviewed By: mont29
Differential Revision: http://developer.blender.org/D2393
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 7e6897a2858..3e85b0d4a15 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -770,7 +770,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP force[1] = (0.5f - result->tg) * strength; force[2] = (0.5f - result->tb) * strength; } - else { + else if (nabla != 0) { strength/=nabla; tex_co[0] += nabla; @@ -810,6 +810,9 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP force[2] = (dgdx - drdy) * strength; } } + else { + zero_v3(force); + } if (eff->pd->flag & PFIELD_TEX_2D) { float fac = -dot_v3v3(force, efd->nor); |