| 87 |
|
sizeof(DCOLORV)*(NCSAMP*ncbins-1) + |
| 88 |
|
strlen(prms)+1); |
| 89 |
|
|
| 90 |
< |
if (binexpr) { // check bin expression |
| 90 |
> |
if (binexpr) { // get/check bin expression |
| 91 |
|
mp->binv = eparse(const_cast<char *>(binexpr)); |
| 92 |
|
if (mp->binv->type == NUM) { // constant expression (0)? |
| 93 |
< |
if ((int)(evalue(mp->binv) + .5) > 0) { |
| 94 |
< |
sprintf(errmsg, "illegal positive constant for bin (%s)", |
| 93 |
> |
if ((int)evalue(mp->binv) != 0) { |
| 94 |
> |
sprintf(errmsg, "illegal non-zero constant for bin (%s)", |
| 95 |
|
binexpr); |
| 96 |
|
error(USER, errmsg); |
| 97 |
|
} |
| 182 |
|
raycontrib(contr, r, PRIMARY); // compute coefficient |
| 183 |
|
if (rcp->HasFlag(RCcontrib)) |
| 184 |
|
smultscolor(contr, r->rcol); // -> value contribution |
| 185 |
+ |
|
| 186 |
|
for (int i = 0; i < NCSAMP; i++) |
| 187 |
|
*dvp++ += contr[i]; // accumulate color/spectrum |
| 188 |
|
return 1; |
| 215 |
|
error(WARNING, "ignoring bad call to AddModifier()"); |
| 216 |
|
return false; |
| 217 |
|
} |
| 218 |
+ |
if (*outspec == '!') { |
| 219 |
+ |
error(USER, "command output not supported by RcontribSimulManager"); |
| 220 |
+ |
return false; |
| 221 |
+ |
} |
| 222 |
|
if (!nChan) { // initial call? |
| 223 |
|
if ((xres < 0) | (yres <= 0)) { |
| 224 |
|
error(USER, "xres, yres must be set before first modifier"); |
| 228 |
|
return false; |
| 229 |
|
nChan = NCSAMP; |
| 230 |
|
} else if (nChan != NCSAMP) { |
| 231 |
< |
error(USER, "number of spectral channels must be fixed"); |
| 231 |
> |
error(USER, "# spectral channels must be fixed in AddModifier()"); |
| 232 |
|
return false; |
| 233 |
|
} |
| 234 |
|
if (Ready()) { |
| 324 |
|
} |
| 325 |
|
char mod[MAXSTR]; |
| 326 |
|
while (fgetword(mod, sizeof(mod), fp)) |
| 327 |
< |
if (!AddModifier(mod, outspec, prms, binval, bincnt)) |
| 327 |
> |
if (!AddModifier(mod, outspec, prms, binval, bincnt)) { |
| 328 |
> |
fclose(fp); |
| 329 |
|
return false; |
| 330 |
+ |
} |
| 331 |
|
fclose(fp); |
| 332 |
|
return true; |
| 333 |
|
} |
| 336 |
|
static int |
| 337 |
|
checkModExists(const LUENT *lp, void *p) |
| 338 |
|
{ |
| 339 |
< |
if (modifier(lp->key) != OVOID) |
| 339 |
> |
OBJECT mod = modifier(lp->key); |
| 340 |
> |
|
| 341 |
> |
if ((mod != OVOID) & (mod < nsceneobjs)) |
| 342 |
|
return 1; |
| 343 |
|
|
| 344 |
|
sprintf(errmsg, "tracked modifier '%s' not found in main scene", lp->key); |
| 351 |
|
RcontribSimulManager::PrepOutput() |
| 352 |
|
{ |
| 353 |
|
if (!outList || !RtraceSimulManager::Ready()) { |
| 354 |
< |
error(INTERNAL, "PrepOutput() called before octree & modifiers assigned"); |
| 354 |
> |
error(INTERNAL, "PrepOutput() called before octree & modifiers set"); |
| 355 |
|
return -1; |
| 356 |
|
} |
| 357 |
|
if (!cdsF) { |
| 358 |
< |
error(INTERNAL, "missing RdataShare constructor call (*cdsF)"); |
| 358 |
> |
error(INTERNAL, "missing RdataShare constructor call (cdsF)"); |
| 359 |
|
return -1; |
| 360 |
|
} |
| 361 |
|
if (lu_doall(&modLUT, checkModExists, NULL) < 0) |
| 362 |
|
return -1; |
| 363 |
|
|
| 364 |
+ |
outList->nRows = yres * (xres + !xres); // all outputs have same #rows |
| 365 |
|
int remWarnings = 20; |
| 366 |
|
for (RcontribOutput *op = outList; op; op = op->next) { |
| 367 |
|
if (op->rData) { |
| 368 |
|
error(INTERNAL, "output channel already open in PrepOutput()"); |
| 369 |
|
return -1; |
| 370 |
|
} |
| 371 |
< |
op->nRows = yres * (xres + !xres); |
| 371 |
> |
op->nRows = outList->nRows; |
| 372 |
|
op->rData = (*cdsF)(op->ofname, outOp, |
| 373 |
|
GetHeadLen()+1024 + op->nRows*op->rowBytes); |
| 374 |
|
freeqstr(op->ofname); op->ofname = NULL; |
| 378 |
|
return -1; |
| 379 |
|
if (rd >= op->nRows) { |
| 380 |
|
if (remWarnings >= 0) { |
| 381 |
< |
sprintf(errmsg, "recovered output '%s' already done", |
| 381 |
> |
sprintf(errmsg, "recovered output '%s' is complete", |
| 382 |
|
op->GetName()); |
| 383 |
< |
error(WARNING, remWarnings ? errmsg : "etc..."); |
| 374 |
< |
remWarnings--; |
| 383 |
> |
error(WARNING, --remWarnings ? errmsg : "etc..."); |
| 384 |
|
} |
| 385 |
|
rd = op->nRows; |
| 386 |
|
} |
| 606 |
|
} |
| 607 |
|
} break; |
| 608 |
|
default: |
| 609 |
< |
error(CONSISTENCY, "unsupported output type in sendModContrib()"); |
| 609 |
> |
error(CONSISTENCY, "unsupported output type in putModContrib()"); |
| 610 |
|
return -1; |
| 611 |
|
} |
| 612 |
|
// clear for next tally |
| 737 |
|
error(CONSISTENCY, "bad accumulator count in child"); |
| 738 |
|
exit(1); |
| 739 |
|
} |
| 740 |
< |
if (rass.ac > accum) |
| 741 |
< |
vecList = (FVECT *)erealloc(vecList, |
| 742 |
< |
sizeof(FVECT)*2*rass.ac); |
| 740 |
> |
if (rass.ac > accum) { |
| 741 |
> |
efree(vecList); |
| 742 |
> |
vecList = (FVECT *)emalloc(sizeof(FVECT)*2*rass.ac); |
| 743 |
> |
} |
| 744 |
|
accum = rass.ac; |
| 745 |
|
rInPos = rass.row; |
| 746 |
|
|