/* new vertex copies, internal to renderer */
typedef struct nV NVERTEX;
struct nV{
LONG x, y, z; // viewport coordinates (to save time)
LONG xs, ys; // screen coordinates
LONG tx, ty; // coordinates in source map (texmaps only of course)
UCHAR outcode; // XY clip outcodes
UCHAR perspect; // flags perspective done
USHORT pad; // multiple of 4 bytes
};
#define LEFT 1 /* XY outcode bits */
#define RIGHT 2
#define TOP 4
#define BOTTOM 8
/* world database vertices */
/* object coords are referenced to object */
/* world coords are updated when moving or rotating object */
/* all others are renderer workspace */
typedef struct {
LONG ox, oy, oz; // object coordinates
LONG x, y, z; // world coordinates
LONG tx, ty; // coordinates in source bitmap - my texmap mod ep 7/15/93
LONG cz; // converted Z coord
NVERTEX *new_copy; // non-NULL if x and y transformed */
UCHAR z_outcode; // 1 set if hither, 2 set if yon, 3 if transformed
UCHAR pad[3]; // make the struct a multiple of 4 bytes
} VERTEX;
#define HITHER 0x01 // Z outcode bits
#define YON 0x02
#define TRANSFORMED 0x04
// world database polys
// object-based normal must be rotated to world copy with object
#ifndef POLYDEF
#define POLYDEF 1
typedef struct {
USHORT color; // color
USHORT npoints; // number of vertices in this poly
ULONG pointsOffset; // Offset from start of this poly
// for the array of indices to vertices
LONG onormalx,
onormaly,
onormalz; // OBJECT surface normal unit vector
LONG normalx,
normaly,
normalz; // WORLD surface normal unit vector
struct _object *object;
} POLY;
#endif
// renderer poly copy
// parent points back to original poly for lighting
// color computed by cosine lighting (currently 0-15)
// maxz is deepest poly point for sorting
typedef struct {
SHORT npoints; /* number of entries in points[] MUST BE FIRST */
USHORT color; /* color after illumination */
POLY *parent;
LONG maxz; /* maximum Z value (for sorting) */
} NPOLY;
typedef struct {
NPOLY *ptr;
LONG depth;
} DSORT; // used for depth sorting
#ifndef REPDEF
#define REPDEF 1
// structure that defines one representation of an object
typedef struct _rep {
LONG size; // use this rep when the object is bigger than this
SHORT nverts; // number of vertices
SHORT npolys; // number of polygons
ULONG polyOffset; // Offset of polygon table from start of rep
#define REPVERT(r,i) (((VERTEX *) ((REP *) (r) + 1))[(i)])
#define REPPOLY(r,i) (((POLY *) ((unsigned char *) (r) + ((REP *) (r))->polyOffset))[(i)])
#define POLYVERT(p,v,i) (((VERTEX *) (v))[((unsigned char *) (p))[(p)->pointsOffset + (i)]])
struct _rep *next; // pointer to next rep in list
LONG update_count; // inc. every time rep moves
USHORT flags;
USHORT pad; // make it a multiple of 4 bytes LONG
} REP;
#endif