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

Comparing ray/src/ot/oconv.c (file contents):
Revision 2.12 by greg, Sat Feb 22 02:07:26 2003 UTC vs.
Revision 2.13 by greg, Wed Mar 12 04:59:04 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  oconv.c - main program for object to octree conversion.
# Line 208 | Line 208 | addobject(cu, obj)                     /* add an object to a cube */
208   register CUBE  *cu;
209   OBJECT  obj;
210   {
211 <        CUBE  cukid;
212 <        OCTREE  ot;
213 <        OBJECT  oset[MAXSET+1];
214 <        unsigned char  inflg[(MAXSET+7)/8], volflg[(MAXSET+7)/8];
215 <        int  in;
216 <        register int  i, j;
211 >        int  inc;
212  
213 <        in = (*ofun[objptr(obj)->otype].funp)(objptr(obj), cu);
213 >        inc = (*ofun[objptr(obj)->otype].funp)(objptr(obj), cu);
214  
215 <        if (in == O_MISS)
215 >        if (inc == O_MISS)
216                  return;                         /* no intersection */
217  
218          if (istree(cu->cutree)) {
219 <                                                /* do children */
219 >                CUBE  cukid;                    /* do children */
220 >                int  i, j;
221                  cukid.cusize = cu->cusize * 0.5;
222                  for (i = 0; i < 8; i++) {
223                          cukid.cutree = octkid(cu->cutree, i);
# Line 236 | Line 232 | OBJECT obj;
232                  return;
233          }
234          if (isempty(cu->cutree)) {
235 <                                                /* singular set */
235 >                OBJECT  oset[2];                /* singular set */
236                  oset[0] = 1; oset[1] = obj;
237                  cu->cutree = fullnode(oset);
238                  return;
239          }
240                                          /* add to full node */
241 +        add2full(cu, obj, inc);
242 + }
243 +
244 +
245 + add2full(cu, obj, inc)                  /* add object to full node */
246 + register CUBE  *cu;
247 + OBJECT  obj;
248 + int  inc;
249 + {
250 +        OCTREE  ot;
251 +        OBJECT  oset[MAXSET+1];
252 +        CUBE  cukid;
253 +        unsigned char  inflg[(MAXSET+7)/8], volflg[(MAXSET+7)/8];
254 +        register int  i, j;
255 +
256          objset(oset, cu->cutree);
257          cukid.cusize = cu->cusize * 0.5;
258  
259 <        if (in==O_IN || oset[0] < objlim || cukid.cusize < mincusize) {
259 >        if (inc==O_IN || oset[0] < objlim || cukid.cusize < mincusize) {
260                                                  /* add to set */
261                  if (oset[0] >= MAXSET) {
262                          sprintf(errmsg, "set overflow in addobject (%s)",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines