| 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"; |
| 526 |
|
#define wrongsource(m, r) (r->rsrc>=0 && source[r->rsrc].so!=r->ro && \ |
| 527 |
|
(m->otype!=MAT_ILLUM || wrongillum(m,r))) |
| 528 |
|
|
| 529 |
+ |
/* badspecular * |
| 530 |
+ |
* |
| 531 |
+ |
* Any undirected specular ray that hits a light source |
| 532 |
+ |
* should be discarded. This is because the source contribution to |
| 533 |
+ |
* specular components is calculated separately to reduce variance. |
| 534 |
+ |
*/ |
| 535 |
+ |
|
| 536 |
+ |
#define badspecular(m, r) (r->rsrc<0 && r->crtype&SPECULAR) |
| 537 |
+ |
|
| 538 |
|
/* distglow * |
| 539 |
|
* |
| 540 |
|
* A distant glow is an object that sometimes acts as a light source, |
| 554 |
|
#define badambient(m, r) ((r->crtype&(AMBIENT|SHADOW))==AMBIENT && \ |
| 555 |
|
!distglow(m, r)) |
| 556 |
|
|
| 557 |
+ |
/* overcount * |
| 558 |
+ |
* |
| 559 |
+ |
* All overcounting possibilities are contained here. |
| 560 |
+ |
*/ |
| 561 |
+ |
|
| 562 |
+ |
#define overcount(m, r) (badspecular(m,r) || wrongsource(m,r) || \ |
| 563 |
+ |
badambient(m,r)) |
| 564 |
+ |
|
| 565 |
|
/* passillum * |
| 566 |
|
* |
| 567 |
|
* An illum passes to another material type when we didn't hit it |
| 587 |
|
register RAY *r; |
| 588 |
|
{ |
| 589 |
|
/* check for over-counting */ |
| 590 |
< |
if (wrongsource(m, r) || badambient(m, r)) |
| 590 |
> |
if (overcount(m, r)) |
| 591 |
|
return; |
| 592 |
|
/* check for passed illum */ |
| 593 |
|
if (passillum(m, r)) { |