ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdriver.h
Revision: 3.18
Committed: Fri Dec 18 11:56:10 1998 UTC (25 years, 4 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.17: +19 -0 lines
Log Message:
created new ogl driver with direct geometry rendering

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