9 |
|
*/ |
10 |
|
|
11 |
|
#include "standard.h" |
12 |
+ |
#include "view.h" |
13 |
|
#include "paths.h" |
14 |
|
#include "vars.h" |
15 |
|
#include <ctype.h> |
16 |
|
#include <sys/types.h> |
17 |
|
|
18 |
< |
/* variables */ |
19 |
< |
#define OBJECT 0 /* object files */ |
20 |
< |
#define SCENE 1 /* scene files */ |
21 |
< |
#define MATERIAL 2 /* material files */ |
18 |
> |
/* variables (alphabetical by name) */ |
19 |
> |
#define AMBFILE 0 /* ambient file name */ |
20 |
> |
#define DETAIL 1 /* level of scene detail */ |
21 |
> |
#define EXPOSURE 2 /* picture exposure setting */ |
22 |
|
#define ILLUM 3 /* mkillum input files */ |
23 |
< |
#define MKILLUM 4 /* mkillum options */ |
24 |
< |
#define RENDER 5 /* rendering options */ |
25 |
< |
#define OCONV 6 /* oconv options */ |
26 |
< |
#define PFILT 7 /* pfilt options */ |
27 |
< |
#define VIEW 8 /* view(s) for picture(s) */ |
28 |
< |
#define ZONE 9 /* simulation zone */ |
29 |
< |
#define QUALITY 10 /* desired rendering quality */ |
30 |
< |
#define OCTREE 11 /* octree file name */ |
31 |
< |
#define PICTURE 12 /* picture file root name */ |
32 |
< |
#define AMBFILE 13 /* ambient file name */ |
33 |
< |
#define OPTFILE 14 /* rendering options file */ |
34 |
< |
#define EXPOSURE 15 /* picture exposure setting */ |
35 |
< |
#define RESOLUTION 16 /* maximum picture resolution */ |
36 |
< |
#define UP 17 /* view up (X, Y or Z) */ |
37 |
< |
#define INDIRECT 18 /* indirection in lighting */ |
38 |
< |
#define DETAIL 19 /* level of scene detail */ |
39 |
< |
#define PENUMBRAS 20 /* shadow penumbras are desired */ |
23 |
> |
#define INDIRECT 4 /* indirection in lighting */ |
24 |
> |
#define MATERIAL 5 /* material files */ |
25 |
> |
#define MKILLUM 6 /* mkillum options */ |
26 |
> |
#define OBJECT 7 /* object files */ |
27 |
> |
#define OCONV 8 /* oconv options */ |
28 |
> |
#define OCTREE 9 /* octree file name */ |
29 |
> |
#define OPTFILE 10 /* rendering options file */ |
30 |
> |
#define PENUMBRAS 11 /* shadow penumbras are desired */ |
31 |
> |
#define PFILT 12 /* pfilt options */ |
32 |
> |
#define PICTURE 13 /* picture file root name */ |
33 |
> |
#define QUALITY 14 /* desired rendering quality */ |
34 |
> |
#define RAWFILE 15 /* raw picture file root name */ |
35 |
> |
#define RENDER 16 /* rendering options */ |
36 |
> |
#define REPORT 17 /* report frequency and errfile */ |
37 |
> |
#define RESOLUTION 18 /* maximum picture resolution */ |
38 |
> |
#define SCENE 19 /* scene files */ |
39 |
> |
#define UP 20 /* view up (X, Y or Z) */ |
40 |
|
#define VARIABILITY 21 /* level of light variability */ |
41 |
< |
#define REPORT 22 /* report frequency and errfile */ |
42 |
< |
#define RAWFILE 23 /* raw picture file root name */ |
43 |
< |
#define ZFILE 24 /* distance file root name */ |
41 |
> |
#define VIEWS 22 /* view(s) for picture(s) */ |
42 |
> |
#define ZFILE 23 /* distance file root name */ |
43 |
> |
#define ZONE 24 /* simulation zone */ |
44 |
|
/* total number of variables */ |
45 |
|
int NVARS = 25; |
46 |
|
|
47 |
|
VARIABLE vv[] = { /* variable-value pairs */ |
48 |
< |
{"objects", 3, 0, NULL, catvalues}, |
49 |
< |
{"scene", 3, 0, NULL, catvalues}, |
50 |
< |
{"materials", 3, 0, NULL, catvalues}, |
48 |
> |
{"AMBFILE", 3, 0, NULL, onevalue}, |
49 |
> |
{"DETAIL", 3, 0, NULL, qualvalue}, |
50 |
> |
{"EXPOSURE", 3, 0, NULL, fltvalue}, |
51 |
|
{"illum", 3, 0, NULL, catvalues}, |
52 |
+ |
{"INDIRECT", 3, 0, NULL, intvalue}, |
53 |
+ |
{"materials", 3, 0, NULL, catvalues}, |
54 |
|
{"mkillum", 3, 0, NULL, catvalues}, |
55 |
< |
{"render", 3, 0, NULL, catvalues}, |
55 |
> |
{"objects", 3, 0, NULL, catvalues}, |
56 |
|
{"oconv", 3, 0, NULL, catvalues}, |
54 |
– |
{"pfilt", 2, 0, NULL, catvalues}, |
55 |
– |
{"view", 2, 0, NULL, NULL}, |
56 |
– |
{"ZONE", 2, 0, NULL, onevalue}, |
57 |
– |
{"QUALITY", 3, 0, NULL, qualvalue}, |
57 |
|
{"OCTREE", 3, 0, NULL, onevalue}, |
59 |
– |
{"PICTURE", 3, 0, NULL, onevalue}, |
60 |
– |
{"AMBFILE", 3, 0, NULL, onevalue}, |
58 |
|
{"OPTFILE", 3, 0, NULL, onevalue}, |
59 |
< |
{"EXPOSURE", 3, 0, NULL, fltvalue}, |
59 |
> |
{"PENUMBRAS", 3, 0, NULL, boolvalue}, |
60 |
> |
{"pfilt", 2, 0, NULL, catvalues}, |
61 |
> |
{"PICTURE", 3, 0, NULL, onevalue}, |
62 |
> |
{"QUALITY", 3, 0, NULL, qualvalue}, |
63 |
> |
{"RAWFILE", 3, 0, NULL, onevalue}, |
64 |
> |
{"render", 3, 0, NULL, catvalues}, |
65 |
> |
{"REPORT", 3, 0, NULL, onevalue}, |
66 |
|
{"RESOLUTION", 3, 0, NULL, onevalue}, |
67 |
+ |
{"scene", 3, 0, NULL, catvalues}, |
68 |
|
{"UP", 2, 0, NULL, onevalue}, |
65 |
– |
{"INDIRECT", 3, 0, NULL, intvalue}, |
66 |
– |
{"DETAIL", 3, 0, NULL, qualvalue}, |
67 |
– |
{"PENUMBRAS", 3, 0, NULL, boolvalue}, |
69 |
|
{"VARIABILITY", 3, 0, NULL, qualvalue}, |
70 |
< |
{"REPORT", 3, 0, NULL, onevalue}, |
70 |
< |
{"RAWFILE", 3, 0, NULL, onevalue}, |
70 |
> |
{"view", 2, 0, NULL, NULL}, |
71 |
|
{"ZFILE", 2, 0, NULL, onevalue}, |
72 |
+ |
{"ZONE", 2, 0, NULL, onevalue}, |
73 |
|
}; |
74 |
|
|
75 |
|
/* overture calculation file */ |
365 |
|
vval(PICTURE) = radname; |
366 |
|
vdef(PICTURE)++; |
367 |
|
} |
368 |
< |
if (!vdef(VIEW)) { |
369 |
< |
vval(VIEW) = "X"; |
370 |
< |
vdef(VIEW)++; |
368 |
> |
if (!vdef(VIEWS)) { |
369 |
> |
vval(VIEWS) = "X"; |
370 |
> |
vdef(VIEWS)++; |
371 |
|
} |
372 |
|
if (!vdef(DETAIL)) { |
373 |
|
vval(DETAIL) = "M"; |
617 |
|
overture = 0; |
618 |
|
switch (vscale(VARIABILITY)) { |
619 |
|
case LOW: |
620 |
< |
op = addarg(op, "-aw 128 -aa .4 -ad 64"); |
620 |
> |
op = addarg(op, "-aa .4 -ad 64"); |
621 |
|
break; |
622 |
|
case MEDIUM: |
623 |
< |
op = addarg(op, "-aw 1024 -aa .3 -ad 128"); |
623 |
> |
op = addarg(op, "-aa .3 -ad 128"); |
624 |
|
break; |
625 |
|
case HIGH: |
626 |
|
op = addarg(op, "-aa .25 -ad 256"); |
696 |
|
overture = 0; |
697 |
|
switch (vscale(VARIABILITY)) { |
698 |
|
case LOW: |
699 |
< |
op = addarg(op, "-aw 128 -aa .25 -ad 196 -as 0"); |
699 |
> |
op = addarg(op, "-aa .25 -ad 196 -as 0"); |
700 |
|
break; |
701 |
|
case MEDIUM: |
702 |
< |
op = addarg(op, "-aw 1024 -aa .2 -ad 400 -as 64"); |
702 |
> |
op = addarg(op, "-aa .2 -ad 400 -as 64"); |
703 |
|
break; |
704 |
|
case HIGH: |
705 |
|
op = addarg(op, "-aa .15 -ad 768 -as 196"); |
772 |
|
overture = 0; |
773 |
|
switch (vscale(VARIABILITY)) { |
774 |
|
case LOW: |
775 |
< |
op = addarg(op, "-aw 128 -aa .15 -ad 256 -as 0"); |
775 |
> |
op = addarg(op, "-aa .15 -ad 256 -as 0"); |
776 |
|
break; |
777 |
|
case MEDIUM: |
778 |
< |
op = addarg(op, "-aw 1024 -aa .125 -ad 512 -as 256"); |
778 |
> |
op = addarg(op, "-aa .125 -ad 512 -as 256"); |
779 |
|
break; |
780 |
|
case HIGH: |
781 |
|
op = addarg(op, "-aa .08 -ad 1024 -as 512"); |
1000 |
|
} |
1001 |
|
/* view number? */ |
1002 |
|
if (isint(viewselect)) |
1003 |
< |
return(specview(nvalue(VIEW, atoi(viewselect)-1))); |
1003 |
> |
return(specview(nvalue(VIEWS, atoi(viewselect)-1))); |
1004 |
|
/* check list */ |
1005 |
< |
while ((mv = nvalue(VIEW, n++)) != NULL) |
1005 |
> |
while ((mv = nvalue(VIEWS, n++)) != NULL) |
1006 |
|
if (matchword(viewselect, mv)) |
1007 |
|
return(specview(mv)); |
1008 |
|
return(specview(viewselect)); /* standard view? */ |
1009 |
|
} |
1010 |
< |
mv = nvalue(VIEW, n); /* use view n */ |
1010 |
> |
mv = nvalue(VIEWS, n); /* use view n */ |
1011 |
|
if (vn != NULL & mv != NULL) { |
1012 |
|
register char *mv2 = mv; |
1013 |
|
if (*mv2 != '-') |
1022 |
|
printview(vopts) /* print out selected view */ |
1023 |
|
register char *vopts; |
1024 |
|
{ |
1025 |
< |
extern char *atos(), *getenv(); |
1026 |
< |
char buf[256]; |
1027 |
< |
FILE *fp; |
1025 |
> |
extern char *strstr(), *atos(), *getenv(); |
1026 |
> |
VIEW vwr; |
1027 |
> |
char buf[128]; |
1028 |
|
register char *cp; |
1029 |
< |
|
1029 |
> |
again: |
1030 |
|
if (vopts == NULL) |
1031 |
|
return(-1); |
1031 |
– |
fputs("VIEW=", stdout); |
1032 |
– |
do { |
1033 |
– |
if (matchword(vopts, "-vf")) { /* expand view file */ |
1034 |
– |
vopts = sskip(vopts); |
1035 |
– |
if (!*atos(buf, sizeof(buf), vopts)) |
1036 |
– |
return(-1); |
1037 |
– |
if ((fp = fopen(buf, "r")) == NULL) |
1038 |
– |
return(-1); |
1039 |
– |
for (buf[sizeof(buf)-2] = '\n'; |
1040 |
– |
fgets(buf, sizeof(buf), fp) != NULL && |
1041 |
– |
buf[0] != '\n'; |
1042 |
– |
buf[sizeof(buf)-2] = '\n') { |
1043 |
– |
if (buf[sizeof(buf)-2] != '\n') { |
1044 |
– |
ungetc(buf[sizeof(buf)-2], fp); |
1045 |
– |
buf[sizeof(buf)-2] = '\0'; |
1046 |
– |
} |
1047 |
– |
if (matchword(buf, "VIEW=") || |
1048 |
– |
matchword(buf, "rview")) { |
1049 |
– |
for (cp = sskip(buf); *cp && *cp != '\n'; cp++) |
1050 |
– |
putchar(*cp); |
1051 |
– |
} |
1052 |
– |
} |
1053 |
– |
fclose(fp); |
1054 |
– |
vopts = sskip(vopts); |
1055 |
– |
} else { |
1056 |
– |
while (isspace(*vopts)) |
1057 |
– |
vopts++; |
1058 |
– |
putchar(' '); |
1032 |
|
#ifdef MSDOS |
1033 |
< |
if (*vopts == '$') { /* expand env. var. */ |
1034 |
< |
if (!*atos(buf, sizeof(buf), vopts+1)) |
1035 |
< |
return(-1); |
1036 |
< |
if ((cp = getenv(buf)) == NULL) |
1064 |
< |
return(-1); |
1065 |
< |
fputs(cp, stdout); |
1066 |
< |
vopts = sskip(vopts); |
1067 |
< |
} else |
1033 |
> |
if (vopts[0] == '$') { |
1034 |
> |
vopts = getenv(vopts+1); |
1035 |
> |
goto again; |
1036 |
> |
} |
1037 |
|
#endif |
1038 |
< |
while (*vopts && !isspace(*vopts)) |
1039 |
< |
putchar(*vopts++); |
1040 |
< |
} |
1041 |
< |
} while (*vopts++); |
1042 |
< |
putchar('\n'); |
1038 |
> |
copystruct(&vwr, &stdview); |
1039 |
> |
cp = vopts; /* get -vf files first */ |
1040 |
> |
while ((cp = strstr(cp, "-vf ")) != NULL && |
1041 |
> |
*atos(buf, sizeof(buf), cp += 4)) |
1042 |
> |
viewfile(buf, &vwr, NULL); |
1043 |
> |
sscanview(&vwr, vopts); /* get the rest */ |
1044 |
> |
fputs(VIEWSTR, stdout); |
1045 |
> |
fprintview(&vwr, stdout); /* print full spec. */ |
1046 |
> |
fputc('\n', stdout); |
1047 |
|
return(0); |
1048 |
|
} |
1049 |
|
|