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

Comparing ray/src/util/rfluxmtx.c (file contents):
Revision 2.15 by greg, Fri Aug 15 19:59:56 2014 UTC vs.
Revision 2.23 by greg, Wed Feb 18 06:18:38 2015 UTC

# Line 36 | Line 36 | static const char RCSid[] = "$Id$";
36  
37   char            *progname;              /* global argv[0] */
38  
39 < int             verbose = 0;            /* verbose mode? */
39 > int             verbose = 0;            /* verbose mode (< 0 no warnings) */
40  
41   char            *rcarg[MAXRCARG+1] = {"rcontrib", "-fo+"};
42   int             nrcargs = 2;
# Line 226 | Line 226 | popen_arglist(char *av[], char *mode)
226                  fputs(": command line too long in popen_arglist()\n", stderr);
227                  return(NULL);
228          }
229 <        if (verbose)
229 >        if (verbose > 0)
230                  fprintf(stderr, "%s: opening pipe %s: %s\n",
231                                  progname, (*mode=='w') ? "to" : "from", cmd);
232          return(popen(cmd, mode));
# Line 244 | Line 244 | my_exec(char *av[])
244                  fputs(": command line too long in my_exec()\n", stderr);
245                  return(1);
246          }
247 <        if (verbose)
247 >        if (verbose > 0)
248                  fprintf(stderr, "%s: running: %s\n", progname, cmd);
249          return(system(cmd));
250   }
# Line 259 | Line 259 | my_exec(char *av[])
259                  fprintf(stderr, "%s: cannot locate %s\n", progname, av[0]);
260                  return(1);
261          }
262 <        if (verbose) {
262 >        if (verbose > 0) {
263                  char    cmd[4096];
264                  if (!convert_commandline(cmd, sizeof(cmd), av))
265                          strcpy(cmd, "COMMAND TOO LONG TO SHOW");
# Line 362 | Line 362 | parse_params(PARAMS *p, char *pargs)
362                  case ' ':
363                  case '\t':
364                  case '\r':
365                        continue;
365                  case '\n':
366 +                        continue;
367                  case '\0':
368                          return(nparams);
369                  default:
# Line 417 | Line 417 | finish_receiver(void)
417          }
418                                          /* determine sample type/bin */
419          if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') {
420 <                binv = "0";             /* uniform sampling -- one bin */
420 >                sprintf(sbuf, "if(-Dx*%g-Dy*%g-Dz*%g,0,-1)",
421 >                        curparams.nrm[0], curparams.nrm[1], curparams.nrm[2]);
422 >                binv = savqstr(sbuf);
423 >                nbins = "1";            /* uniform sampling -- one bin */
424                  uniform = 1;
425          } else if (tolower(curparams.hemis[0]) == 's' &&
426                                  tolower(curparams.hemis[1]) == 'c') {
# Line 516 | Line 519 | make_axes(FVECT uva[2], const FVECT nrm)
519   {
520          int     i;
521  
522 <        uva[1][0] = 0.5 - frandom();
520 <        uva[1][1] = 0.5 - frandom();
521 <        uva[1][2] = 0.5 - frandom();
522 <        for (i = 3; i--; )
523 <                if ((-0.6 < nrm[i]) & (nrm[i] < 0.6))
524 <                        break;
525 <        if (i < 0) {
522 >        if (!getperpendicular(uva[0], nrm)) {
523                  fputs(progname, stderr);
524                  fputs(": bad surface normal in make_axes!\n", stderr);
525                  exit(1);
526          }
527 <        uva[1][i] = 1.0;
531 <        VCROSS(uva[0], uva[1], nrm);
532 <        normalize(uva[0]);
533 <        VCROSS(uva[1], nrm, uva[0]);
527 >        fcross(uva[1], nrm, uva[0]);
528   }
529  
530   /* Illegal sender surfaces end up here */
# Line 792 | Line 786 | sample_reinhart(PARAMS *p, int b, FILE *fp)
786                  alt = (row+samp3[1])*RAH;
787                  azi = (2.*PI)*(col+samp3[2]-.5)/rnaz(row);
788                  duvw[2] = cos(alt);     /* measured from horizon */
789 <                duvw[0] = tcos(azi)*duvw[2];
790 <                duvw[1] = tsin(azi)*duvw[2];
789 >                duvw[0] = tsin(azi)*duvw[2];
790 >                duvw[1] = tcos(azi)*duvw[2];
791                  duvw[2] = sqrt(1. - duvw[2]*duvw[2]);
792                  for (i = 3; i--; )
793                          orig_dir[1][i] = -duvw[0]*p->udir[i] -
# Line 844 | Line 838 | sample_klems(PARAMS *p, int b, FILE *fp)
838  
839          while (n--) {                   /* stratified sampling */
840                  SDmultiSamp(samp2, 2, (n+frandom())/sampcnt);
841 <                if (!bo_getvec(duvw, b+samp2[1], kbasis[bi]))
841 >                if (!bi_getvec(duvw, b+samp2[1], kbasis[bi]))
842                          return(0);
843                  for (i = 3; i--; )
844                          orig_dir[1][i] = duvw[0]*p->udir[i] +
# Line 867 | Line 861 | prepare_sampler(void)
861                  fputs(": no sender surface!\n", stderr);
862                  return(-1);
863          }
864 <        if (curparams.outfn != NULL)    /* misplaced output file spec. */
864 >                                        /* misplaced output file spec. */
865 >        if ((curparams.outfn != NULL) & (verbose >= 0))
866                  fprintf(stderr, "%s: warning - ignoring output file in sender ('%s')\n",
867                                  progname, curparams.outfn);
868                                          /* check/set basis hemisphere */
# Line 1018 | Line 1013 | add_surface(int st, const char *oname, FILE *fp)
1013                  snew->area *= PI*snew->area;
1014                  break;
1015          }
1016 <        if (snew->area <= FTINY) {
1016 >        if ((snew->area <= FTINY) & (verbose >= 0)) {
1017                  fprintf(stderr, "%s: warning - zero area for surface '%s'\n",
1018                                  progname, oname);
1019                  free(snew);
# Line 1205 | Line 1200 | main(int argc, char *argv[])
1200                  na = 1;
1201                  switch (argv[a][1]) {   /* !! Keep consistent !! */
1202                  case 'v':               /* verbose mode */
1203 <                        verbose = !verbose;
1203 >                        verbose = 1;
1204                          na = 0;
1205                          continue;
1206                  case 'f':               /* special case for -fo, -ff, etc. */
# Line 1246 | Line 1241 | main(int argc, char *argv[])
1241                          iropt = argv[a];
1242                          na = 0;
1243                          continue;
1244 <                case 'V':               /* options without arguments */
1245 <                case 'w':
1244 >                case 'w':               /* options without arguments */
1245 >                        if (argv[a][2] != '+') verbose = -1;
1246 >                case 'V':
1247                  case 'u':
1248                  case 'h':
1249                  case 'r':
# Line 1354 | Line 1350 | main(int argc, char *argv[])
1350   #ifdef getc_unlocked
1351          flockfile(rcfp);
1352   #endif
1353 <        if (verbose) {
1353 >        if (verbose > 0) {
1354                  fprintf(stderr, "%s: sampling %d directions", progname, nsbins);
1355                  if (curparams.nsurfs > 1)
1356                          fprintf(stderr, " (%d elements)\n", curparams.nsurfs);
# Line 1364 | Line 1360 | main(int argc, char *argv[])
1360          for (i = 0; i < nsbins; i++)    /* send rcontrib ray samples */
1361                  if (!(*curparams.sample_basis)(&curparams, i, rcfp))
1362                          return(1);
1363 <        return(pclose(rcfp) == 0);      /* all finished! */
1363 >        return(pclose(rcfp) < 0);       /* all finished! */
1364   userr:
1365          if (a < argc-2)
1366                  fprintf(stderr, "%s: unsupported option '%s'", progname, argv[a]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines