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.2 by greg, Thu Dec 19 14:54:53 1991 UTC vs.
Revision 2.6 by greg, Fri Jul 10 14:56:24 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 30 | Line 30 | static char SCCSid[] = "$SunId$ LBL";
30  
31   #include  "otypes.h"
32  
33 + #include  "resolu.h"
34 +
35   int  dimlist[MAXDIM];                   /* sampling dimensions */
36   int  ndims = 0;                         /* number of sampling dimensions */
37   int  samplendx = 0;                     /* index for this sample */
# Line 51 | Line 53 | int  vspretest = 512;                  /* virtual source pretest dens
53   int  directinvis = 0;                   /* sources invisible? */
54   double  srcsizerat = .25;               /* maximum ratio source size/dist. */
55  
56 + double  specthresh = .15;               /* specular sampling threshold */
57 + double  specjitter = 1.;                /* specular sampling jitter */
58 +
59   int  maxdepth = 6;                      /* maximum recursion depth */
60   double  minweight = 4e-3;               /* minimum ray weight */
61  
# Line 67 | Line 72 | extern OBJREC  Lamb;                   /* a Lambertian surface */
72  
73   static RAY  thisray;                    /* for our convenience */
74  
75 < static int  oputo(), oputd(), oputv(), oputl(),
75 > static int  oputo(), oputd(), oputv(), oputl(), oputL(),
76                  oputp(), oputn(), oputs(), oputw(), oputm();
77  
78   static int  (*ray_out[10])(), (*every_out[10])();
# Line 85 | Line 90 | int  code;
90   }
91  
92  
93 + char *
94 + formstr(f)                              /* return format identifier */
95 + int  f;
96 + {
97 +        switch (f) {
98 +        case 'a': return("ascii");
99 +        case 'f': return("float");
100 +        case 'd': return("double");
101 +        case 'c': return(COLRFMT);
102 +        }
103 +        return("unknown");
104 + }
105 +
106 +
107   rtrace(fname)                           /* trace rays from file */
108   char  *fname;
109   {
# Line 105 | Line 124 | char  *fname;
124          case 'a': putreal = puta; break;
125          case 'f': putreal = putf; break;
126          case 'd': putreal = putd; break;
127 +        case 'c':
128 +                if (strcmp(outvals, "v"))
129 +                        error(USER, "color format with value output only");
130 +                break;
131 +        default:
132 +                error(CONSISTENCY, "botched output format");
133          }
134 +        fputformat(formstr(outform), stdout);
135 +        putchar('\n');
136 +        if (hresolu > 0 && vresolu > 0)
137 +                fprtresolu(hresolu, vresolu, stdout);
138                                          /* process file */
139          while (getvec(orig, inform, fp) == 0 &&
140                          getvec(direc, inform, fp) == 0) {
# Line 161 | Line 190 | register char  *vs;
190                          *table++ = oputv;
191                          castonly = 0;
192                          break;
193 <                case 'l':                               /* length */
193 >                case 'l':                               /* effective distance */
194                          *table++ = oputl;
195                          castonly = 0;
196                          break;
197 +                case 'L':                               /* single ray length */
198 +                        *table++ = oputL;
199 +                        break;
200                  case 'p':                               /* point */
201                          *table++ = oputp;
202                          break;
# Line 238 | Line 270 | FILE  *fp;
270   {
271          extern char  *fgetword();
272          static float  vf[3];
273 +        static double  vd[3];
274          char  buf[32];
275          register int  i;
276  
# Line 256 | Line 289 | FILE  *fp;
289                  vec[0] = vf[0]; vec[1] = vf[1]; vec[2] = vf[2];
290                  break;
291          case 'd':                                       /* binary double */
292 <                if (fread((char *)vec, sizeof(double), 3, fp) != 3)
292 >                if (fread((char *)vd, sizeof(double), 3, fp) != 3)
293                          return(-1);
294 +                vec[0] = vd[0]; vec[1] = vd[1]; vec[2] = vd[2];
295                  break;
296 +        default:
297 +                error(CONSISTENCY, "botched input format");
298          }
299          return(0);
300   }
# Line 314 | Line 350 | static
350   oputv(r)                                /* print value */
351   register RAY  *r;
352   {
353 +        COLR  cout;
354 +        
355 +        if (outform == 'c') {
356 +                setcolr(cout,   colval(r->rcol,RED),
357 +                                colval(r->rcol,GRN),
358 +                                colval(r->rcol,BLU));
359 +                fwrite((char *)cout, sizeof(cout), 1, stdout);
360 +                return;
361 +        }
362          (*putreal)(colval(r->rcol,RED));
363          (*putreal)(colval(r->rcol,GRN));
364          (*putreal)(colval(r->rcol,BLU));
# Line 321 | Line 366 | register RAY  *r;
366  
367  
368   static
369 < oputl(r)                                /* print length */
369 > oputl(r)                                /* print effective distance */
370   register RAY  *r;
371   {
372          (*putreal)(r->rt);
373 + }
374 +
375 +
376 + static
377 + oputL(r)                                /* print single ray length */
378 + register RAY  *r;
379 + {
380 +        (*putreal)(r->rot);
381   }
382  
383  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines