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