| 11 |
|
|
| 12 |
|
#include "ray.h" |
| 13 |
|
#include "view.h" |
| 14 |
+ |
#include "otypes.h" |
| 15 |
|
#include "source.h" |
| 16 |
|
|
| 17 |
|
|
| 374 |
|
} |
| 375 |
|
/* loop through all sources */ |
| 376 |
|
for (i = nsources; i--; ) { |
| 377 |
+ |
/* skip illum's */ |
| 378 |
+ |
if (findmaterial(source[i].so)->otype == MAT_ILLUM) |
| 379 |
+ |
continue; |
| 380 |
|
/* compute image polygon for source */ |
| 381 |
|
if (!(nsv = sourcepoly(i, spoly))) |
| 382 |
|
continue; |
| 448 |
|
if (source[sp->sn].sflags & SSPOT && |
| 449 |
|
spotout(&sr, source[sp->sn].sl.s)) |
| 450 |
|
continue; /* outside spot */ |
| 451 |
< |
w = poly_area(ppoly, npv) * hres * vres; |
| 452 |
< |
if (w < .95) { /* subpixel source */ |
| 449 |
< |
rayorigin(&sr, NULL, SHADOW, 1.0); |
| 450 |
< |
sr.rsrc = sp->sn; |
| 451 |
< |
} else |
| 452 |
< |
rayorigin(&sr, NULL, PRIMARY, 1.0); |
| 451 |
> |
rayorigin(&sr, NULL, SHADOW, 1.0); |
| 452 |
> |
sr.rsrc = sp->sn; |
| 453 |
|
rayvalue(&sr); /* compute value */ |
| 454 |
|
if (bright(sr.rcol) <= FTINY) |
| 455 |
|
continue; /* missed/blocked */ |
| 456 |
|
/* modify pixel */ |
| 457 |
+ |
w = poly_area(ppoly, npv) * hres * vres; |
| 458 |
|
if (zbf[y-y0] != NULL && |
| 459 |
< |
sr.rt < 0.99*zbf[y-y0][x-x0]) |
| 459 |
> |
sr.rt < 0.99*zbf[y-y0][x-x0]) { |
| 460 |
|
zbf[y-y0][x-x0] = sr.rt; |
| 461 |
< |
else if (!bigdiff(sr.rcol, pic[y-y0][x-x0], |
| 462 |
< |
0.01)) /* source sample */ |
| 461 |
> |
} else if (!bigdiff(sr.rcol, pic[y-y0][x-x0], |
| 462 |
> |
0.01)) { /* source sample */ |
| 463 |
|
scalecolor(pic[y-y0][x-x0], w); |
| 464 |
< |
else { |
| 464 |
< |
scalecolor(sr.rcol, w); |
| 465 |
< |
scalecolor(pic[y-y0][x-x0], 1.-w); |
| 466 |
< |
addcolor(pic[y-y0][x-x0], sr.rcol); |
| 464 |
> |
continue; |
| 465 |
|
} |
| 466 |
+ |
scalecolor(sr.rcol, w); |
| 467 |
+ |
scalecolor(pic[y-y0][x-x0], 1.-w); |
| 468 |
+ |
addcolor(pic[y-y0][x-x0], sr.rcol); |
| 469 |
|
} |
| 470 |
|
} |
| 471 |
|
} |