--- ray/src/rt/rtrace.c 1993/06/18 10:14:42 2.15 +++ ray/src/rt/rtrace.c 1994/12/21 09:52:00 2.18 @@ -1,4 +1,4 @@ -/* Copyright (c) 1992 Regents of the University of California */ +/* Copyright (c) 1994 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -61,6 +61,8 @@ double srcsizerat = .25; /* maximum ratio source siz double specthresh = .15; /* specular sampling threshold */ double specjitter = 1.; /* specular sampling jitter */ +int backvis = 1; /* back face visibility */ + int maxdepth = 6; /* maximum recursion depth */ double minweight = 4e-3; /* minimum ray weight */ @@ -133,10 +135,7 @@ char *fname; setmode(fileno(fp), O_BINARY); #endif /* set up output */ - if (imm_irrad) - outvals = "v"; - else - setoutput(outvals); + setoutput(outvals); switch (outform) { case 'a': putreal = puta; break; case 'f': putreal = putf; break; @@ -166,7 +165,7 @@ char *fname; if (imm_irrad) irrad(orig, direc); else - traceray(orig, direc); + rad(orig, direc); /* flush if time */ if (--nextflush == 0) { fflush(stdout); @@ -241,25 +240,18 @@ register char *vs; } -traceray(org, dir) /* compute and print ray value(s) */ +rad(org, dir) /* compute and print ray value(s) */ FVECT org, dir; { - register int (**tp)(); - VCOPY(thisray.rorg, org); VCOPY(thisray.rdir, dir); + thisray.rmax = 0.0; rayorigin(&thisray, NULL, PRIMARY, 1.0); if (castonly) localhit(&thisray, &thescene) || sourcehit(&thisray); else rayvalue(&thisray); - - if (ray_out[0] == NULL) - return; - for (tp = ray_out; *tp != NULL; tp++) - (**tp)(&thisray); - if (outform == 'a') - putchar('\n'); + printvals(&thisray); } @@ -274,14 +266,26 @@ FVECT org, dir; } rayorigin(&thisray, NULL, PRIMARY, 1.0); /* pretend we hit surface */ - thisray.rot = 1.0; + thisray.rot = 1.0-1e-4; thisray.rod = 1.0; VCOPY(thisray.ron, dir); for (i = 0; i < 3; i++) /* fudge factor */ thisray.rop[i] = org[i] + 1e-4*dir[i]; /* compute and print */ (*ofun[Lamb.otype].funp)(&Lamb, &thisray); - oputv(&thisray); + printvals(&thisray); +} + + +printvals(r) /* print requested ray values */ +RAY *r; +{ + register int (**tp)(); + + if (ray_out[0] == NULL) + return; + for (tp = ray_out; *tp != NULL; tp++) + (**tp)(r); if (outform == 'a') putchar('\n'); } @@ -354,9 +358,10 @@ RAY *r; if (every_out[0] == NULL) return; - if (traincl == 1 && r->ro == NULL) - return; - if (traincl != -1 && traincl != inset(traset, r->ro->omod)) + if (r->ro == NULL) { + if (traincl == 1) + return; + } else if (traincl != -1 && traincl != inset(traset, r->ro->omod)) return; tabin(r); for (tp = every_out; *tp != NULL; tp++)