| 10 |
|
#include <stdlib.h> |
| 11 |
|
#include <string.h> |
| 12 |
|
|
| 13 |
+ |
#include "platform.h" |
| 14 |
|
#include "rtprocess.h" /* Windows: must come first because of conflicts */ |
| 15 |
|
#include "glare.h" |
| 16 |
|
|
| 70 |
|
{ |
| 71 |
|
int hi = shash(y); |
| 72 |
|
SCAN *slast; |
| 73 |
< |
register SCAN *sl; |
| 73 |
> |
SCAN *sl; |
| 74 |
|
|
| 75 |
|
for (sl = hashtab[hi]; sl != NULL; sl = sl->next) |
| 76 |
|
if (sl->y == y) /* active scanline */ |
| 97 |
|
int y |
| 98 |
|
) |
| 99 |
|
{ |
| 100 |
< |
register SCAN *sl; |
| 101 |
< |
register int i; |
| 100 |
> |
SCAN *sl; |
| 101 |
> |
int i; |
| 102 |
|
/* first check our buffers */ |
| 103 |
|
sl = claimscan(y); |
| 104 |
|
if (sl == NULL) |
| 177 |
|
pp[0] = pictview.vp[0] + vd[0]; |
| 178 |
|
pp[1] = pictview.vp[1] + vd[1]; |
| 179 |
|
pp[2] = pictview.vp[2] + vd[2]; |
| 180 |
< |
viewloc(ip, &pictview, pp); |
| 180 |
< |
if (ip[2] <= FTINY || ip[0] < 0. || ip[0] >= 1. || |
| 181 |
< |
ip[1] < 0. || ip[1] >= 1.) |
| 180 |
> |
if (viewloc(ip, &pictview, pp) != VL_GOOD) |
| 181 |
|
return(-1.0); |
| 182 |
|
colr_color(res, getpictscan((int)(ip[1]*pysiz))[(int)(ip[0]*pxsiz)]); |
| 183 |
|
return(luminance(res)/exposure); |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
|
| 187 |
< |
extern double |
| 187 |
> |
double |
| 188 |
|
getviewpix( /* compute single view pixel */ |
| 189 |
|
int vh, |
| 190 |
|
int vv |
| 199 |
|
npixinvw++; |
| 200 |
|
if ((res = pict_val(dir)) >= 0.0) |
| 201 |
|
return(res); |
| 202 |
< |
if (rt_pd.r == -1) { |
| 202 |
> |
if (!(rt_pd.flags & PF_RUNNING)) { |
| 203 |
|
npixmiss++; |
| 204 |
|
return(-1.0); |
| 205 |
|
} |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
|
| 217 |
< |
extern void |
| 217 |
> |
void |
| 218 |
|
getviewspan( /* compute a span of view pixels */ |
| 219 |
|
int vv, |
| 220 |
|
float *vb |
| 221 |
|
) |
| 222 |
|
{ |
| 223 |
|
float rt_buf[6*MAXPIX]; /* rtrace send/receive buffer */ |
| 224 |
< |
register int n; /* number of pixels in buffer */ |
| 224 |
> |
int n; /* number of pixels in buffer */ |
| 225 |
|
short buf_vh[MAXPIX]; /* pixel positions */ |
| 226 |
|
FVECT dir; |
| 227 |
< |
register int vh; |
| 227 |
> |
int vh; |
| 228 |
|
|
| 229 |
|
#ifdef DEBUG |
| 230 |
|
if (verbose) |
| 240 |
|
npixinvw++; |
| 241 |
|
if ((vb[vh+hsize] = pict_val(dir)) >= 0.0) |
| 242 |
|
continue; |
| 243 |
< |
if (rt_pd.r == -1) { /* missing information */ |
| 243 |
> |
if (!(rt_pd.flags & PF_RUNNING)) { /* missing information */ |
| 244 |
|
npixmiss++; |
| 245 |
|
continue; |
| 246 |
|
} |
| 247 |
|
/* send to rtrace */ |
| 248 |
|
if (n >= maxpix) { /* flush */ |
| 249 |
|
rt_compute(rt_buf, n); |
| 250 |
< |
while (n-- > 0) |
| 250 |
> |
while (n > 0) { |
| 251 |
> |
--n; |
| 252 |
|
vb[buf_vh[n]+hsize] = luminance(rt_buf+3*n); |
| 253 |
+ |
} |
| 254 |
|
} |
| 255 |
|
rt_buf[6*n] = ourview.vp[0]; |
| 256 |
|
rt_buf[6*n+1] = ourview.vp[1]; |
| 299 |
|
void *p |
| 300 |
|
) |
| 301 |
|
{ |
| 302 |
< |
char fmt[32]; |
| 302 |
> |
char fmt[MAXFMTLEN]; |
| 303 |
|
|
| 304 |
|
if (isexpos(s)) |
| 305 |
|
exposure *= exposval(s); |
| 311 |
|
} |
| 312 |
|
|
| 313 |
|
|
| 314 |
< |
extern void |
| 314 |
> |
void |
| 315 |
|
open_pict( /* open picture file */ |
| 316 |
|
char *fn |
| 317 |
|
) |
| 320 |
|
fprintf(stderr, "%s: cannot open\n", fn); |
| 321 |
|
exit(1); |
| 322 |
|
} |
| 323 |
+ |
SET_FILE_BINARY(pictfp); |
| 324 |
|
exposure = 1.0; |
| 325 |
|
getheader(pictfp, getexpos, NULL); |
| 326 |
|
if (wrongformat || !fscnresolu(&pxsiz, &pysiz, pictfp)) { |
| 331 |
|
} |
| 332 |
|
|
| 333 |
|
|
| 334 |
< |
extern void |
| 334 |
> |
void |
| 335 |
|
close_pict(void) /* done with picture */ |
| 336 |
|
{ |
| 337 |
|
if (pictfp == NULL) |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
|
| 345 |
< |
extern void |
| 345 |
> |
void |
| 346 |
|
fork_rtrace( /* open pipe and start rtrace */ |
| 347 |
|
char *av[] |
| 348 |
|
) |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
|
| 368 |
< |
extern void |
| 368 |
> |
void |
| 369 |
|
done_rtrace(void) /* wait for rtrace to finish */ |
| 370 |
|
{ |
| 371 |
|
int status; |
| 376 |
|
progname, status); |
| 377 |
|
exit(1); |
| 378 |
|
} |
| 377 |
– |
rt_pd.r = -1; |
| 379 |
|
} |
| 380 |
|
|
| 381 |
|
|
| 385 |
|
SCAN *sold[NRETIRE]; |
| 386 |
|
int n; |
| 387 |
|
int h; |
| 388 |
< |
register SCAN *sl; |
| 389 |
< |
register int i; |
| 388 |
> |
SCAN *sl; |
| 389 |
> |
int i; |
| 390 |
|
/* grab the NRETIRE oldest scanlines */ |
| 391 |
|
sold[n = 0] = NULL; |
| 392 |
|
for (h = 0; h < HSIZE; h++) |
| 427 |
|
initscans(void) /* initialize scanline buffers */ |
| 428 |
|
{ |
| 429 |
|
int scansize; |
| 430 |
< |
register SCAN *ptr; |
| 431 |
< |
register int i; |
| 430 |
> |
SCAN *ptr; |
| 431 |
> |
int i; |
| 432 |
|
/* initialize positions */ |
| 433 |
|
scanpos = (long *)bmalloc(pysiz*sizeof(long)); |
| 434 |
|
if (scanpos == NULL) |