107 |
|
char *myrtopts[] = { "-h-", "-x", "1", "-y", "0", |
108 |
|
"-dt", "0", "-as", "0", "-aa", "0", NULL }; |
109 |
|
|
110 |
< |
#define RTCOEFF "-o~~~~TmWdp" /* compute coefficients only */ |
111 |
< |
#define RTCONTRIB "-o~~~~TmVdp" /* compute ray contributions */ |
110 |
> |
#define RTCOEFF "-o~~~TmWdp" /* compute coefficients only */ |
111 |
> |
#define RTCONTRIB "-o~~~TmVdp" /* compute ray contributions */ |
112 |
|
|
113 |
|
struct rtproc rt0; /* head of rtrace process list */ |
114 |
|
|
702 |
|
printheader(FILE *fout, const char *info) |
703 |
|
{ |
704 |
|
extern char VersionID[]; |
705 |
< |
FILE *fin = fopen(octree, "r"); |
706 |
< |
|
707 |
< |
if (fin == NULL) |
708 |
< |
quit(1); |
709 |
< |
checkheader(fin, "ignore", fout); /* copy octree header */ |
710 |
< |
fclose(fin); |
705 |
> |
/* copy octree header */ |
706 |
> |
if (octree[0] == '!') { |
707 |
> |
newheader("RADIANCE", fout); |
708 |
> |
fputs(octree+1, fout); |
709 |
> |
if (octree[strlen(octree)-1] != '\n') |
710 |
> |
fputc('\n', fout); |
711 |
> |
} else { |
712 |
> |
FILE *fin = fopen(octree, "r"); |
713 |
> |
if (fin == NULL) |
714 |
> |
quit(1); |
715 |
> |
checkheader(fin, "ignore", fout); |
716 |
> |
fclose(fin); |
717 |
> |
} |
718 |
|
printargs(gargc-1, gargv, fout); /* add our command */ |
719 |
|
fprintf(fout, "SOFTWARE= %s\n", VersionID); |
720 |
|
fputnow(fout); |
1113 |
|
continue; |
1114 |
|
if (rt->buf == NULL) { |
1115 |
|
rt->bsiz = treebufsiz; |
1116 |
< |
rt->buf = (char *)malloc(treebufsiz); |
1116 |
> |
rt->buf = (char *)malloc(rt->bsiz); |
1117 |
|
} else if (rt->nbr + BUFSIZ > rt->bsiz) { |
1118 |
|
if (rt->bsiz + BUFSIZ <= treebufsiz) |
1119 |
|
rt->bsiz = treebufsiz; |
1127 |
|
if (nr <= 0) |
1128 |
|
error(USER, "rtrace process died"); |
1129 |
|
rt->nbr += nr; /* advance & check */ |
1130 |
< |
if (rt->nbr >= 8 && !memcmp(rt->buf+rt->nbr-8, |
1131 |
< |
"~\t~\t~\t~\t", 8)) { |
1132 |
< |
rt->nbr -= 8; /* elide terminator */ |
1130 |
> |
if (rt->nbr >= 6 && !memcmp(rt->buf+rt->nbr-6, |
1131 |
> |
"~\t~\t~\t", 6)) { |
1132 |
> |
rt->nbr -= 6; /* elide terminator */ |
1133 |
|
queue_raytree(rt); |
1134 |
|
rtfree = rt; /* ready for next ray */ |
1135 |
|
} |
1171 |
|
lastray+1 < lastray) { |
1172 |
|
while (wait_rproc() != NULL) |
1173 |
|
process_queue(); |
1174 |
< |
if (lastray+1 < lastray) |
1168 |
< |
lastdone = lastray = 0; |
1174 |
> |
lastdone = lastray = 0; |
1175 |
|
} |
1176 |
|
rtp = get_rproc(); /* get avail. rtrace process */ |
1177 |
|
rtp->raynum = ++lastray; /* assign ray */ |