diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-01-06 00:56:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-01-06 00:56:28 +0300 |
commit | 33ffc996642ad714d181cababbbc1b1aa81f6f50 (patch) | |
tree | 0130934153889ab9aa82367ced2b972ceab16fe1 /source | |
parent | 5e8299bda3f858420280f190dbcfb5845db0a6ae (diff) |
Fix for use of uninitialized variable in shadow caching, could
sometimes give 1 nan pixel.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 18f6b5a15c8..c0ebab1390a 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3502,16 +3502,22 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) /* this is the way used all over to check for shadow */ if(lar->shb || (lar->mode & LA_SHAD_RAY)) { + LampShadowSample *ls; LampShadowSubSample *lss; - int a, b, tot= re->r.threads*re->r.osa; + int a, b; lar->shadsamp= MEM_mallocN(re->r.threads*sizeof(LampShadowSample), "lamp shadow sample"); - lss= lar->shadsamp[0].s; + ls= lar->shadsamp; + /* shadfacs actually mean light, let's put them to 1 to prevent unitialized accidents */ - for(a=0; a<tot; a++, lss++) { - for(b=0; b<4; b++) { + for(a=0; a<re->r.threads; a++, ls++) { + lss= ls->s; + for(b=0; b<re->r.osa; b++, lss++) { lss->samplenr= -1; /* used to detect whether we store or read */ - lss->shadfac[b]= 1.0f; + lss->shadfac[0]= 1.0f; + lss->shadfac[1]= 1.0f; + lss->shadfac[2]= 1.0f; + lss->shadfac[3]= 1.0f; } } } |