ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rv3.c
(Generate patch)

Comparing ray/src/rt/rv3.c (file contents):
Revision 2.22 by greg, Thu Aug 21 07:05:59 2008 UTC vs.
Revision 2.25 by greg, Thu Aug 28 23:50:39 2008 UTC

# Line 25 | Line 25 | static const char      RCSid[] = "$Id$";
25   #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
26   #endif
27  
28 + static unsigned long  niflush;          /* flushes since newimage() */
29  
30   int
31   getrect(                                /* get a box */
# Line 154 | Line 155 | paint(                 /* compute and paint a rectangle */
155          extern int  ray_pnprocs;
156          static unsigned long  lastflush = 0;
157          static RAY  thisray;
158 +        int     flushintvl;
159          double  h, v;
160  
161          if (p->xmax - p->xmin <= 0 || p->ymax - p->ymin <= 0) { /* empty */
# Line 184 | Line 186 | paint(                 /* compute and paint a rectangle */
186          copycolor(p->v, thisray.rcol);
187          scalecolor(p->v, exposure);
188  
189 <        (*dev->paintr)(greyscale?greyof(p->v):p->v, p->xmin, p->ymin, p->xmax, p->ymax);
189 >        while (p->kid != NULL) {                /* need to propogate down */
190 >                int  mx = (p->xmin + p->xmax) >> 1;
191 >                int  my = (p->ymin + p->ymax) >> 1;
192 >                int  ki;
193 >                if (p->x >= mx)
194 >                        ki = (p->y >= my) ? UR : DR;
195 >                else
196 >                        ki = (p->y >= my) ? UL : DL;
197 >                pcopy(p, p->kid+ki);
198 >                p = p->kid + ki;
199 >        }
200  
201 <        if (dev->flush != NULL && raynum - lastflush >= WFLUSH*ray_pnprocs) {
201 >        (*dev->paintr)(greyscale?greyof(p->v):p->v,
202 >                        p->xmin, p->ymin, p->xmax, p->ymax);
203 >
204 >        if (ambounce <= 0)                      /* shall we check for input? */
205 >                flushintvl = ray_pnprocs*WFLUSH;
206 >        else if (niflush < WFLUSH)
207 >                flushintvl = ray_pnprocs*niflush/(ambounce+1);
208 >        else
209 >                flushintvl = ray_pnprocs*WFLUSH/(ambounce+1);
210 >
211 >        if (dev->flush != NULL && raynum - lastflush >= flushintvl) {
212                  lastflush = raynum;
213                  (*dev->flush)();
214 +                niflush++;
215          }
216          return(1);
217   }
218  
219  
220   int
221 < waitrays(void)                          /* finish up pending rays */
221 > waitrays(void)                                  /* finish up pending rays */
222   {
223          int     nwaited = 0;
224          int     rval;
# Line 249 | Line 272 | newimage(                                      /* start a new image */
272                  ray_popen(nproc);
273                  newparam = 0;
274          }
275 <                                                /* get first value */
275 >        niflush = 0;                            /* get first value */
276          paint(&ptrunk);
277   }
278  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines