63 |
|
} |
64 |
|
fputs(progname, fp); |
65 |
|
fprintview(&ourview, fp); |
66 |
+ |
fputs(sskip(s), fp); |
67 |
|
fputs("\n", fp); |
68 |
|
fclose(fp); |
69 |
|
return; |
70 |
|
} |
71 |
|
sprintf(buf, "view type (%c): ", ourview.type); |
72 |
|
(*dev->comout)(buf); |
73 |
< |
(*dev->comin)(buf); |
73 |
> |
(*dev->comin)(buf, NULL); |
74 |
|
if (buf[0] == CTRL(C)) return; |
75 |
|
if (buf[0] && buf[0] != ourview.type) { |
76 |
|
nv.type = buf[0]; |
80 |
|
sprintf(buf, "view point (%.6g %.6g %.6g): ", |
81 |
|
ourview.vp[0], ourview.vp[1], ourview.vp[2]); |
82 |
|
(*dev->comout)(buf); |
83 |
< |
(*dev->comin)(buf); |
83 |
> |
(*dev->comin)(buf, NULL); |
84 |
|
if (buf[0] == CTRL(C)) return; |
85 |
|
if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) == 3) |
86 |
|
change++; |
89 |
|
sprintf(buf, "view direction (%.6g %.6g %.6g): ", |
90 |
|
ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]); |
91 |
|
(*dev->comout)(buf); |
92 |
< |
(*dev->comin)(buf); |
92 |
> |
(*dev->comin)(buf, NULL); |
93 |
|
if (buf[0] == CTRL(C)) return; |
94 |
|
if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) == 3) |
95 |
|
change++; |
98 |
|
sprintf(buf, "view up (%.6g %.6g %.6g): ", |
99 |
|
ourview.vup[0], ourview.vup[1], ourview.vup[2]); |
100 |
|
(*dev->comout)(buf); |
101 |
< |
(*dev->comin)(buf); |
101 |
> |
(*dev->comin)(buf, NULL); |
102 |
|
if (buf[0] == CTRL(C)) return; |
103 |
|
if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) == 3) |
104 |
|
change++; |
107 |
|
sprintf(buf, "view horiz and vert size (%.6g %.6g): ", |
108 |
|
ourview.horiz, ourview.vert); |
109 |
|
(*dev->comout)(buf); |
110 |
< |
(*dev->comin)(buf); |
110 |
> |
(*dev->comin)(buf, NULL); |
111 |
|
if (buf[0] == CTRL(C)) return; |
112 |
|
if (sscanf(buf, "%lf %lf", &nv.horiz, &nv.vert) == 2) |
113 |
|
change++; |
117 |
|
sprintf(buf, "view shift and lift (%.6g %.6g): ", |
118 |
|
ourview.hoff, ourview.voff); |
119 |
|
(*dev->comout)(buf); |
120 |
< |
(*dev->comin)(buf); |
120 |
> |
(*dev->comin)(buf, NULL); |
121 |
|
if (buf[0] == CTRL(C)) return; |
122 |
|
if (sscanf(buf, "%lf %lf", &nv.hoff, &nv.voff) == 2) |
123 |
|
change++; |
138 |
|
VIEW nv; |
139 |
|
|
140 |
|
if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ |
141 |
< |
copyview(&nv, &stdview); |
141 |
> |
copystruct(&nv, &stdview); |
142 |
|
if ((fname = getpath(buf, NULL, 0)) == NULL || |
143 |
< |
(success = viewfile(fname, &nv)) == -1) { |
143 |
> |
(success = viewfile(fname, &nv, 0, 0)) == -1) { |
144 |
|
sprintf(errmsg, "cannot open \"%s\"", buf); |
145 |
|
error(COMMAND, errmsg); |
146 |
|
return; |
151 |
|
newview(&nv); |
152 |
|
return; |
153 |
|
} |
154 |
< |
if (oldview.horiz == 0) { /* no old view! */ |
154 |
> |
if (oldview.type == 0) { /* no old view! */ |
155 |
|
error(COMMAND, "no previous view"); |
156 |
|
return; |
157 |
|
} |
158 |
< |
copyview(&nv, &ourview); |
159 |
< |
copyview(&ourview, &oldview); |
160 |
< |
copyview(&oldview, &nv); |
158 |
> |
copystruct(&nv, &ourview); |
159 |
> |
copystruct(&ourview, &oldview); |
160 |
> |
copystruct(&oldview, &nv); |
161 |
|
newimage(); |
162 |
|
} |
163 |
|
|
283 |
|
if (*cp == '\0') { /* interactive */ |
284 |
|
sprintf(buf, "exposure (%lf): ", exposure); |
285 |
|
(*dev->comout)(buf); |
286 |
< |
(*dev->comin)(buf); |
286 |
> |
(*dev->comin)(buf, NULL); |
287 |
|
for (cp = buf; isspace(*cp); cp++) |
288 |
|
; |
289 |
|
if (*cp == '\0') |
336 |
|
|
337 |
|
if (s[0] == '\0') { |
338 |
|
(*dev->comout)("aa ab ad ar as av dc dj dt lr lw sp st: "); |
339 |
< |
(*dev->comin)(buf); |
339 |
> |
(*dev->comin)(buf, NULL); |
340 |
|
s = buf; |
341 |
|
} |
342 |
|
switch (s[0]) { |
347 |
|
sprintf(buf, "limit weight (%.6g): ", |
348 |
|
minweight); |
349 |
|
(*dev->comout)(buf); |
350 |
< |
(*dev->comin)(buf); |
350 |
> |
(*dev->comin)(buf, NULL); |
351 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
352 |
|
break; |
353 |
|
} |
358 |
|
sprintf(buf, "limit reflection (%d): ", |
359 |
|
maxdepth); |
360 |
|
(*dev->comout)(buf); |
361 |
< |
(*dev->comin)(buf); |
361 |
> |
(*dev->comin)(buf, NULL); |
362 |
|
if (sscanf(buf, "%d", &i0) != 1) |
363 |
|
break; |
364 |
|
} |
375 |
|
sprintf(buf, "direct jitter (%.6g): ", |
376 |
|
dstrsrc); |
377 |
|
(*dev->comout)(buf); |
378 |
< |
(*dev->comin)(buf); |
378 |
> |
(*dev->comin)(buf, NULL); |
379 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
380 |
|
break; |
381 |
|
} |
386 |
|
sprintf(buf, "direct certainty (%.6g): ", |
387 |
|
shadcert); |
388 |
|
(*dev->comout)(buf); |
389 |
< |
(*dev->comin)(buf); |
389 |
> |
(*dev->comin)(buf, NULL); |
390 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
391 |
|
break; |
392 |
|
} |
397 |
|
sprintf(buf, "direct threshold (%.6g): ", |
398 |
|
shadthresh); |
399 |
|
(*dev->comout)(buf); |
400 |
< |
(*dev->comin)(buf); |
400 |
> |
(*dev->comin)(buf, NULL); |
401 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
402 |
|
break; |
403 |
|
} |
417 |
|
colval(ambval,GRN), |
418 |
|
colval(ambval,BLU)); |
419 |
|
(*dev->comout)(buf); |
420 |
< |
(*dev->comin)(buf); |
420 |
> |
(*dev->comin)(buf, NULL); |
421 |
|
if (sscanf(buf, "%lf %lf %lf", |
422 |
|
&d0, &d1, &d2) != 3) |
423 |
|
break; |
429 |
|
sprintf(buf, "ambient accuracy (%.6g): ", |
430 |
|
ambacc); |
431 |
|
(*dev->comout)(buf); |
432 |
< |
(*dev->comin)(buf); |
432 |
> |
(*dev->comin)(buf, NULL); |
433 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
434 |
|
break; |
435 |
|
} |
440 |
|
sprintf(buf, "ambient divisions (%d): ", |
441 |
|
ambdiv); |
442 |
|
(*dev->comout)(buf); |
443 |
< |
(*dev->comin)(buf); |
443 |
> |
(*dev->comin)(buf, NULL); |
444 |
|
if (sscanf(buf, "%d", &i0) != 1) |
445 |
|
break; |
446 |
|
} |
451 |
|
sprintf(buf, "ambient super-samples (%d): ", |
452 |
|
ambssamp); |
453 |
|
(*dev->comout)(buf); |
454 |
< |
(*dev->comin)(buf); |
454 |
> |
(*dev->comin)(buf, NULL); |
455 |
|
if (sscanf(buf, "%d", &i0) != 1) |
456 |
|
break; |
457 |
|
} |
462 |
|
sprintf(buf, "ambient bounces (%d): ", |
463 |
|
ambounce); |
464 |
|
(*dev->comout)(buf); |
465 |
< |
(*dev->comin)(buf); |
465 |
> |
(*dev->comin)(buf, NULL); |
466 |
|
if (sscanf(buf, "%d", &i0) != 1) |
467 |
|
break; |
468 |
|
} |
473 |
|
sprintf(buf, "ambient resolution (%d): ", |
474 |
|
ambres); |
475 |
|
(*dev->comout)(buf); |
476 |
< |
(*dev->comin)(buf); |
476 |
> |
(*dev->comin)(buf, NULL); |
477 |
|
if (sscanf(buf, "%d", &i0) != 1) |
478 |
|
break; |
479 |
|
} |
490 |
|
if (sscanf(s+2, "%d", &i0) != 1) { |
491 |
|
sprintf(buf, "sample pixel (%d): ", psample); |
492 |
|
(*dev->comout)(buf); |
493 |
< |
(*dev->comin)(buf); |
493 |
> |
(*dev->comin)(buf, NULL); |
494 |
|
if (sscanf(buf, "%d", &i0) != 1) |
495 |
|
break; |
496 |
|
} |
502 |
|
sprintf(buf, "sample threshold (%.6g): ", |
503 |
|
maxdiff); |
504 |
|
(*dev->comout)(buf); |
505 |
< |
(*dev->comin)(buf); |
505 |
> |
(*dev->comin)(buf, NULL); |
506 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
507 |
|
break; |
508 |
|
} |
561 |
|
ofun[thisray.ro->otype].funame, |
562 |
|
thisray.ro->oname); |
563 |
|
(*dev->comout)(buf); |
564 |
< |
(*dev->comin)(buf); |
564 |
> |
(*dev->comin)(buf, NULL); |
565 |
|
if (thisray.rot >= FHUGE) |
566 |
|
(*dev->comout)("at infinity"); |
567 |
|
else { |
569 |
|
thisray.rop[1], thisray.rop[2]); |
570 |
|
(*dev->comout)(buf); |
571 |
|
} |
572 |
< |
(*dev->comin)(buf); |
572 |
> |
(*dev->comin)(buf, NULL); |
573 |
|
sprintf(buf, "with value (%.6g %.6g %.6g)", |
574 |
|
colval(thisray.rcol,RED), |
575 |
|
colval(thisray.rcol,GRN), |
576 |
|
colval(thisray.rcol,BLU)); |
577 |
|
(*dev->comout)(buf); |
578 |
|
} |
579 |
< |
(*dev->comin)(buf); |
579 |
> |
(*dev->comin)(buf, NULL); |
580 |
|
} |
581 |
|
|
582 |
|
|