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.30 by greg, Thu Jun 9 17:09:39 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 <math.h>
# Line 169 | Line 170 | SDloadFile(SDData *sd, const char *fname)
170                                  /* try loading variable resolution data */
171          lastErr = SDloadTre(sd, wtl);
172                                  /* check our result */
173 <        switch (lastErr) {
173 <        case SDEformat:
174 <        case SDEdata:
175 <        case SDEsupport:        /* possibly we just tried the wrong format */
173 >        if (lastErr == SDEsupport)      /* try matrix BSDF if not tree data */
174                  lastErr = SDloadMtx(sd, wtl);
175 <                break;
178 <        default:                /* variable res. OK else serious error */
179 <                break;
180 <        }
175 >                
176                                  /* done with XML file */
177          ezxml_free(fl);
178          
# Line 496 | Line 491 | SDsizeBSDF(double *projSA, const FVECT v1, const RREAL
491          SDError         ec;
492          int             i;
493                                          /* check arguments */
494 <        if ((projSA == NULL) | (v1 == NULL))
494 >        if ((projSA == NULL) | (v1 == NULL) | (sd == NULL))
495                  return SDEargument;
496                                          /* initialize extrema */
497          switch (qflags) {
# Line 516 | Line 511 | SDsizeBSDF(double *projSA, const FVECT v1, const RREAL
511                  rdf = sd->rf;
512          else
513                  rdf = sd->rb;
514 <        tdf = NULL;                     /* transmitted component? */
515 <        if (v2 != NULL && v1[2] > 0 ^ v2[2] > 0) {
516 <                rdf = NULL;
517 <                tdf = sd->tf;
518 <        }
514 >        tdf = sd->tf;
515 >        if (v2 != NULL)                 /* bidirectional? */
516 >                if (v1[2] > 0 ^ v2[2] > 0)
517 >                        rdf = NULL;
518 >                else
519 >                        tdf = NULL;
520          ec = SDEdata;                   /* run through components */
521          for (i = (rdf==NULL) ? 0 : rdf->ncomp; i--; ) {
522                  ec = (*rdf->comp[i].func->queryProjSA)(projSA, v1, v2,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines