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.79 by greg, Mon Oct 4 04:42:33 2004 UTC vs.
Revision 2.86 by greg, Thu Aug 21 07:05:59 2008 UTC

# Line 1012 | Line 1012 | specview(                              /* get proper view spec from vs */
1012          } else if (*vs == 'z') {
1013                  zpos = -1; vs++;
1014          }
1015 <        viewtype = 'v';
1016 <        if((*vs == 'v') | (*vs == 'l') | (*vs == 'a') | (*vs == 'h') | (*vs == 'c'))
1015 >        switch (*vs) {
1016 >        case VT_PER:
1017 >        case VT_PAR:
1018 >        case VT_ANG:
1019 >        case VT_HEM:
1020 >        case VT_PLS:
1021 >        case VT_CYL:
1022                  viewtype = *vs++;
1023 +                break;
1024 +        default:
1025 +                viewtype = VT_PER;
1026 +                break;
1027 +        }
1028          cp = viewopts;
1029          if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) {       /* got one! */
1030                  *cp++ = '-'; *cp++ = 'v'; *cp++ = 't'; *cp++ = viewtype;
# Line 1056 | Line 1066 | specview(                              /* get proper view spec from vs */
1066                  }
1067                  cp = addarg(cp, vup[upax+3]);
1068                  switch (viewtype) {
1069 <                case 'v':
1069 >                case VT_PER:
1070                          cp = addarg(cp, "-vh 45 -vv 45");
1071                          break;
1072 <                case 'l':
1072 >                case VT_PAR:
1073                          d = sqrt(dim[0]*dim[0]+dim[1]*dim[1]+dim[2]*dim[2]);
1074                          sprintf(cp, " -vh %.2g -vv %.2g", d, d);
1075                          cp += strlen(cp);
1076                          break;
1077 <                case 'a':
1078 <                case 'h':
1077 >                case VT_ANG:
1078 >                case VT_HEM:
1079 >                case VT_PLS:
1080                          cp = addarg(cp, "-vh 180 -vv 180");
1081                          break;
1082 <                case 'c':
1082 >                case VT_CYL:
1083                          cp = addarg(cp, "-vh 180 -vv 90");
1084                          break;
1085                  }
# Line 1145 | Line 1156 | myprintview(                   /* print out selected view */
1156          VIEW    vwr;
1157          char    buf[128];
1158          register char   *cp;
1159 + #ifdef _WIN32
1160 + /* XXX Should we allow something like this for all platforms? */
1161 + /* XXX Or is it still required at all? */
1162 + again:
1163 + #endif
1164          if (vopts == NULL)
1165                  return(-1);
1166   #ifdef _WIN32
# Line 1181 | Line 1197 | rvu(                           /* run rvu with first view */
1197          if (sayview)
1198                  myprintview(vw, stdout);
1199          sprintf(combuf, "rvu %s%s%s -R %s ", vw, po, opts, rifname);
1200 +        if (nprocs > 1)
1201 +                sprintf(combuf+strlen(combuf), "-n %d ", nprocs);
1202          if (rvdevice != NULL)
1203                  sprintf(combuf+strlen(combuf), "-o %s ", rvdevice);
1204          if (vdef(EXPOSURE))
# Line 1315 | Line 1333 | rpict(                         /* run rpict and pfilt for each view */
1333                                          zopt, oct1name, rawfile);
1334                          if (pfile != NULL && inchild()) {
1335                                                  /* rpict persistent mode */
1336 <                                if (!silent) {
1336 >                                if (!silent)
1337                                          printf("\t%s\n", combuf);
1338 <                                        fflush(stdout);
1321 <                                }
1338 >                                fflush(stdout);
1339                                  sprintf(combuf, "rpict%s %s %s%s%s %s > %s",
1340                                                  rep, rppopt, res, po, opts,
1341                                                  oct1name, rawfile);
1325                                fflush(stdout);
1342                                  fp = popen(combuf, "w");
1343                                  if (fp == NULL)
1344                                          goto rperror;
# Line 1360 | Line 1376 | rpict(                         /* run rpict and pfilt for each view */
1376          }
1377          wait_process(1);                /* wait for children to finish */
1378          if (pfile != NULL) {            /* clean up rpict persistent mode */
1379 <                int     pid;
1379 >                RT_PID  pid;
1380                  fp = fopen(pfile, "r");
1381                  if (fp != NULL) {
1382                          if (fscanf(fp, "%*s %d", &pid) != 1 ||
# Line 1403 | Line 1419 | runcom(                        /* run command */
1419                  printf("\t%s\n", cs);
1420          if (!nprocs)
1421                  return(0);
1422 <        fflush(stdout);         /* flush output and pass to shell */
1422 >        fflush(NULL);           /* flush output and pass to shell */
1423          return(system(cs));
1424   }
1425  
# Line 1439 | Line 1455 | mvfile(                /* move a file */
1455   static int
1456   next_process(void)                      /* fork the next process (max. nprocs) */
1457   {
1458 <        int     child_pid;
1458 >        RT_PID  child_pid;
1459  
1460          if (nprocs <= 1)
1461                  return(0);              /* it's us or no one */
# Line 1450 | Line 1466 | next_process(void)                     /* fork the next process (max. np
1466          }
1467          if (children_running >= nprocs)
1468                  wait_process(0);        /* wait for someone to finish */
1469 <        fflush(stdout);
1469 >        fflush(NULL);                   /* flush output */
1470          child_pid = fork();             /* split process */
1471          if (child_pid == 0) {           /* we're the child */
1472                  children_running = -1;
# Line 1469 | Line 1485 | wait_process(                  /* wait for process(es) to finish */
1485          int     all
1486   )
1487   {
1488 <        int     ourstatus = 0;
1489 <        int     pid, status;
1488 >        int     ourstatus = 0, status;
1489 >        RT_PID  pid;
1490  
1491          if (all)
1492                  all = children_running;
# Line 1507 | Line 1523 | int    all;
1523   }
1524   int
1525   kill(pid, sig) /* win|unix_process.c should also wait and kill */
1526 < int pid, sig;
1526 > RT_PID pid;
1527 > int sig;
1528   {
1529          return 0;
1530   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines