5 |
|
* Query values from the given BSDF (scattering interpolant or XML repres.) |
6 |
|
* Input query is incident and exiting vectors directed away from surface. |
7 |
|
* We normalize. Output is a BSDF value for the vector pair. |
8 |
+ |
* A zero length in or out vector is ignored, causing output to be flushed. |
9 |
|
* It is wise to sort the input directions to keep identical ones together |
10 |
|
* when using a scattering interpolant representation. |
11 |
|
*/ |
26 |
|
{ |
27 |
|
double dvec[6]; |
28 |
|
float fvec[6]; |
29 |
< |
|
29 |
> |
tryagain: |
30 |
|
switch (fmt) { |
31 |
|
case 'a': |
32 |
|
if (fscanf(fp, FVFORMAT, &idir[0], &idir[1], &idir[2]) != 3 || |
47 |
|
break; |
48 |
|
} |
49 |
|
if ((normalize(idir) == 0) | (normalize(odir) == 0)) { |
50 |
< |
fprintf(stderr, "%s: zero input vector!\n", progname); |
51 |
< |
return(0); |
50 |
> |
fflush(stdout); /* desired side-effect? */ |
51 |
> |
goto tryagain; |
52 |
|
} |
53 |
|
return(1); |
54 |
|
} |