ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rcontrib.h
Revision: 2.6
Committed: Tue Jun 19 00:12:08 2012 UTC (11 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.5: +2 -2 lines
Log Message:
Added quick-exit mode and fixed bug in recovery option with -c > 1

File Contents

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