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

Comparing ray/src/rt/rpict.c (file contents):
Revision 2.46 by greg, Wed Apr 17 14:02:05 1996 UTC vs.
Revision 2.50 by gwlarson, Mon Apr 13 14:01:08 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1995 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 53 | Line 53 | int  psample = 4;                      /* pixel sample size */
53   double  maxdiff = .05;                  /* max. difference for interpolation */
54   double  dstrpix = 0.67;                 /* square pixel distribution */
55  
56 + double  mblur = 0.;                     /* motion blur parameter */
57 +
58   double  dstrsrc = 0.0;                  /* square source distribution */
59   double  shadthresh = .05;               /* shadow threshold */
60   double  shadcert = .5;                  /* shadow certainty */
# Line 102 | Line 104 | extern unsigned long  nrays;           /* number of rays traced
104  
105   #define  pixjitter()    (.5+dstrpix*(.5-frandom()))
106  
107 < static int  hres, vres;                 /* resolution for this frame */
107 > int  hres, vres;                        /* resolution for this frame */
108  
109 + static VIEW     lastview;               /* the previous view input */
110 +
111   extern char  *mktemp();
112  
113   double  pixvalue();
# Line 228 | Line 232 | char  *pout, *zout, *prvr;
232                  for ( ; seq < rn; seq++)
233                          if (nextview(stdin) == EOF)
234                                  error(USER, "unexpected EOF on view input");
235 +                setview(&ourview);
236                  prvr = fbuf;                    /* mark for renaming */
237          }
238          if (pout != NULL & prvr != NULL) {
# Line 269 | Line 274 | char  *pout, *zout, *prvr;
274                                                  fbuf);
275                                          error(USER, errmsg);
276                                  }
277 +                                setview(&ourview);
278                                  continue;               /* don't clobber */
279                          }
280                          if (freopen(fbuf, "w", stdout) == NULL) {
# Line 331 | Line 337 | FILE  *fp;
337   {
338          char  linebuf[256];
339  
340 +        copystruct(&lastview, &ourview);
341          while (fgets(linebuf, sizeof(linebuf), fp) != NULL)
342                  if (isview(linebuf) && sscanview(&ourview, linebuf) > 0)
343                          return(0);
# Line 403 | Line 410 | char  *zfile, *oldfile;
410          else
411   #endif
412          signal(SIGCONT, report);
413 <        ypos = vres-1 - i;
413 >        ypos = vres-1 - i;                      /* initialize sampling */
414 >        if (directvis)
415 >                init_drawsources(psample);
416          fillscanline(scanbar[0], zbar[0], sampdens, hres, ypos, hstep);
417                                                  /* compute scanlines */
418          for (ypos -= ystep; ypos > -ystep; ypos -= ystep) {
# Line 423 | Line 432 | char  *zfile, *oldfile;
432                                  hres, ypos, hstep);
433                                                          /* fill bar */
434                  fillscanbar(scanbar, zbar, hres, ypos, ystep);
435 <                                                        /* add bitty sources */
436 <                drawsources(&ourview, hres, vres, scanbar, zbar,
428 <                                0, hres, ypos, ystep, psample);
435 >                if (directvis)                          /* add bitty sources */
436 >                        drawsources(scanbar, zbar, 0, hres, ypos, ystep);
437                                                          /* write it out */
438   #ifndef  BSD
439                  signal(SIGCONT, SIG_IGN);       /* don't interrupt writes */
# Line 602 | Line 610 | pixvalue(col, x, y)            /* compute pixel value */
610   COLOR  col;                     /* returned color */
611   int  x, y;                      /* pixel position */
612   {
613 <        static RAY  thisray;
614 <
615 <        if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview,
616 <                        (x+pixjitter())/hres, (y+pixjitter())/vres)) < -FTINY) {
613 >        RAY  thisray;
614 >        FVECT   lorg, ldir;
615 >        double  hpos, vpos, lmax, d;
616 >                                                /* compute view ray */
617 >        hpos = (x+pixjitter())/hres;
618 >        vpos = (y+pixjitter())/vres;
619 >        if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir,
620 >                                        &ourview, hpos, vpos)) < -FTINY) {
621                  setcolor(col, 0.0, 0.0, 0.0);
622                  return(0.0);
623          }
624  
613        rayorigin(&thisray, NULL, PRIMARY, 1.0);
614
625          samplendx = pixnumber(x,y,hres,vres);   /* set pixel index */
626 +
627 +                                                /* optional motion blur */
628 +        if (lastview.type && mblur > FTINY && (lmax = viewray(lorg, ldir,
629 +                                        &lastview, hpos, vpos)) >= -FTINY) {
630 +                register int    i;
631 +                register double  d = mblur*(.5-urand(281+samplendx));
632 +
633 +                thisray.rmax = (1.-d)*thisray.rmax + d*lmax;
634 +                for (i = 3; i--; ) {
635 +                        thisray.rorg[i] = (1.-d)*thisray.rorg[i] + d*lorg[i];
636 +                        thisray.rdir[i] = (1.-d)*thisray.rdir[i] + d*ldir[i];
637 +                }
638 +                if (normalize(thisray.rdir) == 0.0)
639 +                        return(0.0);
640 +        }
641 +
642 +        rayorigin(&thisray, NULL, PRIMARY, 1.0);
643  
644          rayvalue(&thisray);                     /* trace ray */
645  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines