| 22 |
|
|
| 23 |
|
extern double ssampdist; /* scatter sampling distance */ |
| 24 |
|
|
| 25 |
+ |
#ifndef MAXSSAMP |
| 26 |
+ |
#define MAXSSAMP 16 /* maximum samples per ray */ |
| 27 |
+ |
#endif |
| 28 |
+ |
|
| 29 |
|
/* |
| 30 |
|
* Structures used by direct() |
| 31 |
|
*/ |
| 386 |
|
COLOR cumval, ctmp; |
| 387 |
|
int i, j; |
| 388 |
|
|
| 389 |
< |
if (r->slights == NULL || r->slights[0] == 0 || r->gecc >= 1.-FTINY) |
| 389 |
> |
if (r->slights == NULL || r->slights[0] == 0 |
| 390 |
> |
|| r->gecc >= 1.-FTINY || r->rot >= FHUGE) |
| 391 |
|
return; |
| 392 |
|
if (ssampdist <= FTINY || (nsamps = r->rot/ssampdist + .5) < 1) |
| 393 |
|
nsamps = 1; |
| 394 |
+ |
#if MAXSSAMP |
| 395 |
+ |
else if (nsamps > MAXSSAMP) |
| 396 |
+ |
nsamps = MAXSSAMP; |
| 397 |
+ |
#endif |
| 398 |
|
oldsampndx = samplendx; |
| 399 |
|
samplendx = random()&0x7fff; /* randomize */ |
| 400 |
|
for (i = r->slights[0]; i > 0; i--) { /* for each source */ |