| 18 |
|
|
| 19 |
|
void |
| 20 |
|
inithemi( /* initialize sampling hemisphere */ |
| 21 |
< |
register AMBHEMI *hp, |
| 21 |
> |
AMBHEMI *hp, |
| 22 |
|
COLOR ac, |
| 23 |
|
RAY *r, |
| 24 |
|
double wt |
| 25 |
|
) |
| 26 |
|
{ |
| 27 |
|
double d; |
| 28 |
< |
register int i; |
| 28 |
> |
int i; |
| 29 |
|
/* set number of divisions */ |
| 30 |
|
if (ambacc <= FTINY && |
| 31 |
|
wt > (d = 0.8*intens(ac)*r->rweight/(ambdiv*minweight))) |
| 58 |
|
|
| 59 |
|
int |
| 60 |
|
divsample( /* sample a division */ |
| 61 |
< |
register AMBSAMP *dp, |
| 61 |
> |
AMBSAMP *dp, |
| 62 |
|
AMBHEMI *h, |
| 63 |
|
RAY *r |
| 64 |
|
) |
| 69 |
|
double xd, yd, zd; |
| 70 |
|
double b2; |
| 71 |
|
double phi; |
| 72 |
< |
register int i; |
| 72 |
> |
int i; |
| 73 |
|
/* ambient coefficient for weight */ |
| 74 |
|
if (ambacc > FTINY) |
| 75 |
|
setcolor(ar.rcoef, AVGREFL, AVGREFL, AVGREFL); |
| 94 |
|
ar.rdir[i] = xd*h->ux[i] + |
| 95 |
|
yd*h->uy[i] + |
| 96 |
|
zd*h->uz[i]; |
| 97 |
+ |
checknorm(ar.rdir); |
| 98 |
|
dimlist[ndims++] = dp->t*h->np + dp->p + 90171; |
| 99 |
|
rayvalue(&ar); |
| 100 |
|
ndims--; |
| 139 |
|
{ |
| 140 |
|
const AMBSAMP *d1 = (const AMBSAMP *)p1; |
| 141 |
|
const AMBSAMP *d2 = (const AMBSAMP *)p2; |
| 142 |
< |
register int c; |
| 142 |
> |
int c; |
| 143 |
|
|
| 144 |
|
if ( (c = d1->t - d2->t) ) |
| 145 |
|
return(c); |
| 149 |
|
|
| 150 |
|
double |
| 151 |
|
doambient( /* compute ambient component */ |
| 152 |
< |
COLOR acol, |
| 152 |
> |
COLOR rcol, |
| 153 |
|
RAY *r, |
| 154 |
|
double wt, |
| 155 |
|
FVECT pg, |
| 160 |
|
AMBHEMI hemi; |
| 161 |
|
AMBSAMP *div; |
| 162 |
|
AMBSAMP dnew; |
| 163 |
< |
register AMBSAMP *dp; |
| 163 |
> |
double acol[3]; |
| 164 |
> |
AMBSAMP *dp; |
| 165 |
|
double arad; |
| 166 |
|
int divcnt; |
| 167 |
< |
register int i, j; |
| 167 |
> |
int i, j; |
| 168 |
|
/* initialize hemisphere */ |
| 169 |
< |
inithemi(&hemi, acol, r, wt); |
| 169 |
> |
inithemi(&hemi, rcol, r, wt); |
| 170 |
|
divcnt = hemi.nt * hemi.np; |
| 171 |
|
/* initialize */ |
| 172 |
|
if (pg != NULL) |
| 173 |
|
pg[0] = pg[1] = pg[2] = 0.0; |
| 174 |
|
if (dg != NULL) |
| 175 |
|
dg[0] = dg[1] = dg[2] = 0.0; |
| 176 |
< |
setcolor(acol, 0.0, 0.0, 0.0); |
| 176 |
> |
setcolor(rcol, 0.0, 0.0, 0.0); |
| 177 |
|
if (divcnt == 0) |
| 178 |
|
return(0.0); |
| 179 |
|
/* allocate super-samples */ |
| 185 |
|
div = NULL; |
| 186 |
|
/* sample the divisions */ |
| 187 |
|
arad = 0.0; |
| 188 |
+ |
acol[0] = acol[1] = acol[2] = 0.0; |
| 189 |
|
if ((dp = div) == NULL) |
| 190 |
|
dp = &dnew; |
| 191 |
|
divcnt = 0; |
| 267 |
|
} |
| 268 |
|
free((void *)div); |
| 269 |
|
} |
| 270 |
+ |
copycolor(rcol, acol); |
| 271 |
|
if (arad <= FTINY) |
| 272 |
|
arad = maxarad; |
| 273 |
|
else |
| 294 |
|
void |
| 295 |
|
comperrs( /* compute initial error estimates */ |
| 296 |
|
AMBSAMP *da, /* assumes standard ordering */ |
| 297 |
< |
register AMBHEMI *hp |
| 297 |
> |
AMBHEMI *hp |
| 298 |
|
) |
| 299 |
|
{ |
| 300 |
|
double b, b2; |
| 301 |
|
int i, j; |
| 302 |
< |
register AMBSAMP *dp; |
| 302 |
> |
AMBSAMP *dp; |
| 303 |
|
/* sum differences from neighbors */ |
| 304 |
|
dp = da; |
| 305 |
|
for (i = 0; i < hp->nt; i++) |
| 347 |
|
posgradient( /* compute position gradient */ |
| 348 |
|
FVECT gv, |
| 349 |
|
AMBSAMP *da, /* assumes standard ordering */ |
| 350 |
< |
register AMBHEMI *hp |
| 350 |
> |
AMBHEMI *hp |
| 351 |
|
) |
| 352 |
|
{ |
| 353 |
< |
register int i, j; |
| 353 |
> |
int i, j; |
| 354 |
|
double nextsine, lastsine, b, d; |
| 355 |
|
double mag0, mag1; |
| 356 |
|
double phi, cosp, sinp, xd, yd; |
| 357 |
< |
register AMBSAMP *dp; |
| 357 |
> |
AMBSAMP *dp; |
| 358 |
|
|
| 359 |
|
xd = yd = 0.0; |
| 360 |
|
for (j = 0; j < hp->np; j++) { |
| 405 |
|
dirgradient( /* compute direction gradient */ |
| 406 |
|
FVECT gv, |
| 407 |
|
AMBSAMP *da, /* assumes standard ordering */ |
| 408 |
< |
register AMBHEMI *hp |
| 408 |
> |
AMBHEMI *hp |
| 409 |
|
) |
| 410 |
|
{ |
| 411 |
< |
register int i, j; |
| 411 |
> |
int i, j; |
| 412 |
|
double mag; |
| 413 |
|
double phi, xd, yd; |
| 414 |
< |
register AMBSAMP *dp; |
| 414 |
> |
AMBSAMP *dp; |
| 415 |
|
|
| 416 |
|
xd = yd = 0.0; |
| 417 |
|
for (j = 0; j < hp->np; j++) { |