ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/glare.h
Revision: 2.8
Committed: Sat Jun 7 05:09:46 2025 UTC (14 hours, 1 minute ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 2.7: +2 -1 lines
Log Message:
refactor: Put some declarations into "paths.h" and included in "platform.h"

File Contents

# Content
1 /* RCSid: $Id: glare.h,v 2.7 2008/05/01 16:42:06 greg Exp $ */
2 /*
3 * Common data structures for glare source finding routines
4 */
5 #ifndef _RAD_GLARE_H_
6 #define _RAD_GLARE_H_
7
8 #include "standard.h"
9 #include "paths.h"
10 #include "view.h"
11 #include "color.h"
12 #include "setscan.h"
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 #define GLAREBR 7.0 /* glare source is this * avg. lum. */
19
20 #define SAMPDENS 75 /* default samples per unit in image */
21 #define TSAMPSTEP 10 /* sample step to compute threshold */
22
23 #define SEPS 1 /* sources this close ==> contig. */
24
25 #define SAMIN .005 /* minimum solid angle for source */
26 #define MAXBUDDY (4.*sqrt(SAMIN/PI)) /* max separation for pairing */
27
28 #define TOOSMALL(s) ((s)->brt*(s)->dom < threshold*SAMIN)
29
30 #define SABIG .025 /* solid angle of splittable source */
31 #define LCORR .12 /* linearity of splittable source */
32
33 extern VIEW ourview; /* our view */
34 extern VIEW pictview; /* picture view */
35 extern VIEW leftview, rightview; /* leftmost and rightmost views */
36
37 extern int verbose; /* verbose reporting */
38 extern char *progname; /* global argv[0] */
39
40 extern double threshold; /* threshold value for glare sources */
41
42 extern int sampdens; /* sample density */
43 extern ANGLE glarang[]; /* glare calculation angles */
44 extern int nglarangs;
45 extern double maxtheta; /* maximum glare angle (in radians) */
46 extern int hsize; /* horizontal size */
47
48 #define nglardirs (2*nglarangs+1)
49 #define vsize (sampdens-1)
50 #define hscale(v) sqrt((double)(sampdens*sampdens - (v)*(v)))
51 #define hlim(v) (int)(maxtheta*hscale(v))
52 #define h_theta(h,v) (-(h)/hscale(v))
53
54 extern struct illum {
55 float theta; /* glare direction */
56 float lcos, lsin; /* cosine and sine to left view */
57 float rcos, rsin; /* cosine and sine to right view */
58 double sum; /* sum of indirect luminances */
59 double n; /* number of values in sum */
60 } *indirect; /* array of indirect illuminances */
61
62 struct srcspan {
63 short v; /* vertical position */
64 short l, r; /* left and right horizontal limits */
65 float brsum; /* sum of brightnesses for this span */
66 struct srcspan *next; /* next source span in list */
67 };
68
69 extern struct source {
70 FVECT dir; /* source direction */
71 double dom; /* solid angle of source */
72 double brt; /* average source brightness */
73 struct srcspan *first; /* first span for this source */
74 struct source *next; /* next source in list */
75 } *donelist; /* finished sources */
76
77
78 extern long npixinvw; /* number of samples in view */
79 extern long npixmiss; /* number of samples missing */
80
81 /* defined in findglare.c */
82 extern void memerr(char *s);
83 extern int compdir(FVECT vd, int x, int y);
84 extern double pixsize(int x, int y);
85 /* defined in glaresrc.c */
86 extern void comp_thresh(void);
87 extern void analyze(void);
88 extern void absorb_specks(void);
89 /* defined in glareval.c */
90 extern void open_pict(char *fn);
91 extern void fork_rtrace(char *av[]);
92 extern void close_pict(void);
93 extern void done_rtrace(void);
94 extern void getviewspan(int vv, float *vb);
95 extern double getviewpix(int vh, int vv);
96
97 #ifdef __cplusplus
98 }
99 #endif
100 #endif /* _RAD_GLARE_H_ */
101