| 1 |
< |
/* Copyright (c) 1993 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1994 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 32 |
|
|
| 33 |
|
extern char *atos(); |
| 34 |
|
|
| 35 |
< |
extern char rifname[]; /* rad input file name */ |
| 35 |
> |
extern FILE *popen(); |
| 36 |
|
|
| 37 |
+ |
extern char rifname[128]; /* rad input file name */ |
| 38 |
+ |
|
| 39 |
|
extern char VersionID[]; |
| 40 |
|
extern char *progname; |
| 41 |
|
extern char *octname; |
| 140 |
|
else { |
| 141 |
|
nv.horiz = ourview.horiz; nv.vert = ourview.vert; |
| 142 |
|
} |
| 143 |
+ |
sprintf(buf, "fore and aft clipping plane (%.6g %.6g): ", |
| 144 |
+ |
ourview.vfore, ourview.vaft); |
| 145 |
+ |
(*dev->comout)(buf); |
| 146 |
+ |
(*dev->comin)(buf, NULL); |
| 147 |
+ |
if (buf[0] == CTRL('C')) return; |
| 148 |
+ |
if (sscanf(buf, "%lf %lf", &nv.vfore, &nv.vaft) == 2) |
| 149 |
+ |
change++; |
| 150 |
+ |
else { |
| 151 |
+ |
nv.vfore = ourview.vfore; nv.vaft = ourview.vaft; |
| 152 |
+ |
} |
| 153 |
|
sprintf(buf, "view shift and lift (%.6g %.6g): ", |
| 154 |
|
ourview.hoff, ourview.voff); |
| 155 |
|
(*dev->comout)(buf); |
| 212 |
|
} |
| 213 |
|
s = sskip(s); |
| 214 |
|
} |
| 215 |
< |
if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') { |
| 215 |
> |
while (isspace(*s)) |
| 216 |
> |
s++; |
| 217 |
> |
if (*s) |
| 218 |
> |
atos(rifname, sizeof(rifname), s); |
| 219 |
> |
else if (rifname[0] == '\0') { |
| 220 |
|
error(COMMAND, "no previous rad file"); |
| 221 |
|
return; |
| 222 |
|
} |
| 247 |
|
s = sskip(s); |
| 248 |
|
else |
| 249 |
|
strcat(buf, "1"); |
| 250 |
< |
if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') { |
| 250 |
> |
if (*s) |
| 251 |
> |
atos(rifname, sizeof(rifname), s); |
| 252 |
> |
else if (rifname[0] == '\0') { |
| 253 |
|
error(COMMAND, "no previous rad file"); |
| 254 |
|
return; |
| 255 |
|
} |
| 286 |
|
nv.type = ourview.type; |
| 287 |
|
VCOPY(nv.vp, ourview.vp); |
| 288 |
|
VCOPY(nv.vup, ourview.vup); |
| 271 |
– |
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
| 289 |
|
nv.horiz = ourview.horiz; nv.vert = ourview.vert; |
| 290 |
+ |
nv.vfore = ourview.vfore; nv.vaft = ourview.vaft; |
| 291 |
+ |
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
| 292 |
|
zoomview(&nv, zfact); |
| 293 |
|
newview(&nv); |
| 294 |
|
} |
| 322 |
|
VCOPY(nv.vp, ourview.vp); |
| 323 |
|
VCOPY(nv.vup, ourview.vup); |
| 324 |
|
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
| 325 |
+ |
nv.vfore = ourview.vfore; nv.vaft = ourview.vaft; |
| 326 |
|
spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); |
| 327 |
|
if (elev != 0.0) { |
| 328 |
|
fcross(v1, nv.vdir, ourview.vup); |
| 362 |
|
register PNODE *p = &ptrunk; |
| 363 |
|
int adapt = 0; |
| 364 |
|
double e = 1.0; |
| 365 |
< |
start: |
| 365 |
> |
|
| 366 |
|
for (cp = s; isspace(*cp); cp++) |
| 367 |
|
; |
| 368 |
|
if (*cp == '@') { |
| 369 |
|
adapt++; |
| 370 |
< |
goto start; |
| 370 |
> |
while (isspace(*++cp)) |
| 371 |
> |
; |
| 372 |
|
} |
| 373 |
|
if (*cp == '\0') { /* normalize to point */ |
| 374 |
|
if (dev->getcur == NULL) |
| 502 |
|
extern int do_irrad; |
| 503 |
|
extern double specjitter; |
| 504 |
|
extern double specthresh; |
| 505 |
+ |
extern int backvis; |
| 506 |
|
char buf[128]; |
| 507 |
|
|
| 508 |
|
if (s[0] == '\0') { |
| 509 |
|
(*dev->comout)( |
| 510 |
< |
"aa ab ad ar as av b dc di dj ds dt i lr lw ps pt sj st: "); |
| 510 |
> |
"aa ab ad ar as av b dc di dj ds dt i lr lw ps pt sj st bv: "); |
| 511 |
|
(*dev->comin)(buf, NULL); |
| 512 |
|
s = buf; |
| 513 |
|
} |
| 546 |
|
goto badparam; |
| 547 |
|
} |
| 548 |
|
break; |
| 549 |
< |
case 'b': /* black and white */ |
| 550 |
< |
getparam(s+1, "black and white", 'b', &greyscale); |
| 549 |
> |
case 'b': /* back faces or black and white */ |
| 550 |
> |
switch (s[1]) { |
| 551 |
> |
case 'v': /* back face visibility */ |
| 552 |
> |
getparam(s+2, "back face visibility", 'b', &backvis); |
| 553 |
> |
break; |
| 554 |
> |
case '\0': /* black and white */ |
| 555 |
> |
case ' ': |
| 556 |
> |
case 'y': case 'Y': case 't': case 'T': case '1': case '+': |
| 557 |
> |
case 'n': case 'N': case 'f': case 'F': case '0': case '-': |
| 558 |
> |
getparam(s+1, "black and white", 'b', &greyscale); |
| 559 |
> |
break; |
| 560 |
> |
default: |
| 561 |
> |
goto badparam; |
| 562 |
> |
} |
| 563 |
|
break; |
| 564 |
|
case 'i': /* irradiance */ |
| 565 |
|
getparam(s+1, "irradiance", 'b', &do_irrad); |
| 635 |
|
int x, y; |
| 636 |
|
RAY thisray; |
| 637 |
|
|
| 638 |
+ |
thisray.rmax = 0.0; |
| 639 |
+ |
|
| 640 |
|
if (!sscanvec(s, thisray.rorg) || |
| 641 |
|
!sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) { |
| 642 |
|
|
| 646 |
|
if ((*dev->getcur)(&x, &y) == ABORT) |
| 647 |
|
return; |
| 648 |
|
|
| 649 |
< |
if (viewray(thisray.rorg, thisray.rdir, &ourview, |
| 650 |
< |
(x+.5)/hresolu, (y+.5)/vresolu) < 0) { |
| 649 |
> |
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, |
| 650 |
> |
&ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) { |
| 651 |
|
error(COMMAND, "not on image"); |
| 652 |
|
return; |
| 653 |
|
} |
| 664 |
|
if (thisray.ro == NULL) |
| 665 |
|
(*dev->comout)("ray hit nothing"); |
| 666 |
|
else { |
| 667 |
< |
sprintf(buf, "ray hit %s %s \"%s\"", |
| 668 |
< |
objptr(thisray.ro->omod)->oname, |
| 667 |
> |
sprintf(buf, "ray hit %s%s %s \"%s\"", |
| 668 |
> |
thisray.rod < 0.0 ? "back of " : "", |
| 669 |
> |
thisray.ro->omod == OVOID ? VOIDID : |
| 670 |
> |
objptr(thisray.ro->omod)->oname, |
| 671 |
|
ofun[thisray.ro->otype].funame, |
| 672 |
|
thisray.ro->oname); |
| 673 |
|
(*dev->comout)(buf); |
| 700 |
|
COLR *scanline; |
| 701 |
|
int y; |
| 702 |
|
|
| 703 |
< |
if (sscanf(s, "%s", buf) != 1 && buf[0] == '\0') { |
| 703 |
> |
while (isspace(*s)) |
| 704 |
> |
s++; |
| 705 |
> |
if (*s) |
| 706 |
> |
atos(buf, sizeof(buf), s); |
| 707 |
> |
else if (buf[0] == '\0') { |
| 708 |
|
error(COMMAND, "no file"); |
| 709 |
|
return; |
| 710 |
|
} |
| 721 |
|
(*dev->comout)(fname); |
| 722 |
|
(*dev->comout)("\"...\n"); |
| 723 |
|
/* write header */ |
| 724 |
+ |
newheader("RADIANCE", fp); |
| 725 |
|
fputs(progname, fp); |
| 726 |
|
fprintview(&ourview, fp); |
| 727 |
|
if (octname != NULL) |