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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.51 by greg, Sat Dec 6 01:08:53 2008 UTC vs.
Revision 1.55 by greg, Wed Dec 9 21:43:35 2009 UTC

# Line 246 | Line 246 | main(int argc, char *argv[])
246                  while ((j = expandarg(&argc, &argv, i)) > 0)
247                          ;
248                  if (j < 0) {
249 <                        fprintf(stderr, "%s: cannot expand '%s'",
249 >                        fprintf(stderr, "%s: cannot expand '%s'\n",
250                                          argv[0], argv[i]);
251                          exit(1);
252                  }
# Line 340 | Line 340 | main(int argc, char *argv[])
340                          case 'b':               /* bin expression/count */
341                                  if (i >= argc-2) break;
342                                  if (argv[i][2] == 'n') {
343 <                                        bincnt = atoi(argv[++i]);
343 >                                        bincnt = (int)(eval(argv[++i]) + .5);
344                                          continue;
345                                  }
346                                  if (argv[i][2]) break;
# Line 580 | Line 580 | addmodifier(char *modn, char *outf, char *binv, int bi
580                  error(USER, errmsg);
581          }
582          if (nmods >= MAXMODLIST)
583 <                error(USER, "too many modifiers");
583 >                error(INTERNAL, "too many modifiers");
584          modname[nmods++] = modn;        /* XXX assumes static string */
585          lep->key = modn;                /* XXX assumes static string */
586          mp = (MODCONT *)malloc(sizeof(MODCONT));
# Line 588 | Line 588 | addmodifier(char *modn, char *outf, char *binv, int bi
588                  error(SYSTEM, "out of memory in addmodifier");
589          mp->outspec = outf;             /* XXX assumes static string */
590          mp->modname = modn;             /* XXX assumes static string */
591 <        if (binv != NULL)
592 <                mp->binv = eparse(binv);
593 <        else
594 <                mp->binv = eparse("0");
595 <        mp->nbins = 1;
591 >        if (binv == NULL)
592 >                binv = "0";             /* use single bin if unspecified */
593 >        mp->binv = eparse(binv);
594 >        if (mp->binv->type == NUM) {    /* check value if constant */
595 >                bincnt = (int)(evalue(mp->binv) + 1.5);
596 >                if (bincnt != 1) {
597 >                        sprintf(errmsg, "illegal non-zero constant for bin (%s)",
598 >                                        binv);
599 >                        error(USER, errmsg);
600 >                }
601 >        }
602 >        mp->nbins = 1;                  /* initialize results holder */
603          setcolor(mp->cbin[0], 0., 0., 0.);
604 <        if (mp->binv->type == NUM)      /* assume one bin if constant */
598 <                bincnt = 1;
599 <        else if (bincnt > 1)
604 >        if (bincnt > 1)
605                  mp = growmodifier(mp, bincnt);
606          lep->data = (char *)mp;
607                                          /* allocate output streams */
# Line 659 | Line 664 | ofname(char *oname, const char *ospec, const char *mna
664                                  mnp = cp;
665                                  break;
666                          case 'd':
667 +                        case 'i':
668 +                        case 'o':
669 +                        case 'x':
670 +                        case 'X':
671                                  if (bnp != NULL)
672                                          return -1;
673                                  bnp = cp;
# Line 1148 | Line 1157 | trace_contribs(FILE *fin)
1157                                  "dummy ray(s) ignored during accumulation\n");
1158                          continue;
1159                  }
1160 <                if (!iblen ||                   /* need reset? */
1160 >                if (!iblen ||                   /* need flush/reset? */
1161                                  queue_length() > 10*nrtprocs() ||
1162                                  lastray+1 < lastray) {
1163                          while (wait_rproc() != NULL)
# Line 1161 | Line 1170 | trace_contribs(FILE *fin)
1170                  if (iblen) {                    /* trace ray if valid */
1171                          writebuf(rtp->pd.w, inpbuf, iblen);
1172                  } else {                        /* else bypass dummy ray */
1173 <                        queue_raytree(rtp);     /* empty tree */
1174 <                        if ((yres <= 0) | (waitflush > 1))
1175 <                                waitflush = 1;  /* flush after this */
1173 >                        queue_raytree(rtp);     /* queue empty ray/record */
1174 >                        if ((yres <= 0) | (xres <= 0))
1175 >                                waitflush = 1;  /* flush right after */
1176                  }
1177                  process_queue();                /* catch up with results */
1178                  if (raysleft && !--raysleft)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines