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.16 by greg, Mon Jun 24 16:16:54 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  dimlist[MAXDIM];                   /* sampling dimensions */
34 + int  ndims = 0;                         /* number of sampling dimensions */
35 + int  samplendx = 0;                     /* index for this sample */
36 +
37 + int  imm_irrad = 0;                     /* compute immediate irradiance? */
38 +
39   int  inform = 'a';                      /* input format */
40   int  outform = 'a';                     /* output format */
41   char  *outvals = "v";                   /* output specification */
# Line 40 | Line 46 | int  vresolu = 0;                      /* vertical resolution */
46   double  dstrsrc = 0.0;                  /* square source distribution */
47   double  shadthresh = .05;               /* shadow threshold */
48   double  shadcert = .5;                  /* shadow certainty */
49 + int  directrelay = 0;                   /* number of source relays */
50 + int  vspretest = 128;                   /* virtual source pretest density */
51  
52   int  maxdepth = 6;                      /* maximum recursion depth */
53   double  minweight = 4e-3;               /* minimum ray weight */
# Line 53 | Line 61 | int  ambounce = 0;                     /* ambient bounces */
61   char  *amblist[128];                    /* ambient include/exclude list */
62   int  ambincl = -1;                      /* include == 1, exclude == 0 */
63  
64 + extern OBJREC  Lamb;                    /* a Lambertian surface */
65 +
66   static RAY  thisray;                    /* for our convenience */
67  
68   static int  oputo(), oputd(), oputv(), oputl(),
# Line 65 | Line 75 | static int  puta(), putf(), putd();
75  
76   static int  (*putreal)();
77  
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 */
78  
74
79   quit(code)                      /* quit program */
80   int  code;
81   {
# Line 108 | Line 112 | char  *fname;
112                          fflush(stdout);
113                          continue;
114                  }
115 +                samplendx++;
116                                                          /* compute and print */
117 <                if (outvals[0] == 'i')
117 >                if (imm_irrad)
118                          irrad(orig, direc);
114                else if (outvals[0] == 'I')
115                        Irrad(orig, direc);
119                  else
120 <                        radiance(orig, direc);
120 >                        traceray(orig, direc);
121                                                          /* flush if time */
122                  if (--nextflush == 0) {
123                          fflush(stdout);
# Line 180 | Line 183 | register char  *vs;
183   }
184  
185  
186 < radiance(org, dir)              /* compute radiance value */
186 > traceray(org, dir)              /* compute and print ray value(s) */
187   FVECT  org, dir;
188   {
189          register int  (**tp)();
# Line 202 | Line 205 | FVECT  org, dir;
205   }
206  
207  
208 < irrad(org, dir)                 /* compute irradiance value */
208 > irrad(org, dir)                 /* compute immediate irradiance value */
209   FVECT  org, dir;
210   {
211          register int  i;
# Line 220 | Line 223 | FVECT  org, dir;
223                  thisray.rop[i] = org[i] + 1e-4*dir[i];
224                                          /* compute and print */
225          (*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);
226          oputv(&thisray);
227          if (outform == 'a')
228                  putchar('\n');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines