94 |
|
|
95 |
|
#define renderopts (*setqopts[vscale(QUALITY)]) |
96 |
|
|
97 |
+ |
/* overture calculation file */ |
98 |
+ |
#ifdef NIX |
99 |
+ |
char overfile[] = "overture.raw"; |
100 |
+ |
#else |
101 |
+ |
char overfile[] = "/dev/null"; |
102 |
+ |
#endif |
103 |
+ |
|
104 |
|
extern long fdate(), time(); |
105 |
|
|
106 |
|
long scenedate; /* date of latest scene or object file */ |
166 |
|
/* print all values if requested */ |
167 |
|
if (explicate) |
168 |
|
printvals(); |
169 |
< |
/* run simulation */ |
169 |
> |
/* build octree */ |
170 |
|
oconv(); |
171 |
+ |
/* check date on ambient file */ |
172 |
+ |
checkambfile(); |
173 |
+ |
/* run simulation */ |
174 |
|
renderopts(ropts); |
175 |
|
xferopts(ropts); |
176 |
|
if (rvdevice != NULL) |
557 |
|
} |
558 |
|
|
559 |
|
|
560 |
+ |
checkambfile() /* check date on ambient file */ |
561 |
+ |
{ |
562 |
+ |
long afdate; |
563 |
+ |
|
564 |
+ |
if (vdef(AMBFILE)) { |
565 |
+ |
afdate = fdate(vval(AMBFILE)); |
566 |
+ |
if (afdate >= 0 & octreedate > afdate) |
567 |
+ |
rmfile(vval(AMBFILE)); |
568 |
+ |
} |
569 |
+ |
} |
570 |
+ |
|
571 |
+ |
|
572 |
|
double |
573 |
|
ambval() /* compute ambient value */ |
574 |
|
{ |
686 |
|
else |
687 |
|
op = addarg(op, "-ds .3"); |
688 |
|
op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .15"); |
689 |
< |
sprintf(op, " -ab %d", overture=vint(INDIRECT)); |
690 |
< |
op += strlen(op); |
689 |
> |
if (overture = vint(INDIRECT)) { |
690 |
> |
sprintf(op, " -ab %d", overture); |
691 |
> |
op += strlen(op); |
692 |
> |
} |
693 |
|
if (vdef(AMBFILE)) { |
694 |
|
sprintf(op, " -af %s", vval(AMBFILE)); |
695 |
|
op += strlen(op); |
799 |
|
} |
800 |
|
#ifdef MSDOS |
801 |
|
else if (n > 50) { |
802 |
< |
register char *evp = bmalloc(n+6); |
779 |
< |
if (evp == NULL) |
780 |
< |
syserr(progname); |
781 |
< |
strcpy(evp, "ROPT="); |
782 |
< |
strcat(evp, ro); |
783 |
< |
if (putenv(evp) != 0) { |
784 |
< |
fprintf(stderr, "%s: out of environment space\n", |
785 |
< |
progname); |
786 |
< |
exit(1); |
787 |
< |
} |
802 |
> |
setenv("ROPT", ro+1); |
803 |
|
strcpy(ro, " $ROPT"); |
804 |
|
} |
805 |
|
#endif |
845 |
|
register int i; |
846 |
|
double cent[3], dim[3], mult, d; |
847 |
|
|
848 |
< |
if (vs == NULL || *vs == '-') |
848 |
> |
if (*vs == '-') |
849 |
|
return(vs); |
850 |
|
upax = 0; /* get the up vector */ |
851 |
|
if (vdef(UP)) { |
939 |
|
cp += strlen(cp); |
940 |
|
} |
941 |
|
} |
942 |
< |
/* append any additional options */ |
943 |
< |
strcpy(cp, vs); |
942 |
> |
strcpy(cp, vs); /* append any additional options */ |
943 |
> |
#ifdef MSDOS |
944 |
> |
if (strlen(viewopts) > 40) { |
945 |
> |
setenv("VIEW", viewopts); |
946 |
> |
return("$VIEW"); |
947 |
> |
} |
948 |
> |
#endif |
949 |
|
return(viewopts); |
950 |
|
} |
951 |
|
|
953 |
|
char * |
954 |
|
getview(n, vn) /* get view n, or NULL if none */ |
955 |
|
int n; |
956 |
< |
char *vn; |
956 |
> |
char *vn; /* returned view name */ |
957 |
|
{ |
958 |
< |
register char *mv; |
958 |
> |
register char *mv = NULL; |
959 |
|
|
960 |
< |
if (viewselect != NULL) { |
960 |
> |
if (viewselect != NULL) { /* command-line selected */ |
961 |
|
if (n) /* only do one */ |
962 |
|
return(NULL); |
963 |
|
if (viewselect[0] == '-') { /* already specified */ |
976 |
|
return(specview(mv)); |
977 |
|
return(specview(viewselect)); /* standard view? */ |
978 |
|
} |
979 |
< |
if (vn != NULL && (mv = nvalue(vv+VIEW, n)) != NULL) { |
979 |
> |
mv = nvalue(vv+VIEW, n); /* use view n */ |
980 |
> |
if (vn != NULL & mv != NULL) { |
981 |
|
if (*mv != '-') |
982 |
|
while (*mv && !isspace(*mv)) |
983 |
|
*vn++ = *mv++; |
984 |
|
*vn = '\0'; |
985 |
|
} |
986 |
< |
return(specview(nvalue(vv+VIEW, n))); /* use view n */ |
986 |
> |
return(specview(mv)); |
987 |
|
} |
988 |
|
|
989 |
|
|
1041 |
|
else |
1042 |
|
badvalue(REPORT); |
1043 |
|
} |
1023 |
– |
/* check date on ambient file */ |
1024 |
– |
if (vdef(AMBFILE)) { |
1025 |
– |
long afdate = fdate(vval(AMBFILE)); |
1026 |
– |
if (afdate >= 0 & octreedate > afdate) |
1027 |
– |
rmfile(vval(AMBFILE)); |
1028 |
– |
} |
1044 |
|
/* do each view */ |
1045 |
|
vn = 0; |
1046 |
|
while ((vw = getview(vn++, vs)) != NULL) { |
1060 |
|
sprintf(combuf, |
1061 |
|
"rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s", |
1062 |
|
rep, vw, opts, |
1063 |
< |
vval(OCTREE), rawfile); |
1063 |
> |
vval(OCTREE), overfile); |
1064 |
|
if (runcom(combuf)) { |
1065 |
|
fprintf(stderr, |
1066 |
< |
"%s: error in overture for view %s\n\t%s removed\n", |
1067 |
< |
progname, vs, rawfile); |
1053 |
< |
unlink(rawfile); |
1066 |
> |
"%s: error in overture for view %s\n", |
1067 |
> |
progname, vs); |
1068 |
|
exit(1); |
1069 |
|
} |
1070 |
+ |
#ifdef NIX |
1071 |
+ |
rmfile(overfile); |
1072 |
+ |
#endif |
1073 |
|
} |
1074 |
|
sprintf(combuf, "rpict%s %s %s%s %s > %s", |
1075 |
|
rep, vw, res, opts, |
1125 |
|
return(0); |
1126 |
|
return(unlink(fn)); |
1127 |
|
} |
1128 |
+ |
|
1129 |
+ |
|
1130 |
+ |
#ifdef MSDOS |
1131 |
+ |
setenv(vname, value) /* set an environment variable */ |
1132 |
+ |
char *vname, *value; |
1133 |
+ |
{ |
1134 |
+ |
register char *evp; |
1135 |
+ |
|
1136 |
+ |
evp = bmalloc(strlen(vname)+strlen(value)+2); |
1137 |
+ |
if (evp == NULL) |
1138 |
+ |
syserr(progname); |
1139 |
+ |
sprintf(evp, "%s=%s", vname, value); |
1140 |
+ |
if (putenv(evp) != 0) { |
1141 |
+ |
fprintf(stderr, "%s: out of environment space\n", progname); |
1142 |
+ |
exit(1); |
1143 |
+ |
} |
1144 |
+ |
if (!silent) |
1145 |
+ |
printf("set %s\n", evp); |
1146 |
+ |
} |
1147 |
+ |
#endif |
1148 |
|
|
1149 |
|
|
1150 |
|
badvalue(vc) /* report bad variable value and exit */ |