1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
535 |
|
#define distglow(m, r) (m->otype==MAT_GLOW && \ |
536 |
|
r->rot > m->oargs.farg[3]) |
537 |
|
|
538 |
< |
/* badambient * |
538 |
> |
/* badcomponent * |
539 |
|
* |
540 |
< |
* We must avoid including counting light sources in the ambient calculation, |
540 |
> |
* We must avoid counting light sources in the ambient calculation, |
541 |
|
* since the direct component is handled separately. Therefore, any |
542 |
|
* ambient ray which hits an active light source must be discarded. |
543 |
+ |
* The same is true for stray specular samples, since the specular |
544 |
+ |
* contribution from light sources is calculated separately. |
545 |
|
*/ |
546 |
|
|
547 |
< |
#define badambient(m, r) ((r->crtype&(AMBIENT|SHADOW))==AMBIENT && \ |
548 |
< |
!distglow(m, r)) |
547 |
> |
#define badcomponent(m, r) (r->crtype&(AMBIENT|SPECULAR) && \ |
548 |
> |
!(r->crtype&SHADOW || r->rod < 0.0 || \ |
549 |
> |
distglow(m, r))) |
550 |
|
|
551 |
+ |
/* overcount * |
552 |
+ |
* |
553 |
+ |
* All overcounting possibilities are contained here. |
554 |
+ |
*/ |
555 |
+ |
|
556 |
+ |
#define overcount(m, r) (badcomponent(m,r) || wrongsource(m,r)) |
557 |
+ |
|
558 |
|
/* passillum * |
559 |
|
* |
560 |
|
* An illum passes to another material type when we didn't hit it |
580 |
|
register RAY *r; |
581 |
|
{ |
582 |
|
/* check for over-counting */ |
583 |
< |
if (wrongsource(m, r) || badambient(m, r)) |
583 |
> |
if (overcount(m, r)) |
584 |
|
return; |
585 |
|
/* check for passed illum */ |
586 |
|
if (passillum(m, r)) { |