diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-05-05 01:43:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-05-05 01:43:43 +0400 |
commit | 41ed305cb2117860e5a68ecab706d5868ec7c836 (patch) | |
tree | 2e4c1c2ac6ac03a33b4d0aaef1b440a9cd21a0c9 /source/blender/blenkernel | |
parent | 74f5a0928f1838045741d3c6eb8dcd0f4b6c24cc (diff) |
make a dummy billboard if its velocity or vector are nan/inf
was causing crashes in the raytracer.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 85898d5a2e8..fffbd31aa02 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4292,6 +4292,23 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] xvec[0] = 1.0f; xvec[1] = 0.0f; xvec[2] = 0.0f; yvec[0] = 0.0f; yvec[1] = 1.0f; yvec[2] = 0.0f; + /* can happen with bad pointcache or physics calculation + * since this becomes geometry, nan's and inf's crash raytrace code. + * better not allow this. */ + if( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) || + !finite(bb->vel[0]) || !finite(bb->vel[1]) || !finite(bb->vel[2]) ) + { + zero_v3(bb->vec); + zero_v3(bb->vel); + + zero_v3(xvec); + zero_v3(yvec); + zero_v3(zvec); + zero_v3(center); + + return; + } + if(bb->align < PART_BB_VIEW) onevec[bb->align]=1.0f; |