| 374 |
|
srcscatter(r) /* compute source scattering into ray */ |
| 375 |
|
register RAY *r; |
| 376 |
|
{ |
| 377 |
+ |
int oldsampndx; |
| 378 |
|
int nsamps; |
| 379 |
|
RAY sr; |
| 380 |
|
SRCINDEX si; |
| 386 |
|
return; |
| 387 |
|
if (ssampdist <= FTINY || (nsamps = r->rot/ssampdist + .5) < 1) |
| 388 |
|
nsamps = 1; |
| 389 |
+ |
oldsampndx = samplendx; |
| 390 |
+ |
samplendx = random()&0x7fff; /* randomize */ |
| 391 |
|
initsrcindex(&si); |
| 392 |
|
for (i = r->slights[0]; i > 0; i--) { /* for each source */ |
| 393 |
|
setcolor(cumval, 0., 0., 0.); |
| 441 |
|
multcolor(cumval, ctmp); |
| 442 |
|
addcolor(r->rcol, cumval); /* sum into ray result */ |
| 443 |
|
} |
| 444 |
+ |
samplendx = oldsampndx; |
| 445 |
|
} |
| 446 |
|
|
| 447 |
|
|