232 |
|
) |
233 |
|
{ |
234 |
|
static int hitlimit = 0; |
235 |
< |
register OBJREC *o; |
236 |
< |
register char **amblp; |
235 |
> |
OBJREC *o; |
236 |
> |
char **amblp; |
237 |
|
|
238 |
|
if (obj == OVOID) { /* starting over */ |
239 |
|
ambset[0] = 0; |
259 |
|
extern void |
260 |
|
multambient( /* compute ambient component & multiply by coef. */ |
261 |
|
COLOR aval, |
262 |
< |
register RAY *r, |
262 |
> |
RAY *r, |
263 |
|
FVECT nrm |
264 |
|
) |
265 |
|
{ |
329 |
|
extern double |
330 |
|
sumambient( /* get interpolated ambient value */ |
331 |
|
COLOR acol, |
332 |
< |
register RAY *r, |
332 |
> |
RAY *r, |
333 |
|
FVECT rn, |
334 |
|
int al, |
335 |
|
AMBTREE *at, |
341 |
|
COLOR ct; |
342 |
|
FVECT ck0; |
343 |
|
int i; |
344 |
< |
register int j; |
345 |
< |
register AMBVAL *av; |
344 |
> |
int j; |
345 |
> |
AMBVAL *av; |
346 |
|
|
347 |
|
wsum = 0.0; |
348 |
|
/* do this node */ |
360 |
|
/* |
361 |
|
* Ambient radius test. |
362 |
|
*/ |
363 |
< |
d = av->pos[0] - r->rop[0]; |
364 |
< |
e1 = d * d; |
365 |
< |
d = av->pos[1] - r->rop[1]; |
366 |
< |
e1 += d * d; |
367 |
< |
d = av->pos[2] - r->rop[2]; |
368 |
< |
e1 += d * d; |
369 |
< |
e1 /= av->rad * av->rad; |
363 |
> |
VSUB(ck0, av->pos, r->rop); |
364 |
> |
e1 = DOT(ck0, ck0) / (av->rad * av->rad); |
365 |
|
if (e1 > ambacc*ambacc*1.21) |
366 |
|
continue; |
367 |
|
/* |
378 |
|
} |
379 |
|
} |
380 |
|
e2 = (1.0 - d) * r->rweight; |
381 |
< |
if (e2 < 0.0) e2 = 0.0; |
382 |
< |
if (e1 + e2 > ambacc*ambacc*1.21) |
381 |
> |
if (e2 < 0.0) |
382 |
> |
e2 = 0.0; |
383 |
> |
else if (e1 + e2 > ambacc*ambacc*1.21) |
384 |
|
continue; |
385 |
|
/* |
386 |
|
* Ray behind test. |
480 |
|
extern void |
481 |
|
extambient( /* extrapolate value at pv, nv */ |
482 |
|
COLOR cr, |
483 |
< |
register AMBVAL *ap, |
483 |
> |
AMBVAL *ap, |
484 |
|
FVECT pv, |
485 |
|
FVECT nv |
486 |
|
) |
487 |
|
{ |
488 |
|
FVECT v1; |
489 |
< |
register int i; |
489 |
> |
int i; |
490 |
|
double d; |
491 |
|
|
492 |
|
d = 1.0; /* zeroeth order */ |
514 |
|
static char *mybuf = NULL; |
515 |
|
|
516 |
|
#ifdef F_SETLKW |
517 |
< |
aflock(creat ? F_WRLCK : F_RDLCK); |
517 |
> |
aflock(cre8 ? F_WRLCK : F_RDLCK); |
518 |
|
#endif |
519 |
|
SET_FILE_BINARY(ambfp); |
520 |
|
if (mybuf == NULL) |
562 |
|
|
563 |
|
static AMBVAL * |
564 |
|
avstore( /* allocate memory and store aval */ |
565 |
< |
register AMBVAL *aval |
565 |
> |
AMBVAL *aval |
566 |
|
) |
567 |
|
{ |
568 |
< |
register AMBVAL *av; |
568 |
> |
AMBVAL *av; |
569 |
|
double d; |
570 |
|
|
571 |
|
if ((av = newambval()) == NULL) |
591 |
|
static AMBTREE * |
592 |
|
newambtree(void) /* allocate 8 ambient tree structs */ |
593 |
|
{ |
594 |
< |
register AMBTREE *atp, *upperlim; |
594 |
> |
AMBTREE *atp, *upperlim; |
595 |
|
|
596 |
|
if (atfreelist == NULL) { /* get more nodes */ |
597 |
|
atfreelist = (AMBTREE *)malloc(ATALLOCSZ*8*sizeof(AMBTREE)); |
625 |
|
void *av |
626 |
|
) |
627 |
|
{ |
628 |
< |
register AMBTREE *at; |
629 |
< |
register AMBVAL *ap; |
628 |
> |
AMBTREE *at; |
629 |
> |
AMBVAL *ap; |
630 |
|
AMBVAL avh; |
631 |
|
FVECT ck0; |
632 |
|
double s; |
633 |
|
int branch; |
634 |
< |
register int i; |
634 |
> |
int i; |
635 |
|
|
636 |
|
if (((AMBVAL*)av)->rad <= FTINY) |
637 |
|
error(CONSISTENCY, "zero ambient radius in avinsert"); |
663 |
|
|
664 |
|
static void |
665 |
|
unloadatree( /* unload an ambient value tree */ |
666 |
< |
register AMBTREE *at, |
666 |
> |
AMBTREE *at, |
667 |
|
unloadtf_t *f |
668 |
|
) |
669 |
|
{ |
670 |
< |
register AMBVAL *av; |
671 |
< |
register int i; |
670 |
> |
AMBVAL *av; |
671 |
> |
int i; |
672 |
|
/* transfer values at this node */ |
673 |
|
for (av = at->alist; av != NULL; av = at->alist) { |
674 |
|
at->alist = av->next; |
712 |
|
const void *av2 |
713 |
|
) |
714 |
|
{ |
715 |
< |
register long lc = ((struct avl *)av2)->t - ((struct avl *)av1)->t; |
715 |
> |
long lc = ((struct avl *)av2)->t - ((struct avl *)av1)->t; |
716 |
|
return(lc<0 ? -1 : lc>0 ? 1 : 0); |
717 |
|
} |
718 |
|
|
729 |
|
const void *avp2 |
730 |
|
) |
731 |
|
{ |
732 |
< |
register long diff = *(char * const *)avp1 - *(char * const *)avp2; |
732 |
> |
long diff = *(char * const *)avp1 - *(char * const *)avp2; |
733 |
|
if (diff < 0) |
734 |
|
return(-1); |
735 |
|
return(diff > 0); |
741 |
|
AMBVAL *avaddr |
742 |
|
) |
743 |
|
{ |
744 |
< |
register AMBVAL **avlpp; |
744 |
> |
AMBVAL **avlpp; |
745 |
|
|
746 |
|
avlpp = (AMBVAL **)bsearch((char *)&avaddr, (char *)avlist2, |
747 |
|
nambvals, sizeof(AMBVAL *), aposcmp); |
762 |
|
{ |
763 |
|
AMBTREE oldatrunk; |
764 |
|
AMBVAL tav, *tap, *pnext; |
765 |
< |
register int i, j; |
765 |
> |
int i, j; |
766 |
|
/* see if it's time yet */ |
767 |
|
if (!always && (ambclock++ < lastsort+sortintvl || |
768 |
|
nambvals < SORT_THRESH)) |
875 |
|
{ |
876 |
|
long flen; |
877 |
|
AMBVAL avs; |
878 |
< |
register int n; |
878 |
> |
int n; |
879 |
|
|
880 |
|
if (ambfp == NULL) /* no ambient file? */ |
881 |
|
return(0); |