26 |
|
int i, y; |
27 |
|
|
28 |
|
if (cv->ncols != 1) |
29 |
< |
error(INTERNAL, "expected matrix in sum_images()"); |
29 |
> |
error(INTERNAL, "expected vector in sum_images()"); |
30 |
|
for (i = 0; i < cv->nrows; i++) { |
31 |
|
const COLORV *scv = cv_lval(cv,i); |
32 |
|
char fname[1024]; |
182 |
|
goto userr; |
183 |
|
|
184 |
|
if (argc-a > 2) { /* VTDs expression */ |
185 |
< |
CMATRIX *smtx, *Dmat, *Tmat, *imtx; |
185 |
> |
CMATRIX *smtx, *Dmat, *Tmat, *imtx; |
186 |
> |
const char *ccp; |
187 |
|
/* get sky vector/matrix */ |
188 |
|
smtx = cm_load(argv[a+3], 0, nsteps, skyfmt); |
189 |
+ |
nsteps = smtx->ncols; |
190 |
|
/* load BSDF */ |
191 |
< |
Tmat = cm_loadBTDF(argv[a+1]); |
191 |
> |
if (argv[a+1][0] != '!' && |
192 |
> |
(ccp = strrchr(argv[a+1], '.')) != NULL && |
193 |
> |
!strcasecmp(ccp+1, "XML")) |
194 |
> |
Tmat = cm_loadBTDF(argv[a+1]); |
195 |
> |
else |
196 |
> |
Tmat = cm_load(argv[a+1], 0, 0, DTfromHeader); |
197 |
|
/* load Daylight matrix */ |
198 |
< |
Dmat = cm_load(argv[a+2], Tmat==NULL ? 0 : Tmat->ncols, |
198 |
> |
Dmat = cm_load(argv[a+2], Tmat->ncols, |
199 |
|
smtx->nrows, DTfromHeader); |
200 |
|
/* multiply vector through */ |
201 |
|
imtx = cm_multiply(Dmat, smtx); |
205 |
|
cm_free(imtx); |
206 |
|
} else { /* sky vector/matrix only */ |
207 |
|
cmtx = cm_load(argv[a+1], 0, nsteps, skyfmt); |
208 |
+ |
nsteps = cmtx->ncols; |
209 |
|
} |
210 |
|
/* prepare output stream */ |
211 |
|
if ((ofspec != NULL) & (nsteps == 1) && hasNumberFormat(ofspec)) { |
325 |
|
userr: |
326 |
|
fprintf(stderr, "Usage: %s [-n nsteps][-o ospec][-i{f|d|h}][-o{f|d}] DCspec [skyf]\n", |
327 |
|
progname); |
328 |
< |
fprintf(stderr, " or: %s [-n nsteps][-o ospec][-i{f|d|h}][-o{f|d}] Vspec Tbsdf.xml Dmat.dat [skyf]\n", |
328 |
> |
fprintf(stderr, " or: %s [-n nsteps][-o ospec][-i{f|d|h}][-o{f|d}] Vspec Tbsdf Dmat.dat [skyf]\n", |
329 |
|
progname); |
330 |
|
return(1); |
331 |
|
} |