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

Comparing ray/src/hd/rhd_qtree.c (file contents):
Revision 3.15 by gregl, Tue Dec 30 17:08:37 1997 UTC vs.
Revision 3.17 by gregl, Thu Jan 1 13:00:15 1998 UTC

# Line 29 | Line 29 | double qtDepthEps = .05;       /* epsilon to compare depths
29   int     qtMinNodesiz = 2;       /* minimum node dimension (pixels) */
30   struct rleaves  qtL;            /* our pile of leaves */
31  
32 + int     rayqleft = 0;           /* rays left to queue before flush */
33 +
34   static int4     falleaves;      /* our list of fallen leaves */
35  
36   #define composted(li)   (qtL.bl <= qtL.tl ? \
# Line 318 | Line 320 | int    drop;
320                  tp->k[q].li = lo;
321          }
322   dropit:
323 <        if (drop) {
324 <                qtL.chr[li][0] = qtL.chr[li][1] = qtL.chr[li][2] = 0;
325 <                qtL.wd[li] = falleaves;
326 <                falleaves = li;
327 <        }
323 >        if (drop)
324 >                if (li+1 == (qtL.tl ? qtL.tl : qtL.nl))
325 >                        qtL.tl = li;            /* special case */
326 >                else {
327 >                        qtL.chr[li][0] = qtL.chr[li][1] = qtL.chr[li][2] = 0;
328 >                        qtL.wd[li] = falleaves;
329 >                        falleaves = li;
330 >                }
331          return(li == lo);
332   }
333  
# Line 334 | Line 339 | FVECT  p, v;
339          register int    li;
340          int     mapit;
341                                  /* grab a leaf */
342 <        if (falleaves >= 0) {           /* check for fallen leaves */
342 >        if (!imm_mode && falleaves >= 0) {      /* check for fallen leaves */
343                  li = falleaves;
344                  falleaves = qtL.wd[li];
345                  mapit = qtL.tml <= qtL.tl ?
346                                  (li < qtL.tml || li >= qtL.tl) :
347                                  (li < qtL.tml && li >= qtL.tl) ;
348 <        } else {                        /* else allocate new one */
348 >        } else {                                /* else allocate new one */
349                  li = qtL.tl++;
350 <                if (qtL.tl >= qtL.nl)   /* advance to next leaf in ring */
350 >                if (qtL.tl >= qtL.nl)           /* next leaf in ring */
351                          qtL.tl = 0;
352 <                if (qtL.tl == qtL.bl)   /* need to shake some free */
352 >                if (qtL.tl == qtL.bl)           /* need to shake some free */
353                          qtCompost(LFREEPCT);
354 <                mapit = 0;              /* we'll map it later */
354 >                mapit = 0;                      /* we'll map it later */
355          }
356          VCOPY(qtL.wp[li], p);
357          qtL.wd[li] = encodedir(v);
358          tmCvColrs(&qtL.brt[li], qtL.chr[li], c, 1);
359 <        if (putleaf(li, 1) && mapit)
360 <                tmMapPixels(qtL.rgb+li, qtL.brt+li, qtL.chr+li, 1);
359 >        if (putleaf(li, 1)) {
360 >                if (mapit)
361 >                        tmMapPixels(qtL.rgb+li, qtL.brt+li, qtL.chr+li, 1);
362 >                if (--rayqleft == 0)
363 >                        dev_flush();            /* flush output */
364 >        }
365   }
366  
367  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines