| 90 | 
  | 
 */ | 
| 91 | 
  | 
 | 
| 92 | 
  | 
#include <string.h> | 
| 93 | 
+ | 
#include <time.h> | 
| 94 | 
  | 
 | 
| 95 | 
  | 
#include  "ray.h" | 
| 96 | 
  | 
#include  "source.h" | 
| 119 | 
  | 
 | 
| 120 | 
  | 
int     do_irrad = 0;                   /* compute irradiance? */ | 
| 121 | 
  | 
 | 
| 122 | 
+ | 
int     rand_samp = 0;                  /* pure Monte Carlo sampling? */ | 
| 123 | 
+ | 
 | 
| 124 | 
  | 
double  dstrsrc = 0.0;                  /* square source distribution */ | 
| 125 | 
  | 
double  shadthresh = .03;               /* shadow threshold */ | 
| 126 | 
  | 
double  shadcert = .75;                 /* shadow certainty */ | 
| 166 | 
  | 
                initotypes(); | 
| 167 | 
  | 
                                        /* initialize urand */ | 
| 168 | 
  | 
        initurand(2048); | 
| 169 | 
+ | 
        srandom(rand_samp ? (long)time(0) : 0L); | 
| 170 | 
  | 
                                        /* read scene octree */ | 
| 171 | 
  | 
        readoct(octname = otnm, ~(IO_FILES|IO_INFO), &thescene, NULL); | 
| 172 | 
  | 
        nsceneobjs = nobjects; | 
| 183 | 
  | 
) | 
| 184 | 
  | 
{ | 
| 185 | 
  | 
        rayorigin(r, PRIMARY, NULL, NULL); | 
| 186 | 
< | 
        samplendx++; | 
| 186 | 
> | 
        samplendx = rand_samp ? random() : samplendx+1; | 
| 187 | 
  | 
        rayvalue(r);            /* assumes origin and direction are set */ | 
| 188 | 
  | 
} | 
| 189 | 
  | 
 |