ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdriver.h
Revision: 3.22
Committed: Fri Jun 20 00:25:49 2003 UTC (20 years, 9 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 3.21: +2 -2 lines
Log Message:
Changed instances of "int4" to "int32" and "int2" to "int16"

File Contents

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