| 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 |
|
|
/* dev_input() return flags */ |
| 19 |
|
|
#define DEV_SHUTDOWN 01 /* user shutdown request */ |
| 20 |
gregl |
3.4 |
#define DEV_NEWVIEW 02 /* view change (new view in odev.v) */ |
| 21 |
|
|
#define DEV_NEWSIZE 04 /* device resolution change */ |
| 22 |
|
|
#define DEV_WAIT 010 /* pause computation and wait for input */ |
| 23 |
gregl |
3.3 |
#define DEV_RESUME 020 /* resume after pause */ |
| 24 |
gregl |
3.4 |
#define DEV_REDRAW 040 /* redraw from server */ |
| 25 |
gregl |
3.1 |
|
| 26 |
|
|
|
| 27 |
|
|
/************************************************************************ |
| 28 |
|
|
* Driver routines (all are required): |
| 29 |
|
|
|
| 30 |
|
|
|
| 31 |
|
|
void |
| 32 |
|
|
dev_open(nm) : prepare the device |
| 33 |
|
|
char *nm; : appropriate title bar annotation |
| 34 |
|
|
|
| 35 |
|
|
Sets fields of odev structure and prepares the display for i/o. |
| 36 |
|
|
The view type, horizontal and vertical view angles and other default |
| 37 |
|
|
parameters in odev.v should also be assigned. |
| 38 |
|
|
|
| 39 |
|
|
|
| 40 |
|
|
void |
| 41 |
|
|
dev_view(nv) : set display view parameters |
| 42 |
|
|
VIEW *nv; : the new view |
| 43 |
|
|
|
| 44 |
|
|
Updates the display for the given view change. |
| 45 |
|
|
Look for nv==&odev.v when making view current after dev_input() |
| 46 |
|
|
returns DEV_NEWVIEW flag. |
| 47 |
|
|
|
| 48 |
|
|
|
| 49 |
|
|
void |
| 50 |
|
|
dev_value(c, p) : register new point of light |
| 51 |
|
|
COLR c; : pixel color (RGBE) |
| 52 |
|
|
FVECT p; : world intersection point |
| 53 |
|
|
|
| 54 |
|
|
Add the given color point to the display output queue. |
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
|
|
int |
| 58 |
|
|
dev_flush() : flush the output and prepare for select call |
| 59 |
|
|
|
| 60 |
|
|
Updates display, taking any pending action required before select(2) call. |
| 61 |
|
|
Returns non-zero if there is device input available. |
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
int |
| 65 |
|
|
dev_input() : process pending display input |
| 66 |
|
|
|
| 67 |
|
|
Called when odev struct file descriptor shows input is ready. |
| 68 |
|
|
Returns flags indicating actions to take in the control process. |
| 69 |
|
|
If the DEV_NEWVIEW or DEV_NEWSIZE flag is returned, the odev |
| 70 |
|
|
structure must be updated beforehand. |
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
void |
| 74 |
|
|
dev_close() : close the display |
| 75 |
|
|
|
| 76 |
|
|
Close the display device and free up resources in preparation for exit. |
| 77 |
|
|
Set odev.v.type=0 and odev.hres=odev.vres=0 when done. |
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
************************************************************************/ |