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.29 by greg, Tue Sep 16 18:35:56 2008 UTC vs.
Revision 2.33 by greg, Fri Oct 8 20:41:04 2010 UTC

# Line 29 | Line 29 | static const char      RCSid[] = "$Id$";
29   #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
30   #endif
31  
32 < static unsigned long  niflush;          /* flushes since newimage() */
32 > static RNUMBER  niflush;                /* flushes since newimage() */
33  
34   int
35   getrect(                                /* get a box */
# Line 197 | Line 197 | paint(                 /* compute and paint a rectangle */
197          } else {                                /* queuing mode */
198                  int     rval;
199                  rayorigin(&thisray, PRIMARY, NULL, NULL);
200 <                thisray.rno = (unsigned long)p;
200 >                thisray.rno = (RNUMBER)p;
201                  rval = ray_pqueue(&thisray);
202                  if (!rval)
203                          return(0);
204                  if (rval < 0)
205                          return(-1);
206 +                                                /* random color place holder */
207 +                setcolor(p->v, frandom(), frandom(), frandom());
208 +                                                /* get node for returned ray */
209                  p = (PNODE *)thisray.rno;
210          }
211  
# Line 212 | Line 215 | paint(                 /* compute and paint a rectangle */
215          recolor(p);                             /* paint it */
216  
217          if (dev->flush != NULL) {               /* shall we check for input? */
218 <                static unsigned long    lastflush = 0;
219 <                unsigned long           counter = raynum;
220 <                int                     flushintvl;
218 >                static RNUMBER  lastflush = 0;
219 >                RNUMBER         counter = raynum;
220 >                int             flushintvl;
221                  if (nproc == 1) {
222                          counter = nrays;
223                          flushintvl = WFLUSH1;
# Line 224 | Line 227 | paint(                 /* compute and paint a rectangle */
227                          flushintvl = nproc*niflush/(ambounce+1);
228                  else
229                          flushintvl = nproc*WFLUSH/(ambounce+1);
230 +                if (lastflush > counter)
231 +                        lastflush = 0;          /* counter wrapped */
232  
233                  if (counter - lastflush >= flushintvl) {
234                          lastflush = counter;
# Line 242 | Line 247 | waitrays(void)                                 /* finish up pending rays */
247          int     rval;
248          RAY     raydone;
249  
250 <        if (nproc == 1)                         /* immediate mode? */
250 >        if (nproc <= 1)                         /* immediate mode? */
251                  return(0);
252          while ((rval = ray_presult(&raydone, 0)) > 0) {
253                  PNODE  *p = (PNODE *)raydone.rno;
# Line 265 | Line 270 | newimage(                                      /* start a new image */
270          extern int      ray_pnprocs;
271          int             newnp;
272                                                  /* change in nproc? */
273 <        if (s != NULL && sscanf(s, "%d", &newnp) == 1 && newnp > 0) {
273 >        if (s != NULL && sscanf(s, "%d", &newnp) == 1 &&
274 >                        (newnp > 0) & (newnp != nproc)) {
275                  if (!newparam) {
270                        if (nproc == 1)
271                                nproc = 0;      /* actually running */
276                          if (newnp == 1)
277                                  ray_pclose(0);
278 <                        else if (newnp < nproc)
279 <                                ray_pclose(nproc - newnp);
278 >                        else if (newnp < ray_pnprocs)
279 >                                ray_pclose(ray_pnprocs - newnp);
280                          else
281 <                                ray_popen(newnp - nproc);
281 >                                ray_popen(newnp - ray_pnprocs);
282                  }
283                  nproc = newnp;
284          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines