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.73 by greg, Tue Jan 18 00:33:16 2005 UTC vs.
Revision 2.78 by greg, Tue Mar 11 02:21:47 2008 UTC

# Line 67 | Line 67 | 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 675 | Line 677 | pixvalue(              /* compute pixel value */
677                  return(0.0);
678          }
679          vdist = ourview.vdist;
680 <
681 <        samplendx = pixnumber(x,y,hres,vres);   /* set pixel index */
680 <
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) {
# Line 694 | Line 695 | pixvalue(              /* compute pixel value */
695          }
696                                                  /* optional depth-of-field */
697          if (dblur > FTINY && vdist > FTINY) {
698 <                double  vc, df[2];
699 <                df[0] = PI/4.*dblur*(.5 - frandom())/sqrt(ourview.hn2);
700 <                df[1] = PI/4.*dblur*(.5 - frandom())/sqrt(ourview.vn2);
701 <                for (i = 3; i--; ) {
702 <                        vc = thisray.rorg[i] + vdist*thisray.rdir[i];
703 <                        thisray.rorg[i] += df[0]*ourview.hvec[i] +
704 <                                                df[1]*ourview.vvec[i] ;
705 <                        thisray.rdir[i] = vc - thisray.rorg[i];
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 && ourview.type != VT_PLS) {
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines