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.33 by greg, Thu Dec 13 07:03:37 2007 UTC vs.
Revision 2.42 by greg, Thu Sep 15 22:34:41 2016 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8   #include  <signal.h>
9   #include  <ctype.h>
10  
11 + #include  "paths.h"             /* win_popen() */
12   #include  "mkillum.h"
13  
14                                  /* default parameters */
# Line 23 | Line 24 | static const char RCSid[] = "$Id$";
24  
25   struct illum_args  thisillum = {        /* our illum and default values */
26                  0,
26                UDzpos,
27                0.,
27                  DFLMAT,
28                  DFLDAT,
29                  0,
30                  VOIDID,
31                  SAMPDENS,
32                  NSAMPS,
34                NULL,
33                  0.,
34          };
35  
# Line 47 | 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 63 | 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;
73        directvis = 0;
71          ambounce = 2;
72                                  /* get options from command line */
73          for (i = 1; i < argc; i++) {
# Line 151 | Line 148 | init(char *octnm, int np)              /* start rendering process(
148  
149   void
150   eputs(                          /* put string to stderr */
151 <        register char  *s
151 >        char  *s
152   )
153   {
154          static int  midline = 0;
# Line 176 | Line 173 | char  *s;
173  
174  
175   void
176 + quit(ec)                        /* make sure exit is called */
177 + int     ec;
178 + {
179 +        if (ray_pnprocs > 0)    /* close children if any */
180 +                ray_pclose(0);          
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 215 | Line 222 | xoptions(                      /* process options in string s */
222          char    *nm
223   )
224   {
218        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 297 | Line 303 | xoptions(                      /* process options in string s */
303                          }
304                          cp = sskip(cp);
305                          continue;
306 <                case 'd':                       /* sample density / BSDF data */
306 >                case 'd':                       /* sample density */
307                          if (*++cp != '=')
308                                  break;
303                        if (thisillum.sd != NULL) {
304                                free_BSDF(thisillum.sd);
305                                thisillum.sd = NULL;
306                        }
309                          if (!*++cp || isspace(*cp))
310                                  continue;
311                          if (isintd(cp, " \t\n\r")) {
312                                  thisillum.sampdens = atoi(cp);
313                          } else {
314 <                                atos(buf, sizeof(buf), cp);
315 <                                thisillum.sd = load_BSDF(buf);
314 <                                if (thisillum.sd == NULL)
315 <                                        break;
314 >                                error(WARNING, "direct BSDF input unsupported");
315 >                                goto opterr;
316                          }
317                          cp = sskip(cp);
318                          continue;
# Line 358 | Line 358 | xoptions(                      /* process options in string s */
358                          }
359                          doneheader = 0;
360                          continue;
361                case 'u':                       /* up direction */
362                        if (*++cp != '=')
363                                break;
364                        if (!*++cp || isspace(*cp)) {
365                                thisillum.udir = UDunknown;
366                                continue;
367                        }
368                        negax = 0;
369                        if (*cp == '+')
370                                cp++;
371                        else if (*cp == '-') {
372                                negax++;
373                                cp++;
374                        }
375                        switch (*cp++) {
376                        case 'x':
377                        case 'X':
378                                thisillum.udir = negax ? UDxneg : UDxpos;
379                                break;
380                        case 'y':
381                        case 'Y':
382                                thisillum.udir = negax ? UDyneg : UDypos;
383                                break;
384                        case 'z':
385                        case 'Z':
386                                thisillum.udir = negax ? UDzneg : UDzpos;
387                                break;
388                        default:
389                                thisillum.udir = UDunknown;
390                                break;
391                        }
392                        if (thisillum.udir == UDunknown || !isspace(*cp))
393                                break;
394                        continue;
395                case 't':                       /* object thickness */
396                        if (*++cp != '=')
397                                break;
398                        if (!isfltd(++cp, " \t\n\r"))
399                                break;
400                        thisillum.thick = atof(cp);
401                        if (thisillum.thick < .0)
402                                thisillum.thick = .0;
403                        cp = sskip(cp);
404                        continue;
361                  case '!':                       /* processed file! */
362                          sprintf(errmsg, "(%s): already processed!", nm);
363                          error(WARNING, errmsg);
# Line 444 | 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);
450        switch (thisillum.udir) {
451        case UDzneg:
452                fputs("u=-Z\t\t\t\t# up is negative Z\n", stdout);
453                break;
454        case UDyneg:
455                fputs("u=-Y\t\t\t\t# up is negative Y\n", stdout);
456                break;
457        case UDxneg:
458                fputs("u=-X\t\t\t\t# up is negative X\n", stdout);
459                break;
460        case UDxpos:
461                fputs("u=+X\t\t\t\t# up is positive X\n", stdout);
462                break;
463        case UDypos:
464                fputs("u=+Y\t\t\t\t# up is positive Y\n", stdout);
465                break;
466        case UDzpos:
467                fputs("u=+Z\t\t\t\t# up is positive Z\n", stdout);
468                break;
469        case UDunknown:
470                break;
471        }
472        printf("t=%f\t\t\t# object thickness\n", thisillum.thick);
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