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

Comparing ray/src/util/rfluxmtx.c (file contents):
Revision 2.8 by greg, Fri Jul 25 15:46:10 2014 UTC vs.
Revision 2.13 by greg, Wed Aug 6 00:59:53 2014 UTC

# Line 11 | Line 11 | static const char RCSid[] = "$Id$";
11   #include <stdlib.h>
12   #include "rtio.h"
13   #include "rtmath.h"
14 + #include "rtprocess.h"
15   #include "bsdf.h"
16   #include "bsdf_m.h"
17   #include "random.h"
# Line 144 | Line 145 | surf_type(const char *otype)
145   static char *
146   oconv_command(int ac, char *av[])
147   {
148 <        static char     oconvbuf[2048] = "!oconv -f";
149 <        char            *cp = oconvbuf + 9;
150 <
148 >        static char     oconvbuf[2048] = "!oconv -f ";
149 >        char            *cp = oconvbuf + 10;
150 >        char            *recv = *av++;
151 >        
152 >        if (ac-- <= 0)
153 >                return(NULL);
154          while (ac-- > 0) {
155 +                strcpy(cp, *av++);
156 +                while (*cp) cp++;
157 +                *cp++ = ' ';
158                  if (cp >= oconvbuf+(sizeof(oconvbuf)-32)) {
159                          fputs(progname, stderr);
160                          fputs(": too many file arguments!\n", stderr);
161                          exit(1);
162                  }
156                *cp++ = ' ';
157                strcpy(cp, *av++);
158                while (*cp) cp++;
163          }
164 <        *cp = '\0';
164 >        strcpy(cp, recv);       /* receiver goes last */
165          return(oconvbuf);
166   }
167  
# Line 401 | Line 405 | finish_receiver(void)
405                  fputs(": undefined normal for hemisphere sampling\n", stderr);
406                  exit(1);
407          }
408 <        if (normalize(curparams.vup) == 0)
408 >        if (normalize(curparams.vup) == 0) {
409                  if (fabs(curparams.nrm[2]) < .7)
410                          curparams.vup[2] = 1;
411                  else
412                          curparams.vup[1] = 1;
413 +        }
414                                          /* determine sample type/bin */
415          if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') {
416                  binv = "0";             /* uniform sampling -- one bin */
# Line 419 | Line 424 | finish_receiver(void)
424                          exit(1);
425                  }
426                  calfn = shirchiufn; shirchiufn = NULL;
427 <                sprintf(sbuf, "SCdim=%d,Nx=%g,Ny=%g,Nz=%g,Ux=%g,Uy=%g,Uz=%g",
427 >                sprintf(sbuf, "SCdim=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g",
428                                  curparams.hsiz,
429                          curparams.nrm[0], curparams.nrm[1], curparams.nrm[2],
430                          curparams.vup[0], curparams.vup[1], curparams.vup[2]);
# Line 429 | Line 434 | finish_receiver(void)
434          } else if ((tolower(curparams.hemis[0]) == 'r') |
435                          (tolower(curparams.hemis[0]) == 't')) {
436                  calfn = reinhfn; reinhfn = NULL;
437 <                sprintf(sbuf, "MF=%d,Nx=%g,Ny=%g,Nz=%g,Ux=%g,Uy=%g,Uz=%g",
437 >                sprintf(sbuf, "MF=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g",
438                                  curparams.hsiz,
439                          curparams.nrm[0], curparams.nrm[1], curparams.nrm[2],
440                          curparams.vup[0], curparams.vup[1], curparams.vup[2]);
# Line 872 | Line 877 | prepare_sampler(void)
877                  fputs(": undefined normal for sender sampling\n", stderr);
878                  return(-1);
879          }
880 <        if (normalize(curparams.vup) == 0)
880 >        if (normalize(curparams.vup) == 0) {
881                  if (fabs(curparams.nrm[2]) < .7)
882                          curparams.vup[2] = 1;
883                  else
884                          curparams.vup[1] = 1;
885 +        }
886          VCROSS(curparams.udir, curparams.vup, curparams.nrm);
887          if (normalize(curparams.udir) == 0) {
888                  fputs(progname, stderr);
# Line 1066 | Line 1072 | add_recv_object(FILE *fp)
1072                                          /* else skip arguments */
1073          if (!fscanf(fp, "%d", &n)) return(0);
1074          while (n-- > 0) fscanf(fp, "%*s");
1075 <        if (!fscanf(fp, "%d", &n)) return;
1075 >        if (!fscanf(fp, "%d", &n)) return(0);
1076          while (n-- > 0) fscanf(fp, "%*d");
1077 <        if (!fscanf(fp, "%d", &n)) return;
1077 >        if (!fscanf(fp, "%d", &n)) return(0);
1078          while (n-- > 0) fscanf(fp, "%*f");
1079          return(0);
1080   }
# Line 1102 | Line 1108 | add_send_object(FILE *fp)
1108                                          /* else skip arguments */
1109          if (!fscanf(fp, "%d", &n)) return(0);
1110          while (n-- > 0) fscanf(fp, "%*s");
1111 <        if (!fscanf(fp, "%d", &n)) return;
1111 >        if (!fscanf(fp, "%d", &n)) return(0);
1112          while (n-- > 0) fscanf(fp, "%*d");
1113 <        if (!fscanf(fp, "%d", &n)) return;
1113 >        if (!fscanf(fp, "%d", &n)) return(0);
1114          while (n-- > 0) fscanf(fp, "%*f");
1115          return(0);
1116   }
# Line 1147 | Line 1153 | load_scene(const char *inspec, int (*ocb)(FILE *))
1153                                          strcat(newparams, inpbuf);
1154                                  continue;
1155                          }
1156 <                        while ((c = getc(fp)) != EOF && c != '\n');
1156 >                        while ((c = getc(fp)) != EOF && c != '\n')
1157                                  ;       /* else skipping comment */
1158                          continue;
1159                  }
# Line 1172 | Line 1178 | main(int argc, char *argv[])
1178   {
1179          char    fmtopt[6] = "-faa";     /* default output is ASCII */
1180          char    *xrs=NULL, *yrs=NULL, *ldopt=NULL;
1181 <        int     wantIrradiance = 0;
1181 >        char    *iropt = NULL;
1182          char    *sendfn;
1183          char    sampcntbuf[32], nsbinbuf[32];
1184          FILE    *rcfp;
# Line 1221 | Line 1227 | main(int argc, char *argv[])
1227                          na = 0;         /* we re-add this later */
1228                          continue;
1229                  case 'I':               /* only for pass-through mode */
1230 <                        wantIrradiance = 1;
1230 >                case 'i':
1231 >                        iropt = argv[a];
1232                          na = 0;
1233                          continue;
1234                  case 'V':               /* options without arguments */
1235                  case 'w':
1236                  case 'u':
1230                case 'i':
1237                  case 'h':
1238                  case 'r':
1239                          break;
# Line 1275 | Line 1281 | done_opts:
1281          if (sendfn[0] == '-') {         /* user wants pass-through mode? */
1282                  if (sendfn[1]) goto userr;
1283                  sendfn = NULL;
1284 <                if (wantIrradiance) {
1284 >                if (iropt) {
1285                          CHECKARGC(1);
1286 <                        rcarg[nrcargs++] = "-I";
1286 >                        rcarg[nrcargs++] = iropt;
1287                  }
1288                  if (xrs) {
1289                          CHECKARGC(2);
# Line 1295 | Line 1301 | done_opts:
1301                  }
1302                  if (sampcnt <= 0) sampcnt = 1;
1303          } else {                        /* else in sampling mode */
1304 <                if (wantIrradiance) {
1304 >                if (iropt) {
1305                          fputs(progname, stderr);
1306 <                        fputs(": -I supported for pass-through only\n", stderr);
1306 >                        fputs(": -i, -I supported for pass-through only\n", stderr);
1307                          return(1);
1308                  }
1309                  fmtopt[2] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f';
# Line 1350 | Line 1356 | done_opts:
1356   userr:
1357          if (a < argc-2)
1358                  fprintf(stderr, "%s: unsupported option '%s'", progname, argv[a]);
1359 <        fprintf(stderr, "Usage: %s [-v][rcontrib options] sender.rad receiver.rad [system.rad ..]\n",
1359 >        fprintf(stderr, "Usage: %s [-v][rcontrib options] sender.rad receiver.rad [-i system.oct] [system.rad ..]\n",
1360                                  progname);
1361          return(1);
1362   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines