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

Comparing ray/src/rt/m_bsdf.c (file contents):
Revision 2.1 by greg, Fri Feb 18 00:40:25 2011 UTC vs.
Revision 2.2 by greg, Fri Feb 18 02:41:55 2011 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8   #include "copyright.h"
9  
10   #include  "ray.h"
11 #include  "paths.h"
11   #include  "ambient.h"
12   #include  "source.h"
13   #include  "func.h"
# Line 65 | Line 64 | typedef struct {
64  
65   #define cvt_sdcolor(cv, svp)    ccy2rgb(&(svp)->spec, (svp)->cieY, cv)
66  
68 /* Convert error from BSDF library */
69 static char *
70 cvt_sderr(SDError ec)
71 {
72        if (!SDerrorDetail[0])
73                return(strcpy(errmsg, SDerrorEnglish[ec]));
74        sprintf(errmsg, "%s: %s", SDerrorEnglish[ec], SDerrorDetail);
75        return(errmsg);
76 }
77
67   /* Compute source contribution for BSDF */
68   static void
69   dirbsdf(
# Line 123 | Line 112 | dirbsdf(
112                  return;
113          ec = SDevalBSDF(&sv, vout, np->vinc, np->sd);
114          if (ec)
115 <                objerror(np->mp, USER, cvt_sderr(ec));
115 >                objerror(np->mp, USER, transSDError(ec));
116  
117          if (sv.cieY <= FTINY)           /* not worth using? */
118                  return;
# Line 174 | Line 163 | sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int usep
163                                          : urand(ilhash(dimlist,ndims)+samplendx),
164                                                  dcp);
165                  if (ec)
166 <                        objerror(ndp->mp, USER, cvt_sderr(ec));
166 >                        objerror(ndp->mp, USER, transSDError(ec));
167                                                  /* zero component? */
168                  if (bsv.cieY <= FTINY)
169                          break;
# Line 273 | Line 262 | m_bsdf(OBJREC *m, RAY *r)
262                                  (m->oargs.nfargs % 3))
263                  objerror(m, USER, "bad # arguments");
264  
265 <        SDerrorDetail[0] = '\0';                /* get BSDF data */
266 <        nd.sd = SDgetCache(m->oargs.sarg[1]);
278 <        if (nd.sd == NULL)
279 <                error(SYSTEM, "out of memory in m_bsdf");
280 <        if (!SDisLoaded(nd.sd)) {
281 <                char    *pname = getpath(m->oargs.sarg[1], getrlibpath(), R_OK);
282 <                if (pname == NULL) {
283 <                        sprintf(errmsg, "cannot find BSDF file \"%s\"",
284 <                                                m->oargs.sarg[1]);
285 <                        objerror(m, USER, errmsg);
286 <                }
287 <                ec = SDloadFile(nd.sd, pname);
288 <                if (ec)
289 <                        objerror(m, USER, cvt_sderr(ec));
290 <                SDretainSet = SDretainAll;
291 <        }
265 >                                                /* get BSDF data */
266 >        nd.sd = loadBSDF(m->oargs.sarg[1]);
267                                                  /* load cal file */
268          mf = getfunc(m, 5, 0x1d, 1);
269                                                  /* get thickness */
# Line 373 | Line 348 | m_bsdf(OBJREC *m, RAY *r)
348          if (!ec)
349                  ec = SDinvXform(nd.fromloc, nd.toloc);
350          if (ec) {
351 <                objerror(m, WARNING, cvt_sderr(ec));
351 >                objerror(m, WARNING, transSDError(ec));
352                  SDfreeCache(nd.sd);
353                  return(1);
354          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines