1 |
gregl |
3.1 |
/* Copyright (c) 1997 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; /* preferred view parameters */ |
14 |
|
|
int hres, vres; /* device resolution */ |
15 |
|
|
int ifd; /* input file descriptor (for select) */ |
16 |
|
|
} odev; /* our open device */ |
17 |
|
|
|
18 |
gregl |
3.8 |
/* user commands */ |
19 |
|
|
#define DC_SETVIEW 0 /* set the view */ |
20 |
|
|
#define DC_GETVIEW 1 /* print the current view */ |
21 |
|
|
#define DC_LASTVIEW 2 /* restore previous view */ |
22 |
|
|
#define DC_PAUSE 3 /* pause the current calculation */ |
23 |
|
|
#define DC_RESUME 4 /* resume the calculation */ |
24 |
gregl |
3.9 |
#define DC_REDRAW 5 /* redraw from server */ |
25 |
|
|
#define DC_KILL 6 /* kill rtrace process(es) */ |
26 |
|
|
#define DC_RESTART 7 /* restart rtrace process(es) */ |
27 |
|
|
#define DC_CLOBBER 8 /* clobber holodeck file */ |
28 |
|
|
#define DC_QUIT 9 /* quit the program */ |
29 |
gregl |
3.1 |
|
30 |
gregl |
3.9 |
#define DC_NCMDS 10 /* number of commands */ |
31 |
gregl |
3.1 |
|
32 |
gregl |
3.8 |
/* dev_input() returns flags from above */ |
33 |
|
|
#define DFL(dc) (1<<(dc)) |
34 |
|
|
|
35 |
|
|
#define CTRL(c) ((c)-'@') |
36 |
|
|
/* commands entered in display window */ |
37 |
gregl |
3.10 |
#define DV_INIT {'\0','v','l','p','\r',CTRL('L'),'K','R','C','q'} |
38 |
gregl |
3.8 |
/* commands entered on stdin */ |
39 |
|
|
#define DC_INIT {"VIEW=","where","last","pause","resume","redraw",\ |
40 |
gregl |
3.9 |
"kill","restart","clobber","quit"} |
41 |
gregl |
3.8 |
|
42 |
|
|
|
43 |
gregl |
3.1 |
/************************************************************************ |
44 |
|
|
* Driver routines (all are required): |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
void |
48 |
|
|
dev_open(nm) : prepare the device |
49 |
|
|
char *nm; : appropriate title bar annotation |
50 |
|
|
|
51 |
|
|
Sets fields of odev structure and prepares the display for i/o. |
52 |
|
|
The view type, horizontal and vertical view angles and other default |
53 |
|
|
parameters in odev.v should also be assigned. |
54 |
|
|
|
55 |
|
|
|
56 |
gregl |
3.7 |
int |
57 |
gregl |
3.1 |
dev_view(nv) : set display view parameters |
58 |
|
|
VIEW *nv; : the new view |
59 |
|
|
|
60 |
|
|
Updates the display for the given view change. |
61 |
|
|
Look for nv==&odev.v when making view current after dev_input() |
62 |
gregl |
3.7 |
returns DEV_NEWVIEW flag. Return 1 on success, or 0 if the |
63 |
|
|
new view would conflict with device requirements. In the latter |
64 |
|
|
case, reset parameters in nv to make it more agreeable, calling |
65 |
|
|
error(COMMAND, "appropriate user warning"). |
66 |
gregl |
3.1 |
|
67 |
|
|
|
68 |
|
|
void |
69 |
gregl |
3.5 |
dev_value(c, p, v) : register new point of light |
70 |
gregl |
3.1 |
COLR c; : pixel color (RGBE) |
71 |
|
|
FVECT p; : world intersection point |
72 |
gregl |
3.5 |
FVECT v; : ray direction vector |
73 |
gregl |
3.1 |
|
74 |
|
|
Add the given color point to the display output queue. |
75 |
|
|
|
76 |
|
|
|
77 |
|
|
int |
78 |
|
|
dev_flush() : flush the output and prepare for select call |
79 |
|
|
|
80 |
|
|
Updates display, taking any pending action required before select(2) call. |
81 |
|
|
Returns non-zero if there is device input available. |
82 |
|
|
|
83 |
|
|
|
84 |
|
|
int |
85 |
|
|
dev_input() : process pending display input |
86 |
|
|
|
87 |
|
|
Called when odev struct file descriptor shows input is ready. |
88 |
|
|
Returns flags indicating actions to take in the control process. |
89 |
gregl |
3.8 |
If the DC_VIEW or DC_RESIZE flag is returned, the odev |
90 |
gregl |
3.1 |
structure must be updated beforehand. |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
void |
94 |
|
|
dev_close() : close the display |
95 |
|
|
|
96 |
|
|
Close the display device and free up resources in preparation for exit. |
97 |
|
|
Set odev.v.type=0 and odev.hres=odev.vres=0 when done. |
98 |
|
|
|
99 |
|
|
|
100 |
|
|
************************************************************************/ |