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; |
75 |
< |
} |
76 |
< |
if (!strcmp(buf, "format: theta phi BSDF\n")) { |
77 |
< |
inpfile[i].isDSF = 0; |
78 |
< |
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 |
|
} |
82 |
|
if (sscanf(buf, "intheta %lf", &inpfile[i].theta) == 1) |
83 |
|
continue; |