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.30 by greg, Tue Sep 18 19:51:07 2007 UTC vs.
Revision 2.39 by greg, Sat Oct 13 20:15:43 2012 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  "rtprocess.h" /* win_popen() */
12   #include  "mkillum.h"
13 #include  "random.h"
13  
14                                  /* default parameters */
15   #define  SAMPDENS       48              /* points per projected steradian */
# Line 25 | Line 24 | static const char RCSid[] = "$Id$";
24  
25   struct illum_args  thisillum = {        /* our illum and default values */
26                  0,
27 <                UDzpos,
27 >                0.,
28                  DFLMAT,
29                  DFLDAT,
30                  0,
31                  VOIDID,
32                  SAMPDENS,
33                  NSAMPS,
35                NULL,
34                  0.,
35          };
36  
# Line 69 | Line 67 | main(          /* compute illum distributions using rtrace */
67          gargv = argv;
68          progname = gargv[0];
69                                  /* set up rendering defaults */
70 <        dstrsrc = 0.25;
70 >        dstrsrc = 0.5;
71          directrelay = 3;
74        directvis = 0;
72          ambounce = 2;
73                                  /* get options from command line */
74          for (i = 1; i < argc; i++) {
# Line 177 | Line 174 | char  *s;
174  
175  
176   void
177 + quit(ec)                        /* make sure exit is called */
178 + int     ec;
179 + {
180 +        if (ray_pnprocs > 0)    /* close children if any */
181 +                ray_pclose(0);          
182 +        exit(ec);
183 + }
184 +
185 +
186 + void
187   filter(         /* process stream */
188          register FILE   *infp,
189          char    *name
# Line 298 | Line 305 | xoptions(                      /* process options in string s */
305                          }
306                          cp = sskip(cp);
307                          continue;
308 <                case 'd':                       /* sample density / BSDF data */
308 >                case 'd':                       /* sample density */
309                          if (*++cp != '=')
310                                  break;
304                        if (thisillum.sd != NULL) {
305                                free_BSDF(thisillum.sd);
306                                thisillum.sd = NULL;
307                        }
311                          if (!*++cp || isspace(*cp))
312                                  continue;
313 <                        if (isintd(++cp, " \t\n\r")) {
313 >                        if (isintd(cp, " \t\n\r")) {
314                                  thisillum.sampdens = atoi(cp);
315                          } else {
316 <                                atos(buf, sizeof(buf), cp);
317 <                                thisillum.sd = load_BSDF(buf);
315 <                                if (thisillum.sd == NULL)
316 <                                        break;
316 >                                error(WARNING, "direct BSDF input unsupported");
317 >                                goto opterr;
318                          }
319                          cp = sskip(cp);
320                          continue;
# Line 359 | Line 360 | xoptions(                      /* process options in string s */
360                          }
361                          doneheader = 0;
362                          continue;
363 <                case 'u':                       /* up direction */
363 >                case 't':                       /* object thickness */
364                          if (*++cp != '=')
365                                  break;
366 <                        if (!*++cp || isspace(*cp)) {
366 <                                thisillum.udir = UDunknown;
367 <                                continue;
368 <                        }
369 <                        negax = 0;
370 <                        if (*cp == '+')
371 <                                cp++;
372 <                        else if (*cp == '-') {
373 <                                negax++;
374 <                                cp++;
375 <                        }
376 <                        switch (*cp++) {
377 <                        case 'x':
378 <                        case 'X':
379 <                                thisillum.udir = negax ? UDxneg : UDxpos;
366 >                        if (!isfltd(++cp, " \t\n\r"))
367                                  break;
368 <                        case 'y':
369 <                        case 'Y':
370 <                                thisillum.udir = negax ? UDyneg : UDypos;
371 <                                break;
385 <                        case 'z':
386 <                        case 'Z':
387 <                                thisillum.udir = negax ? UDxneg : UDxpos;
388 <                                break;
389 <                        default:
390 <                                thisillum.udir = UDunknown;
391 <                                break;
392 <                        }
393 <                        if (thisillum.udir == UDunknown || !isspace(*cp))
394 <                                break;
368 >                        thisillum.thick = atof(cp);
369 >                        if (thisillum.thick < .0)
370 >                                thisillum.thick = .0;
371 >                        cp = sskip(cp);
372                          continue;
373                  case '!':                       /* processed file! */
374                          sprintf(errmsg, "(%s): already processed!", nm);
# Line 435 | Line 412 | printopts(void)                        /* print out option default values *
412                  printf("l+\t\t\t\t# light type on\n");
413          else
414                  printf("l-\t\t\t\t# light type off\n");
415 <        printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens);
416 <        printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps);
415 >        printf("d=%d\t\t\t\t# density of directions\n", thisillum.sampdens);
416 >        printf("s=%d\t\t\t\t# samples per direction\n", thisillum.nsamps);
417          printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt);
418 <        switch (thisillum.udir) {
442 <        case UDzneg:
443 <                fputs("u=-Z\t\t\t\t# up is negative Z\n", stdout);
444 <                break;
445 <        case UDyneg:
446 <                fputs("u=-Y\t\t\t\t# up is negative Y\n", stdout);
447 <                break;
448 <        case UDxneg:
449 <                fputs("u=-X\t\t\t\t# up is negative X\n", stdout);
450 <                break;
451 <        case UDxpos:
452 <                fputs("u=+X\t\t\t\t# up is positive X\n", stdout);
453 <                break;
454 <        case UDypos:
455 <                fputs("u=+Y\t\t\t\t# up is positive Y\n", stdout);
456 <                break;
457 <        case UDzpos:
458 <                fputs("u=+Z\t\t\t\t# up is positive Z\n", stdout);
459 <                break;
460 <        case UDunknown:
461 <                break;
462 <        }
418 >        printf("t=%f\t\t\t# object thickness\n", thisillum.thick);
419   }
420  
421  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines