1 |
< |
/* Copyright (c) 1992 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1993 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
186 |
|
getaim(s) /* aim camera */ |
187 |
|
char *s; |
188 |
|
{ |
189 |
– |
extern double tan(), atan(); |
189 |
|
double zfact; |
190 |
|
VIEW nv; |
191 |
|
|
216 |
|
getrotate(s) /* rotate camera */ |
217 |
|
char *s; |
218 |
|
{ |
220 |
– |
extern double normalize(), tan(), atan(); |
219 |
|
VIEW nv; |
220 |
|
FVECT v1; |
221 |
|
double angle, elev, zfact; |
263 |
|
{ |
264 |
|
char buf[128]; |
265 |
|
register char *cp; |
268 |
– |
register PNODE *p; |
266 |
|
RECT r; |
267 |
|
int x, y; |
268 |
< |
double e; |
269 |
< |
|
268 |
> |
register PNODE *p = &ptrunk; |
269 |
> |
int adapt = 0; |
270 |
> |
double e = 1.0; |
271 |
> |
start: |
272 |
|
for (cp = s; isspace(*cp); cp++) |
273 |
|
; |
274 |
+ |
if (*cp == '@') { |
275 |
+ |
adapt++; |
276 |
+ |
goto start; |
277 |
+ |
} |
278 |
|
if (*cp == '\0') { /* normalize to point */ |
279 |
|
if (dev->getcur == NULL) |
280 |
|
return; |
284 |
|
r.l = r.d = 0; |
285 |
|
r.r = hresolu; r.u = vresolu; |
286 |
|
p = findrect(x, y, &ptrunk, &r, -1); |
284 |
– |
e = 1.0; |
287 |
|
} else { |
288 |
|
if (*cp == '=') { /* absolute setting */ |
289 |
|
p = NULL; |
291 |
|
for (cp++; isspace(*cp); cp++) |
292 |
|
; |
293 |
|
if (*cp == '\0') { /* interactive */ |
294 |
< |
sprintf(buf, "exposure (%lf): ", exposure); |
294 |
> |
sprintf(buf, "exposure (%f): ", exposure); |
295 |
|
(*dev->comout)(buf); |
296 |
|
(*dev->comin)(buf, NULL); |
297 |
|
for (cp = buf; isspace(*cp); cp++) |
299 |
|
if (*cp == '\0') |
300 |
|
return; |
301 |
|
} |
300 |
– |
} else { /* normalize to average */ |
301 |
– |
p = &ptrunk; |
302 |
– |
e = 1.0; |
302 |
|
} |
303 |
|
if (*cp == '+' || *cp == '-') /* f-stops */ |
304 |
|
e *= pow(2.0, atof(cp)); |
306 |
|
e *= atof(cp); |
307 |
|
} |
308 |
|
if (p != NULL) { /* relative setting */ |
309 |
< |
if (bright(p->v) < 1e-25) { |
309 |
> |
if (bright(p->v) < 1e-15) { |
310 |
|
error(COMMAND, "cannot normalize to zero"); |
311 |
|
return; |
312 |
|
} |
313 |
< |
e *= 0.5 / bright(p->v); |
313 |
> |
if (adapt) |
314 |
> |
e *= 106./pow(1.219+pow(luminance(p->v)/exposure,.4),2.5)/exposure; |
315 |
> |
else |
316 |
> |
e *= 0.5 / bright(p->v); |
317 |
|
} |
318 |
|
if (e <= FTINY || fabs(1.0 - e) <= FTINY) |
319 |
|
return; |
402 |
|
extern int ambdiv; |
403 |
|
extern int ambssamp; |
404 |
|
extern int ambounce; |
405 |
< |
extern int directinvis; |
405 |
> |
extern int directvis; |
406 |
|
extern double srcsizerat; |
407 |
|
extern int do_irrad; |
408 |
|
extern double specjitter; |
439 |
|
case 't': /* threshold */ |
440 |
|
getparam(s+2, "direct threshold", 'r', &shadthresh); |
441 |
|
break; |
442 |
< |
case 'i': /* invisibility */ |
443 |
< |
getparam(s+2, "direct invisibility", |
444 |
< |
'b', &directinvis); |
442 |
> |
case 'v': /* visibility */ |
443 |
> |
getparam(s+2, "direct visibility", |
444 |
> |
'b', &directvis); |
445 |
|
break; |
446 |
|
case 's': /* sampling */ |
447 |
|
getparam(s+2, "direct sampling", 'r', &srcsizerat); |
459 |
|
case 'a': /* ambient */ |
460 |
|
switch (s[1]) { |
461 |
|
case 'v': /* value */ |
462 |
< |
getparam(s+2, "ambient value", 'C', ambval); |
462 |
> |
getparam(s+2, "ambient value", 'C', (COLOR *)ambval); |
463 |
|
break; |
464 |
|
case 'a': /* accuracy */ |
465 |
|
getparam(s+2, "ambient accuracy", 'r', &ambacc); |
597 |
|
error(COMMAND, errmsg); |
598 |
|
return; |
599 |
|
} |
600 |
+ |
#ifdef MSDOS |
601 |
+ |
setmode(fileno(fp), O_BINARY); |
602 |
+ |
#endif |
603 |
|
(*dev->comout)("writing \""); |
604 |
|
(*dev->comout)(fname); |
605 |
|
(*dev->comout)("\"...\n"); |