110 |
|
int explicate = 0; /* explicate variables */ |
111 |
|
int silent = 0; /* do work silently */ |
112 |
|
int noaction = 0; /* don't do anything */ |
113 |
+ |
int vwonly = 0; /* print view only */ |
114 |
|
char *rvdevice = NULL; /* rview output device */ |
115 |
|
char *viewselect = NULL; /* specific view only */ |
116 |
|
|
144 |
|
case 'o': |
145 |
|
rvdevice = argv[++i]; |
146 |
|
break; |
147 |
+ |
case 'V': |
148 |
+ |
vwonly++; |
149 |
+ |
/* fall through */ |
150 |
|
case 'v': |
151 |
|
viewselect = argv[++i]; |
152 |
|
break; |
171 |
|
/* print all values if requested */ |
172 |
|
if (explicate) |
173 |
|
printvals(); |
174 |
+ |
/* print view and exit? */ |
175 |
+ |
if (vwonly) |
176 |
+ |
exit(printview()==0 ? 0 : 1); |
177 |
|
/* build octree */ |
178 |
|
oconv(); |
179 |
|
/* check date on ambient file */ |
585 |
|
ambval() /* compute ambient value */ |
586 |
|
{ |
587 |
|
if (vdef(EXPOSURE)) { |
588 |
+ |
if (!isflt(vval(EXPOSURE))) |
589 |
+ |
badvalue(EXPOSURE); |
590 |
|
if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-') |
591 |
|
return(.5/pow(2.,atof(vval(EXPOSURE)))); |
592 |
< |
if (isdigit(vval(EXPOSURE)[0]) || vval(EXPOSURE)[0] == '.') |
584 |
< |
return(.5/atof(vval(EXPOSURE))); |
585 |
< |
badvalue(EXPOSURE); |
592 |
> |
return(.5/atof(vval(EXPOSURE))); |
593 |
|
} |
594 |
|
if (vlet(ZONE) == 'E') |
595 |
|
return(10.); |
993 |
|
*vn = '\0'; |
994 |
|
} |
995 |
|
/* view number? */ |
996 |
< |
if (isdigit(viewselect[0])) |
996 |
> |
if (isint(viewselect)) |
997 |
|
return(specview(nvalue(vv+VIEW, atoi(viewselect)-1))); |
998 |
|
/* check list */ |
999 |
|
while ((mv = nvalue(vv+VIEW, n++)) != NULL) |
1010 |
|
*vn = '\0'; |
1011 |
|
} |
1012 |
|
return(specview(mv)); |
1013 |
+ |
} |
1014 |
+ |
|
1015 |
+ |
|
1016 |
+ |
printview() /* print out selected view */ |
1017 |
+ |
{ |
1018 |
+ |
extern char *atos(); |
1019 |
+ |
char buf[256]; |
1020 |
+ |
FILE *fp; |
1021 |
+ |
register char *vopts, *cp; |
1022 |
+ |
|
1023 |
+ |
vopts = getview(0, NULL); |
1024 |
+ |
if (vopts == NULL) |
1025 |
+ |
return(-1); |
1026 |
+ |
fputs("VIEW=", stdout); |
1027 |
+ |
do { |
1028 |
+ |
if (matchword(vopts, "-vf")) { /* expand view file */ |
1029 |
+ |
vopts = sskip(vopts); |
1030 |
+ |
if (!*atos(buf, sizeof(buf), vopts)) |
1031 |
+ |
return(-1); |
1032 |
+ |
if ((fp = fopen(buf, "r")) == NULL) |
1033 |
+ |
return(-1); |
1034 |
+ |
for (buf[sizeof(buf)-2] = '\n'; |
1035 |
+ |
fgets(buf, sizeof(buf), fp) != NULL && |
1036 |
+ |
buf[0] != '\n'; |
1037 |
+ |
buf[sizeof(buf)-2] = '\n') { |
1038 |
+ |
if (buf[sizeof(buf)-2] != '\n') { |
1039 |
+ |
ungetc(buf[sizeof(buf)-2], fp); |
1040 |
+ |
buf[sizeof(buf)-2] = '\0'; |
1041 |
+ |
} |
1042 |
+ |
if (matchword(buf, "VIEW=") || |
1043 |
+ |
matchword(buf, "rview")) { |
1044 |
+ |
for (cp = sskip(buf); *cp && *cp != '\n'; cp++) |
1045 |
+ |
putchar(*cp); |
1046 |
+ |
} |
1047 |
+ |
} |
1048 |
+ |
fclose(fp); |
1049 |
+ |
vopts = sskip(vopts); |
1050 |
+ |
} else { |
1051 |
+ |
while (isspace(*vopts)) |
1052 |
+ |
vopts++; |
1053 |
+ |
putchar(' '); |
1054 |
+ |
while (*vopts && !isspace(*vopts)) |
1055 |
+ |
putchar(*vopts++); |
1056 |
+ |
} |
1057 |
+ |
} while (*vopts++); |
1058 |
+ |
putchar('\n'); |
1059 |
+ |
return(0); |
1060 |
|
} |
1061 |
|
|
1062 |
|
|