make a dummy billboard if its velocity or vector are nan/inf

was causing crashes in the raytracer.
This commit is contained in:
Campbell Barton
2010-05-04 21:43:43 +00:00
parent 74f5a0928f
commit 41ed305cb2

View File

@@ -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;