68 |
|
r->gecc = seccg; |
69 |
|
r->slights = NULL; |
70 |
|
} else { /* spawned ray */ |
71 |
< |
if (ro->rot >= FHUGE) { |
71 |
> |
if (ro->rot >= FHUGE*.99) { |
72 |
|
memset(r, 0, sizeof(RAY)); |
73 |
|
return(-1); /* illegal continuation */ |
74 |
|
} |
116 |
|
if (photonMapping && rt != TRANS) |
117 |
|
return(-1); |
118 |
|
} |
119 |
< |
if (maxdepth <= 0 && rc != NULL) { /* Russian roulette */ |
119 |
> |
if ((maxdepth <= 0) & (rc != NULL)) { /* Russian roulette */ |
120 |
|
if (minweight <= 0.0) |
121 |
|
error(USER, "zero ray weight in Russian roulette"); |
122 |
< |
if (maxdepth < 0 && r->rlvl > -maxdepth) |
122 |
> |
if ((maxdepth < 0) & (r->rlvl > -maxdepth)) |
123 |
|
return(-1); /* upper reflection limit */ |
124 |
|
if (r->rweight >= minweight) |
125 |
|
return(0); |
130 |
|
r->rweight = minweight; |
131 |
|
return(0); |
132 |
|
} |
133 |
< |
return(r->rweight >= minweight && r->rlvl <= abs(maxdepth) ? 0 : -1); |
133 |
> |
return((r->rweight >= minweight) & (r->rlvl <= abs(maxdepth)) ? 0 : -1); |
134 |
|
} |
135 |
|
|
136 |
|
|
146 |
|
r->ro = NULL; |
147 |
|
r->rox = NULL; |
148 |
|
r->rxt = r->rmt = r->rot = FHUGE; |
149 |
+ |
VCOPY(r->rop, r->rorg); |
150 |
|
r->pert[0] = r->pert[1] = r->pert[2] = 0.0; |
151 |
+ |
r->rflips = 0; |
152 |
|
r->uv[0] = r->uv[1] = 0.0; |
153 |
|
setcolor(r->pcol, 1.0, 1.0, 1.0); |
154 |
|
setcolor(r->mcol, 0.0, 0.0, 0.0); |
231 |
|
int tst_irrad = do_irrad && !(r->crtype & ~(PRIMARY|TRANS)); |
232 |
|
OBJREC *m; |
233 |
|
|
234 |
< |
r->rxt = r->rmt = r->rot; /* preset effective ray length */ |
234 |
> |
r->rxt = r->rot; /* preset effective ray length */ |
235 |
|
for ( ; mod != OVOID; mod = m->omod) { |
236 |
|
m = objptr(mod); |
237 |
|
/****** unnecessary test since modifier() is always called |
405 |
|
int flags |
406 |
|
) |
407 |
|
{ |
408 |
+ |
static int warnedPM = 0; |
409 |
+ |
|
410 |
|
rc[0] = rc[1] = rc[2] = 1.; |
411 |
|
|
412 |
|
while (r != NULL && r->crtype&flags) { |
413 |
|
int i = 3; |
414 |
|
while (i--) |
415 |
|
rc[i] *= colval(r->rcoef,i); |
416 |
+ |
/* check for participating medium */ |
417 |
+ |
if (!warnedPM && (bright(r->cext) > FTINY) | |
418 |
+ |
(bright(r->albedo) > FTINY)) { |
419 |
+ |
error(WARNING, |
420 |
+ |
"ray contribution calculation does not support participating media"); |
421 |
+ |
warnedPM++; |
422 |
+ |
} |
423 |
|
r = r->parent; |
424 |
|
} |
425 |
|
} |
511 |
|
r->pert[0] = -r->pert[0]; |
512 |
|
r->pert[1] = -r->pert[1]; |
513 |
|
r->pert[2] = -r->pert[2]; |
514 |
+ |
r->rflips++; |
515 |
|
} |
516 |
|
|
517 |
|
|