diff options
author | Ton Roosendaal <ton@blender.org> | 2004-04-07 22:19:30 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-04-07 22:19:30 +0400 |
commit | c0d1177adea6e595cb6ab5b2de22fa71b53b8aa5 (patch) | |
tree | cca67f78708ac7d187d7054f4cd753b0f34b1aa2 /source/blender/radiosity | |
parent | 9dea66a835df9b5b93f0c4f5130a6e9b9a8e5197 (diff) |
bug fix #1127
Quads in radiositizer got normals calculated using 3 vertices only. this
can go wrong in occasions... and made blender hang.
Used CalcNormFloat4() instead!
Diffstat (limited to 'source/blender/radiosity')
-rw-r--r-- | source/blender/radiosity/intern/source/raddisplay.c | 3 | ||||
-rw-r--r-- | source/blender/radiosity/intern/source/radfactors.c | 17 | ||||
-rw-r--r-- | source/blender/radiosity/intern/source/radpreprocess.c | 11 |
3 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/radiosity/intern/source/raddisplay.c b/source/blender/radiosity/intern/source/raddisplay.c index 8046f07874d..4be1ea7f63b 100644 --- a/source/blender/radiosity/intern/source/raddisplay.c +++ b/source/blender/radiosity/intern/source/raddisplay.c @@ -64,6 +64,8 @@ #include "BIF_space.h" #include "BIF_mywindow.h" +#include "BSE_view.h" + #include "radio.h" /* cpack has to be endian-insensitive! (old irisgl function) */ @@ -217,6 +219,7 @@ void drawpatch_ext(RPatch *patch, unsigned int col) if (sa->spacetype==SPACE_VIEW3D) { /* use mywinget() here: otherwise it draws in header */ if(sa->win != mywinget()) areawinset(sa->win); + persp(PERSP_VIEW); drawnodeWire(patch->first); } sa= sa->next; diff --git a/source/blender/radiosity/intern/source/radfactors.c b/source/blender/radiosity/intern/source/radfactors.c index 5e2812138e2..fb66f994cbc 100644 --- a/source/blender/radiosity/intern/source/radfactors.c +++ b/source/blender/radiosity/intern/source/radfactors.c @@ -312,20 +312,23 @@ int makeformfactors(RPatch *shoot) { RNode **re; float len, vec[3], up[3], side[3], tar[5][3], *fp; - int a, overfl; + int a=0, overfl; if(RG.totelem==0) return 0; - + memset(RG.formfactors, 0, 4*RG.totelem); /* set up hemiview */ /* first: random upvector */ do { + a++; vec[0]= (float)BLI_drand(); vec[1]= (float)BLI_drand(); vec[2]= (float)BLI_drand(); Crossf(up, shoot->norm, vec); len= Normalise(up); + /* this safety for input normals that are zero or illegal sized */ + if(a>3) return 0; } while(len==0.0 || len>1.0); VECCOPY(hemitop.up, up); @@ -372,16 +375,6 @@ int makeformfactors(RPatch *shoot) } if(overfl) { - /* - drawOverflowElem(); - while(get_mbut()&L_MOUSE==0) { - if(get_mbut()&M_MOUSE) { - viewmove(); - drawpatch_ext(shoot,0xFF77FF); - drawOverflowElem(); - } - } - */ if(shoot->first->down1) { splitpatch(shoot); return 0; diff --git a/source/blender/radiosity/intern/source/radpreprocess.c b/source/blender/radiosity/intern/source/radpreprocess.c index 9d418bff153..80c6294db02 100644 --- a/source/blender/radiosity/intern/source/radpreprocess.c +++ b/source/blender/radiosity/intern/source/radpreprocess.c @@ -431,9 +431,14 @@ void rad_collect_meshes() rn->f= RAD_PATCH; /* this node is a Patch */ rn->type= rp->type; - CalcNormFloat(v1, v2, v3, rp->norm); - if(rn->type==4) rp->area= AreaQ3Dfl(v1, v2, v3, v4); - else rp->area= AreaT3Dfl(v1, v2, v3); + if(rn->type==4) { + rp->area= AreaQ3Dfl(v1, v2, v3, v4); + CalcNormFloat4(v1, v2, v3, v4, rp->norm); + } + else { + rp->area= AreaT3Dfl(v1, v2, v3); + CalcNormFloat(v1, v2, v3, rp->norm); + } rn->area= rp->area; |