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

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.24 by gregl, Wed Jul 9 11:25:49 1997 UTC vs.
Revision 2.25 by gregl, Fri Oct 17 10:14:37 1997 UTC

# Line 37 | Line 37 | int  ndims = 0;                                /* number of sampling dimensions */
37   int  samplendx = 0;                     /* index for this sample */
38  
39   int  imm_irrad = 0;                     /* compute immediate irradiance? */
40 + int  lim_dist = 0;                      /* limit distance? */
41  
42   int  inform = 'a';                      /* input format */
43   int  outform = 'a';                     /* output format */
# Line 82 | Line 83 | char  *amblist[128];                   /* ambient include/exclude list
83   int  ambincl = -1;                      /* include == 1, exclude == 0 */
84  
85   extern OBJREC  Lamb;                    /* a Lambertian surface */
86 + extern OBJREC  Aftplane;                /* aft clipping object */
87  
88 +
89   static RAY  thisray;                    /* for our convenience */
90  
91   static int  oputo(), oputd(), oputv(), oputl(), oputL(),
# Line 128 | Line 131 | char  *fname;
131          long  vcount = hresolu>1 ? hresolu*vresolu : vresolu;
132          long  nextflush = hresolu;
133          FILE  *fp;
134 +        double  d;
135          FVECT  orig, direc;
136                                          /* set up input */
137          if (fname == NULL)
# Line 162 | Line 166 | char  *fname;
166          while (getvec(orig, inform, fp) == 0 &&
167                          getvec(direc, inform, fp) == 0) {
168  
169 <                if (normalize(direc) == 0.0) {          /* zero ==> flush */
169 >                d = normalize(direc);
170 >                if (d == 0.0) {                         /* zero ==> flush */
171                          bogusray();
172                          if (--nextflush <= 0) {
173                                  fflush(stdout);
# Line 174 | Line 179 | char  *fname;
179                          if (imm_irrad)
180                                  irrad(orig, direc);
181                          else
182 <                                rad(orig, direc);
182 >                                rad(orig, direc, lim_dist ? d : 0.0);
183                                                          /* flush if time */
184                          if (--nextflush == 0) {
185                                  fflush(stdout);
# Line 259 | Line 264 | bogusray()                     /* print out empty record */
264   }
265  
266  
267 < rad(org, dir)                   /* compute and print ray value(s) */
267 > rad(org, dir, dmax)             /* compute and print ray value(s) */
268   FVECT  org, dir;
269 + double  dmax;
270   {
271          VCOPY(thisray.rorg, org);
272          VCOPY(thisray.rdir, dir);
273 <        thisray.rmax = 0.0;
273 >        thisray.rmax = dmax;
274          rayorigin(&thisray, NULL, PRIMARY, 1.0);
275 <        if (castonly)
276 <                localhit(&thisray, &thescene) || sourcehit(&thisray);
277 <        else
275 >        if (castonly) {
276 >                if (!localhit(&thisray, &thescene))
277 >                        if (thisray.ro == &Aftplane) {  /* clipped */
278 >                                thisray.ro = NULL;
279 >                                thisray.rot = FHUGE;
280 >                        } else
281 >                                sourcehit(&thisray);
282 >        } else
283                  rayvalue(&thisray);
284          printvals(&thisray);
285   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines