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.71 by schorsch, Sat Oct 23 18:55:53 2004 UTC vs.
Revision 2.77 by greg, Wed Apr 5 06:22:56 2006 UTC

# Line 61 | Line 61 | double dstrpix = 0.67;                 /* square pixel distribution
61  
62   double  mblur = 0.;                     /* motion blur parameter */
63  
64 + double  dblur = 0.;                     /* depth-of-field blur parameter */
65 +
66   void  (*trace)() = NULL;                /* trace call */
67  
68   int  do_irrad = 0;                      /* compute irradiance? */
69  
70 + int  rand_samp = 0;                     /* pure Monte Carlo sampling? */
71 +
72   double  dstrsrc = 0.0;                  /* square source distribution */
73   double  shadthresh = .05;               /* shadow threshold */
74   double  shadcert = .5;                  /* shadow certainty */
# Line 94 | Line 98 | int  ambres = 64;                      /* ambient resolution */
98   int  ambdiv = 512;                      /* ambient divisions */
99   int  ambssamp = 128;                    /* ambient super-samples */
100   int  ambounce = 0;                      /* ambient bounces */
101 < char  *amblist[128];                    /* ambient include/exclude list */
101 > char  *amblist[AMBLLEN];                /* ambient include/exclude list */
102   int  ambincl = -1;                      /* include == 1, exclude == 0 */
103  
104   int  ralrm = 0;                         /* seconds between reports */
# Line 662 | Line 666 | pixvalue(              /* compute pixel value */
666   {
667          RAY  thisray;
668          FVECT   lorg, ldir;
669 <        double  hpos, vpos, lmax;
669 >        double  hpos, vpos, vdist, lmax;
670 >        register int    i;
671                                                  /* compute view ray */
672          hpos = (x+pixjitter())/hres;
673          vpos = (y+pixjitter())/vres;
# Line 671 | Line 676 | pixvalue(              /* compute pixel value */
676                  setcolor(col, 0.0, 0.0, 0.0);
677                  return(0.0);
678          }
679 <
680 <        samplendx = pixnumber(x,y,hres,vres);   /* set pixel index */
681 <
679 >        vdist = ourview.vdist;
680 >                                                /* set pixel index */
681 >        samplendx = pixnumber(x,y,hres,vres);
682                                                  /* optional motion blur */
683          if (lastview.type && mblur > FTINY && (lmax = viewray(lorg, ldir,
684                                          &lastview, hpos, vpos)) >= -FTINY) {
680                register int    i;
685                  register double  d = mblur*(.5-urand(281+samplendx));
686  
687                  thisray.rmax = (1.-d)*thisray.rmax + d*lmax;
# Line 687 | Line 691 | pixvalue(              /* compute pixel value */
691                  }
692                  if (normalize(thisray.rdir) == 0.0)
693                          return(0.0);
694 +                vdist = (1.-d)*vdist + d*lastview.vdist;
695          }
696 +                                                /* optional depth-of-field */
697 +        if (dblur > FTINY && vdist > FTINY) {
698 +                double  vc, dfh, dfv;
699 +                                                /* PI/4. square/circle conv. */
700 +                dfh = PI/4.*dblur*(.5 - frandom());
701 +                dfv = PI/4.*dblur*(.5 - frandom());
702 +                if (ourview.type == VT_PER || ourview.type == VT_PAR) {
703 +                        dfh /= sqrt(ourview.hn2);
704 +                        dfv /= sqrt(ourview.vn2);
705 +                        for (i = 3; i--; ) {
706 +                                vc = thisray.rorg[i] + vdist*thisray.rdir[i];
707 +                                thisray.rorg[i] += dfh*ourview.hvec[i] +
708 +                                                        dfv*ourview.vvec[i] ;
709 +                                thisray.rdir[i] = vc - thisray.rorg[i];
710 +                        }
711 +                } else {                        /* non-standard view case */
712 +                        double  dfd = PI/4.*dblur*(.5 - frandom());
713 +                        if (ourview.type != VT_ANG) {
714 +                                if (ourview.type != VT_CYL)
715 +                                        dfh /= sqrt(ourview.hn2);
716 +                                dfv /= sqrt(ourview.vn2);
717 +                        }
718 +                        for (i = 3; i--; ) {
719 +                                vc = thisray.rorg[i] + vdist*thisray.rdir[i];
720 +                                thisray.rorg[i] += dfh*ourview.hvec[i] +
721 +                                                        dfv*ourview.vvec[i] +
722 +                                                        dfd*ourview.vdir[i] ;
723 +                                thisray.rdir[i] = vc - thisray.rorg[i];
724 +                        }
725 +                }
726 +                if (normalize(thisray.rdir) == 0.0)
727 +                        return(0.0);
728 +        }
729  
730 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
730 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
731  
732          rayvalue(&thisray);                     /* trace ray */
733  
# Line 758 | Line 796 | writerr:
796          error(SYSTEM, errmsg);
797          return -1; /* pro forma return */
798   }
761
799  
800   static int
801   pixnumber(              /* compute pixel index (brushed) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines