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.25 by greg, Sun Apr 24 20:16:52 2011 UTC vs.
Revision 2.32 by greg, Thu Jun 23 16:00:37 2011 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   *
11   */
12  
13 + #define _USE_MATH_DEFINES
14   #include <stdio.h>
15   #include <stdlib.h>
16 + #include <string.h>
17   #include <math.h>
18 + #include <ctype.h>
19   #include "ezxml.h"
20   #include "hilbert.h"
21   #include "bsdf.h"
# Line 106 | Line 109 | SDloadGeometry(SDData *sd, ezxml_t wdb)
109          if ((geom = ezxml_child(wdb, "Geometry")) == NULL ||
110                          (mgfstr = ezxml_txt(geom)) == NULL)
111                  return SDEnone;
112 +        while (isspace(*mgfstr))
113 +                ++mgfstr;
114 +        if (!*mgfstr)
115 +                return SDEnone;
116          if ((fmt = ezxml_attr(geom, "format")) != NULL &&
117                          strcasecmp(fmt, "MGF")) {
118                  sprintf(SDerrorDetail,
# Line 169 | Line 176 | SDloadFile(SDData *sd, const char *fname)
176                                  /* try loading variable resolution data */
177          lastErr = SDloadTre(sd, wtl);
178                                  /* check our result */
179 <        switch (lastErr) {
173 <        case SDEformat:
174 <        case SDEdata:
175 <        case SDEsupport:        /* possibly we just tried the wrong format */
179 >        if (lastErr == SDEsupport)      /* try matrix BSDF if not tree data */
180                  lastErr = SDloadMtx(sd, wtl);
181 <                break;
178 <        default:                /* variable res. OK else serious error */
179 <                break;
180 <        }
181 >                
182                                  /* done with XML file */
183          ezxml_free(fl);
184          
# Line 496 | Line 497 | SDsizeBSDF(double *projSA, const FVECT v1, const RREAL
497          SDError         ec;
498          int             i;
499                                          /* check arguments */
500 <        if ((projSA == NULL) | (v1 == NULL))
500 >        if ((projSA == NULL) | (v1 == NULL) | (sd == NULL))
501                  return SDEargument;
502                                          /* initialize extrema */
503          switch (qflags) {
# Line 516 | Line 517 | SDsizeBSDF(double *projSA, const FVECT v1, const RREAL
517                  rdf = sd->rf;
518          else
519                  rdf = sd->rb;
520 <        tdf = NULL;                     /* transmitted component? */
521 <        if (v2 != NULL && v1[2] > 0 ^ v2[2] > 0) {
522 <                rdf = NULL;
523 <                tdf = sd->tf;
524 <        }
520 >        tdf = sd->tf;
521 >        if (v2 != NULL)                 /* bidirectional? */
522 >                if (v1[2] > 0 ^ v2[2] > 0)
523 >                        rdf = NULL;
524 >                else
525 >                        tdf = NULL;
526          ec = SDEdata;                   /* run through components */
527          for (i = (rdf==NULL) ? 0 : rdf->ncomp; i--; ) {
528                  ec = (*rdf->comp[i].func->queryProjSA)(projSA, v1, v2,
# Line 812 | Line 814 | SDmapDir(FVECT resVec, RREAL vMtx[3][3], const FVECT i
814  
815   #include "standard.h"
816   #include "paths.h"
815 #include <ctype.h>
817  
818   #define MAXLATS         46              /* maximum number of latitudes */
819  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines