ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rsensor.c
(Generate patch)

Comparing ray/src/util/rsensor.c (file contents):
Revision 2.7 by greg, Sat Dec 12 19:01:00 2009 UTC vs.
Revision 2.8 by greg, Sun Sep 26 15:41:46 2010 UTC

# Line 120 | Line 120 | main(
120                                          putchar('\n');
121                                  }
122                                                  /* start process(es) */
123 <                                ray_pinit(argv[argc-1], nprocs);
123 >                                if (strcmp(argv[argc-1], "."))
124 >                                        ray_pinit(argv[argc-1], nprocs);
125                          }
126                          comp_sensor(argv[i]);   /* process a sensor file */
127                          continue;
# Line 194 | Line 195 | main(
195                  }
196                  i += rval;
197          }
198 <        if (!ray_pnprocs)
198 >        if (sensor == NULL)
199                  error(USER, i<argc ? "missing sensor file" : "missing octree");
200          quit(0);
201   }
# Line 461 | Line 462 | sens_val(
462          return(s_val(t,p));
463   }
464  
465 + /* Print origin and direction */
466 + static void
467 + print_ray(
468 +        FVECT rorg,
469 +        FVECT rdir
470 + )
471 + {
472 +        printf("%.6g %.6g %.6g %.8f %.8f %.8f\n",
473 +                        rorg[0], rorg[1], rorg[2],
474 +                        rdir[0], rdir[1], rdir[2]);
475 + }
476 +
477   /* Compute sensor output */
478   static void
479   comp_sensor(
# Line 495 | Line 508 | comp_sensor(
508                          get_direc(rr.rdir, (i+frandom())/nt, (j+frandom())/np);
509                          if (ourview.vfore > FTINY)
510                                  VSUM(rr.rorg, rr.rorg, rr.rdir, ourview.vfore);
511 +                        if (!ray_pnprocs) {
512 +                                print_ray(rr.rorg, rr.rdir);
513 +                                continue;
514 +                        }
515                          rr.rmax = .0;
516                          rayorigin(&rr, PRIMARY, NULL, NULL);
517                          scalecolor(rr.rcoef, sf);
# Line 507 | Line 524 | comp_sensor(
524                  get_direc(rr.rdir, frandom(), frandom());
525                  if (ourview.vfore > FTINY)
526                          VSUM(rr.rorg, rr.rorg, rr.rdir, ourview.vfore);
527 +                if (!ray_pnprocs) {
528 +                        print_ray(rr.rorg, rr.rdir);
529 +                        continue;
530 +                }
531                  rr.rmax = .0;
532                  rayorigin(&rr, PRIMARY, NULL, NULL);
533                  scalecolor(rr.rcoef, sf);
534                  if (ray_pqueue(&rr) == 1)
535                          addcolor(vsum, rr.rcol);
536          }
537 +        if (!ray_pnprocs)                       /* just printing rays */
538 +                return;
539                                                  /* scale partial result */
540          scalecolor(vsum, sf);
541                                                  /* add direct component */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines