16 |
|
#include "ambient.h" |
17 |
|
#include "rpaint.h" |
18 |
|
#include "random.h" |
19 |
– |
#include "paths.h" |
19 |
|
#include "view.h" |
20 |
|
#include "pmapray.h" |
21 |
|
|
23 |
– |
extern char *progname; /* global argv[0] */ |
24 |
– |
|
22 |
|
VIEW ourview = STDVIEW; /* viewing parameters */ |
23 |
|
int hresolu, vresolu; /* image resolution */ |
24 |
|
|
52 |
|
static void sigdie(int signo, char *msg); |
53 |
|
static void printdefaults(void); |
54 |
|
|
55 |
+ |
static void |
56 |
+ |
set_defaults(void) |
57 |
+ |
{ |
58 |
+ |
shadthresh = .1; |
59 |
+ |
shadcert = .25; |
60 |
+ |
directrelay = 0; |
61 |
+ |
vspretest = 128; |
62 |
+ |
srcsizerat = 0.; |
63 |
+ |
specthresh = .3; |
64 |
+ |
specjitter = 1.; |
65 |
+ |
maxdepth = 6; |
66 |
+ |
minweight = 1e-3; |
67 |
+ |
ambacc = 0.3; |
68 |
+ |
ambres = 32; |
69 |
+ |
ambdiv = 256; |
70 |
+ |
ambssamp = 64; |
71 |
+ |
} |
72 |
+ |
|
73 |
|
int |
74 |
|
main(int argc, char *argv[]) |
75 |
|
{ |
90 |
|
/* global program name */ |
91 |
|
progname = argv[0] = fixargv0(argv[0]); |
92 |
|
/* set our defaults */ |
93 |
< |
shadthresh = .1; |
79 |
< |
shadcert = .25; |
80 |
< |
directrelay = 0; |
81 |
< |
vspretest = 128; |
82 |
< |
srcsizerat = 0.; |
83 |
< |
specthresh = .3; |
84 |
< |
specjitter = 1.; |
85 |
< |
maxdepth = 6; |
86 |
< |
minweight = 1e-2; |
87 |
< |
ambacc = 0.3; |
88 |
< |
ambres = 32; |
89 |
< |
ambdiv = 256; |
90 |
< |
ambssamp = 64; |
93 |
> |
set_defaults(); |
94 |
|
/* option city */ |
95 |
|
for (i = 1; i < argc; i++) { |
96 |
|
/* expand arguments */ |
194 |
|
goto badopt; |
195 |
|
} |
196 |
|
} |
197 |
+ |
/* set/check spectral sampling */ |
198 |
+ |
if (setspectrsamp(CNDX, WLPART) <= 0) |
199 |
+ |
error(USER, "unsupported spectral sampling"); |
200 |
+ |
|
201 |
|
err = setview(&ourview); /* set viewing parameters */ |
202 |
|
if (err != NULL) |
203 |
|
error(USER, err); |
264 |
|
|
265 |
|
void |
266 |
|
wputs( /* warning output function */ |
267 |
< |
char *s |
267 |
> |
const char *s |
268 |
|
) |
269 |
|
{ |
270 |
|
int lasterrno = errno; |
271 |
+ |
if (erract[WARNING].pf == NULL) |
272 |
+ |
return; /* called by calcomp or someone */ |
273 |
|
eputs(s); |
274 |
|
errno = lasterrno; |
275 |
|
} |
277 |
|
|
278 |
|
void |
279 |
|
eputs( /* put string to stderr */ |
280 |
< |
char *s |
280 |
> |
const char *s |
281 |
|
) |
282 |
|
{ |
283 |
|
static int midline = 0; |