13 |
|
#include <string.h> |
14 |
|
|
15 |
|
#include "platform.h" |
16 |
+ |
#include "rtprocess.h" /* win_popen() */ |
17 |
+ |
#include "paths.h" |
18 |
|
#include "ray.h" |
19 |
|
#include "source.h" |
20 |
|
#include "ambient.h" |
63 |
|
|
64 |
|
|
65 |
|
void |
66 |
< |
getview( /* get/show view parameters */ |
66 |
> |
getview( /* get/show/save view parameters */ |
67 |
|
char *s |
68 |
|
) |
69 |
|
{ |
82 |
|
error(COMMAND, "bad view option(s)"); |
83 |
|
return; |
84 |
|
} |
85 |
< |
if (sscanf(s, "%s", buf) == 1) { /* write parameters to a file */ |
85 |
> |
if (nextword(buf, sizeof(buf), s) != NULL) { /* write to a file */ |
86 |
|
if ((fname = getpath(buf, NULL, 0)) == NULL || |
87 |
|
(fp = fopen(fname, "a")) == NULL) { |
88 |
|
sprintf(errmsg, "cannot open \"%s\"", buf); |
164 |
|
char *fname; |
165 |
|
int success; |
166 |
|
VIEW nv; |
167 |
< |
|
168 |
< |
if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ |
167 |
> |
/* get parameters from a file */ |
168 |
> |
if (nextword(buf, sizeof(buf), s) != NULL) { |
169 |
|
nv = stdview; |
170 |
|
if ((fname = getpath(buf, "", R_OK)) == NULL || |
171 |
|
(success = viewfile(fname, &nv, NULL)) == -1) { |
206 |
|
} |
207 |
|
s = sskip(s); |
208 |
|
} |
209 |
< |
while (isspace(*s)) |
208 |
< |
s++; |
209 |
< |
if (*s) |
210 |
< |
atos(rifname, sizeof(rifname), s); |
211 |
< |
else if (rifname[0] == '\0') { |
209 |
> |
if (nextword(rifname, sizeof(rifname), s) == NULL && !rifname[0]) { |
210 |
|
error(COMMAND, "no previous rad file"); |
211 |
|
return; |
212 |
|
} |
239 |
|
s = sskip(s); |
240 |
|
else |
241 |
|
strcat(buf, "1"); |
242 |
< |
if (*s) |
245 |
< |
atos(rifname, sizeof(rifname), s); |
246 |
< |
else if (rifname[0] == '\0') { |
242 |
> |
if (nextword(rifname, sizeof(rifname), s) == NULL && !rifname[0]) { |
243 |
|
error(COMMAND, "no previous rad file"); |
244 |
|
return; |
245 |
|
} |
530 |
|
char *s |
531 |
|
) |
532 |
|
{ |
533 |
+ |
int prev_newp = newparam; |
534 |
|
char buf[128]; |
535 |
|
|
536 |
|
if (s[0] == '\0') { |
537 |
|
(*dev->comout)( |
538 |
< |
"aa ab ad ar as av aw b bv dc dv dj ds dt i lr lw me ma mg ms ps pt sj st u: "); |
538 |
> |
"aa ab ad ar as av aw b bv dc dv dj ds dt i lr lw me ma mg ms ps pt ss st u: "); |
539 |
|
(*dev->comin)(buf, NULL); |
540 |
|
s = buf; |
541 |
|
} |
596 |
|
case 'n': case 'N': case 'f': case 'F': case '0': case '-': |
597 |
|
getparam(s+1, "black and white", 'b', |
598 |
|
(void *)&greyscale); |
599 |
+ |
newparam = prev_newp; |
600 |
|
break; |
601 |
|
default: |
602 |
|
goto badparam; |
679 |
|
default: |
680 |
|
goto badparam; |
681 |
|
} |
682 |
+ |
newparam = prev_newp; |
683 |
|
break; |
684 |
|
case 's': /* specular */ |
685 |
|
switch (s[1]) { |
686 |
< |
case 'j': /* jitter */ |
687 |
< |
getparam(s+2, "specular jitter", 'r', |
686 |
> |
case 's': /* sampling */ |
687 |
> |
getparam(s+2, "specular sampling", 'r', |
688 |
|
(void *)&specjitter); |
689 |
|
break; |
690 |
|
case 't': /* threshold */ |
712 |
|
char *s |
713 |
|
) |
714 |
|
{ |
715 |
< |
char buf[128]; |
716 |
< |
int x, y; |
718 |
< |
OBJREC *ino; |
719 |
< |
RAY thisray; |
715 |
> |
RAY thisray; |
716 |
> |
char buf[512]; |
717 |
|
|
718 |
|
thisray.rmax = 0.0; |
719 |
|
|
720 |
|
if (!sscanvec(s, thisray.rorg) || |
721 |
|
!sscanvec(sskip2(s,3), thisray.rdir)) { |
722 |
+ |
int x, y; |
723 |
|
|
724 |
|
if (dev->getcur == NULL) |
725 |
|
return; |
746 |
|
OBJREC *mat = NULL; |
747 |
|
OBJREC *mod = NULL; |
748 |
|
char matspec[256]; |
749 |
+ |
OBJREC *ino; |
750 |
+ |
|
751 |
|
matspec[0] = '\0'; |
752 |
|
if (thisray.ro->omod != OVOID) { |
753 |
|
mod = objptr(thisray.ro->omod); |
800 |
|
FILE *fp; |
801 |
|
COLR *scanline; |
802 |
|
int y; |
803 |
< |
|
804 |
< |
while (isspace(*s)) |
805 |
< |
s++; |
806 |
< |
if (*s) |
807 |
< |
atos(buf, sizeof(buf), s); |
808 |
< |
else if (buf[0] == '\0') { |
803 |
> |
/* XXX relies on words.c 2.11 behavior */ |
804 |
> |
if (nextword(buf, sizeof(buf), s) == NULL && !buf[0]) { |
805 |
|
error(COMMAND, "no file"); |
806 |
|
return; |
807 |
|
} |