109 |
|
if (sscanvec(buf, nv.vp)) |
110 |
|
change++; |
111 |
|
sprintf(buf, "view direction (%.6g %.6g %.6g): ", |
112 |
< |
ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]); |
112 |
> |
ourview.vdir[0]*ourview.vdist, |
113 |
> |
ourview.vdir[1]*ourview.vdist, |
114 |
> |
ourview.vdir[2]*ourview.vdist); |
115 |
|
(*dev->comout)(buf); |
116 |
|
(*dev->comin)(buf, NULL); |
117 |
|
if (buf[0] == CTRL('C')) return; |
118 |
< |
if (sscanvec(buf, nv.vdir)) |
118 |
> |
if (sscanvec(buf, nv.vdir)) { |
119 |
> |
nv.vdist = 1.; |
120 |
|
change++; |
121 |
+ |
} |
122 |
|
sprintf(buf, "view up (%.6g %.6g %.6g): ", |
123 |
|
ourview.vup[0], ourview.vup[1], ourview.vup[2]); |
124 |
|
(*dev->comout)(buf); |
280 |
|
return; |
281 |
|
zoomview(&nv, zfact); |
282 |
|
newview(&nv); |
283 |
+ |
} |
284 |
+ |
|
285 |
+ |
|
286 |
+ |
extern void |
287 |
+ |
getfocus( /* set focus distance */ |
288 |
+ |
char *s |
289 |
+ |
) |
290 |
+ |
{ |
291 |
+ |
FVECT vc; |
292 |
+ |
double dist; |
293 |
+ |
|
294 |
+ |
if (sscanf(s, "%lf", &dist) < 1) { |
295 |
+ |
int x, y; |
296 |
+ |
RAY thisray; |
297 |
+ |
if (dev->getcur == NULL) |
298 |
+ |
return; |
299 |
+ |
(*dev->comout)("Pick focus point\n"); |
300 |
+ |
if ((*dev->getcur)(&x, &y) == ABORT) |
301 |
+ |
return; |
302 |
+ |
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, |
303 |
+ |
&ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) { |
304 |
+ |
error(COMMAND, "not on image"); |
305 |
+ |
return; |
306 |
+ |
} |
307 |
+ |
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
308 |
+ |
if (!localhit(&thisray, &thescene)) { |
309 |
+ |
error(COMMAND, "not a local object"); |
310 |
+ |
return; |
311 |
+ |
} |
312 |
+ |
dist = thisray.rot; |
313 |
+ |
} else if (dist <= .0) { |
314 |
+ |
error(COMMAND, "focus distance must be positive"); |
315 |
+ |
return; |
316 |
+ |
} |
317 |
+ |
ourview.vdist = dist; |
318 |
|
} |
319 |
|
|
320 |
|
|