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.9 by greg, Fri Jul 25 16:58:20 2014 UTC vs.
Revision 2.11 by greg, Fri Jul 25 19:23:14 2014 UTC

# Line 401 | Line 401 | finish_receiver(void)
401                  fputs(": undefined normal for hemisphere sampling\n", stderr);
402                  exit(1);
403          }
404 <        if (normalize(curparams.vup) == 0)
404 >        if (normalize(curparams.vup) == 0) {
405                  if (fabs(curparams.nrm[2]) < .7)
406                          curparams.vup[2] = 1;
407                  else
408                          curparams.vup[1] = 1;
409 +        }
410                                          /* determine sample type/bin */
411          if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') {
412                  binv = "0";             /* uniform sampling -- one bin */
# Line 872 | Line 873 | prepare_sampler(void)
873                  fputs(": undefined normal for sender sampling\n", stderr);
874                  return(-1);
875          }
876 <        if (normalize(curparams.vup) == 0)
876 >        if (normalize(curparams.vup) == 0) {
877                  if (fabs(curparams.nrm[2]) < .7)
878                          curparams.vup[2] = 1;
879                  else
880                          curparams.vup[1] = 1;
881 +        }
882          VCROSS(curparams.udir, curparams.vup, curparams.nrm);
883          if (normalize(curparams.udir) == 0) {
884                  fputs(progname, stderr);
# Line 1066 | Line 1068 | add_recv_object(FILE *fp)
1068                                          /* else skip arguments */
1069          if (!fscanf(fp, "%d", &n)) return(0);
1070          while (n-- > 0) fscanf(fp, "%*s");
1071 <        if (!fscanf(fp, "%d", &n)) return;
1071 >        if (!fscanf(fp, "%d", &n)) return(0);
1072          while (n-- > 0) fscanf(fp, "%*d");
1073 <        if (!fscanf(fp, "%d", &n)) return;
1073 >        if (!fscanf(fp, "%d", &n)) return(0);
1074          while (n-- > 0) fscanf(fp, "%*f");
1075          return(0);
1076   }
# Line 1102 | Line 1104 | add_send_object(FILE *fp)
1104                                          /* else skip arguments */
1105          if (!fscanf(fp, "%d", &n)) return(0);
1106          while (n-- > 0) fscanf(fp, "%*s");
1107 <        if (!fscanf(fp, "%d", &n)) return;
1107 >        if (!fscanf(fp, "%d", &n)) return(0);
1108          while (n-- > 0) fscanf(fp, "%*d");
1109 <        if (!fscanf(fp, "%d", &n)) return;
1109 >        if (!fscanf(fp, "%d", &n)) return(0);
1110          while (n-- > 0) fscanf(fp, "%*f");
1111          return(0);
1112   }
# Line 1147 | Line 1149 | load_scene(const char *inspec, int (*ocb)(FILE *))
1149                                          strcat(newparams, inpbuf);
1150                                  continue;
1151                          }
1152 <                        while ((c = getc(fp)) != EOF && c != '\n');
1152 >                        while ((c = getc(fp)) != EOF && c != '\n')
1153                                  ;       /* else skipping comment */
1154                          continue;
1155                  }
# Line 1172 | Line 1174 | main(int argc, char *argv[])
1174   {
1175          char    fmtopt[6] = "-faa";     /* default output is ASCII */
1176          char    *xrs=NULL, *yrs=NULL, *ldopt=NULL;
1177 <        int     wantIrradiance = 0;
1177 >        char    *iropt = NULL;
1178          char    *sendfn;
1179          char    sampcntbuf[32], nsbinbuf[32];
1180          FILE    *rcfp;
# Line 1221 | Line 1223 | main(int argc, char *argv[])
1223                          na = 0;         /* we re-add this later */
1224                          continue;
1225                  case 'I':               /* only for pass-through mode */
1226 <                        wantIrradiance = 1;
1226 >                case 'i':
1227 >                        iropt = argv[a];
1228                          na = 0;
1229                          continue;
1230                  case 'V':               /* options without arguments */
1231                  case 'w':
1232                  case 'u':
1230                case 'i':
1233                  case 'h':
1234                  case 'r':
1235                          break;
# Line 1275 | Line 1277 | done_opts:
1277          if (sendfn[0] == '-') {         /* user wants pass-through mode? */
1278                  if (sendfn[1]) goto userr;
1279                  sendfn = NULL;
1280 <                if (wantIrradiance) {
1280 >                if (iropt) {
1281                          CHECKARGC(1);
1282 <                        rcarg[nrcargs++] = "-I";
1282 >                        rcarg[nrcargs++] = iropt;
1283                  }
1284                  if (xrs) {
1285                          CHECKARGC(2);
# Line 1295 | Line 1297 | done_opts:
1297                  }
1298                  if (sampcnt <= 0) sampcnt = 1;
1299          } else {                        /* else in sampling mode */
1300 <                if (wantIrradiance) {
1300 >                if (iropt) {
1301                          fputs(progname, stderr);
1302 <                        fputs(": -I supported for pass-through only\n", stderr);
1302 >                        fputs(": -i, -I supported for pass-through only\n", stderr);
1303                          return(1);
1304                  }
1305                  fmtopt[2] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines