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.30 by greg, Tue Sep 18 19:51:07 2007 UTC

# Line 25 | Line 25 | static const char RCSid[] = "$Id$";
25  
26   struct illum_args  thisillum = {        /* our illum and default values */
27                  0,
28 +                UDzpos,
29                  DFLMAT,
30                  DFLDAT,
31                  0,
32                  VOIDID,
33                  SAMPDENS,
34                  NSAMPS,
35 +                NULL,
36                  0.,
37          };
38  
# Line 112 | Line 114 | main(          /* compute illum distributions using rtrace */
114          init(argv[gargc-1], nprocs);
115          if (gargc < argc) {
116                  if (gargc == argc-1 || argv[gargc][0] != '<' || argv[gargc][1])
117 <                        error(USER, "Use '< file1 file2 ..' for multiple inputs");
117 >                        error(USER, "use '< file1 file2 ..' for multiple inputs");
118                  for (i = gargc+1; i < argc; i++) {
119                          if ((fp = fopen(argv[i], "r")) == NULL) {
120                                  sprintf(errmsg,
# Line 216 | Line 218 | xoptions(                      /* process options in string s */
218   {
219          extern FILE     *freopen();
220          char    buf[64];
221 +        int     negax;
222          int     nerrs = 0;
223          register char   *cp;
224  
# Line 295 | Line 298 | xoptions(                      /* process options in string s */
298                          }
299                          cp = sskip(cp);
300                          continue;
301 <                case 'd':                       /* point sample density */
301 >                case 'd':                       /* sample density / BSDF data */
302                          if (*++cp != '=')
303                                  break;
304 <                        if (!isintd(++cp, " \t\n\r"))
305 <                                break;
306 <                        thisillum.sampdens = atoi(cp);
304 >                        if (thisillum.sd != NULL) {
305 >                                free_BSDF(thisillum.sd);
306 >                                thisillum.sd = NULL;
307 >                        }
308 >                        if (!*++cp || isspace(*cp))
309 >                                continue;
310 >                        if (isintd(++cp, " \t\n\r")) {
311 >                                thisillum.sampdens = atoi(cp);
312 >                        } else {
313 >                                atos(buf, sizeof(buf), cp);
314 >                                thisillum.sd = load_BSDF(buf);
315 >                                if (thisillum.sd == NULL)
316 >                                        break;
317 >                        }
318                          cp = sskip(cp);
319                          continue;
320 <                case 's':                       /* point super-samples */
320 >                case 's':                       /* surface super-samples */
321                          if (*++cp != '=')
322                                  break;
323                          if (!isintd(++cp, " \t\n\r"))
# Line 345 | Line 359 | xoptions(                      /* process options in string s */
359                          }
360                          doneheader = 0;
361                          continue;
362 +                case 'u':                       /* up direction */
363 +                        if (*++cp != '=')
364 +                                break;
365 +                        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;
380 +                                break;
381 +                        case 'y':
382 +                        case 'Y':
383 +                                thisillum.udir = negax ? UDyneg : UDypos;
384 +                                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;
395 +                        continue;
396                  case '!':                       /* processed file! */
397                          sprintf(errmsg, "(%s): already processed!", nm);
398                          error(WARNING, errmsg);
# Line 390 | Line 438 | printopts(void)                        /* print out option default values *
438          printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens);
439          printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps);
440          printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt);
441 +        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 +        }
463   }
464  
465  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines