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

Comparing ray/src/gen/mkillum.c (file contents):
Revision 2.29 by greg, Fri Sep 14 21:29:08 2007 UTC vs.
Revision 2.44 by greg, Mon Feb 6 22:40:21 2023 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8   #include  <signal.h>
9   #include  <ctype.h>
10  
11 < #include  "platform.h"
11 > #include  "paths.h"             /* win_popen() */
12   #include  "mkillum.h"
13 #include  "random.h"
13  
14                                  /* default parameters */
15   #define  SAMPDENS       48              /* points per projected steradian */
# Line 46 | Line 45 | int    doneheader = 0;         /* printed header yet? */
45   int     warnings = 1;           /* print warnings? */
46  
47   void init(char *octnm, int np);
48 < void filter(register FILE       *infp, char     *name);
48 > void filter(FILE        *infp, char     *name);
49   void xoptions(char      *s, char        *nm);
50   void printopts(void);
51 < void printhead(register int  ac, register char  **av);
51 > void printhead(int  ac, char  **av);
52   void xobject(FILE  *fp, char  *nm);
53  
54  
# Line 62 | Line 61 | main(          /* compute illum distributions using rtrace */
61          int     nprocs = 1;
62          FILE    *fp;
63          int     rval;
64 <        register int    i;
64 >        int     i;
65                                  /* set global arguments */
66          gargv = argv;
67          progname = gargv[0];
68                                  /* set up rendering defaults */
69 <        dstrsrc = 0.25;
69 >        dstrsrc = 0.5;
70          directrelay = 3;
72        directvis = 0;
71          ambounce = 2;
72                                  /* get options from command line */
73          for (i = 1; i < argc; i++) {
# Line 112 | Line 110 | main(          /* compute illum distributions using rtrace */
110          init(argv[gargc-1], nprocs);
111          if (gargc < argc) {
112                  if (gargc == argc-1 || argv[gargc][0] != '<' || argv[gargc][1])
113 <                        error(USER, "Use '< file1 file2 ..' for multiple inputs");
113 >                        error(USER, "use '< file1 file2 ..' for multiple inputs");
114                  for (i = gargc+1; i < argc; i++) {
115                          if ((fp = fopen(argv[i], "r")) == NULL) {
116                                  sprintf(errmsg,
# Line 150 | Line 148 | init(char *octnm, int np)              /* start rendering process(
148  
149   void
150   eputs(                          /* put string to stderr */
151 <        register char  *s
151 >        const char  *s
152   )
153   {
154          static int  midline = 0;
# Line 166 | Line 164 | eputs(                         /* put string to stderr */
164  
165  
166   void
167 < wputs(s)                        /* print warning if enabled */
170 < char  *s;
167 > wputs(const char *s)                    /* print warning if enabled */
168   {
169          if (warnings)
170                  eputs(s);
# Line 175 | Line 172 | char  *s;
172  
173  
174   void
175 + quit(int ec)                    /* make sure exit is called */
176 + {
177 +        if (ray_pnprocs > 0)    /* close children if any */
178 +                ray_pclose(0);
179 +        else if (ray_pnprocs < 0)
180 +                _exit(ec);      /* avoid flush() in child */
181 +        exit(ec);
182 + }
183 +
184 +
185 + void
186   filter(         /* process stream */
187 <        register FILE   *infp,
187 >        FILE    *infp,
188          char    *name
189   )
190   {
191          char    buf[512];
192          FILE    *pfp;
193 <        register int    c;
193 >        int     c;
194  
195          while ((c = getc(infp)) != EOF) {
196                  if (isspace(c))
# Line 214 | Line 222 | xoptions(                      /* process options in string s */
222          char    *nm
223   )
224   {
217        extern FILE     *freopen();
225          char    buf[64];
226 +        int     negax;
227          int     nerrs = 0;
228 <        register char   *cp;
228 >        char    *cp;
229  
230          if (strncmp(s, "#@mkillum", 9) || !isspace(s[9])) {
231                  fputs(s, stdout);               /* not for us */
# Line 295 | Line 303 | xoptions(                      /* process options in string s */
303                          }
304                          cp = sskip(cp);
305                          continue;
306 <                case 'd':                       /* point sample density */
306 >                case 'd':                       /* sample density */
307                          if (*++cp != '=')
308                                  break;
309 <                        if (!isintd(++cp, " \t\n\r"))
310 <                                break;
311 <                        thisillum.sampdens = atoi(cp);
309 >                        if (!*++cp || isspace(*cp))
310 >                                continue;
311 >                        if (isintd(cp, " \t\n\r")) {
312 >                                thisillum.sampdens = atoi(cp);
313 >                        } else {
314 >                                error(WARNING, "direct BSDF input unsupported");
315 >                                goto opterr;
316 >                        }
317                          cp = sskip(cp);
318                          continue;
319 <                case 's':                       /* point super-samples */
319 >                case 's':                       /* surface super-samples */
320                          if (*++cp != '=')
321                                  break;
322                          if (!isintd(++cp, " \t\n\r"))
# Line 387 | Line 400 | printopts(void)                        /* print out option default values *
400                  printf("l+\t\t\t\t# light type on\n");
401          else
402                  printf("l-\t\t\t\t# light type off\n");
403 <        printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens);
404 <        printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps);
403 >        printf("d=%d\t\t\t\t# density of directions\n", thisillum.sampdens);
404 >        printf("s=%d\t\t\t\t# samples per direction\n", thisillum.nsamps);
405          printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt);
406   }
407  
408  
409   void
410   printhead(                      /* print out header */
411 <        register int  ac,
412 <        register char  **av
411 >        int  ac,
412 >        char  **av
413   )
414   {
415          putchar('#');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines