diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-08 03:58:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-08 03:58:15 +0300 |
commit | 47d6166adb7a5100e04c645e7d6284c5c1b95c9d (patch) | |
tree | fc4ba4dc703d5730cc5fcf8dd26dca5b3ccb2d3f /source/blender/editors/space_view3d/drawobject.c | |
parent | 1a8665ac4551913e25138109ad10196c2958b6d3 (diff) |
fix [#25088] Add spot lamp causing crash
this is actually an assert not a crash, when the lamp and view axis were aligned, the quat could not correctly be converted into a matrix.
Now fallback to the X axis in this case.
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8b5b08b8a5a..b28be7bad86 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -789,7 +789,9 @@ static void spotvolume(float *lvec, float *vvec, float inp) cross_v3_v3v3(temp,vvec,lvec); /* equation for a plane through vvec en lvec */ cross_v3_v3v3(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */ - normalize_v3(plane); + /* vectors are exactly aligned, use the X axis, this is arbitrary */ + if(normalize_v3(plane) == 0.0f) + plane[1]= 1.0f; /* now we've got two equations: one of a cone and one of a plane, but we have three unknowns. We remove one unkown by rotating the plane to z=0 (the plane normal) */ |