ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdriver.h
Revision: 3.15
Committed: Mon Aug 10 18:39:46 1998 UTC (25 years, 8 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.14: +4 -3 lines
Log Message:
changed dev_value() interface so NULL is passed for infinite points

File Contents

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