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.23 by greg, Thu Aug 21 16:13:00 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 int  niflush;                    /* flushes since newimage() */
28 > static unsigned long  niflush;          /* flushes since newimage() */
29  
30   int
31   getrect(                                /* get a box */
# Line 155 | 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 185 | Line 186 | paint(                 /* compute and paint a rectangle */
186          copycolor(p->v, thisray.rcol);
187          scalecolor(p->v, exposure);
188  
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          (*dev->paintr)(greyscale?greyof(p->v):p->v,
202                          p->xmin, p->ymin, p->xmax, p->ymax);
203  
204 <        if (dev->flush != NULL && raynum - lastflush >= ray_pnprocs *
205 <                        (ambounce > 0 && niflush < WFLUSH ? niflush : WFLUSH)) {
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++;
# Line 199 | Line 218 | paint(                 /* compute and paint a rectangle */
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines