home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gondwana.ecr.mu.oz.au/pub/
/
Graphics.tar
/
Graphics
/
fermiVogle.tar.Z
/
fermiVogle.tar
/
devel
/
src
/
vogle.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-07
|
6KB
|
274 lines
#ifndef VOGLEH
#define VOGLEH 1
/*
* default location for font library
*/
#ifdef PC /* Stupid pox head crap */
#define FONTLIB "c:\\lib\\hershey\\"
#ifndef __OS2__ /* BCOS2 defines malloc as a void pointer */
char *malloc();
#endif
#endif
#ifndef FONTLIB
#define FONTLIB "/usr/local/lib/hershey/"
#endif
/*
* standard colour indices
*/
#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7
/*
* Hershey text justification
*/
#define V_XCENTERED 1
#define V_YCENTERED 2
#define V_LEFT 4 /* The default */
#define V_RIGHT 8
#define V_TOP 16
#define V_BOTTOM 32 /* The default */
/*
* Line thickness
*/
#define THIN 0
#define THICK 1
/*
* when (if ever) we need the precision
*/
#ifdef DOUBLE
#define float double
#endif
/*
* How to convert degrees to radians
*/
#ifndef PI
#define PI 3.14159265358979
#endif
#define D2R (PI / 180.0)
/*
* miscellaneous typedefs and type defines
*/
typedef float Vector[4];
typedef float Matrix[4][4];
typedef float Tensor[4][4][4];
/*
* when register variables get us into trouble
*/
#ifdef NOREGISTER
#define register
#endif
/*
* max number of vertices in a ploygon
*/
#define MAXVERTS 128
/*
* max number of characters in a font name
*/
#define FONTNAMELEN 256
/*
* object definitions
*/
#define MAXENTS 101 /* size of object table */
#define MAXTOKS 100 /* num. of tokens alloced at once in
an object */
/*
* functions which can appear in objects
*/
#define ARC 1
#define BOXTEXT 2
#define CALLOBJ 3
#define CENTERTEXT 4
#define CIRCLE 5
#define CLEAR 6
#define COLOR 7
#define DRAW 8
#define DRAWCHAR 9
#define DRAWSTR 10
#define FIXEDWIDTH 11
#define VFONT 12
#define HATCHANG 13
#define HATCHPITCH 14
#define LOADMATRIX 15
#define MAPCOLOR 16
#define MOVE 17
#define MULTMATRIX 18
#define POLY 19
#define POLYFILL 20
#define POLYHATCH 21
#define POPATTRIBUTES 22
#define POPMATRIX 23
#define POPVIEWPORT 24
#define PUSHATTRIBUTES 25
#define PUSHMATRIX 26
#define PUSHVIEWPORT 27
#define RCURVE 28
#define RPATCH 29
#define SECTOR 30
#define TEXTANG 31
#define TEXTSIZE 32
#define VIEWPORT 33
#define BACKBUFFER 34
#define FRONTBUFFER 35
#define SWAPBUFFER 36
#define BACKFACING 37
#define TRANSLATE 38
#define ROTATE 39
#define SCALE 40
#define VFLUSH 41
/*
* data types for object tokens
*/
typedef union tk {
int i;
float f;
} Token;
typedef struct tls {
int count;
Token *toks;
struct tls *next;
} TokList;
/*
* attributes
*/
typedef struct {
unsigned char *style,
*dashp,
fill,
hatch,
backface,
justify,
backbuf,
exvp,
fixedwidth;
int color;
int softtext;
float fontheight;
float fontwidth;
float hatchcos,
hatchsin,
hatchpitch;
float textcos,
textsin;
float dash,
adist;
char font[FONTNAMELEN];
} Attribute;
/*
* viewport
*/
typedef struct vp {
float left;
float right;
float bottom;
float top;
} Viewport;
/*
* stacks
*/
typedef struct ms { /* Matrix stack entries */
Matrix m;
struct ms *back;
} Mstack;
typedef struct as { /* Attribute stack entries */
Attribute a;
struct as *back;
} Astack;
typedef struct vs { /* Viewport stack entries */
Viewport v;
struct vs *back;
} Vstack;
/*
* vogle device structures
*/
typedef struct dev {
char *devname; /* name of device */
char *large, /* name of large font */
*small; /* name of small font */
int (*Vbackb)(), /* Set drawing in back buffer */
(*Vchar)(char), /* Draw a hardware character */
(*Vcheckkey)(), /* Ckeck if a key was hit */
(*Vclear)(void), /* Clear the screen to current color */
(*Vcolor)(int), /* Set current color */
(*Vdraw)(int, int), /* Draw a line */
(*Vexit)(void), /* Exit graphics */
(*Vfill)(int, int[], int[]), /* Fill a polygon */
(*Vfont)(char *), /* Set hardware font */
(*Vfrontb)(), /* Set drawing in front buffer */
(*Vgetkey)(), /* Wait for and get the next key hit */
(*Vinit)(void), /* Initialise the device */
(*Vlocator)(), /* Get mouse/cross hair position */
(*Vmapcolor)(int, int, int, int),/* Set color indicies */
(*Vsetlw)(int), /* Set line thickness */
(*Vstring)(char *), /* Draw a hardware string */
(*Vswapb)(), /* Swap front and back buffers */
(*Vsync)(); /* Syncronise the display */
} DevEntry;
typedef struct vdev {
char initialised,
clipoff,
inobject,
inpolygon,
upset, /* is up vector set */
cpVvalid, /* is the current device position valid */
sync, /* Do we syncronise the display */
inbackbuffer, /* are we in the backbuffer */
clipplanes; /* active clipping planes */
void (*pmove)(), /* Polygon moves */
(*pdraw)(); /* Polygon draws */
TokList *tokens; /* ptr to list of tokens for current object */
Mstack *transmat; /* top of transformation stack */
Astack *attr; /* top of attribute stack */
Vstack *viewport; /* top of viewport stack */
float hheight, hwidth; /* hardware character height, width */
Vector cpW, /* current postion in world coords */
cpWtrans, /* current world coords transformed */
upvector; /* world up */
int depth, /* # bit planes on screen */
maxVx, minVx,
maxVy, minVy,
sizeX, sizeY, /* size of square on screen */
sizeSx, sizeSy, /* side in x, side in y (# pixels) */
cpVx, cpVy;
DevEntry dev;
} Device;
extern Device vdevice; /* device structure */
#define V_X 0 /* x axis in cpW */
#define V_Y 1 /* y axis in cpW */
#define V_Z 2 /* z axis in cpW */
#define V_W 3 /* w axis in cpW */
/*
* ANSII prototypes
*/
#include "proto.h"
#endif