ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rcontrib.h
Revision: 2.7
Committed: Thu Jun 21 17:14:32 2012 UTC (11 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.6: +3 -1 lines
Log Message:
Accommodations for Windows

File Contents

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