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.37 by greg, Fri Apr 15 00:06:36 2016 UTC vs.
Revision 2.44 by greg, Thu Apr 13 22:47:17 2017 UTC

# Line 64 | Line 64 | typedef struct {
64          FVECT   uva[2];                 /* tangent axes */
65          int     ntris;                  /* number of triangles */
66          struct ptri {
67 <                float   afrac;                  /* fraction of total area */
67 >                double  afrac;                  /* fraction of total area */
68                  short   vndx[3];                /* vertex indices */
69          }       tri[1];                 /* triangle array (extends struct) */
70   } POLYTRIS;                     /* triangulated polygon */
# Line 138 | Line 138 | oconv_command(int ac, char *av[])
138          
139          if (ac-- <= 0)
140                  return(NULL);
141 +        if (verbose < 0) {      /* turn off warnings */
142 +                strcpy(cp, "-w- ");
143 +                cp += 4;
144 +        }
145          while (ac-- > 0) {
146                  strcpy(cp, *av++);
147                  while (*cp) cp++;
# Line 379 | Line 383 | finish_receiver(void)
383                          curparams.vup[1] = 1;
384          }
385                                          /* determine sample type/bin */
386 <        if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') {
386 >        if ((tolower(curparams.hemis[0]) == 'u') | (curparams.hemis[0] == '1')) {
387                  sprintf(sbuf, "if(-Dx*%g-Dy*%g-Dz*%g,0,-1)",
388                          curparams.nrm[0], curparams.nrm[1], curparams.nrm[2]);
389                  binv = savqstr(sbuf);
# Line 602 | Line 606 | ssamp_poly(FVECT orig, SURF *sp, double x)
606                  sp->priv = (void *)ptp;
607          }
608                                          /* pick triangle by partial area */
609 <        for (i = 0; i < ptp->ntris && x > ptp->tri[i].afrac; i++)
609 >        for (i = 0; i < ptp->ntris-1 && x > ptp->tri[i].afrac; i++)
610                  x -= ptp->tri[i].afrac;
611          SDmultiSamp(samp2, 2, x/ptp->tri[i].afrac);
612          samp2[0] *= samp2[1] = sqrt(samp2[1]);
# Line 690 | Line 694 | sample_uniform(PARAMS *p, int b, FILE *fp)
694                                                  duvw[2]*p->nrm[i] ;
695                  if (!sample_origin(p, orig_dir[0], orig_dir[1], samp3[0]))
696                          return(0);
697 <                if (fwrite(orig_dir, sizeof(FVECT), 2, fp) != 2)
697 >                if (putbinary(orig_dir, sizeof(FVECT), 2, fp) != 2)
698                          return(0);
699          }
700          return(1);
# Line 720 | Line 724 | sample_shirchiu(PARAMS *p, int b, FILE *fp)
724                                                  duvw[2]*p->nrm[i] ;
725                  if (!sample_origin(p, orig_dir[0], orig_dir[1], samp3[0]))
726                          return(0);
727 <                if (fwrite(orig_dir, sizeof(FVECT), 2, fp) != 2)
727 >                if (putbinary(orig_dir, sizeof(FVECT), 2, fp) != 2)
728                          return(0);
729          }
730          return(1);
# Line 768 | Line 772 | sample_reinhart(PARAMS *p, int b, FILE *fp)
772                                                  duvw[2]*p->nrm[i] ;
773                  if (!sample_origin(p, orig_dir[0], orig_dir[1], samp3[0]))
774                          return(0);
775 <                if (fwrite(orig_dir, sizeof(FVECT), 2, fp) != 2)
775 >                if (putbinary(orig_dir, sizeof(FVECT), 2, fp) != 2)
776                          return(0);
777          }
778          return(1);
# Line 819 | Line 823 | sample_klems(PARAMS *p, int b, FILE *fp)
823                                                  duvw[2]*p->nrm[i] ;
824                  if (!sample_origin(p, orig_dir[0], orig_dir[1], samp2[0]))
825                          return(0);
826 <                if (fwrite(orig_dir, sizeof(FVECT), 2, fp) != 2)
826 >                if (putbinary(orig_dir, sizeof(FVECT), 2, fp) != 2)
827                          return(0);
828          }
829          return(1);
# Line 867 | Line 871 | prepare_sampler(void)
871                  curparams.udir[1] *= -1.;
872                  curparams.udir[2] *= -1.;
873          }
874 <        if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1')
874 >        if ((tolower(curparams.hemis[0]) == 'u') | (curparams.hemis[0] == '1'))
875                  curparams.sample_basis = sample_uniform;
876          else if (tolower(curparams.hemis[0]) == 's' &&
877                                  tolower(curparams.hemis[1]) == 'c')
# Line 1305 | Line 1309 | main(int argc, char *argv[])
1309                          fputs(": -i, -I supported for pass-through only\n", stderr);
1310                          return(1);
1311                  }
1312 <                fmtopt[2] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f';
1312 > #ifdef SMLFLT
1313 >                fmtopt[2] = 'f';
1314 > #else
1315 >                fmtopt[2] = 'd';
1316 > #endif
1317                  if (sampcnt <= 0) sampcnt = 10000;
1318          }
1319          sprintf(sampcntbuf, "%d", sampcnt);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines