| 23 | 
  | 
extern double  minweight;               /* minimum ray weight */ | 
| 24 | 
  | 
extern int  do_irrad;                   /* compute irradiance? */ | 
| 25 | 
  | 
 | 
| 26 | 
< | 
long  nrays = 0L;                       /* number of rays traced */ | 
| 26 | 
> | 
long  raynum = 0L;                      /* next unique ray number */ | 
| 27 | 
> | 
long  nrays = 0L;                       /* number of calls to localhit */ | 
| 28 | 
  | 
 | 
| 29 | 
  | 
static double  Lambfa[5] = {PI, PI, PI, 0.0, 0.0}; | 
| 30 | 
  | 
OBJREC  Lamb = { | 
| 48 | 
  | 
                r->crtype = r->rtype = rt; | 
| 49 | 
  | 
                r->rsrc = -1; | 
| 50 | 
  | 
                r->clipset = NULL; | 
| 51 | 
+ | 
                r->revf = raytrace; | 
| 52 | 
  | 
        } else {                                /* spawned ray */ | 
| 53 | 
  | 
                r->rlvl = ro->rlvl; | 
| 54 | 
  | 
                if (rt & RAYREFL) { | 
| 59 | 
  | 
                        r->rsrc = ro->rsrc; | 
| 60 | 
  | 
                        r->clipset = ro->newcset; | 
| 61 | 
  | 
                } | 
| 62 | 
+ | 
                r->revf = ro->revf; | 
| 63 | 
  | 
                r->rweight = ro->rweight * rw; | 
| 64 | 
  | 
                r->crtype = ro->crtype | (r->rtype = rt); | 
| 65 | 
  | 
                VCOPY(r->rorg, ro->rop); | 
| 66 | 
  | 
        } | 
| 67 | 
< | 
        r->rno = nrays; | 
| 67 | 
> | 
        rayclear(r); | 
| 68 | 
> | 
        return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1); | 
| 69 | 
> | 
} | 
| 70 | 
> | 
 | 
| 71 | 
> | 
 | 
| 72 | 
> | 
rayclear(r)                     /* clear a ray for (re)evaluation */ | 
| 73 | 
> | 
register RAY  *r; | 
| 74 | 
> | 
{ | 
| 75 | 
> | 
        r->rno = raynum++; | 
| 76 | 
  | 
        r->newcset = r->clipset; | 
| 77 | 
  | 
        r->ro = NULL; | 
| 78 | 
  | 
        r->rot = FHUGE; | 
| 80 | 
  | 
        setcolor(r->pcol, 1.0, 1.0, 1.0); | 
| 81 | 
  | 
        setcolor(r->rcol, 0.0, 0.0, 0.0); | 
| 82 | 
  | 
        r->rt = 0.0; | 
| 72 | 
– | 
        return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1); | 
| 83 | 
  | 
} | 
| 84 | 
  | 
 | 
| 85 | 
  | 
 | 
| 86 | 
< | 
rayvalue(r)                     /* compute a ray's value */ | 
| 86 | 
> | 
raytrace(r)                     /* trace a ray and compute its value */ | 
| 87 | 
  | 
RAY  *r; | 
| 88 | 
  | 
{ | 
| 89 | 
  | 
        extern int  (*trace)(); | 
| 324 | 
  | 
        register int  i; | 
| 325 | 
  | 
 | 
| 326 | 
  | 
        nrays++;                        /* increment trace counter */ | 
| 317 | 
– | 
 | 
| 327 | 
  | 
        sflags = 0; | 
| 328 | 
  | 
        for (i = 0; i < 3; i++) { | 
| 329 | 
  | 
                curpos[i] = r->rorg[i]; |