ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rad.c
(Generate patch)

Comparing ray/src/util/rad.c (file contents):
Revision 2.43 by greg, Thu Jul 6 12:15:40 1995 UTC vs.
Revision 2.46 by greg, Tue Nov 7 18:22:24 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1994 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 38 | Line 38 | int    onevalue(), catvalues(), boolvalue(),
38   #define ZONE            9               /* simulation zone */
39   #define QUALITY         10              /* desired rendering quality */
40   #define OCTREE          11              /* octree file name */
41 < #define PICTURE         12              /* picture file name */
41 > #define PICTURE         12              /* picture file root name */
42   #define AMBFILE         13              /* ambient file name */
43   #define OPTFILE         14              /* rendering options file */
44   #define EXPOSURE        15              /* picture exposure setting */
# Line 49 | Line 49 | int    onevalue(), catvalues(), boolvalue(),
49   #define PENUMBRAS       20              /* shadow penumbras are desired */
50   #define VARIABILITY     21              /* level of light variability */
51   #define REPORT          22              /* report frequency and errfile */
52 < #define RAWSAVE         23              /* save raw picture file */
52 > #define RAWFILE         23              /* raw picture file root name */
53 > #define ZFILE           24              /* distance file root name */
54                                  /* total number of variables */
55 < #define NVARS           24
55 > #define NVARS           25
56  
57   VARIABLE        vv[NVARS] = {           /* variable-value pairs */
58          {"objects",     3,      0,      NULL,   catvalues},
# Line 77 | Line 78 | VARIABLE       vv[NVARS] = {           /* variable-value pairs */
78          {"PENUMBRAS",   3,      0,      NULL,   boolvalue},
79          {"VARIABILITY", 3,      0,      NULL,   qualvalue},
80          {"REPORT",      3,      0,      NULL,   onevalue},
81 <        {"RAWSAVE",     3,      0,      NULL,   boolvalue},
81 >        {"RAWFILE",     3,      0,      NULL,   onevalue},
82 >        {"ZFILE",       2,      0,      NULL,   onevalue},
83   };
84  
85   VARIABLE        *matchvar();
# Line 99 | Line 101 | char   *nvalue();
101  
102                                  /* overture calculation file */
103   #ifdef NIX
104 < char    overfile[] = "overture.raw";
104 > char    overfile[] = "overture.unf";
105   #else
106   char    overfile[] = "/dev/null";
107   #endif
# Line 561 | Line 563 | double org[3], *sizp;
563          extern FILE     *popen();
564          static double   oorg[3], osiz = 0.;
565          double  min[3], max[3];
566 <        char    buf[512];
566 >        char    buf[1024];
567          FILE    *fp;
568          register int    i;
569  
# Line 649 | Line 651 | setdefaults()                  /* set default values for unassigned v
651                  vval(VARIABILITY) = "L";
652                  vdef(VARIABILITY)++;
653          }
652        if (!vdef(RAWSAVE)) {
653                vval(RAWSAVE) = "F";
654                vdef(RAWSAVE)++;
655        }
654   }
655  
656  
# Line 691 | Line 689 | printvals()                    /* print variable values */
689   oconv()                         /* run oconv and mkillum if necessary */
690   {
691          static char     illumtmp[] = "ilXXXXXX";
692 <        char    combuf[512], ocopts[64], mkopts[64];
692 >        char    combuf[1024], ocopts[64], mkopts[64];
693  
694          oconvopts(ocopts);              /* get options */
695          if (octreedate < scenedate) {   /* check date on original octree */
# Line 779 | Line 777 | oconv()                                /* run oconv and mkillum if necessary */
777                                  "%s: error generating octree\n\t%s removed\n",
778                                          progname, oct1name);
779                          unlink(oct1name);
780 +                        unlink(illumtmp);
781                          exit(1);
782                  }
783                  rmfile(illumtmp);
# Line 1185 | Line 1184 | register char  *vs;
1184                  zpos = -1; vs++;
1185          }
1186          viewtype = 'v';
1187 <        if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h')
1187 >        if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h' | *vs == 'c')
1188                  viewtype = *vs++;
1189          cp = viewopts;
1190          if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) {       /* got one! */
# Line 1240 | Line 1239 | register char  *vs;
1239                  case 'h':
1240                          cp = addarg(cp, "-vh 180 -vv 180");
1241                          break;
1242 +                case 'c':
1243 +                        cp = addarg(cp, "-vh 180 -vv 90");
1244 +                        break;
1245                  }
1246          } else {
1247                  while (!isspace(*vs))           /* else skip id */
# Line 1388 | Line 1390 | rpict(opts, po)                                /* run rpict and pfilt for each vie
1390   char    *opts, *po;
1391   {
1392          char    combuf[1024];
1393 <        char    rawfile[MAXPATH], picfile[MAXPATH], rep[MAXPATH+16], res[32];
1393 >        char    rawfile[MAXPATH], picfile[MAXPATH];
1394 >        char    zopt[MAXPATH+4], rep[MAXPATH+16], res[32];
1395          char    pfopts[128];
1396          char    vs[32], *vw;
1397          int     vn, mult;
# Line 1441 | Line 1444 | char   *opts, *po;
1444                  if (!vs[0])
1445                          sprintf(vs, "%d", vn);
1446                  sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs);
1447 +                if (vdef(ZFILE))
1448 +                        sprintf(zopt, " -z %s_%s.zbf", vval(ZFILE), vs);
1449 +                else
1450 +                        zopt[0] = '\0';
1451                                                  /* check date on picture */
1452                  pfdt = fdate(picfile);
1453                  if (pfdt >= oct1date)
1454                          continue;
1455                                                  /* get raw file name */
1456 <                sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs);
1456 >                sprintf(rawfile, "%s_%s.unf",
1457 >                        vdef(RAWFILE) ? vval(RAWFILE) : vval(PICTURE), vs);
1458                  rfdt = fdate(rawfile);
1459                  if (touchonly) {                /* update times only */
1460                          if (rfdt) {
# Line 1458 | Line 1466 | char   *opts, *po;
1466                  }
1467                                                  /* build rpict command */
1468                  if (rfdt >= oct1date)           /* recover */
1469 <                        sprintf(combuf, "rpict%s%s%s -ro %s %s",
1470 <                                        rep, po, opts, rawfile, oct1name);
1469 >                        sprintf(combuf, "rpict%s%s%s%s -ro %s %s",
1470 >                                rep, po, opts, zopt, rawfile, oct1name);
1471                  else {
1472                          if (overture) {         /* run overture calculation */
1473                                  sprintf(combuf,
# Line 1476 | Line 1484 | char   *opts, *po;
1484                                  rmfile(overfile);
1485   #endif
1486                          }
1487 <                        sprintf(combuf, "rpict%s %s %s%s%s %s > %s",
1488 <                                        rep, vw, res, po, opts,
1489 <                                oct1name, rawfile);
1487 >                        sprintf(combuf, "rpict%s %s %s%s%s%s %s > %s",
1488 >                                        rep, vw, res, po, opts, zopt,
1489 >                                        oct1name, rawfile);
1490                  }
1491                  if (runcom(combuf)) {           /* run rpict */
1492                          fprintf(stderr, "%s: error rendering view %s\n",
1493                                          progname, vs);
1494                          exit(1);
1495                  }
1496 +                if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) {
1497                                                  /* build pfilt command */
1498 <                if (mult > 1)
1499 <                        sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s",
1498 >                        if (mult > 1)
1499 >                                sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s",
1500                                          pfopts, mult, mult, rawfile, picfile);
1501 <                else
1502 <                        sprintf(combuf, "pfilt%s %s > %s", pfopts,
1503 <                                        rawfile, picfile);
1504 <                if (runcom(combuf)) {           /* run pfilt */
1505 <                        fprintf(stderr,
1506 <                        "%s: error filtering view %s\n\t%s removed\n",
1507 <                                        progname, vs, picfile);
1508 <                        unlink(picfile);
1509 <                        exit(1);
1501 >                        else
1502 >                                sprintf(combuf, "pfilt%s %s > %s", pfopts,
1503 >                                                rawfile, picfile);
1504 >                        if (runcom(combuf)) {           /* run pfilt */
1505 >                                fprintf(stderr,
1506 >                                "%s: error filtering view %s\n\t%s removed\n",
1507 >                                                progname, vs, picfile);
1508 >                                unlink(picfile);
1509 >                                exit(1);
1510 >                        }
1511                  }
1512                                                  /* remove/rename raw file */
1513 <                if (vbool(RAWSAVE)) {
1514 <                        sprintf(combuf, "%s_%s.rwp", vval(PICTURE), vs);
1513 >                if (vdef(RAWFILE)) {
1514 >                        sprintf(combuf, "%s_%s.pic", vval(RAWFILE), vs);
1515                          mvfile(rawfile, combuf);
1516                  } else
1517                          rmfile(rawfile);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines