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

Comparing ray/src/rt/rc2.c (file contents):
Revision 2.1 by greg, Sat Jun 9 07:16:47 2012 UTC vs.
Revision 2.2 by greg, Sun Jun 10 05:25:42 2012 UTC

# Line 83 | Line 83 | printheader(FILE *fout, const char *info)
83                  if (octname[strlen(octname)-1] != '\n')
84                          fputc('\n', fout);
85          } else {
86 <                FILE    *fin = fopen(octname, "r");
86 >                FILE    *fin = fopen(octname, (outfmt=='a') ? "r" : "rb");
87                  if (fin == NULL)
88                          quit(1);
89 <                checkheader(fin, "ignore", fout);
89 >                checkheader(fin, OCTFMT, fout);
90                  fclose(fin);
91          }
92          printargs(gargc-1, gargv, fout);        /* add our command */
# Line 256 | Line 256 | static void
256   put_contrib(const DCOLOR cnt, FILE *fout)
257   {
258          double  sf = 1;
259 <        float   fv[3];
259 >        COLOR   fv;
260          COLR    cv;
261  
262          if (accumulate > 1)
# Line 272 | Line 272 | put_contrib(const DCOLOR cnt, FILE *fout)
272                  break;
273          case 'f':
274                  if (accumulate > 1) {
275 <                        fv[0] = sf*cnt[0]; fv[1] = sf*cnt[1]; fv[2] = sf*cnt[2];
275 >                        copycolor(fv, cnt);
276 >                        scalecolor(fv, sf);
277                  } else
278                          copycolor(fv, cnt);
279                  fwrite(fv, sizeof(float), 3, fout);
280                  break;
281          case 'd':
282                  if (accumulate > 1) {
283 <                        double  dv[3];
284 <                        dv[0] = sf*cnt[0]; dv[1] = sf*cnt[1]; dv[2] = sf*cnt[2];
283 >                        DCOLOR  dv;
284 >                        copycolor(dv, cnt);
285 >                        scalecolor(dv, sf);
286                          fwrite(dv, sizeof(double), 3, fout);
287                  } else
288                          fwrite(cnt, sizeof(double), 3, fout);
# Line 302 | Line 304 | put_contrib(const DCOLOR cnt, FILE *fout)
304   void
305   mod_output(MODCONT *mp)
306   {
307 <        STREAMOUT       *sop = getostream(mp->outspec, mp->modname, 0,0);
307 >        STREAMOUT       *sop = getostream(mp->outspec, mp->modname, 0, 0);
308          int             j;
309  
310          put_contrib(mp->cbin[0], sop->ofp);
311          if (mp->nbins > 3 &&    /* minor optimization */
312 <                        sop == getostream(mp->outspec, mp->modname, 1,0))
312 >                        sop == getostream(mp->outspec, mp->modname, 1, 0))
313                  for (j = 1; j < mp->nbins; j++)
314                          put_contrib(mp->cbin[j], sop->ofp);
315          else
316                  for (j = 1; j < mp->nbins; j++) {
317 <                        sop = getostream(mp->outspec, mp->modname,j,0);
317 >                        sop = getostream(mp->outspec, mp->modname, j, 0);
318                          put_contrib(mp->cbin[j], sop->ofp);
319                  }
320   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines