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.12 by greg, Fri Jan 22 09:51:20 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;
# Line 86 | Line 86 | static int  (*putreal)();
86   quit(code)                      /* quit program */
87   int  code;
88   {
89 + #ifndef  NIX
90 +        headclean();            /* delete header file */
91 +        pfclean();              /* clean up persist files */
92 + #endif
93          exit(code);
94   }
95  
# Line 118 | Line 122 | char  *fname;
122                  sprintf(errmsg, "cannot open input file \"%s\"", fname);
123                  error(SYSTEM, errmsg);
124          }
125 + #ifdef MSDOS
126 +        if (inform != 'a')
127 +                setmode(fileno(fp), O_BINARY);
128 + #endif
129                                          /* set up output */
130          setoutput(outvals);
131          switch (outform) {
# Line 131 | Line 139 | char  *fname;
139          default:
140                  error(CONSISTENCY, "botched output format");
141          }
142 <        if (hresolu > 0 && vresolu > 0)
143 <                fprtresolu(hresolu, vresolu, stdout);
142 >        if (hresolu > 0) {
143 >                if (vresolu > 0)
144 >                        fprtresolu(hresolu, vresolu, stdout);
145 >                fflush(stdout);
146 >        }
147                                          /* process file */
148          while (getvec(orig, inform, fp) == 0 &&
149                          getvec(direc, inform, fp) == 0) {
# Line 157 | Line 168 | char  *fname;
168                  if (--vcount == 0)                      /* check for end */
169                          break;
170          }
171 +        fflush(stdout);
172          if (vcount > 0)
173                  error(USER, "read error");
174 <        fclose(fp);
174 >        if (fname != NULL)
175 >                fclose(fp);
176   }
177  
178  
# Line 198 | Line 211 | register char  *vs;
211                  case 'p':                               /* point */
212                          *table++ = oputp;
213                          break;
214 <                case 'n':                               /* normal */
214 >                case 'n':                               /* perturbed normal */
215                          *table++ = oputn;
216 +                        castonly = 0;
217                          break;
218 +                case 'N':                               /* unperturbed normal */
219 +                        *table++ = oputN;
220 +                        break;
221                  case 's':                               /* surface */
222                          *table++ = oputs;
223                          break;
# Line 396 | Line 413 | register RAY  *r;
413  
414  
415   static
416 < oputn(r)                                /* print normal */
416 > oputN(r)                                /* print unperturbed normal */
417   register RAY  *r;
418   {
419          if (r->rot < FHUGE) {
# Line 408 | Line 425 | register RAY  *r;
425                  (*putreal)(0.0);
426                  (*putreal)(0.0);
427          }
428 + }
429 +
430 +
431 + static
432 + oputn(r)                                /* print perturbed normal */
433 + RAY  *r;
434 + {
435 +        FVECT  pnorm;
436 +
437 +        if (r->rot >= FHUGE) {
438 +                (*putreal)(0.0);
439 +                (*putreal)(0.0);
440 +                (*putreal)(0.0);
441 +                return;
442 +        }
443 +        raynormal(pnorm, r);
444 +        (*putreal)(pnorm[0]);
445 +        (*putreal)(pnorm[1]);
446 +        (*putreal)(pnorm[2]);
447   }
448  
449  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines