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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.32 by gwlarson, Thu Aug 6 10:30:38 1998 UTC vs.
Revision 2.33 by gwlarson, Tue Sep 15 09:52:39 1998 UTC

# Line 44 | Line 44 | OBJREC  Aftplane;                      /* aft clipping plane object */
44  
45   static int  raymove(), checkset(), checkhit();
46  
47 < #define  MAXLOOP        128             /* modifier loop detection */
47 > #ifndef  MAXLOOP
48 > #define  MAXLOOP        0               /* modifier loop detection */
49 > #endif
50  
51   #define  RAYHIT         (-1)            /* return value for intercepted ray */
52  
# Line 160 | Line 162 | rayshade(r, mod)               /* shade ray r with material mod */
162   register RAY  *r;
163   int  mod;
164   {
163        static int  depth = 0;
165          int  gotmat;
166          register OBJREC  *m;
167 + #if  MAXLOOP
168 +        static int  depth = 0;
169                                          /* check for infinite loop */
170          if (depth++ >= MAXLOOP)
171                  objerror(r->ro, USER, "possible modifier loop");
172 + #endif
173          r->rt = r->rot;                 /* set effective ray length */
174          for (gotmat = 0; !gotmat && mod != OVOID; mod = m->omod) {
175                  m = objptr(mod);
# Line 178 | Line 182 | int  mod;
182                                          /* hack for irradiance calculation */
183                  if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS))) {
184                          if (irr_ignore(m->otype)) {
185 + #if  MAXLOOP
186                                  depth--;
187 + #endif
188                                  raytrans(r);
189                                  return(1);
190                          }
# Line 188 | Line 194 | int  mod;
194                                          /* materials call raytexture */
195                  gotmat = (*ofun[m->otype].funp)(m, r);
196          }
197 + #if  MAXLOOP
198          depth--;
199 + #endif
200          return(gotmat);
201   }
202  
# Line 228 | Line 236 | raytexture(r, mod)                     /* get material modifiers */
236   RAY  *r;
237   int  mod;
238   {
231        static int  depth = 0;
239          register OBJREC  *m;
240 + #if  MAXLOOP
241 +        static int  depth = 0;
242                                          /* check for infinite loop */
243          if (depth++ >= MAXLOOP)
244                  objerror(r->ro, USER, "modifier loop");
245 + #endif
246                                          /* execute textures and patterns */
247          for ( ; mod != OVOID; mod = m->omod) {
248                  m = objptr(mod);
# Line 248 | Line 258 | int  mod;
258                          objerror(r->ro, USER, errmsg);
259                  }
260          }
261 + #if  MAXLOOP
262          depth--;                        /* end here */
263 + #endif
264   }
265  
266  
# Line 277 | Line 289 | double  coef;
289                  backmat = rayshade(&br, back);
290                                          /* check for transparency */
291          if (backmat ^ foremat)
292 <                if (!foremat && coef > FTINY)
292 >                if (backmat && coef > FTINY)
293                          raytrans(&fr);
294 <                else if (!backmat && coef < 1.0-FTINY)
294 >                else if (foremat && coef < 1.0-FTINY)
295                          raytrans(&br);
296                                          /* mix perturbations */
297          for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines