9 |
|
|
10 |
|
#define _USE_MATH_DEFINES |
11 |
|
#include <stdlib.h> |
12 |
– |
#include <string.h> |
12 |
|
#include <math.h> |
13 |
|
#include "rtio.h" |
14 |
|
#include "resolu.h" |
53 |
|
/* current input direction */ |
54 |
|
double theta_in_deg, phi_in_deg; |
55 |
|
|
56 |
+ |
/* header line sharing callback */ |
57 |
+ |
int (*sir_headshare)(char *s) = NULL; |
58 |
+ |
|
59 |
|
/* Register new input direction */ |
60 |
|
int |
61 |
|
new_input_direction(double new_theta, double new_phi) |
664 |
|
char fmt[MAXFMTLEN]; |
665 |
|
int i; |
666 |
|
|
667 |
+ |
if (isheadid(s)) |
668 |
+ |
return(0); |
669 |
|
if (!strncmp(s, "NAME=", 5)) { |
670 |
|
strcpy(bsdf_name, s+5); |
671 |
|
bsdf_name[strlen(bsdf_name)-1] = '\0'; |
672 |
+ |
return(1); |
673 |
|
} |
674 |
|
if (!strncmp(s, "MANUFACT=", 9)) { |
675 |
|
strcpy(bsdf_manuf, s+9); |
676 |
|
bsdf_manuf[strlen(bsdf_manuf)-1] = '\0'; |
677 |
+ |
return(1); |
678 |
|
} |
679 |
|
if (!strncmp(s, "SYMMETRY=", 9)) { |
680 |
|
inp_coverage = atoi(s+9); |
681 |
|
single_plane_incident = !inp_coverage; |
682 |
< |
return(0); |
682 |
> |
return(1); |
683 |
|
} |
684 |
|
if (!strncmp(s, "IO_SIDES=", 9)) { |
685 |
|
sscanf(s+9, "%d %d", &input_orient, &output_orient); |
686 |
< |
return(0); |
686 |
> |
return(1); |
687 |
|
} |
688 |
|
if (!strncmp(s, "COLORIMETRY=", 12)) { |
689 |
|
fmt[0] = '\0'; |
694 |
|
if (i < 0) |
695 |
|
return(-1); |
696 |
|
rbf_colorimetry = i; |
697 |
< |
return(0); |
697 |
> |
return(1); |
698 |
|
} |
699 |
|
if (!strncmp(s, "GRIDRES=", 8)) { |
700 |
|
sscanf(s+8, "%d", &grid_res); |
701 |
< |
return(0); |
701 |
> |
return(1); |
702 |
|
} |
703 |
|
if (!strncmp(s, "BSDFMIN=", 8)) { |
704 |
|
sscanf(s+8, "%lf", &bsdf_min); |
705 |
< |
return(0); |
705 |
> |
return(1); |
706 |
|
} |
707 |
|
if (!strncmp(s, "BSDFSPEC=", 9)) { |
708 |
|
sscanf(s+9, "%lf %lf", &bsdf_spec_val, &bsdf_spec_rad); |
709 |
< |
return(0); |
709 |
> |
return(1); |
710 |
|
} |
711 |
< |
if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT)) |
712 |
< |
return(-1); |
711 |
> |
if (formatval(fmt, s)) |
712 |
> |
return (strcmp(fmt, BSDFREP_FMT) ? -1 : 0); |
713 |
> |
if (sir_headshare != NULL) |
714 |
> |
return ((*sir_headshare)(s)); |
715 |
|
return(0); |
716 |
|
} |
717 |
|
|