ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bsdf.c
(Generate patch)

Comparing ray/src/common/bsdf.c (file contents):
Revision 2.36 by greg, Sat Sep 17 22:09:33 2011 UTC vs.
Revision 2.37 by greg, Sun Mar 4 20:11:10 2012 UTC

# Line 226 | Line 226 | SDnewSpectralDF(int nc)
226          return df;
227   }
228  
229 + /* Add component(s) to spectral distribution function */
230 + SDSpectralDF *
231 + SDaddComponent(SDSpectralDF *odf, int nadd)
232 + {
233 +        SDSpectralDF    *df;
234 +
235 +        if (odf == NULL)
236 +                return SDnewSpectralDF(nadd);
237 +        if (nadd <= 0)
238 +                return odf;
239 +        df = (SDSpectralDF *)realloc(odf, sizeof(SDSpectralDF) +
240 +                                (odf->ncomp+nadd-1)*sizeof(SDComponent));
241 +        if (df == NULL) {
242 +                sprintf(SDerrorDetail,
243 +                        "Cannot add %d component(s) to spectral DF", nadd);
244 +                SDfreeSpectralDF(odf);
245 +                return NULL;
246 +        }
247 +        memset(df->comp+df->ncomp, 0, nadd*sizeof(SDComponent));
248 +        df->ncomp += nadd;
249 +        return df;
250 + }
251 +
252   /* Free cached cumulative distributions for BSDF component */
253   void
254   SDfreeCumulativeCache(SDSpectralDF *df)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines