--- ray/src/util/rsensor.c 2008/12/13 00:44:05 2.6 +++ ray/src/util/rsensor.c 2010/09/26 15:41:46 2.8 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rsensor.c,v 2.6 2008/12/13 00:44:05 greg Exp $"; +static const char RCSid[] = "$Id: rsensor.c,v 2.8 2010/09/26 15:41:46 greg Exp $"; #endif /* @@ -71,6 +71,17 @@ print_defaults() /* print out default parameters */ print_rdefaults(); } + +void +quit(ec) /* make sure exit is called */ +int ec; +{ + if (ray_pnprocs > 0) /* close children if any */ + ray_pclose(0); + exit(ec); +} + + int main( int argc, @@ -109,7 +120,8 @@ main( putchar('\n'); } /* start process(es) */ - ray_pinit(argv[argc-1], nprocs); + if (strcmp(argv[argc-1], ".")) + ray_pinit(argv[argc-1], nprocs); } comp_sensor(argv[i]); /* process a sensor file */ continue; @@ -183,7 +195,7 @@ main( } i += rval; } - if (!ray_pnprocs) + if (sensor == NULL) error(USER, i FTINY) VSUM(rr.rorg, rr.rorg, rr.rdir, ourview.vfore); + if (!ray_pnprocs) { + print_ray(rr.rorg, rr.rdir); + continue; + } rr.rmax = .0; rayorigin(&rr, PRIMARY, NULL, NULL); scalecolor(rr.rcoef, sf); @@ -496,12 +524,18 @@ comp_sensor( get_direc(rr.rdir, frandom(), frandom()); if (ourview.vfore > FTINY) VSUM(rr.rorg, rr.rorg, rr.rdir, ourview.vfore); + if (!ray_pnprocs) { + print_ray(rr.rorg, rr.rdir); + continue; + } rr.rmax = .0; rayorigin(&rr, PRIMARY, NULL, NULL); scalecolor(rr.rcoef, sf); if (ray_pqueue(&rr) == 1) addcolor(vsum, rr.rcol); } + if (!ray_pnprocs) /* just printing rays */ + return; /* scale partial result */ scalecolor(vsum, sf); /* add direct component */