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.72 by greg, Fri Nov 5 17:36:55 2004 UTC vs.
Revision 2.79 by schorsch, Thu Apr 24 10:28:25 2008 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   #include  <sys/time.h>
15   #include  <sys/resource.h>
16   #else
17 + #ifndef MINGW
18   #include  <sys/times.h>
19 + #else
20 + #include  <sys/time.h>
21 + #endif
22   #include  <unistd.h>
23   #endif
24   #endif
# Line 61 | Line 65 | double dstrpix = 0.67;                 /* square pixel distribution
65  
66   double  mblur = 0.;                     /* motion blur parameter */
67  
68 + double  dblur = 0.;                     /* depth-of-field blur parameter */
69 +
70   void  (*trace)() = NULL;                /* trace call */
71  
72   int  do_irrad = 0;                      /* compute irradiance? */
73  
74 + int  rand_samp = 0;                     /* pure Monte Carlo sampling? */
75 +
76   double  dstrsrc = 0.0;                  /* square source distribution */
77   double  shadthresh = .05;               /* shadow threshold */
78   double  shadcert = .5;                  /* shadow certainty */
# Line 662 | Line 670 | pixvalue(              /* compute pixel value */
670   {
671          RAY  thisray;
672          FVECT   lorg, ldir;
673 <        double  hpos, vpos, lmax;
673 >        double  hpos, vpos, vdist, lmax;
674 >        register int    i;
675                                                  /* compute view ray */
676          hpos = (x+pixjitter())/hres;
677          vpos = (y+pixjitter())/vres;
# Line 671 | Line 680 | pixvalue(              /* compute pixel value */
680                  setcolor(col, 0.0, 0.0, 0.0);
681                  return(0.0);
682          }
683 <
684 <        samplendx = pixnumber(x,y,hres,vres);   /* set pixel index */
685 <
683 >        vdist = ourview.vdist;
684 >                                                /* set pixel index */
685 >        samplendx = pixnumber(x,y,hres,vres);
686                                                  /* optional motion blur */
687          if (lastview.type && mblur > FTINY && (lmax = viewray(lorg, ldir,
688                                          &lastview, hpos, vpos)) >= -FTINY) {
680                register int    i;
689                  register double  d = mblur*(.5-urand(281+samplendx));
690  
691                  thisray.rmax = (1.-d)*thisray.rmax + d*lmax;
# Line 687 | Line 695 | pixvalue(              /* compute pixel value */
695                  }
696                  if (normalize(thisray.rdir) == 0.0)
697                          return(0.0);
698 +                vdist = (1.-d)*vdist + d*lastview.vdist;
699          }
700 +                                                /* optional depth-of-field */
701 +        if (dblur > FTINY && vdist > FTINY) {
702 +                double  vc, dfh, dfv;
703 +                                                /* PI/4. square/circle conv. */
704 +                dfh = PI/4.*dblur*(.5 - frandom());
705 +                dfv = PI/4.*dblur*(.5 - frandom());
706 +                if (ourview.type == VT_PER || ourview.type == VT_PAR) {
707 +                        dfh /= sqrt(ourview.hn2);
708 +                        dfv /= sqrt(ourview.vn2);
709 +                        for (i = 3; i--; ) {
710 +                                vc = thisray.rorg[i] + vdist*thisray.rdir[i];
711 +                                thisray.rorg[i] += dfh*ourview.hvec[i] +
712 +                                                        dfv*ourview.vvec[i] ;
713 +                                thisray.rdir[i] = vc - thisray.rorg[i];
714 +                        }
715 +                } else {                        /* non-standard view case */
716 +                        double  dfd = PI/4.*dblur*(.5 - frandom());
717 +                        if (ourview.type != VT_ANG && ourview.type != VT_PLS) {
718 +                                if (ourview.type != VT_CYL)
719 +                                        dfh /= sqrt(ourview.hn2);
720 +                                dfv /= sqrt(ourview.vn2);
721 +                        }
722 +                        for (i = 3; i--; ) {
723 +                                vc = thisray.rorg[i] + vdist*thisray.rdir[i];
724 +                                thisray.rorg[i] += dfh*ourview.hvec[i] +
725 +                                                        dfv*ourview.vvec[i] +
726 +                                                        dfd*ourview.vdir[i] ;
727 +                                thisray.rdir[i] = vc - thisray.rorg[i];
728 +                        }
729 +                }
730 +                if (normalize(thisray.rdir) == 0.0)
731 +                        return(0.0);
732 +        }
733  
734 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
734 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
735  
736          rayvalue(&thisray);                     /* trace ray */
737  
# Line 758 | Line 800 | writerr:
800          error(SYSTEM, errmsg);
801          return -1; /* pro forma return */
802   }
761
803  
804   static int
805   pixnumber(              /* compute pixel index (brushed) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines