| 11 |
|
|
| 12 |
|
#include "ray.h" |
| 13 |
|
#include "view.h" |
| 14 |
+ |
#include "otypes.h" |
| 15 |
|
#include "source.h" |
| 16 |
|
|
| 17 |
|
|
| 300 |
|
register int i, j; |
| 301 |
|
|
| 302 |
|
if (s->sflags & (SDISTANT|SFLAT)) { |
| 303 |
< |
if (s->sflags & SDISTANT && ourview.type == VT_PAR) |
| 304 |
< |
return(0); /* all or nothing case */ |
| 303 |
> |
if (s->sflags & SDISTANT) { |
| 304 |
> |
if (ourview.type == VT_PAR) |
| 305 |
> |
return(0); /* all or nothing case */ |
| 306 |
> |
if (s->srad >= 0.05) |
| 307 |
> |
return(0); /* should never be a problem */ |
| 308 |
> |
} |
| 309 |
|
if (s->sflags & SFLAT) { |
| 310 |
|
for (i = 0; i < 3; i++) |
| 311 |
|
ap[i] = s->sloc[i] - ourview.vp[i]; |
| 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 */ |
| 445 |
< |
rayorigin(&sr, NULL, SHADOW, 1.0); |
| 446 |
< |
sr.rsrc = sp->sn; |
| 447 |
< |
} else |
| 448 |
< |
rayorigin(&sr, NULL, PRIMARY, 1.0); |
| 451 |
> |
rayorigin(&sr, SHADOW, NULL, NULL); |
| 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 */ |
| 463 |
< |
setcolor(pic[y-y0][x-x0], 0., 0., 0.); |
| 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 |
> |
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); |