310 |
|
double prob, ourthresh, hwt, test2, hit2; |
311 |
|
RAY sr; |
312 |
|
|
313 |
+ |
if (nsources <= 0) |
314 |
+ |
return; |
315 |
|
srccnt = (CONTRIB *)malloc(nsources*sizeof(CONTRIB)); |
316 |
|
cntord = (CNTPTR *)malloc(nsources*sizeof(CNTPTR)); |
317 |
|
if (srccnt == NULL || cntord == NULL) |
340 |
|
(source[sn].so, &sr) )) |
341 |
|
continue; |
342 |
|
/* compute contribution */ |
343 |
< |
rayshade(&sr, sr.ro->omod); |
343 |
> |
raycont(&sr); |
344 |
|
multcolor(srccnt[sn].val, sr.rcol); |
345 |
|
cntord[sn].brt = bright(srccnt[sn].val); |
346 |
|
} |
378 |
|
/* test for hit */ |
379 |
|
rayorigin(&sr, r, SHADOW, 1.0); |
380 |
|
VCOPY(sr.rdir, srccnt[cntord[sn].sno].dir); |
381 |
+ |
sr.rsrc = cntord[sn].sno; |
382 |
|
if (localhit(&sr, &thescene) && |
383 |
|
sr.ro != source[cntord[sn].sno].so) { |
384 |
|
/* check for transmission */ |
385 |
< |
if (sr.clipset != NULL && inset(sr.clipset, sr.ro->omod)) |
383 |
< |
raytrans(&sr); |
384 |
< |
else |
385 |
< |
rayshade(&sr, sr.ro->omod); |
385 |
> |
raycont(&sr); |
386 |
|
if (bright(sr.rcol) <= FTINY) |
387 |
|
continue; /* missed! */ |
388 |
|
(*f)(srccnt[cntord[sn].sno].val, p, |
397 |
|
} |
398 |
|
/* weighted hit rate */ |
399 |
|
hwt = hit2 / test2; |
400 |
< |
#ifdef notdef |
400 |
> |
#ifdef DEBUG |
401 |
|
sprintf(errmsg, "%d tested, %d untested, %f hit rate\n", |
402 |
|
sn, ncnts-sn, hwt); |
403 |
|
eputs(errmsg); |
410 |
|
addcolor(r->rcol, srccnt[cntord[sn].sno].val); |
411 |
|
} |
412 |
|
|
413 |
< |
free(srccnt); |
414 |
< |
free(cntord); |
413 |
> |
free((char *)srccnt); |
414 |
> |
free((char *)cntord); |
415 |
|
} |
416 |
|
|
417 |
|
|
455 |
|
m->oargs.farg[2]); |
456 |
|
/* modify value */ |
457 |
|
multcolor(r->rcol, r->pcol); |
458 |
+ |
/* assign distance */ |
459 |
+ |
r->rt = r->rot; |
460 |
|
} |
461 |
|
} |
462 |
|
|