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

Comparing ray/src/rt/srcobstr.c (file contents):
Revision 2.7 by greg, Wed Sep 8 06:07:52 2004 UTC vs.
Revision 2.12 by greg, Tue Apr 19 01:15:07 2005 UTC

# Line 27 | Line 27 | castshadow(int sn, FVECT rorg, FVECT rdir)
27          VCOPY(rt.rorg, rorg);
28          VCOPY(rt.rdir, rdir);
29          rt.rmax = 0;
30 <        rayorigin(&rt, NULL, PRIMARY, 1.0);
30 >        rayorigin(&rt, PRIMARY, NULL, NULL);
31                                          /* check for intersection */
32          while (localhit(&rt, &thescene)) {
33                  RAY     rt1 = rt;       /* pretend we were aimed at source */
# Line 50 | Line 50 | castshadow(int sn, FVECT rorg, FVECT rdir)
50   }
51  
52  
53 < static void                             /* initialize occlusion cache */
53 > void                                    /* initialize occlusion cache */
54   initobscache(int sn)
55   {
56          register SRCREC *srcp = &source[sn];
# Line 60 | Line 60 | initobscache(int sn)
60          int             i, j, k;
61          int             ax, ax1, ax2;
62  
63 +        if (srcp->sflags & (SSKIP|SPROX|SSPOT|SVIRTUAL))
64 +                return;                 /* don't cache these */
65          if (srcp->sflags & SDISTANT)
66                  cachelen = 4*SHADCACHE*SHADCACHE;
67          else if (srcp->sflags & SFLAT)
# Line 67 | Line 69 | initobscache(int sn)
69          else /* spherical distribution */
70                  cachelen = SHADCACHE*SHADCACHE*6;
71                                          /* allocate cache */
70        DCHECK(srcp->obscache != NULL,
71                        CONSISTENCY, "initobscache() called twice");
72          srcp->obscache = (OBSCACHE *)malloc(sizeof(OBSCACHE) +
73                                                  sizeof(OBJECT)*(cachelen-1));
74          if (srcp->obscache == NULL)
# Line 290 | Line 290 | srcblocker(register RAY *r)
290          if (r->robj == OVOID || objptr(r->robj) != r->ro ||
291                          isvolume(r->ro->otype))
292                  return(0);              /* don't record complex blockers */
293 +        if (r->rsrc < 0 || source[r->rsrc].so == r->ro)
294 +                return(0);              /* just a mistake, that's all */
295          m = findmaterial(r->ro);
296          if (m == NULL)
297                  return(0);              /* no material?! */
# Line 308 | Line 310 | srcblocked(RAY *r)
310  
311          if (obs == OVOID)
312                  return(0);
313 <        op = objptr(obs);               /* check for intersection */
314 <        return((*ofun[op->otype].funp)(op, r));
313 >        op = objptr(obs);               /* check blocker intersection */
314 >        if (!(*ofun[op->otype].funp)(op, r))
315 >                return(0);
316 >        if (source[r->rsrc].sflags & SDISTANT)
317 >                return(1);
318 >        op = source[r->rsrc].so;        /* check source intersection */
319 >        if (!(*ofun[op->otype].funp)(op, r))
320 >                return(1);
321 >        rayclear(r);
322 >        return(0);                      /* source in front */
323   }
324  
325  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines