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

Comparing ray/src/cv/pabopto2bsdf.c (file contents):
Revision 2.2 by greg, Sat Jun 29 22:35:15 2013 UTC vs.
Revision 2.5 by greg, Thu Sep 12 16:09:31 2013 UTC

# Line 62 | Line 62 | init_pabopto_inp(const int i, const char *fname)
62          inpfile[i].theta = inpfile[i].phi = -10001.;
63                                  /* read header information */
64          while ((c = getc(fp)) == '#' || c == EOF) {
65 +                char    typ[32];
66                  if (fgets(buf, sizeof(buf), fp) == NULL) {
67                          fputs(fname, stderr);
68                          fputs(": unexpected EOF\n", stderr);
69                          fclose(fp);
70                          return(0);
71                  }
72 <                if (!strcmp(buf, "format: theta phi DSF\n")) {
73 <                        inpfile[i].isDSF = 1;
74 <                        continue;
72 >                if (sscanf(buf, "format: theta phi %s", typ) == 1) {
73 >                        if (!strcasecmp(typ, "DSF")) {
74 >                                inpfile[i].isDSF = 1;
75 >                                continue;
76 >                        }
77 >                        if (!strcasecmp(typ, "BSDF")) {
78 >                                inpfile[i].isDSF = 0;
79 >                                continue;
80 >                        }
81                  }
75                if (!strcmp(buf, "format: theta phi BSDF\n")) {
76                        inpfile[i].isDSF = 0;
77                        continue;
78                }
82                  if (sscanf(buf, "intheta %lf", &inpfile[i].theta) == 1)
83                          continue;
84                  if (sscanf(buf, "inphi %lf", &inpfile[i].phi) == 1)
# Line 96 | Line 99 | init_pabopto_inp(const int i, const char *fname)
99                  fputs(": unknown incident angle\n", stderr);
100                  return(0);
101          }
102 +        while (inpfile[i].phi < 0)      /* normalize phi direction */
103 +                inpfile[i].phi += 360.;
104          return(1);
105   }
106  
# Line 112 | Line 117 | add_pabopto_inp(const int i)
117                  fputs(": cannot open\n", stderr);
118                  return(0);
119          }
115 #ifdef DEBUG
116        fprintf(stderr, "Loading measurements from '%s'...\n", inpfile[i].fname);
117 #endif
120                                          /* prepare input grid */
121          if (!i || cmp_inang(&inpfile[i-1], &inpfile[i])) {
122                  if (i)                  /* need to process previous incidence */
# Line 125 | Line 127 | add_pabopto_inp(const int i)
127   #endif
128                  new_bsdf_data(inpfile[i].theta, inpfile[i].phi);
129          }
130 + #ifdef DEBUG
131 +        fprintf(stderr, "Loading measurements from '%s'...\n", inpfile[i].fname);
132 + #endif
133                                          /* read scattering data */
134          while (fscanf(fp, "%lf %lf %lf\n", &theta_out, &phi_out, &val) == 3)
135                  add_bsdf_data(theta_out, phi_out, val, inpfile[i].isDSF);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines