7 |
|
* External symbols declared in ray.h |
8 |
|
*/ |
9 |
|
|
10 |
< |
/* ==================================================================== |
11 |
< |
* The Radiance Software License, Version 1.0 |
12 |
< |
* |
13 |
< |
* Copyright (c) 1990 - 2002 The Regents of the University of California, |
14 |
< |
* through Lawrence Berkeley National Laboratory. All rights reserved. |
15 |
< |
* |
16 |
< |
* Redistribution and use in source and binary forms, with or without |
17 |
< |
* modification, are permitted provided that the following conditions |
18 |
< |
* are met: |
19 |
< |
* |
20 |
< |
* 1. Redistributions of source code must retain the above copyright |
21 |
< |
* notice, this list of conditions and the following disclaimer. |
22 |
< |
* |
23 |
< |
* 2. Redistributions in binary form must reproduce the above copyright |
24 |
< |
* notice, this list of conditions and the following disclaimer in |
25 |
< |
* the documentation and/or other materials provided with the |
26 |
< |
* distribution. |
27 |
< |
* |
28 |
< |
* 3. The end-user documentation included with the redistribution, |
29 |
< |
* if any, must include the following acknowledgment: |
30 |
< |
* "This product includes Radiance software |
31 |
< |
* (http://radsite.lbl.gov/) |
32 |
< |
* developed by the Lawrence Berkeley National Laboratory |
33 |
< |
* (http://www.lbl.gov/)." |
34 |
< |
* Alternately, this acknowledgment may appear in the software itself, |
35 |
< |
* if and wherever such third-party acknowledgments normally appear. |
36 |
< |
* |
37 |
< |
* 4. The names "Radiance," "Lawrence Berkeley National Laboratory" |
38 |
< |
* and "The Regents of the University of California" must |
39 |
< |
* not be used to endorse or promote products derived from this |
40 |
< |
* software without prior written permission. For written |
41 |
< |
* permission, please contact [email protected]. |
42 |
< |
* |
43 |
< |
* 5. Products derived from this software may not be called "Radiance", |
44 |
< |
* nor may "Radiance" appear in their name, without prior written |
45 |
< |
* permission of Lawrence Berkeley National Laboratory. |
46 |
< |
* |
47 |
< |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
48 |
< |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
49 |
< |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
50 |
< |
* DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR |
51 |
< |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
52 |
< |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
53 |
< |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
54 |
< |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
55 |
< |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
56 |
< |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
57 |
< |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 |
< |
* SUCH DAMAGE. |
59 |
< |
* ==================================================================== |
60 |
< |
* |
61 |
< |
* This software consists of voluntary contributions made by many |
62 |
< |
* individuals on behalf of Lawrence Berkeley National Laboratory. For more |
63 |
< |
* information on Lawrence Berkeley National Laboratory, please see |
64 |
< |
* <http://www.lbl.gov/>. |
65 |
< |
*/ |
10 |
> |
#include "copyright.h" |
11 |
|
|
12 |
|
#include "ray.h" |
13 |
+ |
#include "paths.h" |
14 |
+ |
#include "pmapopt.h" |
15 |
|
|
16 |
|
|
17 |
|
int |
18 |
< |
getrenderopt(ac, av) /* get next render option */ |
19 |
< |
int ac; |
20 |
< |
char *av[]; |
18 |
> |
getrenderopt( /* get next render option */ |
19 |
> |
int ac, |
20 |
> |
char *av[] |
21 |
> |
) |
22 |
|
{ |
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 '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]) { |
144 |
|
amblp = amblist; |
145 |
|
} |
146 |
|
if (av[0][2] == 'I') { /* file */ |
147 |
< |
rval = wordfile(amblp, |
148 |
< |
getpath(av[1],getlibpath(),R_OK)); |
147 |
> |
rval = wordfile(amblp, AMBLLEN-(amblp-amblist), |
148 |
> |
getpath(av[1],getrlibpath(),R_OK)); |
149 |
|
if (rval < 0) { |
150 |
|
sprintf(errmsg, |
151 |
< |
"cannot open ambient include file \"%s\"", av[0]); |
151 |
> |
"cannot open ambient include file \"%s\"", av[1]); |
152 |
|
error(SYSTEM, errmsg); |
153 |
|
} |
154 |
|
amblp += rval; |
155 |
|
} else { |
156 |
< |
*amblp++ = av[1]; |
156 |
> |
*amblp++ = savqstr(av[1]); |
157 |
|
*amblp = NULL; |
158 |
|
} |
159 |
|
return(1); |
165 |
|
amblp = amblist; |
166 |
|
} |
167 |
|
if (av[0][2] == 'E') { /* file */ |
168 |
< |
rval = wordfile(amblp, |
169 |
< |
getpath(av[1],getlibpath(),R_OK)); |
168 |
> |
rval = wordfile(amblp, AMBLLEN-(amblp-amblist), |
169 |
> |
getpath(av[1],getrlibpath(),R_OK)); |
170 |
|
if (rval < 0) { |
171 |
|
sprintf(errmsg, |
172 |
< |
"cannot open ambient exclude file \"%s\"", av[0]); |
172 |
> |
"cannot open ambient exclude file \"%s\"", av[1]); |
173 |
|
error(SYSTEM, errmsg); |
174 |
|
} |
175 |
|
amblp += rval; |
176 |
|
} else { |
177 |
< |
*amblp++ = av[1]; |
177 |
> |
*amblp++ = savqstr(av[1]); |
178 |
|
*amblp = NULL; |
179 |
|
} |
180 |
|
return(1); |
181 |
|
case 'f': /* file */ |
182 |
|
check(3,"s"); |
183 |
< |
ambfile= av[1]; |
183 |
> |
ambfile = savqstr(av[1]); |
184 |
|
return(1); |
185 |
|
} |
186 |
|
break; |
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 |
|
void |
224 |
< |
print_rdefaults() /* print default render values to stdout */ |
224 |
> |
print_rdefaults(void) /* print default render values to stdout */ |
225 |
|
{ |
271 |
– |
register char *cp; |
272 |
– |
|
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 ? "-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)); |
255 |
|
colval(salbedo,GRN), colval(salbedo,BLU)); |
256 |
|
printf("-mg %f\t\t\t# mist scattering eccentricity\n", seccg); |
257 |
|
printf("-ms %f\t\t\t# mist sampling distance\n", ssampdist); |
258 |
< |
printf("-lr %-9d\t\t\t# limit reflection\n", maxdepth); |
259 |
< |
printf("-lw %f\t\t\t# limit weight\n", minweight); |
258 |
> |
printf("-lr %-9d\t\t\t# limit reflection%s\n", maxdepth, |
259 |
> |
maxdepth<=0 ? " (Russian roulette)" : ""); |
260 |
> |
printf("-lw %.2e\t\t\t# limit weight\n", minweight); |
261 |
> |
|
262 |
> |
/* PMAP: output photon map defaults */ |
263 |
> |
printPmapDefaults(); |
264 |
|
} |