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 1.7 by greg, Fri Jan 12 10:50:59 1990 UTC vs.
Revision 1.10 by greg, Wed Aug 29 13:01:16 1990 UTC

# Line 179 | Line 179 | char  *s;
179   eputs(s)                                /* put string to stderr */
180   register char  *s;
181   {
182 <        static int  inline = 0;
182 >        static int  inln = 0;
183  
184 <        if (!inline++) {
184 >        if (!inln++) {
185                  fputs(progname, stderr);
186                  fputs(": ", stderr);
187          }
188          fputs(s, stderr);
189          if (*s && s[strlen(s)-1] == '\n')
190 <                inline = 0;
190 >                inln = 0;
191   }
192  
193  
# Line 195 | Line 195 | addobject(cu, obj)                     /* add an object to a cube */
195   register CUBE  *cu;
196   OBJECT  obj;
197   {
198 + #define nexti(n)  ((ndx += cnt*cnt++)%(n))
199 +        static unsigned long  ndx;
200 +        static unsigned int  cnt;
201          CUBE  cukid;
202          OCTREE  ot;
203          OBJECT  oset[MAXSET+1];
204 <        int  in;
204 >        int  in, k;
205          register int  i, j;
206  
207          in = (*ofun[objptr(obj)->otype].funp)(objptr(obj), cu);
# Line 252 | Line 255 | OBJECT  obj;
255                                          if ((1<<j) & i)
256                                                  cukid.cuorg[j] += cukid.cusize;
257                                  }
258 <                                addobject(&cukid, obj);
258 >                                                        /* surfaces first */
259                                  for (j = 1; j <= oset[0]; j++)
260 <                                        addobject(&cukid, oset[j]);
260 >                                        if (!isvolume(objptr(oset[j])->otype))
261 >                                                addobject(&cukid, oset[j]);
262 >                                                        /* then this object */
263 >                                addobject(&cukid, obj);
264 >                                                        /* volumes last */
265 >                                k = nexti(oset[0]);     /* random start */
266 >                                for (j = k+1; j <= oset[0]; j++)
267 >                                        if (isvolume(objptr(oset[j])->otype))
268 >                                                addobject(&cukid, oset[j]);
269 >                                for (j = 1; j <= k; j++)
270 >                                        if (isvolume(objptr(oset[j])->otype))
271 >                                                addobject(&cukid, oset[j]);
272                                  octkid(ot, i) = cukid.cutree;
273                          }
274                          cu->cutree = ot;
275                  }
276          }
277 + #undef nexti
278   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines