--- ray/src/rt/srcdraw.c 2003/06/26 00:58:10 2.7 +++ ray/src/rt/srcdraw.c 2003/10/24 05:29:43 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: srcdraw.c,v 2.7 2003/06/26 00:58:10 schorsch Exp $"; +static const char RCSid[] = "$Id: srcdraw.c,v 2.10 2003/10/24 05:29:43 greg Exp $"; #endif /* * Draw small sources into image in case we missed them. @@ -263,7 +263,7 @@ sourcepoly(sn, sp) /* compute image polygon for sour int sn; RREAL sp[MAXVERT][2]; { - static char cubeord[8][6] = {{1,3,2,6,4,5},{0,4,5,7,3,2}, + static short cubeord[8][6] = {{1,3,2,6,4,5},{0,4,5,7,3,2}, {0,1,3,7,6,4},{0,1,5,7,6,2}, {0,2,6,7,5,1},{0,4,6,7,3,1}, {0,2,3,7,5,4},{1,5,4,6,2,3}}; @@ -285,9 +285,9 @@ RREAL sp[MAXVERT][2]; for (j = 0; j < 4; j++) { /* four corners */ for (i = 0; i < 3; i++) { ap[i] = s->sloc[i]; - if (j==1|j==2) ap[i] += s->ss[SU][i]; + if ((j==1)|(j==2)) ap[i] += s->ss[SU][i]; else ap[i] -= s->ss[SU][i]; - if (j==2|j==3) ap[i] += s->ss[SV][i]; + if ((j==2)|(j==3)) ap[i] += s->ss[SV][i]; else ap[i] -= s->ss[SV][i]; if (s->sflags & SDISTANT) { ap[i] *= 1. + ourview.vfore; @@ -409,19 +409,22 @@ int x0, xsiz, y0, ysiz; /* origin and size of subimag if (source[sp->sn].sflags & SSPOT && spotout(&sr, source[sp->sn].sl.s)) continue; /* outside spot */ - rayorigin(&sr, NULL, SHADOW, 1.0); - sr.rsrc = sp->sn; + 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); rayvalue(&sr); /* compute value */ if (bright(sr.rcol) <= FTINY) continue; /* missed/blocked */ /* modify pixel */ if (zbf[y-y0] != NULL && - sr.rt < 0.999*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.001)) /* source sample */ + 0.01)) /* source sample */ setcolor(pic[y-y0][x-x0], 0., 0., 0.); - w = poly_area(ppoly, npv) * hres * vres; scalecolor(sr.rcol, w); scalecolor(pic[y-y0][x-x0], 1.-w); addcolor(pic[y-y0][x-x0], sr.rcol);