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.18 by greg, Thu May 28 09:13:19 2015 UTC vs.
Revision 2.22 by greg, Mon Dec 9 00:44:29 2024 UTC

# Line 15 | Line 15 | static const char RCSid[] = "$Id$";
15  
16   #include  "source.h"
17  
18 < #define ABS(x)  ((x)>0 ? (x) : -(x))
18 > #if  SHADCACHE                  /* preemptive shadow checking */
19  
20 + #ifndef MAX2SHADE
21 + #define MAX2SHADE       200             /* limit # of sources to precheck */
22 + #endif
23  
24 < #if  SHADCACHE                  /* preemptive shadow checking */
24 > #define ABS(x)  ((x)>0 ? (x) : -(x))
25  
26  
27   OBJECT *        antimodlist = NULL;     /* set of clipped materials */
# Line 36 | Line 39 | castshadow(int sn, FVECT rorg, FVECT rdir)
39                                          /* check for intersection */
40          while (localhit(&rt, &thescene)) {
41                  RAY     rt1 = rt;       /* pretend we were aimed at source */
42 <                rt1.crtype |= rt1.rtype = SHADOW;
42 >                rt1.crtype |= rt1.rtype = RSHADOW;
43                  rt1.rdir[0] = -rt.rdir[0];
44                  rt1.rdir[1] = -rt.rdir[1];
45                  rt1.rdir[2] = -rt.rdir[2];
# Line 48 | Line 51 | castshadow(int sn, FVECT rorg, FVECT rdir)
51                  if (srcblocker(&rt1))
52                          return(1);
53                                          /* move past failed blocker */
54 <                VSUM(rt.rorg, rt.rop, rt.rdir, FTINY);
54 >                VSUM(rt.rorg, rt.rop, rt.rdir, 10.*FTINY);
55                  rayclear(&rt);          /* & try again... */
56          }
57          return(0);                      /* found no blockers */
# Line 111 | Line 114 | initobscache(int sn)
114                                          /* clear cache */
115          for (i = cachelen; i--; )
116                  srcp->obscache->obs[i] = OVOID;
117 + #if (MAX2SHADE >= 0)
118 +        if (sn >= MAX2SHADE)            /* limit on prechecking */
119 +                return;
120 + #endif
121                                          /* cast shadow rays */
122          if (srcp->sflags & SDISTANT) {
123                  for (k = 3; k--; )
# Line 302 | Line 309 | srcblocker(RAY *r)
309          m = findmaterial(r->ro);
310          if (m == NULL)
311                  return(0);              /* no material?! */
312 <        if (!isopaque(m->otype))
312 >        if (!isopaque(m))
313                  return(0);              /* material not a reliable blocker */
314          *srcobstructp(r) = r->robj;     /* else record obstructor */
315          return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines