| 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 |
< |
#define DEV_WAIT 010 /* pause computation and wait for input */ |
| 23 |
< |
#define DEV_RESUME 020 /* resume after pause */ |
| 24 |
< |
#define DEV_REDRAW 040 /* redraw from server */ |
| 18 |
> |
/* 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 |
> |
#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 |
|
|
| 30 |
+ |
#define DC_NCMDS 10 /* number of commands */ |
| 31 |
|
|
| 32 |
+ |
/* 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 |
+ |
#define DV_INIT {'\0','v','l','p','\r',CTRL('L'),'K','R','C','q'} |
| 38 |
+ |
/* commands entered on stdin */ |
| 39 |
+ |
#define DC_INIT {"VIEW=","where","last","pause","resume","redraw",\ |
| 40 |
+ |
"kill","restart","clobber","quit"} |
| 41 |
+ |
|
| 42 |
+ |
|
| 43 |
|
/************************************************************************ |
| 44 |
|
* Driver routines (all are required): |
| 45 |
|
|
| 53 |
|
parameters in odev.v should also be assigned. |
| 54 |
|
|
| 55 |
|
|
| 56 |
< |
void |
| 56 |
> |
int |
| 57 |
|
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 |
< |
returns DEV_NEWVIEW flag. |
| 62 |
> |
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 |
|
|
| 67 |
|
|
| 68 |
|
void |
| 69 |
< |
dev_value(c, p) : register new point of light |
| 69 |
> |
dev_value(c, p, v) : register new point of light |
| 70 |
|
COLR c; : pixel color (RGBE) |
| 71 |
|
FVECT p; : world intersection point |
| 72 |
+ |
FVECT v; : ray direction vector |
| 73 |
|
|
| 74 |
|
Add the given color point to the display output queue. |
| 75 |
|
|
| 86 |
|
|
| 87 |
|
Called when odev struct file descriptor shows input is ready. |
| 88 |
|
Returns flags indicating actions to take in the control process. |
| 89 |
< |
If the DEV_NEWVIEW or DEV_NEWSIZE flag is returned, the odev |
| 89 |
> |
If the DC_VIEW or DC_RESIZE flag is returned, the odev |
| 90 |
|
structure must be updated beforehand. |
| 91 |
|
|
| 92 |
|
|