ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/source.c
(Generate patch)

Comparing ray/src/rt/source.c (file contents):
Revision 2.19 by greg, Fri Dec 8 18:22:28 1995 UTC vs.
Revision 2.21 by greg, Mon Dec 11 15:00:24 1995 UTC

# Line 374 | Line 374 | char  *p;                      /* data for f */
374   srcscatter(r)                   /* compute source scattering into ray */
375   register RAY  *r;
376   {
377 +        int  oldsampndx;
378          int  nsamps;
379          RAY  sr;
380          SRCINDEX  si;
# Line 385 | Line 386 | register RAY  *r;
386                  return;
387          if (ssampdist <= FTINY || (nsamps = r->rot/ssampdist + .5) < 1)
388                  nsamps = 1;
389 <        initsrcindex(&si);
389 >        oldsampndx = samplendx;
390 >        samplendx = random()&0x7fff;            /* randomize */
391          for (i = r->slights[0]; i > 0; i--) {   /* for each source */
392                  setcolor(cumval, 0., 0., 0.);
393                  lastt = r->rot;
# Line 396 | Line 398 | register RAY  *r;
398                          sr.rorg[1] = r->rorg[1] + r->rdir[1]*t;
399                          sr.rorg[2] = r->rorg[2] + r->rdir[2]*t;
400                          sr.rmax = 0.;
401 <                                                /* sample ray to this source */
402 <                        if (si.sp >= si.np-1 || !srcray(&sr, NULL, &si) ||
403 <                                        sr.rsrc != r->slights[i]) {
404 <                                si.sn = r->slights[i]-1;        /* reset */
405 <                                si.np = 0;
406 <                                if (!srcray(&sr, NULL, &si) ||
405 <                                                sr.rsrc != r->slights[i])
406 <                                        continue;               /* no path */
407 <                        }
401 >                        initsrcindex(&si);      /* sample ray to this source */
402 >                        si.sn = r->slights[i];
403 >                        nopart(&si, &sr);
404 >                        if (!srcray(&sr, NULL, &si) ||
405 >                                        sr.rsrc != r->slights[i])
406 >                                continue;               /* no path */
407                          copycolor(sr.cext, r->cext);
408                          sr.albedo = r->albedo;
409                          sr.gecc = r->gecc;
# Line 438 | Line 437 | register RAY  *r;
437                  multcolor(cumval, ctmp);
438                  addcolor(r->rcol, cumval);      /* sum into ray result */
439          }
440 +        samplendx = oldsampndx;
441   }
442  
443  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines