65 |
|
if (pframe.d < 0) pframe.d = 0; |
66 |
|
if (pframe.r > ourview.hresolu) pframe.r = ourview.hresolu; |
67 |
|
if (pframe.u > ourview.vresolu) pframe.u = ourview.vresolu; |
68 |
+ |
if (pframe.l > pframe.r) pframe.l = pframe.r; |
69 |
+ |
if (pframe.d > pframe.u) pframe.d = pframe.u; |
70 |
|
pdepth = 0; |
71 |
|
} |
72 |
|
|
76 |
|
{ |
77 |
|
FILE *fp; |
78 |
|
char buf[128]; |
79 |
< |
char *fname, *getpath(); |
79 |
> |
char *fname; |
80 |
|
int change = 0; |
81 |
|
VIEW nv; |
82 |
|
|
83 |
|
if (sscanf(s, "%s", buf) == 1) { /* write parameters to a file */ |
84 |
< |
if ((fname = getpath(buf, NULL)) == NULL || |
84 |
> |
if ((fname = getpath(buf, NULL, 0)) == NULL || |
85 |
|
(fp = fopen(fname, "a")) == NULL) { |
86 |
|
sprintf(errmsg, "cannot open \"%s\"", buf); |
87 |
|
error(COMMAND, errmsg); |
158 |
|
char *s; |
159 |
|
{ |
160 |
|
char buf[128]; |
161 |
< |
char *fname, *getpath(); |
161 |
> |
char *fname; |
162 |
|
int success; |
163 |
|
VIEW nv; |
164 |
|
|
165 |
|
if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ |
166 |
|
bcopy(&stdview, &nv, sizeof(VIEW)); |
167 |
< |
if ((fname = getpath(buf, NULL)) == NULL || |
167 |
> |
if ((fname = getpath(buf, NULL, 0)) == NULL || |
168 |
|
(success = viewfile(fname, &nv)) == -1) { |
169 |
|
sprintf(errmsg, "cannot open \"%s\"", buf); |
170 |
|
error(COMMAND, errmsg); |
371 |
|
e *= atof(cp); |
372 |
|
} |
373 |
|
if (p != NULL) { /* relative setting */ |
374 |
< |
if (intens(p->v) <= FTINY) { |
374 |
> |
if (bright(p->v) <= FTINY) { |
375 |
|
error(COMMAND, "cannot normalize to zero"); |
376 |
|
return; |
377 |
|
} |
378 |
< |
e *= 0.5 / intens(p->v); |
378 |
> |
e *= 0.5 / bright(p->v); |
379 |
|
} |
380 |
|
if (e <= FTINY || fabs(1.0 - e) <= FTINY) |
381 |
|
return; |
393 |
|
extern double minweight; |
394 |
|
extern int maxdepth; |
395 |
|
extern double dstrsrc; |
396 |
+ |
extern double shadthresh; |
397 |
+ |
extern double shadcert; |
398 |
|
extern COLOR ambval; |
399 |
|
extern double ambacc; |
400 |
|
extern double minarad; |
407 |
|
char buf[128]; |
408 |
|
|
409 |
|
if (s[0] == '\0') { |
410 |
< |
(*dev->comout)("aa ab ad ar as av ds lr lw sd sp: "); |
410 |
> |
(*dev->comout)("aa ab ad ar as av dc dj dt lr lw sp st: "); |
411 |
|
(*dev->comin)(buf); |
412 |
|
s = buf; |
413 |
|
} |
440 |
|
goto badparam; |
441 |
|
} |
442 |
|
break; |
443 |
< |
case 'd': /* distribute source */ |
444 |
< |
if (s[1] != 's') |
443 |
> |
case 'd': /* direct */ |
444 |
> |
switch (s[1]) { |
445 |
> |
case 'j': /* jitter */ |
446 |
> |
if (sscanf(s+2, "%lf", &d0) != 1) { |
447 |
> |
sprintf(buf, "direct jitter (%.6g): ", |
448 |
> |
dstrsrc); |
449 |
> |
(*dev->comout)(buf); |
450 |
> |
(*dev->comin)(buf); |
451 |
> |
if (sscanf(buf, "%lf", &d0) != 1) |
452 |
> |
break; |
453 |
> |
} |
454 |
> |
dstrsrc = d0; |
455 |
> |
break; |
456 |
> |
case 'c': /* certainty */ |
457 |
> |
if (sscanf(s+2, "%lf", &d0) != 1) { |
458 |
> |
sprintf(buf, "direct certainty (%.6g): ", |
459 |
> |
shadcert); |
460 |
> |
(*dev->comout)(buf); |
461 |
> |
(*dev->comin)(buf); |
462 |
> |
if (sscanf(buf, "%lf", &d0) != 1) |
463 |
> |
break; |
464 |
> |
} |
465 |
> |
shadcert = d0; |
466 |
> |
break; |
467 |
> |
case 't': /* threshold */ |
468 |
> |
if (sscanf(s+2, "%lf", &d0) != 1) { |
469 |
> |
sprintf(buf, "direct threshold (%.6g): ", |
470 |
> |
shadthresh); |
471 |
> |
(*dev->comout)(buf); |
472 |
> |
(*dev->comin)(buf); |
473 |
> |
if (sscanf(buf, "%lf", &d0) != 1) |
474 |
> |
break; |
475 |
> |
} |
476 |
> |
shadthresh = d0; |
477 |
> |
break; |
478 |
> |
default: |
479 |
|
goto badparam; |
442 |
– |
if (sscanf(s+2, "%lf", &d0) != 1) { |
443 |
– |
sprintf(buf, "distribute source (%.6g): ", dstrsrc); |
444 |
– |
(*dev->comout)(buf); |
445 |
– |
(*dev->comin)(buf); |
446 |
– |
if (sscanf(buf, "%lf", &d0) != 1) |
447 |
– |
break; |
480 |
|
} |
449 |
– |
dstrsrc = d0; |
481 |
|
break; |
482 |
|
case 'a': /* ambient */ |
483 |
|
switch (s[1]) { |
569 |
|
psample = i0; |
570 |
|
pdepth = 0; |
571 |
|
break; |
572 |
< |
case 'd': /* difference */ |
572 |
> |
case 't': /* threshold */ |
573 |
|
if (sscanf(s+2, "%lf", &d0) != 1) { |
574 |
< |
sprintf(buf, "sample difference (%.6g): ", |
574 |
> |
sprintf(buf, "sample threshold (%.6g): ", |
575 |
|
maxdiff); |
576 |
|
(*dev->comout)(buf); |
577 |
|
(*dev->comin)(buf); |
655 |
|
char *s; |
656 |
|
{ |
657 |
|
static char buf[128]; |
658 |
< |
char *fname, *getpath(); |
658 |
> |
char *fname; |
659 |
|
FILE *fp; |
660 |
|
COLR *scanline; |
661 |
|
int y; |
664 |
|
error(COMMAND, "no file"); |
665 |
|
return; |
666 |
|
} |
667 |
< |
if ((fname = getpath(buf, NULL)) == NULL || |
667 |
> |
if ((fname = getpath(buf, NULL, 0)) == NULL || |
668 |
|
(fp = fopen(fname, "w")) == NULL) { |
669 |
|
sprintf(errmsg, "cannot open \"%s\"", buf); |
670 |
|
error(COMMAND, errmsg); |
676 |
|
/* write header */ |
677 |
|
fputs(progname, fp); |
678 |
|
fprintview(&ourview, fp); |
679 |
< |
fputs("\n", fp); |
679 |
> |
putc('\n', fp); |
680 |
|
if (exposure != 1.0) |
681 |
|
fprintf(fp, "EXPOSURE=%e\n", exposure); |
682 |
< |
fprintf(fp, "\n-Y %d +X %d\n", ourview.vresolu, ourview.hresolu); |
682 |
> |
putc('\n', fp); |
683 |
> |
fputresolu(YMAJOR|YDECR, ourview.hresolu, ourview.vresolu, fp); |
684 |
|
|
685 |
|
scanline = (COLR *)malloc(ourview.hresolu*sizeof(COLR)); |
686 |
|
if (scanline == NULL) |