| 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 || distglow(m, r))) |
| 549 |
|
|
| 550 |
+ |
/* overcount * |
| 551 |
+ |
* |
| 552 |
+ |
* All overcounting possibilities are contained here. |
| 553 |
+ |
*/ |
| 554 |
+ |
|
| 555 |
+ |
#define overcount(m, r) (badcomponent(m,r) || wrongsource(m,r)) |
| 556 |
+ |
|
| 557 |
|
/* passillum * |
| 558 |
|
* |
| 559 |
|
* An illum passes to another material type when we didn't hit it |
| 579 |
|
register RAY *r; |
| 580 |
|
{ |
| 581 |
|
/* check for over-counting */ |
| 582 |
< |
if (wrongsource(m, r) || badambient(m, r)) |
| 582 |
> |
if (overcount(m, r)) |
| 583 |
|
return; |
| 584 |
|
/* check for passed illum */ |
| 585 |
|
if (passillum(m, r)) { |