--- ray/src/common/bsdf_m.c 2011/06/09 17:09:39 3.16 +++ ray/src/common/bsdf_m.c 2011/08/21 22:38:12 3.20 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdf_m.c,v 3.16 2011/06/09 17:09:39 greg Exp $"; +static const char RCSid[] = "$Id: bsdf_m.c,v 3.20 2011/08/21 22:38:12 greg Exp $"; #endif /* * bsdf_m.c @@ -87,18 +87,6 @@ fequal(double a, double b) return (a <= 1e-6) & (a >= -1e-6); } -/* Returns the name of the given tag */ -#ifdef ezxml_name -#undef ezxml_name -static char * -ezxml_name(ezxml_t xml) -{ - if (xml == NULL) - return NULL; - return xml->name; -} -#endif - /* Returns the given tag's character content or empty string if none */ #ifdef ezxml_txt #undef ezxml_txt @@ -190,7 +178,7 @@ fo_getndx(const FVECT v, void *p) { ANGLE_BASIS *ab = (ANGLE_BASIS *)p; int li, ndx; - double pol, azi, d; + double pol, azi; if (v == NULL) return -1; @@ -610,11 +598,13 @@ SDloadMtx(SDData *sd, ezxml_t wtl) sd->name); return SDEsupport; } - /* get angle basis */ - rval = load_angle_basis(ezxml_child(ezxml_child(wtl, - "DataDefinition"), "AngleBasis")); - if (rval < 0) - return convert_errcode(rval); + /* get angle bases */ + for (wld = ezxml_child(ezxml_child(wtl, "DataDefinition"), "AngleBasis"); + wld != NULL; wld = wld->next) { + rval = load_angle_basis(wld); + if (rval < 0) + return convert_errcode(rval); + } /* load BSDF components */ for (wld = ezxml_child(wtl, "WavelengthData"); wld != NULL; wld = wld->next) { @@ -769,7 +759,7 @@ SDgetMtxCDist(const FVECT inVec, SDComponent *sdc) } cdlast = NULL; /* check for it in cache list */ for (cd = (SDMatCDst *)sdc->cdList; cd != NULL; - cdlast = cd, cd = (SDMatCDst *)cd->next) + cdlast = cd, cd = cd->next) if (cd->indx == myCD.indx && (cd->calen == myCD.calen) & (cd->ob_priv == myCD.ob_priv) & (cd->ob_vec == myCD.ob_vec)) @@ -788,7 +778,7 @@ SDgetMtxCDist(const FVECT inVec, SDComponent *sdc) } if (cdlast != NULL) { /* move entry to head of cache list */ cdlast->next = cd->next; - cd->next = sdc->cdList; + cd->next = (SDMatCDst *)sdc->cdList; sdc->cdList = (SDCDst *)cd; } return (SDCDst *)cd; /* ready to go */ @@ -808,7 +798,7 @@ SDsampMtxCDist(FVECT ioVec, double randX, const SDCDst /* binary search to find index */ ilower = 0; iupper = mcd->calen; while ((i = (iupper + ilower) >> 1) != ilower) - if ((long)target >= (long)mcd->carr[i]) + if (target >= mcd->carr[i]) ilower = i; else iupper = i;