ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rview.c
(Generate patch)

Comparing ray/src/rt/rview.c (file contents):
Revision 2.14 by greg, Wed Dec 21 09:52:07 1994 UTC vs.
Revision 2.28 by greg, Mon Jun 13 20:07:56 2005 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  rview.c - routines and variables for interactive view generation.
6   *
7 < *     3/24/87
7 > *  External symbols declared in rpaint.h
8   */
9  
10 < #include  "ray.h"
10 > #include "copyright.h"
11  
15 #include  "rpaint.h"
16
12   #include  <signal.h>
18
13   #include  <ctype.h>
14  
15 < VIEW  ourview = STDVIEW;                /* viewing parameters */
16 < int  hresolu, vresolu;                  /* image resolution */
15 > #include  "ray.h"
16 > #include  "rpaint.h"
17  
18 +
19 + CUBE  thescene;                         /* our scene */
20 + OBJECT  nsceneobjs;                     /* number of objects in our scene */
21 +
22   int  dimlist[MAXDIM];                   /* sampling dimensions */
23   int  ndims = 0;                         /* number of sampling dimensions */
24   int  samplendx = 0;                     /* index for this sample */
25  
26 + extern void  ambnotify();
27 + void  (*addobjnotify[])() = {ambnotify, NULL};
28 +
29 + VIEW  ourview = STDVIEW;                /* viewing parameters */
30 + int  hresolu, vresolu;                  /* image resolution */
31 +
32 + void  (*trace)() = NULL;                /* trace call */
33 +
34 + int  do_irrad = 0;                      /* compute irradiance? */
35 +
36 + int  rand_samp = 0;                     /* pure Monte Carlo sampling? */
37 +
38   int  psample = 8;                       /* pixel sample size */
39   double  maxdiff = .15;                  /* max. sample difference */
40  
# Line 38 | Line 48 | int  vspretest = 128;                  /* virtual source pretest dens
48   int  directvis = 1;                     /* sources visible? */
49   double  srcsizerat = 0.;                /* maximum ratio source size/dist. */
50  
51 + COLOR  cextinction = BLKCOLOR;          /* global extinction coefficient */
52 + COLOR  salbedo = BLKCOLOR;              /* global scattering albedo */
53 + double  seccg = 0.;                     /* global scattering eccentricity */
54 + double  ssampdist = 0.;                 /* scatter sampling distance */
55 +
56   double  specthresh = .3;                /* specular sampling threshold */
57   double  specjitter = 1.;                /* specular sampling jitter */
58  
59   int  backvis = 1;                       /* back face visibility */
60  
61 < int  maxdepth = 4;                      /* maximum recursion depth */
61 > int  maxdepth = 6;                      /* maximum recursion depth */
62   double  minweight = 1e-2;               /* minimum ray weight */
63  
64 + char  *ambfile = NULL;                  /* ambient file name */
65   COLOR  ambval = BLKCOLOR;               /* ambient value */
66 < double  ambacc = 0.2;                   /* ambient accuracy */
67 < int  ambres = 8;                        /* ambient resolution */
68 < int  ambdiv = 32;                       /* ambient divisions */
69 < int  ambssamp = 0;                      /* ambient super-samples */
66 > int  ambvwt = 0;                        /* initial weight for ambient value */
67 > double  ambacc = 0.3;                   /* ambient accuracy */
68 > int  ambres = 32;                       /* ambient resolution */
69 > int  ambdiv = 256;                      /* ambient divisions */
70 > int  ambssamp = 64;                     /* ambient super-samples */
71   int  ambounce = 0;                      /* ambient bounces */
72 < char  *amblist[128];                    /* ambient include/exclude list */
72 > char  *amblist[AMBLLEN];                /* ambient include/exclude list */
73   int  ambincl = -1;                      /* include == 1, exclude == 0 */
74  
75   int  greyscale = 0;                     /* map colors to brightness? */
76 < char  *devname = dev_default;           /* output device name */
76 > char  *dvcname = dev_default;           /* output device name */
77  
78   struct driver  *dev = NULL;             /* driver functions */
79  
# Line 75 | Line 92 | static char  *reserve_mem = NULL;      /* pre-allocated res
92   #define  CTRL(c)        ((c)-'@')
93  
94  
95 + void
96   quit(code)                      /* quit program */
97   int  code;
98   {
# Line 87 | Line 105 | int  code;
105   }
106  
107  
108 + void
109   devopen(dname)                          /* open device driver */
110   char  *dname;
111   {
# Line 97 | Line 116 | char  *dname;
116          id = octname!=NULL ? octname : progname;
117                                                  /* check device table */
118          for (i = 0; devtable[i].name; i++)
119 <                if (!strcmp(dname, devtable[i].name))
119 >                if (!strcmp(dname, devtable[i].name)) {
120                          if ((dev = (*devtable[i].init)(dname, id)) == NULL) {
121                                  sprintf(errmsg, "cannot initialize %s", dname);
122                                  error(USER, errmsg);
123                          } else
124                                  return;
125 < #ifndef NIX                                                
125 >                }
126                                                  /* not there, try exec */
127          if ((dev = comm_init(dname, id)) == NULL) {
128                  sprintf(errmsg, "cannot start device \"%s\"", dname);
129                  error(USER, errmsg);
130          }
112 #endif
131   }
132  
133  
134 + void
135   devclose()                              /* close our device */
136   {
137          if (dev != NULL)
# Line 121 | Line 140 | devclose()                             /* close our device */
140   }
141  
142  
143 + void
144   printdevices()                          /* print list of output devices */
145   {
146          register int  i;
# Line 130 | Line 150 | printdevices()                         /* print list of output devices */
150   }
151  
152  
153 + void
154   rview()                         /* do a view */
155   {
156          char  buf[32];
157  
158 <        devopen(devname);               /* open device */
158 >        devopen(dvcname);               /* open device */
159          newimage();                     /* start image (calls fillreserves) */
160  
161          for ( ; ; ) {                   /* quit in command() */
# Line 162 | Line 183 | rview()                                /* do a view */
183   }
184  
185  
186 + void
187   fillreserves()                  /* fill memory reserves */
188   {
189          if (reserve_mem != NULL)
190                  return;
191 <        reserve_mem = malloc(RESERVE_AMT);
191 >        reserve_mem = (char *)malloc(RESERVE_AMT);
192   }
193  
194  
195 + void
196   freereserves()                  /* free memory reserves */
197   {
198          if (reserve_mem == NULL)
# Line 179 | Line 202 | freereserves()                 /* free memory reserves */
202   }
203  
204  
205 + void
206   command(prompt)                 /* get/execute command */
207   char  *prompt;
208   {
# Line 193 | Line 217 | again:
217          else *++args = '\0';
218          
219          switch (inpbuf[0]) {
220 <        case 'f':                               /* new frame (or free mem.) */
220 >        case 'f':                               /* new frame (|focus|free) */
221                  if (badcom("frame")) {
222 <                        if (badcom("free"))
223 <                                goto commerr;
224 <                        free_objmem();
222 >                        if (badcom("focus")) {
223 >                                if (badcom("free"))
224 >                                        goto commerr;
225 >                                free_objmem();
226 >                                break;
227 >                        }
228 >                        getfocus(args);
229                          break;
230                  }
231                  getframe(args);
# Line 307 | Line 335 | dostop:
335                  devclose();
336                  kill(0, SIGTSTP);
337                  /* pc stops here */
338 <                devopen(devname);
338 >                devopen(dvcname);
339                  redraw();
340                  break;
341   #endif
# Line 327 | Line 355 | commerr:
355   }
356  
357  
358 + void
359   rsample()                       /* sample the image */
360   {
361          int  xsiz, ysiz, y;
# Line 349 | Line 378 | rsample()                      /* sample the image */
378                  return;
379          pl = (PNODE **)malloc(xsiz*sizeof(PNODE *));
380          if (pl == NULL) {
381 <                free((char *)rl);
381 >                free((void *)rl);
382                  return;
383          }
384          /*
# Line 410 | Line 439 | rsample()                      /* sample the image */
439                  }
440          }
441   escape:
442 <        free((char *)rl);
443 <        free((char *)pl);
442 >        free((void *)rl);
443 >        free((void *)pl);
444   }
445  
446  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines