9 |
|
*/ |
10 |
|
|
11 |
|
#include "glare.h" |
12 |
+ |
#include "resolu.h" |
13 |
|
/* maximum rtrace buffer size */ |
14 |
|
#define MAXPIX (4096/(6*sizeof(float))) |
15 |
|
|
154 |
|
FVECT vd; |
155 |
|
{ |
156 |
|
FVECT pp; |
157 |
< |
double vpx, vpy, vpz; |
157 |
> |
FVECT ip; |
158 |
|
COLOR res; |
159 |
|
|
160 |
|
if (pictfp == NULL) |
162 |
|
pp[0] = pictview.vp[0] + vd[0]; |
163 |
|
pp[1] = pictview.vp[1] + vd[1]; |
164 |
|
pp[2] = pictview.vp[2] + vd[2]; |
165 |
< |
viewpixel(&vpx, &vpy, &vpz, &pictview, pp); |
166 |
< |
if (vpz <= FTINY || vpx < 0. || vpx >= 1. || vpy < 0. || vpy >= 1.) |
165 |
> |
viewloc(ip, &pictview, pp); |
166 |
> |
if (ip[2] <= FTINY || ip[0] < 0. || ip[0] >= 1. || |
167 |
> |
ip[1] < 0. || ip[1] >= 1.) |
168 |
|
return(-1.0); |
169 |
< |
colr_color(res, getpictscan((int)(vpy*pysiz))[(int)(vpx*pxsiz)]); |
169 |
> |
colr_color(res, getpictscan((int)(ip[1]*pysiz))[(int)(ip[0]*pxsiz)]); |
170 |
|
return(luminance(res)/exposure); |
171 |
|
} |
172 |
|
|
295 |
|
} |
296 |
|
exposure = 1.0; |
297 |
|
getheader(pictfp, getexpos, NULL); |
298 |
< |
if (wrongformat || |
299 |
< |
fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { |
298 |
< |
fprintf("%s: bad picture format\n", fn); |
298 |
> |
if (wrongformat || !fscnresolu(&pxsiz, &pysiz, pictfp)) { |
299 |
> |
fprintf(stderr, "%s: incompatible picture format\n", fn); |
300 |
|
exit(1); |
301 |
|
} |
302 |
|
initscans(); |