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

Comparing ray/src/common/testBSDF.c (file contents):
Revision 1.8 by greg, Thu Feb 2 00:34:55 2017 UTC vs.
Revision 1.9 by greg, Thu Feb 2 04:46:38 2017 UTC

# Line 24 | Line 24 | Usage(const char *prog)
24          printf("  i\t\t\t\t Report general information (metadata)\n");
25          printf("  c\t\t\t\t Report diffuse and specular components\n");
26          printf("  q theta_i phi_i theta_o phi_o\t Query BSDF for given path (CIE-XYZ)\n");
27 <        printf("  s N theta phi\t\t\t Generate N ray directions at given incidence\n");
28 <        printf("  h theta phi\t\t\t Report hemispherical total at given incidence\n");
29 <        printf("  r theta phi\t\t\t Report hemispherical reflection at given incidence\n");
30 <        printf("  t theta phi\t\t\t Report hemispherical transmission at given incidence\n");
27 >        printf("  s[r|t][s|d] N theta phi\t\t\t Generate N ray directions & colors at given incidence\n");
28 >        printf("  h[s|d] theta phi\t\t\t Report hemispherical scatteromg at given incidence\n");
29 >        printf("  r[s|d] theta phi\t\t\t Report hemispherical reflection at given incidence\n");
30 >        printf("  t[s|d] theta phi\t\t\t Report hemispherical transmission at given incidence\n");
31          printf("  a theta phi [t2 p2]\t\t Report resolution (in proj. steradians) for given direction(s)\n");
32          printf("  ^D\t\t\t\t Quit program\n");
33   }
# Line 77 | Line 77 | main(int argc, char *argv[])
77                  char    *cp2;
78                  FVECT   vin, vout;
79                  double  proja[2];
80 <                int     n;
80 >                int     n, i;
81                  SDValue val;
82                  
83                  while (isspace(*cp)) cp++;
# Line 142 | Line 142 | main(int argc, char *argv[])
142                                  goto noBSDFerr;
143                          if (!*sskip2(cp,3))
144                                  break;
145 <                        n = atoi(sskip2(cp,1));
145 >                        if (toupper(cp[1]) == 'R') {
146 >                                sflags &= ~SDsampT;
147 >                                ++cp;
148 >                        } else if (toupper(cp[1]) == 'T') {
149 >                                sflags &= ~SDsampR;
150 >                                ++cp;
151 >                        }
152 >                        if (toupper(cp[1]) == 'S')
153 >                                sflags &= ~SDsampDf;
154 >                        else if (toupper(cp[1]) == 'D')
155 >                                sflags &= ~SDsampSp;
156 >                        i = n = atoi(sskip2(cp,1));
157                          vec_from_deg(vin, atof(sskip2(cp,2)), atof(sskip2(cp,3)));
158 <                        while (n-- > 0) {
159 <                                if (SDreportError(SDsampBSDF(&val, vin,
160 <                                                rand()*(1./(RAND_MAX+.5)),
158 >                        while (i-- > 0) {
159 >                                VCOPY(vout, vin);
160 >                                if (SDreportError(SDsampBSDF(&val, vout,
161 >                                                (i+rand()*(1./(RAND_MAX+.5)))/(double)n,
162                                                  sflags, bsdf), stderr))
163                                          break;
164 <                                printf("%.8f %.8f %.8f\n", vin[0], vin[1], vin[2]);
164 >                                printf("%.8f %.8f %.8f ", vout[0], vout[1], vout[2]);
165 >                                printXYZ("", &val);
166                          }
167                          continue;
168 <                case 'H':                       /* hemispherical totals */
168 >                case 'H':                       /* hemispherical values */
169                  case 'R':
170                  case 'T':
171                          if (!bsdf)
172                                  goto noBSDFerr;
173                          if (!*sskip2(cp,2))
174                                  break;
175 <                        if (tolower(*cp) == 'r')
175 >                        if (toupper(cp[0]) == 'R')
176                                  sflags &= ~SDsampT;
177 <                        else if (tolower(*cp) == 't')
177 >                        else if (toupper(cp[0]) == 'T')
178                                  sflags &= ~SDsampR;
179 +                        if (toupper(cp[1]) == 'S')
180 +                                sflags &= ~SDsampDf;
181 +                        else if (toupper(cp[1]) == 'D')
182 +                                sflags &= ~SDsampSp;
183                          vec_from_deg(vin, atof(sskip2(cp,1)), atof(sskip2(cp,2)));
184                          printf("%.4e\n", SDdirectHemi(vin, sflags, bsdf));
185                          continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines