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.7 by greg, Tue Jul 21 10:36:37 1992 UTC vs.
Revision 2.14 by greg, Tue May 4 13:26:52 1993 UTC

# Line 50 | Line 50 | double  shadthresh = .05;              /* shadow threshold */
50   double  shadcert = .5;                  /* shadow certainty */
51   int  directrelay = 1;                   /* number of source relays */
52   int  vspretest = 512;                   /* virtual source pretest density */
53 < int  directinvis = 0;                   /* sources invisible? */
53 > int  directvis = 1;                     /* sources visible? */
54   double  srcsizerat = .25;               /* maximum ratio source size/dist. */
55  
56   double  specthresh = .15;               /* specular sampling threshold */
# Line 73 | Line 73 | extern OBJREC  Lamb;                   /* a Lambertian surface */
73   static RAY  thisray;                    /* for our convenience */
74  
75   static int  oputo(), oputd(), oputv(), oputl(), oputL(),
76 <                oputp(), oputn(), oputs(), oputw(), oputm();
76 >                oputp(), oputn(), oputN(), oputs(), oputw(), oputm();
77  
78 < static int  (*ray_out[10])(), (*every_out[10])();
79 < static int  castonly;
78 > static int  ourtrace(), tabin();
79 > static int  (*ray_out[16])(), (*every_out[16])();
80 > static int  castonly = 0;
81  
82   static int  puta(), putf(), putd();
83  
# Line 86 | Line 87 | static int  (*putreal)();
87   quit(code)                      /* quit program */
88   int  code;
89   {
90 + #ifndef  NIX
91 +        headclean();            /* delete header file */
92 +        pfclean();              /* clean up persist files */
93 + #endif
94          exit(code);
95   }
96  
# Line 118 | Line 123 | char  *fname;
123                  sprintf(errmsg, "cannot open input file \"%s\"", fname);
124                  error(SYSTEM, errmsg);
125          }
126 + #ifdef MSDOS
127 +        if (inform != 'a')
128 +                setmode(fileno(fp), O_BINARY);
129 + #endif
130                                          /* set up output */
131 <        setoutput(outvals);
131 >        if (imm_irrad)
132 >                outvals = "v";
133 >        else
134 >                setoutput(outvals);
135          switch (outform) {
136          case 'a': putreal = puta; break;
137          case 'f': putreal = putf; break;
# Line 131 | Line 143 | char  *fname;
143          default:
144                  error(CONSISTENCY, "botched output format");
145          }
146 <        if (hresolu > 0 && vresolu > 0)
147 <                fprtresolu(hresolu, vresolu, stdout);
146 >        if (hresolu > 0) {
147 >                if (vresolu > 0)
148 >                        fprtresolu(hresolu, vresolu, stdout);
149 >                fflush(stdout);
150 >        }
151                                          /* process file */
152          while (getvec(orig, inform, fp) == 0 &&
153                          getvec(direc, inform, fp) == 0) {
# Line 157 | Line 172 | char  *fname;
172                  if (--vcount == 0)                      /* check for end */
173                          break;
174          }
175 +        fflush(stdout);
176          if (vcount > 0)
177                  error(USER, "read error");
178 <        fclose(fp);
178 >        if (fname != NULL)
179 >                fclose(fp);
180   }
181  
182  
183   setoutput(vs)                           /* set up output tables */
184   register char  *vs;
185   {
186 <        extern int  ourtrace(), (*trace)();
186 >        extern int  (*trace)();
187          register int (**table)() = ray_out;
188  
189          castonly = 1;
# Line 198 | Line 215 | register char  *vs;
215                  case 'p':                               /* point */
216                          *table++ = oputp;
217                          break;
218 <                case 'n':                               /* normal */
218 >                case 'n':                               /* perturbed normal */
219                          *table++ = oputn;
220 +                        castonly = 0;
221                          break;
222 +                case 'N':                               /* unperturbed normal */
223 +                        *table++ = oputN;
224 +                        break;
225                  case 's':                               /* surface */
226                          *table++ = oputs;
227                          break;
# Line 396 | Line 417 | register RAY  *r;
417  
418  
419   static
420 < oputn(r)                                /* print normal */
420 > oputN(r)                                /* print unperturbed normal */
421   register RAY  *r;
422   {
423          if (r->rot < FHUGE) {
# Line 408 | Line 429 | register RAY  *r;
429                  (*putreal)(0.0);
430                  (*putreal)(0.0);
431          }
432 + }
433 +
434 +
435 + static
436 + oputn(r)                                /* print perturbed normal */
437 + RAY  *r;
438 + {
439 +        FVECT  pnorm;
440 +
441 +        if (r->rot >= FHUGE) {
442 +                (*putreal)(0.0);
443 +                (*putreal)(0.0);
444 +                (*putreal)(0.0);
445 +                return;
446 +        }
447 +        raynormal(pnorm, r);
448 +        (*putreal)(pnorm[0]);
449 +        (*putreal)(pnorm[1]);
450 +        (*putreal)(pnorm[2]);
451   }
452  
453  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines