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 |
|
|
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); |
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 |
|
} |
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 |
|
|
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); |
258 |
|
objerror(r->ro, USER, errmsg); |
259 |
|
} |
260 |
|
} |
261 |
+ |
#if MAXLOOP |
262 |
|
depth--; /* end here */ |
263 |
+ |
#endif |
264 |
|
} |
265 |
|
|
266 |
|
|
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++) |