| 5 |
|
* Take BSDF XML file and generate a referencing Radiance object |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include "rtio.h" |
| 9 |
|
#include "paths.h" |
| 10 |
|
#include "bsdf.h" |
| 11 |
|
|
| 83 |
|
|
| 84 |
|
/* Load a BSDF XML file and produce a corresponding Radiance object */ |
| 85 |
|
static int |
| 86 |
< |
cvtBSDF(const char *fname) |
| 86 |
> |
cvtBSDF(char *fname) |
| 87 |
|
{ |
| 88 |
|
int retOK; |
| 89 |
|
SDData myBSDF; |
| 90 |
< |
/* load the XML file */ |
| 90 |
> |
char *pname; |
| 91 |
> |
/* find and load the XML file */ |
| 92 |
|
retOK = strlen(fname); |
| 93 |
|
if (retOK < 5 || strcmp(fname+retOK-4, ".xml")) { |
| 94 |
|
fprintf(stderr, "%s: input does not end in '.xml'\n", fname); |
| 95 |
|
return(0); |
| 96 |
|
} |
| 97 |
+ |
pname = getpath(fname, getrlibpath(), R_OK); |
| 98 |
+ |
if (pname == NULL) { |
| 99 |
+ |
fprintf(stderr, "%s: cannot find BSDF file\n", fname); |
| 100 |
+ |
return(0); |
| 101 |
+ |
} |
| 102 |
|
SDclearBSDF(&myBSDF, fname); |
| 103 |
< |
if (SDreportEnglish(SDloadFile(&myBSDF, fname), stderr)) |
| 103 |
> |
if (SDreportEnglish(SDloadFile(&myBSDF, pname), stderr)) |
| 104 |
|
return(0); |
| 105 |
|
retOK = (myBSDF.dim[0] > FTINY) & (myBSDF.dim[1] > FTINY); |
| 106 |
|
if (!retOK) { |