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 1.6 by greg, Thu Jul 25 10:59:05 1991 UTC vs.
Revision 2.5 by greg, Thu Nov 19 20:27:48 1992 UTC

# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include  <ctype.h>
16  
17                                  /* default parameters */
18 < #define  SAMPDENS       128             /* points per projected steradian */
18 > #define  SAMPDENS       48              /* points per projected steradian */
19   #define  NSAMPS         32              /* samples per point */
20   #define  DFLMAT         "illum_mat"     /* material name */
21 + #define  DFLDAT         "illum"         /* data file name */
22                                  /* selection options */
23   #define  S_NONE         0               /* select none */
24   #define  S_ELEM         1               /* select specified element */
# Line 25 | Line 26 | static char SCCSid[] = "$SunId$ LBL";
26   #define  S_ALL          3               /* select all */
27  
28                                  /* rtrace command and defaults */
29 < char  *rtargv[64] = { "rtrace", "-dj", ".25", "-dr", "3", "-di+",
29 > char  *rtargv[64] = { "rtrace", "-dj", ".25", "-dr", "3", "-dv-",
30                  "-ab", "2", "-ad", "256", "-as", "128", "-aa", ".15", };
31   int  rtargc = 14;
32                                  /* overriding rtrace options */
33 < char  *myrtopts[] = { "-I-", "-i-", "-ov", "-h-", "-fff", NULL };
33 > char  *myrtopts[] = { "-I-", "-i-", "-ov", "-h-", "-fff", "-y", "0", NULL };
34  
35   struct rtproc   rt;             /* our rtrace process */
36  
37   struct illum_args  thisillum = {        /* our illum and default values */
38                  0,
39                  DFLMAT,
40 <                DFLMAT,
40 >                DFLDAT,
41                  0,
42                  VOIDID,
43                  SAMPDENS,
44                  NSAMPS,
45 +                0.,
46          };
47  
48   char    matcheck[MAXSTR];       /* current material to include or exclude */
# Line 80 | Line 82 | char   *argv[];
82                  if (argv[i][0] == '-' && argv[i][1] == 'w')
83                          warnings = !warnings;
84          }
85 <        if ((gargc = i) < 2)
84 <                error(USER, "too few arguments");
85 >        gargc = i;
86          rtargc--;
87          for (i = 0; myrtopts[i] != NULL; i++)
88                  rtargv[rtargc++] = myrtopts[i];
# Line 89 | Line 90 | char   *argv[];
90          rtargv[rtargc] = NULL;
91                                  /* just asking for defaults? */
92          if (!strcmp(argv[gargc-1], "-defaults")) {
93 +                printopts(); fflush(stdout);
94                  rtpath = getpath(rtargv[0], getenv("PATH"), X_OK);
95                  if (rtpath == NULL) {
96                          eputs(rtargv[0]);
# Line 99 | Line 101 | char   *argv[];
101                  perror(rtpath);
102                  exit(1);
103          }
104 +        if (gargc < 2 || argv[gargc-1][0] == '-')
105 +                error(USER, "missing octree argument");
106                                  /* else initialize and run our calculation */
107          init();
108          if (gargc+1 < argc)
# Line 144 | Line 148 | init()                         /* start rtrace and set up buffers */
148                                          /* set up signal handling */
149          signal(SIGPIPE, quit);
150                                          /* start rtrace process */
151 +        errno = 0;
152          maxbytes = open_process(rt.pd, rtargv);
153          if (maxbytes == 0) {
154                  eputs(rtargv[0]);
# Line 256 | Line 261 | char   *nm;
261                                  break;
262                          if (!*++cp) {
263                                  strcpy(thisillum.datafile,thisillum.matname);
264 +                                thisillum.dfnum = 0;
265                                  thisillum.flags &= ~IL_DATCLB;
266                                  continue;
267                          }
# Line 268 | Line 274 | char   *nm;
274                  case 'e':                       /* exclude material */
275                          if (cp[1] != '=')
276                                  break;
277 <                        matselect = (*++cp == 'i') ? S_ELEM : S_COMPL;
278 <                        atos(matcheck, MAXSTR, ++cp);
277 >                        matselect = (*cp == 'i') ? S_ELEM : S_COMPL;
278 >                        cp += 2;
279 >                        atos(matcheck, MAXSTR, cp);
280                          cp = sskip(cp);
281                          continue;
282                  case 'a':                       /* use everything */
# Line 325 | Line 332 | char   *nm;
332                                  break;
333                          cp++;
334                          continue;
335 +                case 'b':                       /* brightness */
336 +                        if (*++cp != '=')
337 +                                break;
338 +                        if (!isfltd(++cp, " \t\n"))
339 +                                break;
340 +                        thisillum.minbrt = atof(cp);
341 +                        if (thisillum.minbrt < 0.)
342 +                                thisillum.minbrt = 0.;
343 +                        cp = sskip(cp);
344 +                        continue;
345                  case 'o':                       /* output file */
346                          if (*++cp != '=')
347                                  break;
# Line 340 | Line 357 | char   *nm;
357                          doneheader = 0;
358                          continue;
359                  case '!':                       /* processed file! */
360 <                        sprintf(errmsg, "(%s): processed by mkillum already!",
344 <                                        nm);
360 >                        sprintf(errmsg, "(%s): already processed!", nm);
361                          error(WARNING, errmsg);
362 +                        matselect = S_NONE;
363                          return;
364                  }
365          opterr:                                 /* skip faulty option */
# Line 362 | Line 379 | char   *nm;
379          }
380                                                  /* print pure comment */
381          printf("# %s", s+2);
382 + }
383 +
384 +
385 + printopts()                     /* print out option default values */
386 + {
387 +        printf("m=%-15s\t\t# material name\n", thisillum.matname);
388 +        printf("f=%-15s\t\t# data file name\n", thisillum.datafile);
389 +        if (thisillum.flags & IL_COLAVG)
390 +                if (thisillum.flags & IL_COLDST)
391 +                        printf("c=d\t\t\t\t# color distribution\n");
392 +                else
393 +                        printf("c=a\t\t\t\t# color average\n");
394 +        else
395 +                printf("c=n\t\t\t\t# color none\n");
396 +        if (thisillum.flags & IL_LIGHT)
397 +                printf("l+\t\t\t\t# light type on\n");
398 +        else
399 +                printf("l-\t\t\t\t# light type off\n");
400 +        printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens);
401 +        printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps);
402 +        printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt);
403   }
404  
405  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines