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.28 by greg, Thu Sep 13 06:31:21 2007 UTC vs.
Revision 2.36 by greg, Sat Dec 12 19:00:59 2009 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  "mkillum.h"
13 #include  "random.h"
12  
13                                  /* default parameters */
14   #define  SAMPDENS       48              /* points per projected steradian */
# Line 25 | Line 23 | static const char RCSid[] = "$Id$";
23  
24   struct illum_args  thisillum = {        /* our illum and default values */
25                  0,
26 +                UDzpos,
27 +                0.,
28                  DFLMAT,
29                  DFLDAT,
30                  0,
31                  VOIDID,
32                  SAMPDENS,
33                  NSAMPS,
34 +                NULL,
35                  0.,
36          };
37  
# Line 67 | Line 68 | main(          /* compute illum distributions using rtrace */
68          gargv = argv;
69          progname = gargv[0];
70                                  /* set up rendering defaults */
71 <        dstrsrc = 0.25;
71 >        dstrsrc = 0.5;
72          directrelay = 3;
73          directvis = 0;
74          ambounce = 2;
75                                  /* get options from command line */
76 <        for (i = 1; i < argc-1; i++) {
76 >        for (i = 1; i < argc; i++) {
77                  while ((rval = expandarg(&argc, &argv, i)) > 0)
78                          ;
79                  if (rval < 0) {
# Line 112 | Line 113 | main(          /* compute illum distributions using rtrace */
113          init(argv[gargc-1], nprocs);
114          if (gargc < argc) {
115                  if (gargc == argc-1 || argv[gargc][0] != '<' || argv[gargc][1])
116 <                        error(USER, "Use '< file1 file2 ..' for multiple inputs");
116 >                        error(USER, "use '< file1 file2 ..' for multiple inputs");
117                  for (i = gargc+1; i < argc; i++) {
118                          if ((fp = fopen(argv[i], "r")) == NULL) {
119                                  sprintf(errmsg,
# Line 175 | Line 176 | char  *s;
176  
177  
178   void
179 + quit(ec)                        /* make sure exit is called */
180 + int     ec;
181 + {
182 +        if (ray_pnprocs > 0)    /* close children if any */
183 +                ray_pclose(0);          
184 +        exit(ec);
185 + }
186 +
187 +
188 + void
189   filter(         /* process stream */
190          register FILE   *infp,
191          char    *name
# Line 216 | Line 227 | xoptions(                      /* process options in string s */
227   {
228          extern FILE     *freopen();
229          char    buf[64];
230 +        int     negax;
231          int     nerrs = 0;
232          register char   *cp;
233  
# Line 295 | Line 307 | xoptions(                      /* process options in string s */
307                          }
308                          cp = sskip(cp);
309                          continue;
310 <                case 'd':                       /* point sample density */
310 >                case 'd':                       /* sample density / BSDF data */
311                          if (*++cp != '=')
312                                  break;
313 <                        if (!isintd(++cp, " \t\n\r"))
314 <                                break;
315 <                        thisillum.sampdens = atoi(cp);
313 >                        if (thisillum.sd != NULL) {
314 >                                free_BSDF(thisillum.sd);
315 >                                thisillum.sd = NULL;
316 >                        }
317 >                        if (!*++cp || isspace(*cp))
318 >                                continue;
319 >                        if (isintd(cp, " \t\n\r")) {
320 >                                thisillum.sampdens = atoi(cp);
321 >                        } else {
322 >                                atos(buf, sizeof(buf), cp);
323 >                                thisillum.sd = load_BSDF(buf);
324 >                                if (thisillum.sd == NULL)
325 >                                        break;
326 >                        }
327                          cp = sskip(cp);
328                          continue;
329 <                case 's':                       /* point super-samples */
329 >                case 's':                       /* surface super-samples */
330                          if (*++cp != '=')
331                                  break;
332                          if (!isintd(++cp, " \t\n\r"))
# Line 345 | Line 368 | xoptions(                      /* process options in string s */
368                          }
369                          doneheader = 0;
370                          continue;
371 +                case 'u':                       /* up direction */
372 +                        if (*++cp != '=')
373 +                                break;
374 +                        if (!*++cp || isspace(*cp)) {
375 +                                thisillum.udir = UDunknown;
376 +                                continue;
377 +                        }
378 +                        negax = 0;
379 +                        if (*cp == '+')
380 +                                cp++;
381 +                        else if (*cp == '-') {
382 +                                negax++;
383 +                                cp++;
384 +                        }
385 +                        switch (*cp++) {
386 +                        case 'x':
387 +                        case 'X':
388 +                                thisillum.udir = negax ? UDxneg : UDxpos;
389 +                                break;
390 +                        case 'y':
391 +                        case 'Y':
392 +                                thisillum.udir = negax ? UDyneg : UDypos;
393 +                                break;
394 +                        case 'z':
395 +                        case 'Z':
396 +                                thisillum.udir = negax ? UDzneg : UDzpos;
397 +                                break;
398 +                        default:
399 +                                thisillum.udir = UDunknown;
400 +                                break;
401 +                        }
402 +                        if (thisillum.udir == UDunknown || !isspace(*cp))
403 +                                break;
404 +                        continue;
405 +                case 't':                       /* object thickness */
406 +                        if (*++cp != '=')
407 +                                break;
408 +                        if (!isfltd(++cp, " \t\n\r"))
409 +                                break;
410 +                        thisillum.thick = atof(cp);
411 +                        if (thisillum.thick < .0)
412 +                                thisillum.thick = .0;
413 +                        cp = sskip(cp);
414 +                        continue;
415                  case '!':                       /* processed file! */
416                          sprintf(errmsg, "(%s): already processed!", nm);
417                          error(WARNING, errmsg);
# Line 387 | Line 454 | printopts(void)                        /* print out option default values *
454                  printf("l+\t\t\t\t# light type on\n");
455          else
456                  printf("l-\t\t\t\t# light type off\n");
457 <        printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens);
458 <        printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps);
457 >        printf("d=%d\t\t\t\t# density of directions\n", thisillum.sampdens);
458 >        printf("s=%d\t\t\t\t# samples per direction\n", thisillum.nsamps);
459          printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt);
460 +        switch (thisillum.udir) {
461 +        case UDzneg:
462 +                fputs("u=-Z\t\t\t\t# up is negative Z\n", stdout);
463 +                break;
464 +        case UDyneg:
465 +                fputs("u=-Y\t\t\t\t# up is negative Y\n", stdout);
466 +                break;
467 +        case UDxneg:
468 +                fputs("u=-X\t\t\t\t# up is negative X\n", stdout);
469 +                break;
470 +        case UDxpos:
471 +                fputs("u=+X\t\t\t\t# up is positive X\n", stdout);
472 +                break;
473 +        case UDypos:
474 +                fputs("u=+Y\t\t\t\t# up is positive Y\n", stdout);
475 +                break;
476 +        case UDzpos:
477 +                fputs("u=+Z\t\t\t\t# up is positive Z\n", stdout);
478 +                break;
479 +        case UDunknown:
480 +                break;
481 +        }
482 +        printf("t=%f\t\t\t# object thickness\n", thisillum.thick);
483   }
484  
485  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines