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.3 by greg, Sat Jun 6 16:30:26 2015 UTC vs.
Revision 1.5 by greg, Wed Feb 3 18:33:18 2016 UTC

# Line 20 | Line 20 | Usage(const char *prog)
20   {
21          printf("Usage: %s [bsdf_directory]\n", prog);
22          printf("Input commands:\n");
23 <        printf("  l bsdf.xml\t\t\t Load (make active) given BSDF input file\n");
24 <        printf("  q theta_i phi_i theta_o phi_o\t Query BSDF for given path\n");
23 >        printf("  L bsdf.xml\t\t\t Load (make active) given BSDF input file\n");
24 >        printf("  q theta_i phi_i theta_o phi_o\t Query BSDF for given path (CIE-XYZ)\n");
25          printf("  s N theta phi\t\t\t Generate N ray directions at given incidence\n");
26          printf("  h theta phi\t\t\t Report hemispherical total at given incidence\n");
27          printf("  r theta phi\t\t\t Report hemispherical reflection at given incidence\n");
# Line 70 | Line 70 | main(int argc, char *argv[])
70                  
71                  while (isspace(*cp)) cp++;
72  
73 <                switch (*cp) {
74 <                case 'l':
73 >                switch (toupper(*cp)) {
74                  case 'L':                       /* load/activate BSDF input */
75                          cp2 = cp = sskip2(cp, 1);
76                          if (!*cp)
# Line 86 | Line 85 | main(int argc, char *argv[])
85                                  SDfreeCache(bsdf);
86                          bsdf = SDcacheFile(path);
87                          continue;
89                case 'q':
88                  case 'Q':                       /* query BSDF value */
89                          if (bsdf == NULL)
90                                  goto noBSDFerr;
# Line 94 | Line 92 | main(int argc, char *argv[])
92                                  break;
93                          vec_from_deg(vin, atof(sskip2(cp,1)), atof(sskip2(cp,2)));
94                          vec_from_deg(vout, atof(sskip2(cp,3)), atof(sskip2(cp,4)));
95 <                        if (!SDreportError(SDevalBSDF(&val, vout, vin, bsdf), stderr))
96 <                                printf("%.3e\n", val.cieY);
95 >                        if (!SDreportError(SDevalBSDF(&val, vout, vin, bsdf), stderr)) {
96 >                                c_ccvt(&val.spec, C_CSXY);
97 >                                printf("%.3e %.3e %.3e\n",
98 >                                                val.spec.cx/val.spec.cy*val.cieY,
99 >                                                val.cieY,
100 >                                                (1.-val.spec.cx-val.spec.cy)/
101 >                                                val.spec.cy*val.cieY);
102 >                        }
103                          continue;
100                case 's':
104                  case 'S':                       /* sample BSDF */
105                          if (bsdf == NULL)
106                                  goto noBSDFerr;
# Line 113 | Line 116 | main(int argc, char *argv[])
116                                  printf("%.8f %.8f %.8f\n", vin[0], vin[1], vin[2]);
117                          }
118                          continue;
116                case 'h':
119                  case 'H':                       /* hemispherical totals */
118                case 'r':
120                  case 'R':
120                case 't':
121                  case 'T':
122                          if (bsdf == NULL)
123                                  goto noBSDFerr;
# Line 130 | Line 130 | main(int argc, char *argv[])
130                          vec_from_deg(vin, atof(sskip2(cp,1)), atof(sskip2(cp,2)));
131                          printf("%.4e\n", SDdirectHemi(vin, sflags, bsdf));
132                          continue;
133                case 'a':
133                  case 'A':                       /* resolution in proj. steradians */
134                          if (bsdf == NULL)
135                                  goto noBSDFerr;
# Line 151 | Line 150 | main(int argc, char *argv[])
150                  Usage(argv[0]);
151                  continue;
152   noBSDFerr:
153 <                fprintf(stderr, "%s: need to use 'l' command to load BSDF\n", argv[0]);
153 >                fprintf(stderr, "%s: need to use 'L' command to load BSDF\n", argv[0]);
154          }
155          return 0;
156   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines