diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-19 13:54:25 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-19 13:54:25 +0400 |
commit | 256348eb6b56ef77c124080dcc14203c77901fe2 (patch) | |
tree | 310869d4c0e10c0d31f39b618fb004d8f70edc5d /source | |
parent | 73d0c673e8df02dc14457215eb46bd5e1468450f (diff) |
Fix #19657: crash when cancelling volume material render, raytree
is invalid if it cancels during build, so don't use it then.
Also fixes some use of unitialized variables in raytracing code.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/rayshade.c | 20 | ||||
-rw-r--r-- | source/blender/render/intern/source/volumetric.c | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 4ad4d6370f8..7043837166a 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -242,7 +242,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi) assert( faces > 0 ); //Create Ray cast accelaration structure - raytree = obr->raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces ); + raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces ); if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) ) vlakprimitive = obr->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "ObjectRen primitives"); else @@ -269,13 +269,20 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi) } } RE_rayobject_done( raytree ); - } + /* in case of cancel during build, raytree is not usable */ + if(test_break(re)) + RE_rayobject_free(raytree); + else + obr->raytree= raytree; + } - if((obi->flag & R_TRANSFORMED) && obi->raytree == NULL) - { - obi->transform_primitives = 0; - obi->raytree = RE_rayobject_instance_create( obr->raytree, obi->mat, obi, obi->obr->rayobi ); + if(obr->raytree) { + if((obi->flag & R_TRANSFORMED) && obi->raytree == NULL) + { + obi->transform_primitives = 0; + obi->raytree = RE_rayobject_instance_create( obr->raytree, obi->mat, obi, obi->obr->rayobi ); + } } if(obi->raytree) return obi->raytree; @@ -439,6 +446,7 @@ void makeraytree(Render *re) { //Calculate raytree max_size //This is ONLY needed to kept a bogus behaviour of SUN and HEMI lights + INIT_MINMAX(min, max); RE_rayobject_merge_bb( re->raytree, min, max ); for(i=0; i<3; i++) { diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 7cb165ccaea..cf4b6b4002f 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -78,7 +78,6 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co) float visibility = 1.f; if(lar->shb) { - float dot=1.f; float dxco[3]={0.f, 0.f, 0.f}, dyco[3]={0.f, 0.f, 0.f}; visibility = testshadowbuf(&R, lar->shb, co, dxco, dyco, 1.0, 0.0); @@ -139,7 +138,8 @@ static int vol_get_bounds(ShadeInput *shi, float *co, float *vec, float *hitco, isect->skip = RE_SKIP_VLR_NEIGHBOUR; isect->orig.face = (void*)shi->vlr; isect->orig.ob = (void*)shi->obi; - } else if (intersect_type == VOL_BOUNDS_SS) { + } else { // if (intersect_type == VOL_BOUNDS_SS) { + isect->skip= 0; isect->orig.face= NULL; isect->orig.ob = NULL; } |