11 |
|
|
12 |
|
#include "ray.h" |
13 |
|
#include "paths.h" |
14 |
+ |
#include "pmapopt.h" |
15 |
|
|
16 |
|
|
17 |
< |
extern int |
17 |
> |
int |
18 |
|
getrenderopt( /* get next render option */ |
19 |
|
int ac, |
20 |
|
char *av[] |
23 |
|
#define check(ol,al) if (av[0][ol] || \ |
24 |
|
badarg(ac-1,av+1,al)) \ |
25 |
|
return(-1) |
26 |
< |
#define bool(olen,var) switch (av[0][olen]) { \ |
26 |
> |
#define check_bool(olen,var) switch (av[0][olen]) { \ |
27 |
|
case '\0': var = !var; break; \ |
28 |
|
case 'y': case 'Y': case 't': case 'T': \ |
29 |
|
case '+': case '1': var = 1; break; \ |
37 |
|
return(-1); |
38 |
|
/* check if it's one we know */ |
39 |
|
switch (av[0][1]) { |
40 |
< |
case 'R': /* random sampling */ |
41 |
< |
bool(2,rand_samp); |
40 |
> |
case 'u': /* uncorrelated sampling */ |
41 |
> |
check_bool(2,rand_samp); |
42 |
|
return(0); |
43 |
|
case 'b': /* back face vis. */ |
44 |
|
if (av[0][2] == 'v') { |
45 |
< |
bool(3,backvis); |
45 |
> |
check_bool(3,backvis); |
46 |
|
return(0); |
47 |
|
} |
48 |
|
break; |
69 |
|
vspretest = atoi(av[1]); |
70 |
|
return(1); |
71 |
|
case 'v': /* visibility */ |
72 |
< |
bool(3,directvis); |
72 |
> |
check_bool(3,directvis); |
73 |
|
return(0); |
74 |
|
case 's': /* size */ |
75 |
|
check(3,"f"); |
83 |
|
check(3,"f"); |
84 |
|
specthresh = atof(av[1]); |
85 |
|
return(1); |
86 |
< |
case 'j': /* jitter */ |
86 |
> |
case 's': /* sampling */ |
87 |
|
check(3,"f"); |
88 |
|
specjitter = atof(av[1]); |
89 |
|
return(1); |
102 |
|
} |
103 |
|
break; |
104 |
|
case 'i': /* irradiance */ |
105 |
< |
bool(2,do_irrad); |
105 |
> |
check_bool(2,do_irrad); |
106 |
|
return(0); |
107 |
|
case 'a': /* ambient */ |
108 |
|
switch (av[0][2]) { |
209 |
|
} |
210 |
|
break; |
211 |
|
} |
212 |
< |
return(-1); /* unknown option */ |
212 |
> |
|
213 |
> |
/* PMAP: Parse photon mapping options */ |
214 |
> |
return(getPmapRenderOpt(ac, av)); |
215 |
> |
|
216 |
> |
/* return(-1); */ /* unknown option */ |
217 |
|
|
218 |
|
#undef check |
219 |
< |
#undef bool |
219 |
> |
#undef check_bool |
220 |
|
} |
221 |
|
|
222 |
|
|
223 |
< |
extern void |
223 |
> |
void |
224 |
|
print_rdefaults(void) /* print default render values to stdout */ |
225 |
|
{ |
226 |
|
printf(do_irrad ? "-i+\t\t\t\t# irradiance calculation on\n" : |
227 |
|
"-i-\t\t\t\t# irradiance calculation off\n"); |
228 |
< |
printf(rand_samp ? "-R+\t\t\t\t# random sampling on\n" : |
229 |
< |
"-R-\t\t\t\t# random sampling off\n"); |
228 |
> |
printf(rand_samp ? "-u+\t\t\t\t# uncorrelated Monte Carlo sampling\n" : |
229 |
> |
"-u-\t\t\t\t# correlated quasi-Monte Carlo sampling\n"); |
230 |
|
printf(backvis ? "-bv+\t\t\t\t# back face visibility on\n" : |
231 |
|
"-bv-\t\t\t\t# back face visibility off\n"); |
232 |
|
printf("-dt %f\t\t\t# direct threshold\n", shadthresh); |
237 |
|
printf("-dp %-9d\t\t\t# direct pretest density\n", vspretest); |
238 |
|
printf(directvis ? "-dv+\t\t\t\t# direct visibility on\n" : |
239 |
|
"-dv-\t\t\t\t# direct visibility off\n"); |
240 |
< |
printf("-sj %f\t\t\t# specular jitter\n", specjitter); |
240 |
> |
printf("-ss %f\t\t\t# specular sampling\n", specjitter); |
241 |
|
printf("-st %f\t\t\t# specular threshold\n", specthresh); |
242 |
|
printf("-av %f %f %f\t# ambient value\n", colval(ambval,RED), |
243 |
|
colval(ambval,GRN), colval(ambval, BLU)); |
257 |
|
printf("-ms %f\t\t\t# mist sampling distance\n", ssampdist); |
258 |
|
printf("-lr %-9d\t\t\t# limit reflection%s\n", maxdepth, |
259 |
|
maxdepth<=0 ? " (Russian roulette)" : ""); |
260 |
< |
printf("-lw %f\t\t\t# limit weight\n", minweight); |
260 |
> |
printf("-lw %.2e\t\t\t# limit weight\n", minweight); |
261 |
> |
|
262 |
> |
/* PMAP: output photon map defaults */ |
263 |
> |
printPmapDefaults(); |
264 |
|
} |