--- ray/src/rt/source.c 1989/07/22 11:07:51 1.16 +++ ray/src/rt/source.c 1990/12/13 10:44:04 1.24 @@ -47,10 +47,7 @@ marksources() /* find and mark source objects */ m = objptr(o->omod); - if (m->otype != MAT_LIGHT && - m->otype != MAT_ILLUM && - m->otype != MAT_GLOW && - m->otype != MAT_SPOT) + if (!islight(m->otype)) continue; if (m->oargs.nfargs != (m->otype == MAT_GLOW ? 4 : @@ -310,6 +307,8 @@ char *p; /* data for f */ double prob, ourthresh, hwt, test2, hit2; RAY sr; + if (nsources <= 0) + return; srccnt = (CONTRIB *)malloc(nsources*sizeof(CONTRIB)); cntord = (CNTPTR *)malloc(nsources*sizeof(CNTPTR)); if (srccnt == NULL || cntord == NULL) @@ -338,7 +337,7 @@ char *p; /* data for f */ (source[sn].so, &sr) )) continue; /* compute contribution */ - rayshade(&sr, sr.ro->omod); + raycont(&sr); multcolor(srccnt[sn].val, sr.rcol); cntord[sn].brt = bright(srccnt[sn].val); } @@ -376,10 +375,11 @@ char *p; /* data for f */ /* test for hit */ rayorigin(&sr, r, SHADOW, 1.0); VCOPY(sr.rdir, srccnt[cntord[sn].sno].dir); + sr.rsrc = cntord[sn].sno; if (localhit(&sr, &thescene) && sr.ro != source[cntord[sn].sno].so) { /* check for transmission */ - rayshade(&sr, sr.ro->omod); + raycont(&sr); if (bright(sr.rcol) <= FTINY) continue; /* missed! */ (*f)(srccnt[cntord[sn].sno].val, p, @@ -407,8 +407,8 @@ char *p; /* data for f */ addcolor(r->rcol, srccnt[cntord[sn].sno].val); } - free(srccnt); - free(cntord); + free((char *)srccnt); + free((char *)cntord); } @@ -452,8 +452,7 @@ register RAY *r; m->oargs.farg[2]); /* modify value */ multcolor(r->rcol, r->pcol); + /* assign distance */ + r->rt = r->rot; } } - - -o_source() {} /* intersection with a source is done elsewhere */