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.16 by schorsch, Sun Jun 8 12:03:10 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 8 | Line 8 | static const char      RCSid[] = "$Id$";
8   */
9  
10   #include  "standard.h"
11 <
11 > #include  "platform.h"
12   #include  "octree.h"
13
13   #include  "object.h"
15
14   #include  "otypes.h"
17
15   #include  "paths.h"
16  
17   #define  OMARGIN        (10*FTINY)      /* margin around global cube */
# Line 25 | Line 22 | char  *progname;                       /* argv[0] */
22  
23   int  nowarn = 0;                        /* supress warnings? */
24  
25 < int  objlim = 5;                        /* # of objects before split */
25 > int  objlim = 6;                        /* # of objects before split */
26  
27 < int  resolu = 8192;                     /* octree resolution limit */
27 > int  resolu = 16384;                    /* octree resolution limit */
28  
29   CUBE  thescene = {EMPTY, {0.0, 0.0, 0.0}, 0.0};         /* our scene */
30  
# Line 85 | Line 82 | char  *argv[];
82                          break;
83                  }
84   breakopt:
85 < #ifdef MSDOS
89 <        setmode(fileno(stdout), O_BINARY);
90 < #endif
85 >        SET_FILE_BINARY(stdout);
86          if (infile != NULL) {           /* get old octree & objects */
87                  if (thescene.cusize > FTINY)
88                          error(USER, "only one of '-b' or '-i'");
# Line 208 | Line 203 | addobject(cu, obj)                     /* add an object to a cube */
203   register CUBE  *cu;
204   OBJECT  obj;
205   {
206 <        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;
206 >        int  inc;
207  
208 <        in = (*ofun[objptr(obj)->otype].funp)(objptr(obj), cu);
208 >        inc = (*ofun[objptr(obj)->otype].funp)(objptr(obj), cu);
209  
210 <        if (in == O_MISS)
210 >        if (inc == O_MISS)
211                  return;                         /* no intersection */
212  
213          if (istree(cu->cutree)) {
214 <                                                /* do children */
214 >                CUBE  cukid;                    /* do children */
215 >                int  i, j;
216                  cukid.cusize = cu->cusize * 0.5;
217                  for (i = 0; i < 8; i++) {
218                          cukid.cutree = octkid(cu->cutree, i);
# Line 236 | Line 227 | OBJECT obj;
227                  return;
228          }
229          if (isempty(cu->cutree)) {
230 <                                                /* singular set */
230 >                OBJECT  oset[2];                /* singular set */
231                  oset[0] = 1; oset[1] = obj;
232                  cu->cutree = fullnode(oset);
233                  return;
234          }
235                                          /* add to full node */
236 +        add2full(cu, obj, inc);
237 + }
238 +
239 +
240 + add2full(cu, obj, inc)                  /* add object to full node */
241 + register CUBE  *cu;
242 + OBJECT  obj;
243 + int  inc;
244 + {
245 +        OCTREE  ot;
246 +        OBJECT  oset[MAXSET+1];
247 +        CUBE  cukid;
248 +        unsigned char  inflg[(MAXSET+7)/8], volflg[(MAXSET+7)/8];
249 +        register int  i, j;
250 +
251          objset(oset, cu->cutree);
252          cukid.cusize = cu->cusize * 0.5;
253  
254 <        if (in==O_IN || oset[0] < objlim || cukid.cusize < mincusize) {
254 >        if (inc==O_IN || oset[0] < objlim || cukid.cusize < mincusize) {
255                                                  /* add to set */
256                  if (oset[0] >= MAXSET) {
257                          sprintf(errmsg, "set overflow in addobject (%s)",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines