ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdriver.h
Revision: 3.16
Committed: Wed Aug 19 17:43:08 1998 UTC (25 years, 8 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.15: +4 -2 lines
Log Message:
added odev.inpready member and periodic input checking to rhdisp

File Contents

# Content
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
3 /* SCCSid "$SunId$ SGI" */
4
5 /*
6 * Header file for holodeck device driver routines.
7 */
8
9 #include "view.h"
10
11 extern struct driver {
12 char *name; /* holodeck name or title */
13 VIEW v; /* base view parameters */
14 int hres, vres; /* base view resolution */
15 int ifd; /* input file descriptor (for select) */
16 int inpready; /* number of unprocessed input events */
17 } odev; /* our open device */
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_PAUSE 3 /* pause the current calculation */
28 #define DC_RESUME 4 /* resume the calculation */
29 #define DC_REDRAW 5 /* redraw from server */
30 #define DC_KILL 6 /* kill rtrace process(es) */
31 #define DC_RESTART 7 /* restart rtrace process(es) */
32 #define DC_CLOBBER 8 /* clobber holodeck file */
33 #define DC_QUIT 9 /* quit the program */
34
35 #define DC_NCMDS 10 /* number of commands */
36
37 /* dev_input() returns flags from above */
38 #define DFL(dc) (1<<(dc))
39
40 #define CTRL(c) ((c)-'@')
41 /* commands entered in display window */
42 #define DV_INIT {'\0','v','l','p','\r',CTRL('L'),'K','R','C','q'}
43 /* commands entered on stdin */
44 #define DC_INIT {"VIEW=","where","last","pause","resume","redraw",\
45 "kill","restart","clobber","quit"}
46
47
48 /************************************************************************
49 * Driver routines (all are required):
50
51
52 void
53 dev_open(nm) : prepare the device
54 char *nm; : appropriate title bar annotation
55
56 Sets fields of odev structure and prepares the display for i/o.
57 The base view type, horizontal and vertical view angles and other
58 default parameters in odev.v should also be assigned.
59
60
61 int
62 dev_view(nv) : set base view parameters
63 VIEW *nv; : the new view
64
65 Updates the display for the given base view change.
66 Look for nv==&odev.v when making view current after dev_input()
67 returns DEV_NEWVIEW flag. Return 1 on success, or 0 if the
68 new view would conflict with device requirements. In the latter
69 case, reset parameters in nv to make it more agreeable, calling
70 error(COMMAND, "appropriate user warning").
71
72
73 void
74 dev_clear() : clear device memory
75
76 Clear the device memory in preparation for fresh data. Clearing
77 the screen is optional.
78
79
80 void
81 dev_value(c, d, p) : register new point of light
82 COLR c; : pixel color (RGBE)
83 FVECT d; : ray direction vector
84 FVECT p; : world intersection point
85
86 Add the given color point to the display output queue. If imm_mode is
87 non-zero, then values are being sent in rapid succession. If p is NULL,
88 then the point is at infinity.
89
90
91 int
92 dev_flush() : flush the output and prepare for select call
93
94 Updates display, taking any pending action required before select(2) call.
95 Returns non-zero if there is device input available, setting odev.inpready.
96
97
98 int
99 dev_input() : process pending display input
100
101 Called when odev struct file descriptor shows input is ready.
102 Returns flags indicating actions to take in the control process.
103 If the DC_VIEW or DC_RESIZE flag is returned, the odev
104 structure must be updated beforehand. No events will be
105 ready when this function returns, and odev.inpready will be 0.
106
107 void
108 dev_auxcom(cmd, args) : process auxiliary command
109 char *cmd, *args; : command name and argument string
110
111 Execute an auxiliary command (not one of those listed at the head of
112 this file). The cmd argument points to the command name itself, and
113 the args argument points to a string with the rest of the input line.
114 If the command isn't known or there ARE no auxiliary commands, print
115 an appropriate COMMAND error message and return.
116
117
118 VIEW *
119 dev_auxview(n, hv) : return nth auxiliary view
120 int n; : auxiliary view number
121 int hv[2]; : returned horiz. and vert. image resolution
122
123 Return the nth auxiliary view associated with the current base view.
124 The hv entries are assigned the horizontal and vertical view resolution,
125 respectively. Function returns NULL if there are no more auxiliary
126 views. The zeroeth auxiliary view is the base view itself.
127
128
129 void
130 dev_close() : close the display
131
132 Close the display device and free up resources in preparation for exit.
133 Set odev.v.type=0 and odev.hres=odev.vres=0 when done.
134
135
136 ************************************************************************/
137
138
139 extern VIEW *dev_auxview();