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.13 by gregl, Wed Dec 24 10:50:49 1997 UTC vs.
Revision 3.14 by gregl, Mon Dec 29 17:31:45 1997 UTC

# Line 34 | Line 34 | struct rleaves qtL;            /* our pile of leaves */
34   static RTREE    **twigbundle;   /* free twig blocks (NULL term.) */
35   static int      nexttwig;       /* next free twig */
36  
37 #define ungetleaf(li)   (qtL.tl=(li))   /* dangerous if used improperly */
37  
39
38   static RTREE *
39   newtwig()                       /* allocate a twig */
40   {
# Line 89 | Line 87 | int    really;
87   }
88  
89  
92 static int
93 newleaf()                       /* allocate a leaf from our pile */
94 {
95        int     li;
96        
97        li = qtL.tl++;
98        if (qtL.tl >= qtL.nl)   /* get next leaf in ring */
99                qtL.tl = 0;
100        if (qtL.tl == qtL.bl)   /* need to shake some free */
101                qtCompost(LFREEPCT);
102        return(li);
103 }
104
105
90   #define LEAFSIZ         (3*sizeof(float)+sizeof(int4)+\
91                          sizeof(TMbright)+6*sizeof(BYTE))
92  
# Line 328 | Line 312 | FVECT  p, v;
312   {
313          register int    li;
314  
315 <        li = newleaf();
315 >        li = qtL.tl++;
316 >        if (qtL.tl >= qtL.nl)   /* advance to next leaf in ring */
317 >                qtL.tl = 0;
318 >        if (qtL.tl == qtL.bl)   /* need to shake some free */
319 >                qtCompost(LFREEPCT);
320          VCOPY(qtL.wp[li], p);
321          qtL.wd[li] = encodedir(v);
322          tmCvColrs(&qtL.brt[li], qtL.chr[li], c, 1);
323          if (!addleaf(li))
324 <                ungetleaf(li);
324 >                qtL.tl = li;    /* unget this leaf */
325   }
326  
327  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines