--- ray/src/rt/srcdraw.c 2004/03/30 16:13:01 2.11 +++ ray/src/rt/srcdraw.c 2005/04/19 01:15:07 2.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: srcdraw.c,v 2.11 2004/03/30 16:13:01 schorsch Exp $"; +static const char RCSid[] = "$Id: srcdraw.c,v 2.16 2005/04/19 01:15:07 greg Exp $"; #endif /* * Draw small sources into image in case we missed them. @@ -11,6 +11,7 @@ static const char RCSid[] = "$Id: srcdraw.c,v 2.11 200 #include "ray.h" #include "view.h" +#include "otypes.h" #include "source.h" @@ -299,8 +300,12 @@ sourcepoly( /* compute image polygon for source */ register int i, j; if (s->sflags & (SDISTANT|SFLAT)) { - if (s->sflags & SDISTANT && ourview.type == VT_PAR) - return(0); /* all or nothing case */ + if (s->sflags & SDISTANT) { + if (ourview.type == VT_PAR) + return(0); /* all or nothing case */ + if (s->srad >= 0.05) + return(0); /* should never be a problem */ + } if (s->sflags & SFLAT) { for (i = 0; i < 3; i++) ap[i] = s->sloc[i] - ourview.vp[i]; @@ -369,6 +374,9 @@ init_drawsources( } /* loop through all sources */ for (i = nsources; i--; ) { + /* skip illum's */ + if (findmaterial(source[i].so)->otype == MAT_ILLUM) + continue; /* compute image polygon for source */ if (!(nsv = sourcepoly(i, spoly))) continue; @@ -440,22 +448,21 @@ drawsources( if (source[sp->sn].sflags & SSPOT && spotout(&sr, source[sp->sn].sl.s)) continue; /* outside spot */ - w = poly_area(ppoly, npv) * hres * vres; - if (w < .95) { /* subpixel source */ - rayorigin(&sr, NULL, SHADOW, 1.0); - sr.rsrc = sp->sn; - } else - rayorigin(&sr, NULL, PRIMARY, 1.0); + rayorigin(&sr, SHADOW, NULL, NULL); + sr.rsrc = sp->sn; rayvalue(&sr); /* compute value */ if (bright(sr.rcol) <= FTINY) continue; /* missed/blocked */ /* modify pixel */ + w = poly_area(ppoly, npv) * hres * vres; if (zbf[y-y0] != NULL && - sr.rt < 0.99*zbf[y-y0][x-x0]) + sr.rt < 0.99*zbf[y-y0][x-x0]) { zbf[y-y0][x-x0] = sr.rt; - else if (!bigdiff(sr.rcol, pic[y-y0][x-x0], - 0.01)) /* source sample */ - setcolor(pic[y-y0][x-x0], 0., 0., 0.); + } else if (!bigdiff(sr.rcol, pic[y-y0][x-x0], + 0.01)) { /* source sample */ + scalecolor(pic[y-y0][x-x0], w); + continue; + } scalecolor(sr.rcol, w); scalecolor(pic[y-y0][x-x0], 1.-w); addcolor(pic[y-y0][x-x0], sr.rcol);