--- ray/src/rt/raytrace.c 1991/06/14 10:34:26 1.19 +++ ray/src/rt/raytrace.c 1991/06/20 13:29:32 1.21 @@ -23,7 +23,8 @@ extern int maxdepth; /* maximum recursion depth */ extern double minweight; /* minimum ray weight */ extern int do_irrad; /* compute irradiance? */ -long nrays = 0L; /* number of rays traced */ +long raynum = 0L; /* next unique ray number */ +long nrays = 0L; /* number of calls to localhit */ static double Lambfa[5] = {PI, PI, PI, 0.0, 0.0}; OBJREC Lamb = { @@ -47,6 +48,7 @@ double rw; r->crtype = r->rtype = rt; r->rsrc = -1; r->clipset = NULL; + r->revf = raytrace; } else { /* spawned ray */ r->rlvl = ro->rlvl; if (rt & RAYREFL) { @@ -57,11 +59,12 @@ double rw; r->rsrc = ro->rsrc; r->clipset = ro->newcset; } + r->revf = ro->revf; r->rweight = ro->rweight * rw; r->crtype = ro->crtype | (r->rtype = rt); VCOPY(r->rorg, ro->rop); } - r->rno = nrays; + r->rno = raynum++; r->newcset = r->clipset; r->ro = NULL; r->rot = FHUGE; @@ -73,7 +76,7 @@ double rw; } -rayvalue(r) /* compute a ray's value */ +raytrace(r) /* trace a ray and compute its value */ RAY *r; { extern int (*trace)(); @@ -314,7 +317,6 @@ register CUBE *scene; register int i; nrays++; /* increment trace counter */ - sflags = 0; for (i = 0; i < 3; i++) { curpos[i] = r->rorg[i];