ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rcontrib.h
Revision: 2.11
Committed: Sat Jul 19 20:03:03 2014 UTC (9 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad4R2P2, rad4R2, rad4R2P1
Changes since 2.10: +3 -1 lines
Log Message:
Fixed bug in parameter parser and added check during main arguments processing

File Contents

# Content
1 /* RCSid $Id: rcontrib.h,v 2.10 2014/07/19 18:19:33 greg Exp $ */
2
3 /*
4 * Header file for rcontrib modules
5 */
6
7 #include "platform.h"
8 #include "paths.h"
9 #include "rtprocess.h"
10 #include "ray.h"
11 #include "func.h"
12 #include "lookup.h"
13
14 extern int gargc; /* global argc */
15 extern char **gargv; /* global argv */
16 extern char *octname; /* global octree name */
17
18 extern int nproc; /* number of processes requested */
19 extern int nchild; /* number of children (-1 in child) */
20
21 extern int inpfmt; /* input format */
22 extern int outfmt; /* output format */
23
24 extern int header; /* output header? */
25 extern int force_open; /* truncate existing output? */
26 extern int recover; /* recover previous output? */
27 extern int accumulate; /* input rays per output record */
28 extern int contrib; /* computing contributions? */
29
30 extern int xres; /* horizontal (scan) size */
31 extern int yres; /* vertical resolution */
32
33 extern int using_stdout; /* are we using stdout? */
34
35 extern int imm_irrad; /* compute immediate irradiance? */
36 extern int lim_dist; /* limit distance? */
37
38 extern int account; /* current accumulation count */
39 extern RNUMBER raysleft; /* number of rays left to trace */
40 extern long waitflush; /* how long until next flush */
41
42 extern RNUMBER lastray; /* last ray number sent */
43 extern RNUMBER lastdone; /* last ray processed */
44
45 typedef double DCOLOR[3]; /* double-precision color */
46
47 /*
48 * The MODCONT structure is used to accumulate ray contributions
49 * for a particular modifier, which may be subdivided into bins
50 * if binv evaluates > 0. If outspec contains a %s in it, this will
51 * be replaced with the modifier name. If outspec contains a %d in it,
52 * this will be used to create one output file per bin, otherwise all bins
53 * will be written to the same file, in order. If the global outfmt
54 * is 'c', then a 4-byte RGBE pixel will be output for each bin value
55 * and the file will conform to a RADIANCE image if xres & yres are set.
56 */
57 typedef struct {
58 const char *outspec; /* output file specification */
59 const char *modname; /* modifier name */
60 const char *params; /* parameter list */
61 EPNODE *binv; /* bin value expression */
62 int nbins; /* number of contribution bins */
63 DCOLOR cbin[1]; /* contribution bins (extends struct) */
64 } MODCONT; /* modifier contribution */
65
66 extern LUTAB modconttab; /* modifier contribution table */
67
68 /*
69 * The STREAMOUT structure holds an open FILE pointer and a count of
70 * the number of RGB triplets per record, or 0 if unknown.
71 */
72 typedef struct {
73 FILE *ofp; /* output file pointer */
74 int outpipe; /* output is to a pipe */
75 int reclen; /* triplets/record */
76 int xr, yr; /* output resolution for picture */
77 } STREAMOUT;
78
79 extern LUTAB ofiletab; /* output stream table */
80
81 #ifndef MAXPROCESS
82 #ifdef _WIN32
83 #define MAXPROCESS 1
84 #else
85 #define MAXPROCESS 128
86 #endif
87 #endif
88
89 #ifndef MAXMODLIST
90 #define MAXMODLIST 2048 /* maximum modifiers we'll track */
91 #endif
92
93 extern const char *modname[MAXMODLIST]; /* ordered modifier name list */
94 extern int nmods; /* number of modifiers */
95
96 extern char RCCONTEXT[]; /* special evaluation context */
97
98 extern char *formstr(int f); /* return format identifier */
99
100 extern void process_rcontrib(void); /* trace ray contributions */
101
102 extern STREAMOUT * getostream(const char *ospec, const char *mname,
103 int bn, int noopen);
104
105 extern void mod_output(MODCONT *mp);
106 extern void end_record(void);
107
108 extern void set_eparams(char *prms);
109
110 extern MODCONT *addmodifier(char *modn, char *outf,
111 char *prms, char *binv, int bincnt);
112 extern void addmodfile(char *fname, char *outf,
113 char *prms, char *binv, int bincnt);
114
115 extern void reload_output(void);
116 extern void recover_output(void);
117
118 extern int getvec(FVECT vec);
119
120 extern int in_rchild(void);
121 extern void end_children(int immed);
122
123 extern void put_zero_record(int ndx);
124
125 extern void parental_loop(void); /* controlling process */
126
127 extern void feeder_loop(void); /* feeder process */
128
129 extern void rcontrib(void); /* main calculation loop */