45 |
|
int |
46 |
|
main(int argc, char *argv[]) |
47 |
|
{ |
48 |
< |
const char *directory = ""; |
48 |
> |
const char *directory = NULL; |
49 |
|
char inp[512], path[512]; |
50 |
|
const SDData *bsdf = NULL; |
51 |
|
|
56 |
|
if (argc == 2) |
57 |
|
directory = argv[1]; |
58 |
|
|
59 |
< |
SDretainSet = SDretainBSDFs; /* keep BSDFs loaded */ |
59 |
> |
SDretainSet = SDretainBSDFs; /* keep BSDFs in memory */ |
60 |
|
|
61 |
|
/* loop on command */ |
62 |
|
while (fgets(inp, sizeof(inp), stdin) != NULL) { |
78 |
|
break; |
79 |
|
while (*cp) cp++; |
80 |
|
while (isspace(*--cp)) *cp = '\0'; |
81 |
< |
if (directory[0]) |
81 |
> |
if (directory) |
82 |
|
sprintf(path, "%s/%s", directory, cp2); |
83 |
|
else |
84 |
|
strcpy(path, cp2); |
85 |
< |
if (bsdf != NULL) |
85 |
> |
if (bsdf) |
86 |
|
SDfreeCache(bsdf); |
87 |
|
bsdf = SDcacheFile(path); |
88 |
|
continue; |
124 |
|
if (!*sskip2(cp,2)) |
125 |
|
break; |
126 |
|
if (tolower(*cp) == 'r') |
127 |
< |
sflags ^= SDsampT; |
127 |
> |
sflags &= ~SDsampT; |
128 |
|
else if (tolower(*cp) == 't') |
129 |
< |
sflags ^= SDsampR; |
129 |
> |
sflags &= ~SDsampR; |
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': |
134 |
< |
case 'A': /* resolution in degrees */ |
134 |
> |
case 'A': /* resolution in proj. steradians */ |
135 |
|
if (bsdf == NULL) |
136 |
|
goto noBSDFerr; |
137 |
|
if (!*sskip2(cp,2)) |