| 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.6 | 
#define DEV_PUTVIEW     0100    /* print out current view */ | 
| 26 | 
gregl | 
3.7 | 
#define DEV_LASTVIEW    0200    /* restore previous view */ | 
| 27 | 
gregl | 
3.1 | 
 | 
| 28 | 
  | 
  | 
 | 
| 29 | 
  | 
  | 
/************************************************************************ | 
| 30 | 
  | 
  | 
 * Driver routines (all are required): | 
| 31 | 
  | 
  | 
 | 
| 32 | 
  | 
  | 
 | 
| 33 | 
  | 
  | 
void | 
| 34 | 
  | 
  | 
dev_open(nm)            : prepare the device | 
| 35 | 
  | 
  | 
char    *nm;            : appropriate title bar annotation | 
| 36 | 
  | 
  | 
 | 
| 37 | 
  | 
  | 
Sets fields of odev structure and prepares the display for i/o. | 
| 38 | 
  | 
  | 
The view type, horizontal and vertical view angles and other default | 
| 39 | 
  | 
  | 
parameters in odev.v should also be assigned. | 
| 40 | 
  | 
  | 
 | 
| 41 | 
  | 
  | 
 | 
| 42 | 
gregl | 
3.7 | 
int | 
| 43 | 
gregl | 
3.1 | 
dev_view(nv)            : set display view parameters | 
| 44 | 
  | 
  | 
VIEW    *nv;            : the new view | 
| 45 | 
  | 
  | 
 | 
| 46 | 
  | 
  | 
Updates the display for the given view change. | 
| 47 | 
  | 
  | 
Look for nv==&odev.v when making view current after dev_input() | 
| 48 | 
gregl | 
3.7 | 
returns DEV_NEWVIEW flag.  Return 1 on success, or 0 if the | 
| 49 | 
  | 
  | 
new view would conflict with device requirements.  In the latter | 
| 50 | 
  | 
  | 
case, reset parameters in nv to make it more agreeable, calling | 
| 51 | 
  | 
  | 
error(COMMAND, "appropriate user warning"). | 
| 52 | 
gregl | 
3.1 | 
 | 
| 53 | 
  | 
  | 
 | 
| 54 | 
  | 
  | 
void | 
| 55 | 
gregl | 
3.5 | 
dev_value(c, p, v)      : register new point of light | 
| 56 | 
gregl | 
3.1 | 
COLR    c;              : pixel color (RGBE) | 
| 57 | 
  | 
  | 
FVECT   p;              : world intersection point | 
| 58 | 
gregl | 
3.5 | 
FVECT   v;              : ray direction vector | 
| 59 | 
gregl | 
3.1 | 
 | 
| 60 | 
  | 
  | 
Add the given color point to the display output queue. | 
| 61 | 
  | 
  | 
 | 
| 62 | 
  | 
  | 
 | 
| 63 | 
  | 
  | 
int | 
| 64 | 
  | 
  | 
dev_flush()             : flush the output and prepare for select call | 
| 65 | 
  | 
  | 
 | 
| 66 | 
  | 
  | 
Updates display, taking any pending action required before select(2) call. | 
| 67 | 
  | 
  | 
Returns non-zero if there is device input available. | 
| 68 | 
  | 
  | 
 | 
| 69 | 
  | 
  | 
 | 
| 70 | 
  | 
  | 
int | 
| 71 | 
  | 
  | 
dev_input()             : process pending display input | 
| 72 | 
  | 
  | 
 | 
| 73 | 
  | 
  | 
Called when odev struct file descriptor shows input is ready. | 
| 74 | 
  | 
  | 
Returns flags indicating actions to take in the control process. | 
| 75 | 
  | 
  | 
If the DEV_NEWVIEW or DEV_NEWSIZE flag is returned, the odev | 
| 76 | 
  | 
  | 
structure must be updated beforehand. | 
| 77 | 
  | 
  | 
 | 
| 78 | 
  | 
  | 
 | 
| 79 | 
  | 
  | 
void | 
| 80 | 
  | 
  | 
dev_close()             : close the display | 
| 81 | 
  | 
  | 
 | 
| 82 | 
  | 
  | 
Close the display device and free up resources in preparation for exit. | 
| 83 | 
  | 
  | 
Set odev.v.type=0 and odev.hres=odev.vres=0 when done. | 
| 84 | 
  | 
  | 
 | 
| 85 | 
  | 
  | 
 | 
| 86 | 
  | 
  | 
 ************************************************************************/ |