| 68 |
|
freepkids(&ptrunk); |
| 69 |
|
/* set up frame */ |
| 70 |
|
if (ourview.hresolu > dev->xsiz || ourview.vresolu > dev->ysiz) |
| 71 |
< |
error(USER, "resolution mismatch"); |
| 71 |
> |
newview(&ourview); /* beware recursive loop! */ |
| 72 |
|
pframe.l = pframe.d = 0; |
| 73 |
|
pframe.r = ourview.hresolu; pframe.u = ourview.vresolu; |
| 74 |
|
pdepth = 0; |
| 247 |
|
{ |
| 248 |
|
char *err; |
| 249 |
|
|
| 250 |
< |
if (vp->hresolu > dev->xsiz || vp->vresolu > dev->ysiz) { |
| 251 |
< |
error(COMMAND, "view not set - resolution mismatch"); |
| 252 |
< |
} else if ((err = setview(vp)) != NULL) { |
| 250 |
> |
if (vp->hresolu > dev->xsiz || vp->vresolu > dev->ysiz) /* shrink */ |
| 251 |
> |
if (vp->vresolu * dev->xsiz < vp->hresolu * dev->ysiz) { |
| 252 |
> |
vp->vresolu = dev->xsiz * vp->vresolu / vp->hresolu; |
| 253 |
> |
vp->hresolu = dev->xsiz; |
| 254 |
> |
} else { |
| 255 |
> |
vp->hresolu = dev->ysiz * vp->hresolu / vp->vresolu; |
| 256 |
> |
vp->vresolu = dev->ysiz; |
| 257 |
> |
} |
| 258 |
> |
if ((err = setview(vp)) != NULL) { |
| 259 |
|
sprintf(errmsg, "view not set - %s", err); |
| 260 |
|
error(COMMAND, errmsg); |
| 261 |
|
} else if (bcmp(vp, &ourview, sizeof(VIEW))) { |
| 262 |
|
bcopy(&ourview, &oldview, sizeof(VIEW)); |
| 263 |
|
bcopy(vp, &ourview, sizeof(VIEW)); |
| 264 |
< |
newimage(); |
| 264 |
> |
newimage(); /* newimage() calls with vp=&ourview! */ |
| 265 |
|
} |
| 266 |
|
} |
| 267 |
|
|
| 268 |
|
|
| 269 |
< |
moveview(angle, mag, vc) /* move viewpoint */ |
| 270 |
< |
double angle, mag; |
| 269 |
> |
moveview(angle, elev, mag, vc) /* move viewpoint */ |
| 270 |
> |
double angle, elev, mag; |
| 271 |
|
FVECT vc; |
| 272 |
|
{ |
| 273 |
|
extern double sqrt(), dist2(); |
| 274 |
|
double d; |
| 275 |
+ |
FVECT v1; |
| 276 |
|
VIEW nv; |
| 277 |
|
register int i; |
| 278 |
|
|
| 279 |
|
VCOPY(nv.vup, ourview.vup); |
| 280 |
|
nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; |
| 281 |
|
spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); |
| 282 |
+ |
if (elev != 0.0) { |
| 283 |
+ |
fcross(v1, ourview.vup, nv.vdir); |
| 284 |
+ |
normalize(v1); |
| 285 |
+ |
spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.)); |
| 286 |
+ |
} |
| 287 |
|
if ((nv.type = ourview.type) == VT_PAR) { |
| 288 |
|
nv.horiz = ourview.horiz / mag; |
| 289 |
|
nv.vert = ourview.vert / mag; |