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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 1.3 by greg, Wed Apr 19 22:24:28 1989 UTC vs.
Revision 1.10 by greg, Tue Mar 27 11:40:05 1990 UTC

# Line 22 | Line 22 | extern double  minweight;              /* minimum ray weight */
22  
23   long  nrays = 0L;                       /* number of rays traced */
24  
25 < #define  MAXLOOP        32              /* modifier loop detection */
25 > #define  MAXLOOP        128             /* modifier loop detection */
26  
27   #define  RAYHIT         (-1)            /* return value for intercepted ray */
28  
# Line 59 | Line 59 | double  rw;
59          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
60          setcolor(r->pcol, 1.0, 1.0, 1.0);
61          setcolor(r->rcol, 0.0, 0.0, 0.0);
62 +        r->rt = 0.0;
63          return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1);
64   }
65  
66  
67   rayvalue(r)                     /* compute a ray's value */
68 < register RAY  *r;
68 > RAY  *r;
69   {
70          extern int  (*trace)();
71  
72 <        if (localhit(r, &thescene))
73 <                if (r->clipset != NULL && inset(r->clipset, r->ro->omod))
73 <                        raytrans(r);            /* object is clipped */
74 <                else
75 <                        rayshade(r, r->ro->omod);
76 <        else if (sourcehit(r))
77 <                rayshade(r, r->ro->omod);
72 >        if (localhit(r, &thescene) || sourcehit(r))
73 >                raycont(r);
74  
75          if (trace != NULL)
76                  (*trace)(r);            /* trace execution */
77   }
78  
79  
80 + raycont(r)                      /* check for clipped object and continue */
81 + register RAY  *r;
82 + {
83 +        if (r->clipset != NULL && inset(r->clipset, r->ro->omod))
84 +                raytrans(r);
85 +        else
86 +                rayshade(r, r->ro->omod);
87 + }
88 +
89 +
90   raytrans(r)                     /* transmit ray as is */
91 < RAY  *r;
91 > register RAY  *r;
92   {
93          RAY  tr;
94  
# Line 90 | Line 96 | RAY  *r;
96                  VCOPY(tr.rdir, r->rdir);
97                  rayvalue(&tr);
98                  copycolor(r->rcol, tr.rcol);
99 +                r->rt = r->rot + tr.rt;
100          }
101   }
102  
# Line 102 | Line 109 | int  mod;
109          register OBJREC  *m;
110                                          /* check for infinite loop */
111          if (depth++ >= MAXLOOP)
112 <                objerror(r->ro, USER, "material loop");
112 >                objerror(r->ro, USER, "possible modifier loop");
113          for ( ; mod != OVOID; mod = m->omod) {
114                  m = objptr(mod);
115 +                /****** unnecessary test since modifier() is always called
116                  if (!ismodifier(m->otype)) {
117                          sprintf(errmsg, "illegal modifier \"%s\"", m->oname);
118                          error(USER, errmsg);
119                  }
120 +                ******/
121                  (*ofun[m->otype].funp)(m, r);   /* execute function */
122                  m->lastrno = r->rno;
123                  if (ismaterial(m->otype)) {     /* materials call raytexture */
# Line 203 | Line 212 | register RAY  *r;
212           *  still fraught with problems since reflected rays and similar
213           *  directions calculated from the surface normal may spawn rays behind
214           *  the surface.  The only solution is to curb textures at high
215 <         *  incidence (Rdot << 1).
215 >         *  incidence (namely, keep DOT(rdir,pert) < Rdot).
216           */
217  
218          for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines