27 |
|
|
28 |
|
if (*s && !strncmp(s, "all", strlen(s))) { |
29 |
|
r->l = r->d = 0; |
30 |
< |
r->r = ourview.hresolu; |
31 |
< |
r->u = ourview.vresolu; |
30 |
> |
r->r = hresolu; |
31 |
> |
r->u = vresolu; |
32 |
|
return(0); |
33 |
|
} |
34 |
|
if (sscanf(s, "%d %d %d %d", &x0, &y0, &x1, &y1) != 4) { |
57 |
|
} |
58 |
|
if (r->l < 0) r->l = 0; |
59 |
|
if (r->d < 0) r->d = 0; |
60 |
< |
if (r->r > ourview.hresolu) r->r = ourview.hresolu; |
61 |
< |
if (r->u > ourview.vresolu) r->u = ourview.vresolu; |
60 |
> |
if (r->r > hresolu) r->r = hresolu; |
61 |
> |
if (r->u > vresolu) r->u = vresolu; |
62 |
|
if (r->l > r->r) r->l = r->r; |
63 |
|
if (r->d > r->u) r->d = r->u; |
64 |
|
return(0); |
89 |
|
(*dev->comout)("Pick view center\n"); |
90 |
|
if ((*dev->getcur)(&x, &y) == ABORT) |
91 |
|
return(-1); |
92 |
< |
rayview(thisray.rorg, thisray.rdir, &ourview, x+.5, y+.5); |
92 |
> |
viewray(thisray.rorg, thisray.rdir, &ourview, |
93 |
> |
(x+.5)/hresolu, (y+.5)/vresolu); |
94 |
|
if (!direc || ourview.type == VT_PAR) { |
95 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
96 |
|
if (!localhit(&thisray, &thescene)) { |
142 |
|
} |
143 |
|
/* jitter ray direction */ |
144 |
|
p->x = h = xmin + (xmax-xmin)*frandom(); |
145 |
+ |
h /= hresolu; |
146 |
|
p->y = v = ymin + (ymax-ymin)*frandom(); |
147 |
+ |
v /= vresolu; |
148 |
|
|
149 |
< |
rayview(thisray.rorg, thisray.rdir, &ourview, h, v); |
149 |
> |
viewray(thisray.rorg, thisray.rdir, &ourview, h, v); |
150 |
|
|
151 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
152 |
|
|
164 |
|
{ |
165 |
|
/* free old image */ |
166 |
|
freepkids(&ptrunk); |
167 |
< |
/* set up frame */ |
168 |
< |
if (ourview.hresolu > dev->xsiz || ourview.vresolu > dev->ysiz) |
169 |
< |
newview(&ourview); /* beware recursive loop! */ |
167 |
> |
/* compute resolution */ |
168 |
> |
hresolu = dev->xsiz; |
169 |
> |
vresolu = dev->ysiz; |
170 |
> |
normaspect(viewaspect(&ourview), &dev->pixaspect, &hresolu, &vresolu); |
171 |
|
pframe.l = pframe.d = 0; |
172 |
< |
pframe.r = ourview.hresolu; pframe.u = ourview.vresolu; |
172 |
> |
pframe.r = hresolu; pframe.u = vresolu; |
173 |
|
pdepth = 0; |
174 |
|
/* clear device */ |
175 |
< |
(*dev->clear)(ourview.hresolu, ourview.vresolu); |
175 |
> |
(*dev->clear)(hresolu, vresolu); |
176 |
|
/* get first value */ |
177 |
< |
paint(&ptrunk, 0, 0, ourview.hresolu, ourview.vresolu); |
177 |
> |
paint(&ptrunk, 0, 0, hresolu, vresolu); |
178 |
|
} |
179 |
|
|
180 |
|
|
181 |
|
redraw() /* redraw the image */ |
182 |
|
{ |
183 |
< |
(*dev->clear)(ourview.hresolu, ourview.vresolu); |
183 |
> |
(*dev->clear)(hresolu, vresolu); |
184 |
|
(*dev->comout)("redrawing...\n"); |
185 |
< |
repaint(0, 0, ourview.hresolu, ourview.vresolu); |
185 |
> |
repaint(0, 0, hresolu, vresolu); |
186 |
|
(*dev->comout)("\n"); |
187 |
|
} |
188 |
|
|
195 |
|
reg.l = xmin; reg.r = xmax; |
196 |
|
reg.d = ymin; reg.u = ymax; |
197 |
|
|
198 |
< |
paintrect(&ptrunk, 0, 0, ourview.hresolu, ourview.vresolu, ®); |
198 |
> |
paintrect(&ptrunk, 0, 0, hresolu, vresolu, ®); |
199 |
|
} |
200 |
|
|
201 |
|
|
206 |
|
{ |
207 |
|
int mx, my; |
208 |
|
|
205 |
– |
if (dev->inpready) |
206 |
– |
return; /* break for input */ |
207 |
– |
|
209 |
|
if (xmax - xmin <= 0 || ymax - ymin <= 0) |
210 |
|
return; |
211 |
|
|
343 |
|
{ |
344 |
|
char *err; |
345 |
|
|
345 |
– |
if (vp->hresolu > dev->xsiz || vp->vresolu > dev->ysiz) /* shrink */ |
346 |
– |
if (vp->vresolu * dev->xsiz < vp->hresolu * dev->ysiz) { |
347 |
– |
vp->vresolu = dev->xsiz * vp->vresolu / vp->hresolu; |
348 |
– |
vp->hresolu = dev->xsiz; |
349 |
– |
} else { |
350 |
– |
vp->hresolu = dev->ysiz * vp->hresolu / vp->vresolu; |
351 |
– |
vp->vresolu = dev->ysiz; |
352 |
– |
} |
346 |
|
if ((err = setview(vp)) != NULL) { |
347 |
|
sprintf(errmsg, "view not set - %s", err); |
348 |
|
error(COMMAND, errmsg); |
349 |
|
} else if (bcmp(vp, &ourview, sizeof(VIEW))) { |
350 |
< |
bcopy(&ourview, &oldview, sizeof(VIEW)); |
351 |
< |
bcopy(vp, &ourview, sizeof(VIEW)); |
350 |
> |
copyview(&oldview, &ourview); |
351 |
> |
copyview(&ourview, vp); |
352 |
|
newimage(); /* newimage() calls with vp=&ourview! */ |
353 |
|
} |
354 |
|
} |
365 |
|
register int i; |
366 |
|
|
367 |
|
VCOPY(nv.vup, ourview.vup); |
368 |
< |
nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; |
368 |
> |
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
369 |
|
spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); |
370 |
|
if (elev != 0.0) { |
371 |
|
fcross(v1, ourview.vup, nv.vdir); |