77 |
|
} |
78 |
|
/* flat file check */ |
79 |
|
if ((data_start = ftell(fp)) > 0 && fseek(fp, 0L, SEEK_END) == 0) { |
80 |
< |
flat_file = (ftell(fp) == data_start + sizeof(COLR)*xr*yr); |
80 |
> |
flat_file = (ftell(fp) >= data_start + sizeof(COLR)*xr*yr); |
81 |
|
if (fseek(fp, data_start, SEEK_SET) < 0) { |
82 |
|
sprintf(errmsg, "cannot seek on picture '%s'", fname); |
83 |
|
error(SYSTEM, errmsg); |
247 |
|
nsteps = smtx->ncols; |
248 |
|
/* load BSDF */ |
249 |
|
if (argv[a+1][0] != '!' && |
250 |
< |
(ccp = strrchr(argv[a+1], '.')) != NULL && |
250 |
> |
(ccp = strrchr(argv[a+1], '.')) > argv[a+1] && |
251 |
|
!strcasecmp(ccp+1, "XML")) |
252 |
|
Tmat = cm_loadBTDF(argv[a+1]); |
253 |
|
else |
267 |
|
} |
268 |
|
/* prepare output stream */ |
269 |
|
if ((ofspec != NULL) & (nsteps == 1) && hasNumberFormat(ofspec)) { |
270 |
< |
sprintf(fnbuf, ofspec, 1); |
270 |
> |
sprintf(fnbuf, ofspec, 0); |
271 |
|
ofspec = fnbuf; |
272 |
|
} |
273 |
|
if (ofspec != NULL && !hasNumberFormat(ofspec)) { |
278 |
|
} |
279 |
|
ofspec = NULL; /* only need to open once */ |
280 |
|
} |
281 |
< |
if (hasNumberFormat(argv[a])) { /* generating image(s) */ |
281 |
> |
if (hasNumberFormat(argv[a])) { /* loading image vector(s) */ |
282 |
|
if (outfmt != DTrgbe) { |
283 |
|
error(WARNING, "changing output type to -oc"); |
284 |
|
outfmt = DTrgbe; |
320 |
|
} |
321 |
|
else if (!sum_images(argv[a], cmtx, ofp)) |
322 |
|
return(1); |
323 |
< |
} else { /* generating vector/matrix */ |
323 |
> |
} else { /* loading view matrix */ |
324 |
|
CMATRIX *Vmat = cm_load(argv[a], 0, cmtx->nrows, DTfromHeader); |
325 |
|
CMATRIX *rmtx = cm_multiply(Vmat, cmtx); |
326 |
|
cm_free(Vmat); |
348 |
|
if ((outfmt != DTrgbe) & (outfmt != DTxyze)) { |
349 |
|
fprintf(ofp, "NROWS=%d\n", rvec->nrows); |
350 |
|
fprintf(ofp, "NCOLS=%d\n", rvec->ncols); |
351 |
< |
fputs("NCOMP=3\n", ofp); |
351 |
> |
fputncomp(3, ofp); |
352 |
|
} |
353 |
|
if ((outfmt == DTfloat) | (outfmt == DTdouble)) |
354 |
|
fputendian(ofp); |
380 |
|
if ((outfmt != DTrgbe) & (outfmt != DTxyze)) { |
381 |
|
fprintf(ofp, "NROWS=%d\n", rmtx->nrows); |
382 |
|
fprintf(ofp, "NCOLS=%d\n", rmtx->ncols); |
383 |
< |
fputs("NCOMP=3\n", ofp); |
383 |
> |
fputncomp(3, ofp); |
384 |
|
} |
385 |
|
if ((outfmt == DTfloat) | (outfmt == DTdouble)) |
386 |
|
fputendian(ofp); |