--- ray/src/rt/rcontrib.c 2014/07/19 18:19:33 2.20 +++ ray/src/rt/rcontrib.c 2014/07/19 18:39:35 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcontrib.c,v 2.20 2014/07/19 18:19:33 greg Exp $"; +static const char RCSid[] = "$Id: rcontrib.c,v 2.21 2014/07/19 18:39:35 greg Exp $"; #endif /* * Accumulate ray contributions for a set of materials @@ -274,11 +274,12 @@ trace_contrib(RAY *r) if (mp == NULL) /* not in our list? */ return; - worldfunc(RCCONTEXT, r); /* else get bin number */ - if (mp->params != last_params) + worldfunc(RCCONTEXT, r); /* else set context */ + if ((mp->params != NULL) & (mp->params != last_params) && + (last_params == NULL || strcmp(mp->params, last_params))) set_eparams(last_params = (char *)mp->params); - if ((bval = evalue(mp->binv)) <= -.5) - return; /* silently ignore */ + if ((bval = evalue(mp->binv)) <= -.5) /* and get bin number */ + return; /* silently ignore negatives */ if ((bn = (int)(bval + .5)) >= mp->nbins) { error(WARNING, "bad bin number (ignored)"); return;