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.95 by greg, Sun Nov 14 17:30:02 2021 UTC vs.
Revision 2.106 by greg, Sat Jan 18 03:49:00 2025 UTC

# Line 48 | Line 48 | static const char RCSid[] = "$Id$";
48   CUBE  thescene;                         /* our scene */
49   OBJECT  nsceneobjs;                     /* number of objects in our scene */
50  
51 + extern RGBPRIMP  out_prims;             /* output color primitives (NULL if spectral) */
52 +
53   int  dimlist[MAXDIM];                   /* sampling dimensions */
54   int  ndims = 0;                         /* number of sampling dimensions */
55   int  samplendx;                         /* sample index number */
# Line 92 | Line 94 | double specjitter = 1.;                /* specular sampling jitter *
94   int  backvis = 1;                       /* back face visibility */
95  
96   int  maxdepth = 7;                      /* maximum recursion depth */
97 < double  minweight = 1e-3;               /* minimum ray weight */
97 > double  minweight = 1e-4;               /* minimum ray weight */
98  
99   char  *ambfile = NULL;                  /* ambient file name */
100   COLOR  ambval = BLKCOLOR;               /* ambient value */
# Line 117 | Line 119 | time_t  tstart;                                /* starting time */
119  
120   int  hres, vres;                        /* resolution for this frame */
121  
122 + extern void     sskip_ray(RAY *r, double h, double v);
123 +
124   static VIEW     lastview;               /* the previous view input */
125  
126   static void report(int);
# Line 340 | Line 344 | rpict(                 /* generate image(s) */
344                  if ((pa < .99) | (pa > 1.01))
345                          fputaspect(pa, stdout);
346                  fputnow(stdout);
347 <                fputprims(stdprims, stdout);
348 <                fputformat(COLRFMT, stdout);
349 <                putchar('\n');
347 >                if (out_prims == xyzprims) {
348 >                        fputformat(CIEFMT, stdout);
349 >                } else {
350 >                        fputprims(out_prims, stdout);
351 >                        fputformat(COLRFMT, stdout);
352 >                }
353 >                putchar('\n');          /* close header */
354                  if (zout != NULL)
355                          sprintf(cp=fbuf, zout, seq);
356                  else
# Line 378 | Line 386 | render(                                /* render the scene */
386          char  *oldfile
387   )
388   {
389 +        const int  srcdrawing =         /* manually draw tiny light sources? */
390 +                (directvis && dblur <= FTINY && (mblur <= FTINY) | !lastview.type);
391          COLOR  *scanbar[MAXDIV+1];      /* scanline arrays of pixel values */
392          float  *zbar[MAXDIV+1];         /* z values */
393          char  *sampdens;                /* previous sample density */
# Line 444 | Line 454 | render(                                /* render the scene */
454          signal(SIGCONT, report);
455   #endif
456          ypos = vres-1 - i;                      /* initialize sampling */
457 <        if (directvis)
457 >        if (srcdrawing)
458                  init_drawsources(psample);
459          fillscanline(scanbar[0], zbar[0], sampdens, hres, ypos, hstep);
460                                                  /* compute scanlines */
# Line 465 | Line 475 | render(                                /* render the scene */
475                                  hres, ypos, hstep);
476                                                          /* fill bar */
477                  fillscanbar(scanbar, zbar, hres, ypos, ystep);
478 <                if (directvis)                          /* add bitty sources */
479 <                        drawsources(scanbar, zbar, 0, hres, ypos, ystep);
478 >                if (srcdrawing)                         /* add bitty sources */
479 >                        drawsources((COLORV **)scanbar, out_prims, zbar, 0, hres, ypos, ystep);
480                                                          /* write it out */
481   #ifdef SIGCONT
482                  signal(SIGCONT, SIG_IGN);       /* don't interrupt writes */
# Line 660 | Line 670 | pixvalue(              /* compute pixel value */
670          int  y
671   )
672   {
663        extern void  SDsquare2disk(double ds[2], double seedx, double seedy);
673          RAY  thisray;
674          FVECT   lorg, ldir;
675 <        double  hpos, vpos, vdist, lmax;
675 >        double  hpos, vpos, lmax;
676          int     i;
677                                                  /* compute view ray */
678          setcolor(col, 0.0, 0.0, 0.0);
# Line 672 | Line 681 | pixvalue(              /* compute pixel value */
681          if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir,
682                                          &ourview, hpos, vpos)) < -FTINY)
683                  return(0.0);
675
676        vdist = ourview.vdist;
684                                                  /* set pixel index */
685          samplendx = pixnumber(x,y,hres,vres);
686                                                  /* optional motion blur */
# Line 688 | Line 695 | pixvalue(              /* compute pixel value */
695                  }
696                  if (normalize(thisray.rdir) == 0.0)
697                          return(0.0);
691                vdist = (1.-d)*vdist + d*lastview.vdist;
698          }
699 <                                                /* optional depth-of-field */
700 <        if (dblur > FTINY) {
701 <                double  vc, df[2];
696 <                                                /* random point on disk */
697 <                SDsquare2disk(df, frandom(), frandom());
698 <                df[0] *= .5*dblur;
699 <                df[1] *= .5*dblur;
700 <                if ((ourview.type == VT_PER) | (ourview.type == VT_PAR)) {
701 <                        double  adj = 1.0;
702 <                        if (ourview.type == VT_PER)
703 <                                adj /= DOT(thisray.rdir, ourview.vdir);
704 <                        df[0] /= sqrt(ourview.hn2);
705 <                        df[1] /= sqrt(ourview.vn2);
706 <                        for (i = 3; i--; ) {
707 <                                vc = ourview.vp[i] + adj*vdist*thisray.rdir[i];
708 <                                thisray.rorg[i] += df[0]*ourview.hvec[i] +
709 <                                                        df[1]*ourview.vvec[i] ;
710 <                                thisray.rdir[i] = vc - thisray.rorg[i];
711 <                        }
712 <                } else {                        /* non-standard view case */
713 <                        double  dfd = PI/4.*dblur*(.5 - frandom());
714 <                        if ((ourview.type != VT_ANG) & (ourview.type != VT_PLS)) {
715 <                                if (ourview.type != VT_CYL)
716 <                                        df[0] /= sqrt(ourview.hn2);
717 <                                df[1] /= sqrt(ourview.vn2);
718 <                        }
719 <                        for (i = 3; i--; ) {
720 <                                vc = ourview.vp[i] + vdist*thisray.rdir[i];
721 <                                thisray.rorg[i] += df[0]*ourview.hvec[i] +
722 <                                                        df[1]*ourview.vvec[i] +
723 <                                                        dfd*ourview.vdir[i] ;
724 <                                thisray.rdir[i] = vc - thisray.rorg[i];
725 <                        }
726 <                }
727 <                if (normalize(thisray.rdir) == 0.0)
728 <                        return(0.0);
729 <        }
699 >                                                /* depth-of-field */
700 >        if (!jitteraperture(thisray.rorg, thisray.rdir, &ourview, dblur))
701 >                return(0.0);
702  
703          rayorigin(&thisray, PRIMARY, NULL, NULL);
704  
705          rayvalue(&thisray);                     /* trace ray */
706 <
707 <        copycolor(col, thisray.rcol);           /* return color */
706 >                                                /* -> color */
707 >        scolor_out(col, out_prims, thisray.rcol);
708  
709          return(raydistance(&thisray));          /* return distance */
710   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines