41 |
|
|
42 |
|
if (getrect(s, &box) < 0) |
43 |
|
return; |
44 |
< |
paintrect(&ptrunk, 0, 0, ourview.hresolu, ourview.vresolu, &box); |
44 |
> |
paintrect(&ptrunk, 0, 0, hresolu, vresolu, &box); |
45 |
|
} |
46 |
|
|
47 |
|
|
113 |
|
else { |
114 |
|
nv.horiz = ourview.horiz; nv.vert = ourview.vert; |
115 |
|
} |
116 |
< |
sprintf(buf, "x and y resolution (%d %d): ", |
117 |
< |
ourview.hresolu, ourview.vresolu); |
116 |
> |
sprintf(buf, "view shift and lift (%.6g %.6g): ", |
117 |
> |
ourview.hoff, ourview.voff); |
118 |
|
(*dev->comout)(buf); |
119 |
|
(*dev->comin)(buf); |
120 |
|
if (buf[0] == CTRL(C)) return; |
121 |
< |
if (sscanf(buf, "%d %d", &nv.hresolu, &nv.vresolu) == 2) |
121 |
> |
if (sscanf(buf, "%lf %lf", &nv.hoff, &nv.voff) == 2) |
122 |
|
change++; |
123 |
|
else { |
124 |
< |
nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; |
124 |
> |
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
125 |
|
} |
126 |
|
if (change) |
127 |
|
newview(&nv); |
137 |
|
VIEW nv; |
138 |
|
|
139 |
|
if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ |
140 |
< |
bcopy(&stdview, &nv, sizeof(VIEW)); |
140 |
> |
copyview(&nv, &stdview); |
141 |
|
if ((fname = getpath(buf, NULL, 0)) == NULL || |
142 |
|
(success = viewfile(fname, &nv)) == -1) { |
143 |
|
sprintf(errmsg, "cannot open \"%s\"", buf); |
150 |
|
newview(&nv); |
151 |
|
return; |
152 |
|
} |
153 |
< |
if (oldview.hresolu == 0) { /* no old view! */ |
153 |
> |
if (oldview.horiz == 0) { /* no old view! */ |
154 |
|
error(COMMAND, "no previous view"); |
155 |
|
return; |
156 |
|
} |
157 |
< |
bcopy(&ourview, &nv, sizeof(VIEW)); |
158 |
< |
bcopy(&oldview, &ourview, sizeof(VIEW)); |
159 |
< |
bcopy(&nv, &oldview, sizeof(VIEW)); |
157 |
> |
copyview(&nv, &ourview); |
158 |
> |
copyview(&ourview, &oldview); |
159 |
> |
copyview(&oldview, &nv); |
160 |
|
newimage(); |
161 |
|
} |
162 |
|
|
172 |
|
return; |
173 |
|
VCOPY(nv.vp, ourview.vp); |
174 |
|
VCOPY(nv.vup, ourview.vup); |
175 |
< |
nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; |
175 |
> |
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
176 |
|
if ((nv.type = ourview.type) == VT_PAR) { |
177 |
|
nv.horiz = ourview.horiz / zfact; |
178 |
|
nv.vert = ourview.vert / zfact; |
213 |
|
} |
214 |
|
VCOPY(nv.vp, ourview.vp); |
215 |
|
VCOPY(nv.vup, ourview.vup); |
216 |
< |
nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; |
216 |
> |
nv.hoff = ourview.hoff; nv.voff = ourview.voff; |
217 |
|
spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); |
218 |
|
if (elev != 0.0) { |
219 |
|
fcross(v1, nv.vdir, ourview.vup); |
270 |
|
if ((*dev->getcur)(&x, &y) == ABORT) |
271 |
|
return; |
272 |
|
r.l = r.d = 0; |
273 |
< |
r.r = ourview.hresolu; r.u = ourview.vresolu; |
273 |
> |
r.r = hresolu; r.u = vresolu; |
274 |
|
p = findrect(x, y, &ptrunk, &r, -1); |
275 |
|
e = 1.0; |
276 |
|
} else { |
540 |
|
if ((*dev->getcur)(&x, &y) == ABORT) |
541 |
|
return; |
542 |
|
|
543 |
< |
rayview(thisray.rorg, thisray.rdir, &ourview, x+.5, y+.5); |
543 |
> |
viewray(thisray.rorg, thisray.rdir, &ourview, |
544 |
> |
(x+.5)/hresolu, (y+.5)/vresolu); |
545 |
|
|
546 |
|
} else if (normalize(thisray.rdir) == 0.0) { |
547 |
|
error(COMMAND, "zero ray direction"); |
608 |
|
if (exposure != 1.0) |
609 |
|
fputexpos(exposure, fp); |
610 |
|
putc('\n', fp); |
611 |
< |
fputresolu(YMAJOR|YDECR, ourview.hresolu, ourview.vresolu, fp); |
611 |
> |
fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp); |
612 |
|
|
613 |
< |
scanline = (COLR *)malloc(ourview.hresolu*sizeof(COLR)); |
613 |
> |
scanline = (COLR *)malloc(hresolu*sizeof(COLR)); |
614 |
|
if (scanline == NULL) |
615 |
|
error(SYSTEM, "out of memory in writepict"); |
616 |
< |
for (y = ourview.vresolu-1; y >= 0; y--) { |
617 |
< |
getpictcolrs(y, scanline, &ptrunk, |
618 |
< |
ourview.hresolu, ourview.vresolu); |
618 |
< |
if (fwritecolrs(scanline, ourview.hresolu, fp) < 0) |
616 |
> |
for (y = vresolu-1; y >= 0; y--) { |
617 |
> |
getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu); |
618 |
> |
if (fwritecolrs(scanline, hresolu, fp) < 0) |
619 |
|
break; |
620 |
|
} |
621 |
|
if (fclose(fp) < 0) |