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.7 by greg, Wed Jul 23 22:39:40 2014 UTC vs.
Revision 2.12 by greg, Mon Jul 28 16:30:18 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 401 | Line 402 | finish_receiver(void)
402                  fputs(": undefined normal for hemisphere sampling\n", stderr);
403                  exit(1);
404          }
405 <        if (normalize(curparams.vup) == 0)
405 >        if (normalize(curparams.vup) == 0) {
406                  if (fabs(curparams.nrm[2]) < .7)
407                          curparams.vup[2] = 1;
408                  else
409                          curparams.vup[1] = 1;
410 +        }
411                                          /* determine sample type/bin */
412          if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') {
413                  binv = "0";             /* uniform sampling -- one bin */
# Line 419 | Line 421 | finish_receiver(void)
421                          exit(1);
422                  }
423                  calfn = shirchiufn; shirchiufn = NULL;
424 <                sprintf(sbuf, "SCdim=%d,Nx=%g,Ny=%g,Nz=%g,Ux=%g,Uy=%g,Uz=%g",
424 >                sprintf(sbuf, "SCdim=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g",
425                                  curparams.hsiz,
426                          curparams.nrm[0], curparams.nrm[1], curparams.nrm[2],
427                          curparams.vup[0], curparams.vup[1], curparams.vup[2]);
# Line 429 | Line 431 | finish_receiver(void)
431          } else if ((tolower(curparams.hemis[0]) == 'r') |
432                          (tolower(curparams.hemis[0]) == 't')) {
433                  calfn = reinhfn; reinhfn = NULL;
434 <                sprintf(sbuf, "MF=%d,Nx=%g,Ny=%g,Nz=%g,Ux=%g,Uy=%g,Uz=%g",
434 >                sprintf(sbuf, "MF=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g",
435                                  curparams.hsiz,
436                          curparams.nrm[0], curparams.nrm[1], curparams.nrm[2],
437                          curparams.vup[0], curparams.vup[1], curparams.vup[2]);
# Line 872 | Line 874 | prepare_sampler(void)
874                  fputs(": undefined normal for sender sampling\n", stderr);
875                  return(-1);
876          }
877 <        if (normalize(curparams.vup) == 0)
877 >        if (normalize(curparams.vup) == 0) {
878                  if (fabs(curparams.nrm[2]) < .7)
879                          curparams.vup[2] = 1;
880                  else
881                          curparams.vup[1] = 1;
882 +        }
883          VCROSS(curparams.udir, curparams.vup, curparams.nrm);
884          if (normalize(curparams.udir) == 0) {
885                  fputs(progname, stderr);
# Line 1000 | Line 1003 | add_surface(int st, const char *oname, FILE *fp)
1003          case ST_SOURCE:
1004                  if (snew->nfargs != 4)
1005                          goto badcount;
1006 <                VCOPY(snew->snrm, snew->farg);
1006 >                for (n = 3; n--; )      /* need to reverse "normal" */
1007 >                        snew->snrm[n] = -snew->farg[n];
1008                  if (normalize(snew->snrm) == 0)
1009                          goto badnorm;
1010                  snew->area = sin((PI/180./2.)*snew->farg[3]);
# Line 1063 | Line 1067 | add_recv_object(FILE *fp)
1067                  return(1);
1068          }
1069                                          /* else skip arguments */
1070 <        if (!fscanf(fp, "%d", &n)) return;
1070 >        if (!fscanf(fp, "%d", &n)) return(0);
1071          while (n-- > 0) fscanf(fp, "%*s");
1072 <        if (!fscanf(fp, "%d", &n)) return;
1072 >        if (!fscanf(fp, "%d", &n)) return(0);
1073          while (n-- > 0) fscanf(fp, "%*d");
1074 <        if (!fscanf(fp, "%d", &n)) return;
1074 >        if (!fscanf(fp, "%d", &n)) return(0);
1075          while (n-- > 0) fscanf(fp, "%*f");
1076          return(0);
1077   }
# Line 1099 | Line 1103 | add_send_object(FILE *fp)
1103                  return(0);
1104          }
1105                                          /* else skip arguments */
1106 <        if (!fscanf(fp, "%d", &n)) return;
1106 >        if (!fscanf(fp, "%d", &n)) return(0);
1107          while (n-- > 0) fscanf(fp, "%*s");
1108 <        if (!fscanf(fp, "%d", &n)) return;
1108 >        if (!fscanf(fp, "%d", &n)) return(0);
1109          while (n-- > 0) fscanf(fp, "%*d");
1110 <        if (!fscanf(fp, "%d", &n)) return;
1110 >        if (!fscanf(fp, "%d", &n)) return(0);
1111          while (n-- > 0) fscanf(fp, "%*f");
1112          return(0);
1113   }
# Line 1146 | Line 1150 | load_scene(const char *inspec, int (*ocb)(FILE *))
1150                                          strcat(newparams, inpbuf);
1151                                  continue;
1152                          }
1153 <                        while ((c = getc(fp)) != EOF && c != '\n');
1153 >                        while ((c = getc(fp)) != EOF && c != '\n')
1154                                  ;       /* else skipping comment */
1155                          continue;
1156                  }
# Line 1171 | Line 1175 | main(int argc, char *argv[])
1175   {
1176          char    fmtopt[6] = "-faa";     /* default output is ASCII */
1177          char    *xrs=NULL, *yrs=NULL, *ldopt=NULL;
1178 +        char    *iropt = NULL;
1179          char    *sendfn;
1180          char    sampcntbuf[32], nsbinbuf[32];
1181          FILE    *rcfp;
# Line 1218 | Line 1223 | main(int argc, char *argv[])
1223                                  goto userr;
1224                          na = 0;         /* we re-add this later */
1225                          continue;
1226 +                case 'I':               /* only for pass-through mode */
1227 +                case 'i':
1228 +                        iropt = argv[a];
1229 +                        na = 0;
1230 +                        continue;
1231                  case 'V':               /* options without arguments */
1232                  case 'w':
1233                  case 'u':
1224                case 'i':
1234                  case 'h':
1235                  case 'r':
1236                          break;
# Line 1269 | Line 1278 | done_opts:
1278          if (sendfn[0] == '-') {         /* user wants pass-through mode? */
1279                  if (sendfn[1]) goto userr;
1280                  sendfn = NULL;
1281 +                if (iropt) {
1282 +                        CHECKARGC(1);
1283 +                        rcarg[nrcargs++] = iropt;
1284 +                }
1285                  if (xrs) {
1286                          CHECKARGC(2);
1287                          rcarg[nrcargs++] = "-x";
# Line 1284 | Line 1297 | done_opts:
1297                          rcarg[nrcargs++] = ldopt;
1298                  }
1299                  if (sampcnt <= 0) sampcnt = 1;
1300 <        } else {                        /* else FVECT determines input format */
1300 >        } else {                        /* else in sampling mode */
1301 >                if (iropt) {
1302 >                        fputs(progname, stderr);
1303 >                        fputs(": -i, -I supported for pass-through only\n", stderr);
1304 >                        return(1);
1305 >                }
1306                  fmtopt[2] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f';
1307                  if (sampcnt <= 0) sampcnt = 10000;
1308          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines