111 |
|
exprev = ih.ev; |
112 |
|
if (!fgetsresolu(&rs, fp)) |
113 |
|
goto readerr; |
114 |
+ |
if (rs.rt != PIXSTANDARD) { |
115 |
+ |
sprintf(errmsg, "unsupported orientation in picture \"%s\"", fname); |
116 |
+ |
error(USER, errmsg); |
117 |
+ |
} |
118 |
|
if (!imres.xr) { /* allocate buffers */ |
119 |
|
imres = rs; |
120 |
|
imsum = (COLOR *)ecalloc(imres.xr*imres.yr, sizeof(COLOR)); |
150 |
|
/* Interpolate between two image pixels */ |
151 |
|
/* XXX skipping expensive ray vector calculations for now */ |
152 |
|
static void |
153 |
< |
interp_pixel(COLOR con, const VIEW *vwn, int xn, int yn, double zn, |
154 |
< |
double pos, int xp, int yp) |
153 |
> |
interp_pixel(COLOR con, const VIEW *vwn, int xn, int yn, double zval, |
154 |
> |
double pos, int xp, int yp, int interpOK) |
155 |
|
{ |
156 |
|
const int hres = scanlen(&imres); |
157 |
|
RREAL ipos; |
158 |
|
FVECT wprev, wcoor, rdir; |
159 |
|
int np, xd, yd, nd; |
160 |
|
COLOR cpr; |
161 |
< |
double sf, zval; |
161 |
> |
double sf; |
162 |
|
/* check if off image */ |
163 |
|
if ((xp < 0) | (xp >= hres)) |
164 |
|
return; |
168 |
|
xd = (1.-pos)*xp + pos*xn + .5; |
169 |
|
yd = (1.-pos)*yp + pos*yn + .5; |
170 |
|
nd = yd*hres + xd; |
171 |
< |
/* check interpolated depth */ |
172 |
< |
zval = (1.-pos)*zprev[np] + pos*zn; |
171 |
> |
/* check depth */ |
172 |
> |
if (interpOK) |
173 |
> |
zval = (1.-pos)*zprev[np] + pos*zval; |
174 |
|
if (zval >= zbuf[nd]) |
175 |
|
return; |
176 |
< |
copycolor(imbuf[nd], con); /* assign interpolated color */ |
176 |
> |
zbuf[nd] = zval; /* assign new depth */ |
177 |
> |
copycolor(imbuf[nd], con); /* assign new color */ |
178 |
> |
if (!interpOK) |
179 |
> |
return; |
180 |
|
scalecolor(imbuf[nd], pos); |
181 |
|
sf = (1.-pos)/exprev; |
182 |
|
colr_color(cpr, imprev[np]); |
183 |
|
scalecolor(cpr, sf); |
184 |
|
addcolor(imbuf[nd], cpr); |
177 |
– |
zbuf[nd] = zval; /* assign new depth */ |
185 |
|
} |
186 |
|
|
187 |
|
|
265 |
|
error(USER, err); |
266 |
|
if (!fgetsresolu(&rs, fpimg)) |
267 |
|
goto readerr; |
268 |
+ |
if (rs.rt != PIXSTANDARD) { |
269 |
+ |
sprintf(errmsg, "unsupported orientation in picture \"%s\"", fname); |
270 |
+ |
error(USER, errmsg); |
271 |
+ |
} |
272 |
|
if ((rs.xr != imres.xr) | (rs.yr != imres.yr)) { |
273 |
|
sprintf(errmsg, "resolution mismatch for picture \"%s\"", fname); |
274 |
|
error(USER, errmsg); |
322 |
|
scalecolor(cval, sf); |
323 |
|
interp_pixel(cval, &fvw, h, n, zscan[h], fpos, |
324 |
|
h + (int)mscan[3*h] - 32768, |
325 |
< |
n - (int)mscan[3*h+1] + 32768); |
325 |
> |
n - (int)mscan[3*h+1] + 32768, |
326 |
> |
mscan[3*h+2]); |
327 |
|
} |
328 |
|
} |
329 |
|
/* fill in missing pixels */ |