1 |
< |
/* Copyright (c) 1993 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
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); |
286 |
|
nv.type = ourview.type; |
287 |
|
VCOPY(nv.vp, ourview.vp); |
288 |
|
VCOPY(nv.vup, ourview.vup); |
279 |
– |
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); |
346 |
|
error(COMMAND, "missing angle"); |
347 |
|
return; |
348 |
|
} |
349 |
< |
if (getinterest(sskip(sskip(s)), 0, vc, &mag) < 0) |
349 |
> |
if (getinterest(sskip2(s,2), 0, vc, &mag) < 0) |
350 |
|
return; |
351 |
|
moveview(angle, elev, mag, vc); |
352 |
|
} |
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) |
492 |
|
extern double shadthresh; |
493 |
|
extern double shadcert; |
494 |
|
extern COLOR ambval; |
495 |
+ |
extern int ambvwt; |
496 |
|
extern double ambacc; |
497 |
|
extern int ambres; |
498 |
|
extern int ambdiv; |
499 |
|
extern int ambssamp; |
500 |
|
extern int ambounce; |
501 |
+ |
extern COLOR cextinction; |
502 |
+ |
extern COLOR salbedo; |
503 |
+ |
extern double seccg; |
504 |
+ |
extern double ssampdist; |
505 |
|
extern int directvis; |
506 |
|
extern double srcsizerat; |
507 |
|
extern int do_irrad; |
508 |
|
extern double specjitter; |
509 |
|
extern double specthresh; |
510 |
+ |
extern int backvis; |
511 |
|
char buf[128]; |
512 |
|
|
513 |
|
if (s[0] == '\0') { |
514 |
|
(*dev->comout)( |
515 |
< |
"aa ab ad ar as av b dc di dj ds dt i lr lw ps pt sj st: "); |
515 |
> |
"aa ab ad ar as av aw b dc dv dj ds dt i lr lw me ma mg ms ps pt sj st bv: "); |
516 |
|
(*dev->comin)(buf, NULL); |
517 |
|
s = buf; |
518 |
|
} |
551 |
|
goto badparam; |
552 |
|
} |
553 |
|
break; |
554 |
< |
case 'b': /* black and white */ |
555 |
< |
getparam(s+1, "black and white", 'b', &greyscale); |
554 |
> |
case 'b': /* back faces or black and white */ |
555 |
> |
switch (s[1]) { |
556 |
> |
case 'v': /* back face visibility */ |
557 |
> |
getparam(s+2, "back face visibility", 'b', &backvis); |
558 |
> |
break; |
559 |
> |
case '\0': /* black and white */ |
560 |
> |
case ' ': |
561 |
> |
case 'y': case 'Y': case 't': case 'T': case '1': case '+': |
562 |
> |
case 'n': case 'N': case 'f': case 'F': case '0': case '-': |
563 |
> |
getparam(s+1, "black and white", 'b', &greyscale); |
564 |
> |
break; |
565 |
> |
default: |
566 |
> |
goto badparam; |
567 |
> |
} |
568 |
|
break; |
569 |
|
case 'i': /* irradiance */ |
570 |
|
getparam(s+1, "irradiance", 'b', &do_irrad); |
574 |
|
case 'v': /* value */ |
575 |
|
getparam(s+2, "ambient value", 'C', (COLOR *)ambval); |
576 |
|
break; |
577 |
+ |
case 'w': /* weight */ |
578 |
+ |
getparam(s+2, "ambient value weight", 'i', &ambvwt); |
579 |
+ |
break; |
580 |
|
case 'a': /* accuracy */ |
581 |
|
if (getparam(s+2, "ambient accuracy", 'r', &ambacc)) |
582 |
|
setambacc(ambacc); |
598 |
|
goto badparam; |
599 |
|
} |
600 |
|
break; |
601 |
+ |
case 'm': /* medium */ |
602 |
+ |
switch (s[1]) { |
603 |
+ |
case 'e': /* extinction coefficient */ |
604 |
+ |
getparam(s+2, "extinction coefficient", 'C', |
605 |
+ |
(COLOR *)cextinction); |
606 |
+ |
break; |
607 |
+ |
case 'a': /* scattering albedo */ |
608 |
+ |
getparam(s+2, "scattering albedo", 'C', |
609 |
+ |
(COLOR *)salbedo); |
610 |
+ |
break; |
611 |
+ |
case 'g': /* scattering eccentricity */ |
612 |
+ |
getparam(s+2, "scattering eccentricity", 'r', &seccg); |
613 |
+ |
break; |
614 |
+ |
case 's': /* sampling distance */ |
615 |
+ |
getparam(s+2, "mist sampling distance", 'r', |
616 |
+ |
&ssampdist); |
617 |
+ |
break; |
618 |
+ |
default: |
619 |
+ |
goto badparam; |
620 |
+ |
} |
621 |
+ |
break; |
622 |
|
case 'p': /* pixel */ |
623 |
|
switch (s[1]) { |
624 |
|
case 's': /* sample */ |
662 |
|
{ |
663 |
|
char buf[128]; |
664 |
|
int x, y; |
665 |
+ |
OBJREC *inst; |
666 |
|
RAY thisray; |
667 |
|
|
668 |
+ |
thisray.rmax = 0.0; |
669 |
+ |
|
670 |
|
if (!sscanvec(s, thisray.rorg) || |
671 |
< |
!sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) { |
671 |
> |
!sscanvec(sskip2(s,3), thisray.rdir)) { |
672 |
|
|
673 |
|
if (dev->getcur == NULL) |
674 |
|
return; |
676 |
|
if ((*dev->getcur)(&x, &y) == ABORT) |
677 |
|
return; |
678 |
|
|
679 |
< |
if (viewray(thisray.rorg, thisray.rdir, &ourview, |
680 |
< |
(x+.5)/hresolu, (y+.5)/vresolu) < 0) { |
679 |
> |
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, |
680 |
> |
&ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) { |
681 |
|
error(COMMAND, "not on image"); |
682 |
|
return; |
683 |
|
} |
694 |
|
if (thisray.ro == NULL) |
695 |
|
(*dev->comout)("ray hit nothing"); |
696 |
|
else { |
697 |
< |
sprintf(buf, "ray hit %s %s \"%s\"", |
697 |
> |
sprintf(buf, "ray hit %s%s %s \"%s\"", |
698 |
> |
thisray.rod < 0.0 ? "back of " : "", |
699 |
|
thisray.ro->omod == OVOID ? VOIDID : |
700 |
|
objptr(thisray.ro->omod)->oname, |
701 |
|
ofun[thisray.ro->otype].funame, |
702 |
|
thisray.ro->oname); |
703 |
+ |
if ((inst = objptr(thisray.robj)) != thisray.ro) |
704 |
+ |
sprintf(buf+strlen(buf), " in instance \"%s\"", |
705 |
+ |
inst->oname); |
706 |
|
(*dev->comout)(buf); |
707 |
|
(*dev->comin)(buf, NULL); |
708 |
|
if (thisray.rot >= FHUGE) |
709 |
|
(*dev->comout)("at infinity"); |
710 |
|
else { |
711 |
< |
sprintf(buf, "at (%.6g %.6g %.6g)", thisray.rop[0], |
712 |
< |
thisray.rop[1], thisray.rop[2]); |
711 |
> |
sprintf(buf, "at (%.6g %.6g %.6g) (%.6g)", |
712 |
> |
thisray.rop[0], thisray.rop[1], |
713 |
> |
thisray.rop[2], thisray.rt); |
714 |
|
(*dev->comout)(buf); |
715 |
|
} |
716 |
|
(*dev->comin)(buf, NULL); |
755 |
|
(*dev->comout)(fname); |
756 |
|
(*dev->comout)("\"...\n"); |
757 |
|
/* write header */ |
758 |
+ |
newheader("RADIANCE", fp); |
759 |
|
fputs(progname, fp); |
760 |
|
fprintview(&ourview, fp); |
761 |
|
if (octname != NULL) |