| 1 |
+ |
#ifndef lint |
| 2 |
+ |
static const char RCSid[] = "$Id$"; |
| 3 |
+ |
#endif |
| 4 |
|
/* |
| 5 |
|
* bsdf_m.c |
| 6 |
|
* |
| 11 |
|
* |
| 12 |
|
*/ |
| 13 |
|
|
| 14 |
< |
#include <stdio.h> |
| 14 |
> |
#include "rtio.h" |
| 15 |
|
#include <stdlib.h> |
| 16 |
|
#include <math.h> |
| 14 |
– |
#include <strings.h> |
| 17 |
|
#include <ctype.h> |
| 18 |
|
#include "ezxml.h" |
| 19 |
|
#include "bsdf.h" |
| 360 |
|
return (df->maxHemi <= 1.01); |
| 361 |
|
} |
| 362 |
|
|
| 361 |
– |
/* skip integer in string */ |
| 362 |
– |
static char * |
| 363 |
– |
i_skip(char *s) |
| 364 |
– |
{ |
| 365 |
– |
while (isspace(*s)) |
| 366 |
– |
s++; |
| 367 |
– |
if (*s == '-' || *s == '+') |
| 368 |
– |
s++; |
| 369 |
– |
if (!isdigit(*s)) |
| 370 |
– |
return(NULL); |
| 371 |
– |
do |
| 372 |
– |
s++; |
| 373 |
– |
while (isdigit(*s)); |
| 374 |
– |
return(s); |
| 375 |
– |
} |
| 376 |
– |
|
| 377 |
– |
/* skip float in string */ |
| 378 |
– |
static char * |
| 379 |
– |
f_skip(char *s) |
| 380 |
– |
{ |
| 381 |
– |
register char *cp; |
| 382 |
– |
|
| 383 |
– |
while (isspace(*s)) |
| 384 |
– |
s++; |
| 385 |
– |
if (*s == '-' || *s == '+') |
| 386 |
– |
s++; |
| 387 |
– |
cp = s; |
| 388 |
– |
while (isdigit(*cp)) |
| 389 |
– |
cp++; |
| 390 |
– |
if (*cp == '.') { |
| 391 |
– |
cp++; s++; |
| 392 |
– |
while (isdigit(*cp)) |
| 393 |
– |
cp++; |
| 394 |
– |
} |
| 395 |
– |
if (cp == s) |
| 396 |
– |
return(NULL); |
| 397 |
– |
if (*cp == 'e' || *cp == 'E') |
| 398 |
– |
return(i_skip(cp+1)); |
| 399 |
– |
return(cp); |
| 400 |
– |
} |
| 401 |
– |
|
| 363 |
|
/* load BSDF distribution for this wavelength */ |
| 364 |
|
static int |
| 365 |
|
load_bsdf_data(SDData *sd, ezxml_t wdb, int rowinc) |
| 462 |
|
return RC_FORMERR; |
| 463 |
|
} |
| 464 |
|
for (i = 0; i < dp->ninc*dp->nout; i++) { |
| 465 |
< |
char *sdnext = f_skip(sdata); |
| 465 |
> |
char *sdnext = fskip(sdata); |
| 466 |
|
if (sdnext == NULL) { |
| 467 |
|
sprintf(SDerrorDetail, |
| 468 |
|
"Bad/missing BSDF ScatteringData in '%s'", |