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.75 by greg, Tue Apr 19 01:15:06 2005 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? */
# Line 94 | Line 96 | int  ambres = 64;                      /* ambient resolution */
96   int  ambdiv = 512;                      /* ambient divisions */
97   int  ambssamp = 128;                    /* ambient super-samples */
98   int  ambounce = 0;                      /* ambient bounces */
99 < char  *amblist[128];                    /* ambient include/exclude list */
99 > char  *amblist[AMBLLEN];                /* ambient include/exclude list */
100   int  ambincl = -1;                      /* include == 1, exclude == 0 */
101  
102   int  ralrm = 0;                         /* seconds between reports */
# Line 662 | Line 664 | pixvalue(              /* compute pixel value */
664   {
665          RAY  thisray;
666          FVECT   lorg, ldir;
667 <        double  hpos, vpos, lmax;
667 >        double  hpos, vpos, vdist, lmax;
668 >        register int    i;
669                                                  /* compute view ray */
670          hpos = (x+pixjitter())/hres;
671          vpos = (y+pixjitter())/vres;
# Line 671 | Line 674 | pixvalue(              /* compute pixel value */
674                  setcolor(col, 0.0, 0.0, 0.0);
675                  return(0.0);
676          }
677 +        vdist = ourview.vdist;
678  
679          samplendx = pixnumber(x,y,hres,vres);   /* set pixel index */
680  
681                                                  /* optional motion blur */
682          if (lastview.type && mblur > FTINY && (lmax = viewray(lorg, ldir,
683                                          &lastview, hpos, vpos)) >= -FTINY) {
680                register int    i;
684                  register double  d = mblur*(.5-urand(281+samplendx));
685  
686                  thisray.rmax = (1.-d)*thisray.rmax + d*lmax;
# Line 687 | Line 690 | pixvalue(              /* compute pixel value */
690                  }
691                  if (normalize(thisray.rdir) == 0.0)
692                          return(0.0);
693 +                vdist = (1.-d)*vdist + d*lastview.vdist;
694          }
695 +                                                /* optional depth-of-field */
696 +        if (dblur > FTINY && vdist > FTINY) {
697 +                double  vc, dfh, dfv;
698 +                                                /* PI/4. square/circle conv. */
699 +                dfh = PI/4.*dblur*(.5 - frandom());
700 +                dfv = PI/4.*dblur*(.5 - frandom());
701 +                if (ourview.type == VT_PER || ourview.type == VT_PAR) {
702 +                        dfh /= sqrt(ourview.hn2);
703 +                        dfv /= sqrt(ourview.vn2);
704 +                        for (i = 3; i--; ) {
705 +                                vc = thisray.rorg[i] + vdist*thisray.rdir[i];
706 +                                thisray.rorg[i] += dfh*ourview.hvec[i] +
707 +                                                        dfv*ourview.vvec[i] ;
708 +                                thisray.rdir[i] = vc - thisray.rorg[i];
709 +                        }
710 +                } else {                        /* non-standard view case */
711 +                        double  dfd = PI/4.*dblur*(.5 - frandom());
712 +                        if (ourview.type != VT_ANG) {
713 +                                if (ourview.type != VT_CYL)
714 +                                        dfh /= sqrt(ourview.hn2);
715 +                                dfv /= sqrt(ourview.vn2);
716 +                        }
717 +                        for (i = 3; i--; ) {
718 +                                vc = thisray.rorg[i] + vdist*thisray.rdir[i];
719 +                                thisray.rorg[i] += dfh*ourview.hvec[i] +
720 +                                                        dfv*ourview.vvec[i] +
721 +                                                        dfd*ourview.vdir[i] ;
722 +                                thisray.rdir[i] = vc - thisray.rorg[i];
723 +                        }
724 +                }
725 +                if (normalize(thisray.rdir) == 0.0)
726 +                        return(0.0);
727 +        }
728  
729 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
729 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
730  
731          rayvalue(&thisray);                     /* trace ray */
732  
# Line 758 | Line 795 | writerr:
795          error(SYSTEM, errmsg);
796          return -1; /* pro forma return */
797   }
761
798  
799   static int
800   pixnumber(              /* compute pixel index (brushed) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines