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.52 by greg, Sat Feb 7 05:40:47 2009 UTC vs.
Revision 1.54 by greg, Sun Jun 14 18:21:58 2009 UTC

# 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 1148 | Line 1153 | trace_contribs(FILE *fin)
1153                                  "dummy ray(s) ignored during accumulation\n");
1154                          continue;
1155                  }
1156 <                if (!iblen ||                   /* need reset? */
1156 >                if (!iblen ||                   /* need flush/reset? */
1157                                  queue_length() > 10*nrtprocs() ||
1158                                  lastray+1 < lastray) {
1159                          while (wait_rproc() != NULL)
# Line 1161 | Line 1166 | trace_contribs(FILE *fin)
1166                  if (iblen) {                    /* trace ray if valid */
1167                          writebuf(rtp->pd.w, inpbuf, iblen);
1168                  } else {                        /* else bypass dummy ray */
1169 <                        queue_raytree(rtp);     /* empty tree */
1170 <                        if ((yres <= 0) | (waitflush > 1))
1171 <                                waitflush = 1;  /* flush after this */
1169 >                        queue_raytree(rtp);     /* queue empty ray/record */
1170 >                        if ((yres <= 0) | (xres <= 0))
1171 >                                waitflush = 1;  /* flush right after */
1172                  }
1173                  process_queue();                /* catch up with results */
1174                  if (raysleft && !--raysleft)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines