Quads in radiositizer got normals calculated using 3 vertices only. this
can go wrong in occasions... and made blender hang.
Used CalcNormFloat4() instead!
This commit is contained in:
Ton Roosendaal 2004-04-07 18:19:30 +00:00
parent 9dea66a835
commit c0d1177ade
3 changed files with 16 additions and 15 deletions

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

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

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