| 28 |
|
COLOR acoef; /* division contribution coefficient */ |
| 29 |
|
struct s_ambsamp { |
| 30 |
|
COLOR v; /* hemisphere sample value */ |
| 31 |
< |
float p[3]; /* intersection point */ |
| 31 |
> |
FVECT p; /* intersection point */ |
| 32 |
|
} sa[1]; /* sample array (extends struct) */ |
| 33 |
|
} AMBHEMI; /* ambient sample hemisphere */ |
| 34 |
|
|
| 103 |
|
setcolor(ar.rcoef, AVGREFL, AVGREFL, AVGREFL); |
| 104 |
|
else |
| 105 |
|
copycolor(ar.rcoef, hp->acoef); |
| 106 |
< |
if (rayorigin(&ar, AMBIENT, hp->rp, ar.rcoef) < 0) { |
| 107 |
< |
setcolor(ap->v, 0., 0., 0.); |
| 108 |
< |
VCOPY(ap->p, hp->rp->rop); |
| 109 |
< |
return(NULL); /* no sample taken */ |
| 110 |
< |
} |
| 106 |
> |
if (rayorigin(&ar, AMBIENT, hp->rp, ar.rcoef) < 0) |
| 107 |
> |
goto badsample; |
| 108 |
|
if (ambacc > FTINY) { |
| 109 |
|
multcolor(ar.rcoef, hp->acoef); |
| 110 |
|
scalecolor(ar.rcoef, 1./AVGREFL); |
| 121 |
|
dimlist[ndims++] = i*hp->ns + j + 90171; |
| 122 |
|
rayvalue(&ar); /* evaluate ray */ |
| 123 |
|
ndims--; |
| 124 |
+ |
if (ar.rt > 20.0*maxarad) /* limit vertex distance */ |
| 125 |
+ |
ar.rt = 20.0*maxarad; |
| 126 |
+ |
else if (ar.rt <= FTINY) /* should never happen! */ |
| 127 |
+ |
goto badsample; |
| 128 |
+ |
VSUM(ap->p, ar.rorg, ar.rdir, ar.rt); |
| 129 |
|
multcolor(ar.rcol, ar.rcoef); /* apply coefficient */ |
| 130 |
|
copycolor(ap->v, ar.rcol); |
| 129 |
– |
if (ar.rt > 20.0*maxarad) /* limit vertex distance */ |
| 130 |
– |
VSUM(ap->p, ar.rorg, ar.rdir, 20.0*maxarad); |
| 131 |
– |
else |
| 132 |
– |
VCOPY(ap->p, ar.rop); |
| 131 |
|
return(ap); |
| 132 |
+ |
badsample: |
| 133 |
+ |
setcolor(ap->v, 0., 0., 0.); |
| 134 |
+ |
VCOPY(ap->p, hp->rp->rop); |
| 135 |
+ |
return(NULL); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
|
| 139 |
|
/* Compute vectors and coefficients for Hessian/gradient calcs */ |
| 140 |
|
static void |
| 141 |
< |
comp_fftri(FFTRI *ftp, float ap0[3], float ap1[3], FVECT rop) |
| 141 |
> |
comp_fftri(FFTRI *ftp, FVECT ap0, FVECT ap1, FVECT rop) |
| 142 |
|
{ |
| 143 |
|
FVECT vcp; |
| 144 |
|
double dot_e, dot_er, dot_r, dot_r1, J2; |