29 |
|
#include "source.h" |
30 |
|
#include "otypes.h" |
31 |
|
#include "resolu.h" |
32 |
+ |
#include "random.h" |
33 |
|
|
34 |
|
CUBE thescene; /* our scene */ |
35 |
|
OBJECT nsceneobjs; /* number of objects in our scene */ |
47 |
|
|
48 |
|
int do_irrad = 0; /* compute irradiance? */ |
49 |
|
|
50 |
+ |
int rand_samp = 0; /* pure Monte Carlo sampling? */ |
51 |
+ |
|
52 |
|
void (*trace)() = NULL; /* trace call */ |
53 |
|
|
54 |
|
char *tralist[128]; /* list of modifers to trace (or no) */ |
198 |
|
nextflush = hresolu; |
199 |
|
} |
200 |
|
} else { |
201 |
< |
samplendx++; |
201 |
> |
samplendx = rand_samp ? random() : samplendx+1; |
202 |
|
/* compute and print */ |
203 |
|
if (imm_irrad) |
204 |
|
irrad(orig, direc); |
639 |
|
RAY *r |
640 |
|
) |
641 |
|
{ |
642 |
< |
COLOR contr; |
642 |
> |
double contr[3]; |
643 |
|
|
644 |
|
raycontrib(contr, r, PRIMARY); |
645 |
< |
(*putreal)(colval(contr,RED)); |
646 |
< |
(*putreal)(colval(contr,GRN)); |
647 |
< |
(*putreal)(colval(contr,BLU)); |
645 |
> |
(*putreal)(contr[RED]); |
646 |
> |
(*putreal)(contr[GRN]); |
647 |
> |
(*putreal)(contr[BLU]); |
648 |
|
} |
649 |
|
|
650 |
|
|