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.5 by greg, Wed Jul 24 16:48:22 1991 UTC vs.
Revision 1.13 by greg, Mon Aug 26 10:16:54 1991 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 36 | Line 37 | struct rtproc  rt;             /* our rtrace process */
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 58 | Line 60 | int    doneheader = 0;         /* printed header yet? */
60   int     warnings = 1;           /* print warnings? */
61  
62   extern char     *fgetline(), *fgetword(), *sskip(),
63 <                *atos(), *iskip(), *fskip();
63 >                *atos(), *iskip(), *fskip(), *strcpy();
64   extern FILE     *popen();
65  
66  
# Line 89 | Line 91 | char   *argv[];
91          rtargv[rtargc] = NULL;
92                                  /* just asking for defaults? */
93          if (!strcmp(argv[gargc-1], "-defaults")) {
94 +                printopts(); fflush(stdout);
95                  rtpath = getpath(rtargv[0], getenv("PATH"), X_OK);
96                  if (rtpath == NULL) {
97                          eputs(rtargv[0]);
# Line 158 | Line 161 | init()                         /* start rtrace and set up buffers */
161          if (rt.buf == NULL || rt.dest == NULL)
162                  error(SYSTEM, "out of memory in init");
163          rt.nrays = 0;
164 +                                        /* set up urand */
165 +        initurand(2048);
166   }
167  
168  
# Line 253 | Line 258 | char   *nm;
258                          if (*++cp != '=')
259                                  break;
260                          if (!*++cp) {
261 +                                strcpy(thisillum.datafile,thisillum.matname);
262 +                                thisillum.dfnum = 0;
263                                  thisillum.flags &= ~IL_DATCLB;
264                                  continue;
265                          }
# Line 263 | Line 270 | char   *nm;
270                          continue;
271                  case 'i':                       /* include material */
272                  case 'e':                       /* exclude material */
273 <                        matselect = (*cp == 'i') ? S_ELEM : S_COMPL;
267 <                        if (*++cp != '=')
273 >                        if (cp[1] != '=')
274                                  break;
275 <                        atos(matcheck, MAXSTR, ++cp);
275 >                        matselect = (*cp == 'i') ? S_ELEM : S_COMPL;
276 >                        cp += 2;
277 >                        atos(matcheck, MAXSTR, cp);
278                          cp = sskip(cp);
279                          continue;
280                  case 'a':                       /* use everything */
# Line 282 | Line 290 | char   *nm;
290                                  break;
291                          switch (*++cp) {
292                          case 'a':                       /* average */
293 <                                thisillum.flags |= IL_COLAVG;
294 <                                thisillum.flags &= ~IL_COLDST;
293 >                                thisillum.flags = (thisillum.flags|IL_COLAVG)
294 >                                                        & ~IL_COLDST;
295                                  break;
296                          case 'd':                       /* distribution */
297                                  thisillum.flags |= (IL_COLDST|IL_COLAVG);
# Line 322 | Line 330 | char   *nm;
330                                  break;
331                          cp++;
332                          continue;
333 +                case 'b':                       /* brightness */
334 +                        if (*++cp != '=')
335 +                                break;
336 +                        if (!isfltd(++cp, " \t\n"))
337 +                                break;
338 +                        thisillum.minbrt = atof(cp);
339 +                        if (thisillum.minbrt < 0.)
340 +                                thisillum.minbrt = 0.;
341 +                        cp = sskip(cp);
342 +                        continue;
343                  case 'o':                       /* output file */
344                          if (*++cp != '=')
345                                  break;
# Line 336 | Line 354 | char   *nm;
354                          }
355                          doneheader = 0;
356                          continue;
357 +                case '!':                       /* processed file! */
358 +                        sprintf(errmsg, "(%s): already processed!", nm);
359 +                        error(WARNING, errmsg);
360 +                        matselect = S_NONE;
361 +                        return;
362                  }
363          opterr:                                 /* skip faulty option */
364                  cp = sskip(cp);
# Line 357 | Line 380 | char   *nm;
380   }
381  
382  
383 + printopts()                     /* print out option default values */
384 + {
385 +        printf("m=%-15s\t\t# material name\n", thisillum.matname);
386 +        printf("f=%-15s\t\t# data file name\n", thisillum.datafile);
387 +        printf("c=n\t\t\t\t# color none\n");
388 +        printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens);
389 +        printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps);
390 +        printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt);
391 + }
392 +
393 +
394   printhead(ac, av)                       /* print out header */
395   register int  ac;
396   register char  **av;
# Line 366 | Line 400 | register char  **av;
400                  putchar(' ');
401                  fputs(*av++, stdout);
402          }
403 <        putchar('\n');
403 >        fputs("\n#@mkillum !\n", stdout);
404   }
405  
406  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines