ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdriver.h
Revision: 3.26
Committed: Fri May 20 02:06:39 2011 UTC (12 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R1, rad4R2P1, rad5R3, HEAD
Changes since 3.25: +3 -3 lines
Log Message:
Changed every instance of BYTE to uby8 to avoid conflicts

File Contents

# User Rev Content
1 greg 3.26 /* RCSid: $Id: rhdriver.h,v 3.25 2006/06/07 17:52:04 schorsch Exp $ */
2 gregl 3.1 /*
3     * Header file for holodeck device driver routines.
4     */
5 schorsch 3.23 #ifndef _RAD_RHDRIVER_H_
6     #define _RAD_RHDRIVER_H_
7 gregl 3.1
8     #include "view.h"
9    
10 schorsch 3.23 #ifdef __cplusplus
11     extern "C" {
12     #endif
13    
14 gregl 3.1 extern struct driver {
15     char *name; /* holodeck name or title */
16 gwlarson 3.13 VIEW v; /* base view parameters */
17     int hres, vres; /* base view resolution */
18 gregl 3.1 int ifd; /* input file descriptor (for select) */
19 gwlarson 3.18 int firstuse; /* non-zero if driver can't recycle samples */
20 gwlarson 3.16 int inpready; /* number of unprocessed input events */
21 gregl 3.1 } odev; /* our open device */
22    
23 gwlarson 3.17 extern char odev_args[]; /* command arguments, if any */
24    
25 gregl 3.11 extern int imm_mode; /* bundles are being delivered immediately */
26    
27 gwlarson 3.14 extern double eyesepdist; /* world eye separation distance */
28    
29 gregl 3.8 /* user commands */
30 gwlarson 3.13 #define DC_SETVIEW 0 /* set the base view */
31     #define DC_GETVIEW 1 /* print the current base view */
32 gregl 3.8 #define DC_LASTVIEW 2 /* restore previous view */
33 gwlarson 3.17 #define DC_FOCUS 3 /* view focus */
34     #define DC_PAUSE 4 /* pause the current calculation */
35     #define DC_RESUME 5 /* resume the calculation */
36     #define DC_REDRAW 6 /* redraw from server */
37     #define DC_KILL 7 /* kill rtrace process(es) */
38     #define DC_RESTART 8 /* restart rtrace process(es) */
39     #define DC_CLOBBER 9 /* clobber holodeck file */
40     #define DC_QUIT 10 /* quit the program */
41 gregl 3.1
42 gwlarson 3.17 #define DC_NCMDS 11 /* number of commands */
43 gregl 3.1
44 gregl 3.8 /* dev_input() returns flags from above */
45     #define DFL(dc) (1<<(dc))
46    
47     #define CTRL(c) ((c)-'@')
48     /* commands entered in display window */
49 gwlarson 3.17 #define DV_INIT {'\0','v','l','f','p','\r',CTRL('L'),'K','R','C','q'}
50 gregl 3.8 /* commands entered on stdin */
51 gwlarson 3.17 #define DC_INIT {"VIEW=","where","last","frame","pause","resume",\
52     "redraw","kill","restart","clobber","quit"}
53 gregl 3.8
54    
55 gregl 3.1 /************************************************************************
56     * Driver routines (all are required):
57    
58    
59     void
60     dev_open(nm) : prepare the device
61     char *nm; : appropriate title bar annotation
62    
63     Sets fields of odev structure and prepares the display for i/o.
64 gwlarson 3.13 The base view type, horizontal and vertical view angles and other
65     default parameters in odev.v should also be assigned.
66 gregl 3.1
67    
68 gregl 3.7 int
69 gwlarson 3.13 dev_view(nv) : set base view parameters
70 gregl 3.1 VIEW *nv; : the new view
71    
72 gwlarson 3.13 Updates the display for the given base view change.
73 gregl 3.1 Look for nv==&odev.v when making view current after dev_input()
74 gregl 3.7 returns DEV_NEWVIEW flag. Return 1 on success, or 0 if the
75     new view would conflict with device requirements. In the latter
76     case, reset parameters in nv to make it more agreeable, calling
77     error(COMMAND, "appropriate user warning").
78 gregl 3.1
79    
80     void
81 gregl 3.12 dev_clear() : clear device memory
82    
83     Clear the device memory in preparation for fresh data. Clearing
84     the screen is optional.
85    
86    
87     void
88 gwlarson 3.15 dev_value(c, d, p) : register new point of light
89 gregl 3.1 COLR c; : pixel color (RGBE)
90 gwlarson 3.15 FVECT d; : ray direction vector
91 gregl 3.1 FVECT p; : world intersection point
92    
93 gregl 3.11 Add the given color point to the display output queue. If imm_mode is
94 gwlarson 3.15 non-zero, then values are being sent in rapid succession. If p is NULL,
95     then the point is at infinity.
96 gregl 3.1
97    
98     int
99     dev_flush() : flush the output and prepare for select call
100    
101     Updates display, taking any pending action required before select(2) call.
102 gwlarson 3.16 Returns non-zero if there is device input available, setting odev.inpready.
103 gregl 3.1
104    
105     int
106     dev_input() : process pending display input
107    
108     Called when odev struct file descriptor shows input is ready.
109     Returns flags indicating actions to take in the control process.
110 gregl 3.8 If the DC_VIEW or DC_RESIZE flag is returned, the odev
111 gwlarson 3.17 structure must be updated beforehand. If the DC_FOCUS
112     flag is set, then odev_args contains the frame dimensions.
113     No events shall remain when this function returns,
114     and odev.inpready will therefore be 0.
115 gwlarson 3.14
116     void
117     dev_auxcom(cmd, args) : process auxiliary command
118     char *cmd, *args; : command name and argument string
119    
120     Execute an auxiliary command (not one of those listed at the head of
121     this file). The cmd argument points to the command name itself, and
122     the args argument points to a string with the rest of the input line.
123     If the command isn't known or there ARE no auxiliary commands, print
124     an appropriate COMMAND error message and return.
125 gregl 3.1
126    
127 gwlarson 3.13 VIEW *
128     dev_auxview(n, hv) : return nth auxiliary view
129     int n; : auxiliary view number
130     int hv[2]; : returned horiz. and vert. image resolution
131    
132     Return the nth auxiliary view associated with the current base view.
133     The hv entries are assigned the horizontal and vertical view resolution,
134     respectively. Function returns NULL if there are no more auxiliary
135     views. The zeroeth auxiliary view is the base view itself.
136    
137    
138 gregl 3.1 void
139 gwlarson 3.19 dev_section(gf, pf) : add geometry and ports for rendering
140     char *gf; : geometry file name
141     char *pf; : portal file name(s)
142 gwlarson 3.18
143 gwlarson 3.19 Add the given geometry file to the list of geometry to render for
144     intermediate views if direct geometry rendering is available. The
145     second argument gives the name(s) of any portal geometry files
146     associated with this section. Multiple portal file names are separated
147     by spaces. A single octree file will be given for the geometry, ending
148     in the ".oct" suffix. Portal files will be given as zero or more
149     Radiance scene description file names. If no portals are given for
150     this section, the string may be NULL. The character strings are
151     guaranteed to be static (or permanently allocated) such that they may
152     be safely stored as a pointer. The same pointers or file lists may be
153     (and often are) given repeatedly. If a given geometry file does not
154     exist, the call should be silently ignored. If gf is NULL, then the
155     last section has been given, and the display can be updated with the
156     new information.
157 gwlarson 3.18
158    
159     void
160 gregl 3.1 dev_close() : close the display
161    
162     Close the display device and free up resources in preparation for exit.
163     Set odev.v.type=0 and odev.hres=odev.vres=0 when done.
164    
165    
166     ************************************************************************/
167 gwlarson 3.13
168    
169 schorsch 3.24 /*
170 gwlarson 3.13 extern VIEW *dev_auxview();
171 schorsch 3.24 */
172     extern int16 *beam_view(VIEW *vn, int hr, int vr);
173 gwlarson 3.18
174 schorsch 3.23
175 schorsch 3.24 extern void dev_open(char *id);
176     extern void dev_close(void);
177     extern void dev_clear(void);
178     extern int dev_view(register VIEW *nv);
179 schorsch 3.25 extern void dev_section(char *gfn, char *pfn);
180 schorsch 3.24 extern void dev_auxcom(char *cmd, char *args);
181     extern VIEW *dev_auxview(int n, int hvres[2]);
182     extern int dev_input(void);
183     extern void dev_value(COLR c, FVECT d, FVECT p);
184     extern int dev_flush(void);
185 greg 3.26 extern void dev_paintr(uby8 rgb[3], int xmin, int ymin, int xmax, int ymax);
186     extern void dev_cone(uby8 rgb[3], FVECT ip, double rad);
187 schorsch 3.23
188     #ifdef __cplusplus
189     }
190     #endif
191     #endif /* _RAD_RHDRIVER_H_ */
192