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 1.12 by greg, Thu Mar 28 10:16:35 1991 UTC vs.
Revision 1.13 by greg, Wed May 1 11:16:58 1991 UTC

# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   *  All values default to ascii representation of real
21   *  numbers.  Binary representations can be selected
22   *  with '-ff' for float or '-fd' for double.  By default,
23 < *  radiance is computed.  The '-oi' or '-oI' options indicate that
23 > *  radiance is computed.  The '-i' or '-I' options indicate that
24   *  irradiance values are desired.
25   */
26  
# Line 30 | Line 30 | static char SCCSid[] = "$SunId$ LBL";
30  
31   #include  "otypes.h"
32  
33 + int  imm_irrad = 0;                     /* compute immediate irradiance? */
34 +
35   int  inform = 'a';                      /* input format */
36   int  outform = 'a';                     /* output format */
37   char  *outvals = "v";                   /* output specification */
# Line 53 | Line 55 | int  ambounce = 0;                     /* ambient bounces */
55   char  *amblist[128];                    /* ambient include/exclude list */
56   int  ambincl = -1;                      /* include == 1, exclude == 0 */
57  
58 + extern OBJREC  Lamb;                    /* a Lambertian surface */
59 +
60   static RAY  thisray;                    /* for our convenience */
61  
62   static int  oputo(), oputd(), oputv(), oputl(),
# Line 65 | Line 69 | static int  puta(), putf(), putd();
69  
70   static int  (*putreal)();
71  
68 static double  Lambfa[5] = {PI, PI, PI, 0.0, 0.0};
69 static OBJREC  Lamb = {
70        OVOID, MAT_PLASTIC, "Lambertian",
71        {0, 5, NULL, Lambfa}, NULL, -1,
72 };                                      /* a Lambertian surface */
72  
74
73   quit(code)                      /* quit program */
74   int  code;
75   {
# Line 109 | Line 107 | char  *fname;
107                          continue;
108                  }
109                                                          /* compute and print */
110 <                if (outvals[0] == 'i')
110 >                if (imm_irrad)
111                          irrad(orig, direc);
114                else if (outvals[0] == 'I')
115                        Irrad(orig, direc);
112                  else
113 <                        radiance(orig, direc);
113 >                        traceray(orig, direc);
114                                                          /* flush if time */
115                  if (--nextflush == 0) {
116                          fflush(stdout);
# Line 180 | Line 176 | register char  *vs;
176   }
177  
178  
179 < radiance(org, dir)              /* compute radiance value */
179 > traceray(org, dir)              /* compute and print ray value(s) */
180   FVECT  org, dir;
181   {
182          register int  (**tp)();
# Line 202 | Line 198 | FVECT  org, dir;
198   }
199  
200  
201 < irrad(org, dir)                 /* compute irradiance value */
201 > irrad(org, dir)                 /* compute immediate irradiance value */
202   FVECT  org, dir;
203   {
204          register int  i;
# Line 220 | Line 216 | FVECT  org, dir;
216                  thisray.rop[i] = org[i] + 1e-4*dir[i];
217                                          /* compute and print */
218          (*ofun[Lamb.otype].funp)(&Lamb, &thisray);
223        oputv(&thisray);
224        if (outform == 'a')
225                putchar('\n');
226 }
227
228
229 Irrad(org, dir)         /* compute irradiance value after intersection */
230 FVECT  org, dir;
231 {
232                                        /* compute intersection */
233        VCOPY(thisray.rorg, org);
234        VCOPY(thisray.rdir, dir);
235        rayorigin(&thisray, NULL, PRIMARY, 1.0);
236        localhit(&thisray, &thescene);
237        if (thisray.ro != NULL)         /* pretend we hit Lambertian surf. */
238                (*ofun[Lamb.otype].funp)(&Lamb, &thisray);
219          oputv(&thisray);
220          if (outform == 'a')
221                  putchar('\n');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines