⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3dr.h

📁 Windows上的MUD客户端程序
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Copyright (C) 1994 Intel Corporation. All rights reserved */


#ifndef	_3DR_H_
#define	_3DR_H_

#ifdef	__cplusplus
extern	"C"{
#endif	/* __cplusplus */

#define	R3D_FUTURES

/*
// During a compile, at most one of these three must be defined to be 1,
// the rest should be 0.
//	WIN16	- for a 16 bit compiler, where a far pointer has 16,16 address.
//	WATCOM	- for Watcom, where a far pointer is 16,32 address.
//	WIN32	- for a Win32s compiler, where a far pointer is a 0,32 address.
//
// Note: Because all three are defined anyway, use #if instead of #ifdef.
*/

#ifndef	WATCOM	
#define	WATCOM	0
#endif

#ifndef	WIN32
#define	WIN32	0
#endif

#ifndef	WIN16	
#define	WIN16	0
#endif

#ifndef	WAT32	
#define	WAT32	0
#endif

#ifndef	UNUSED_PARAMETER
#define	UNUSED_PARAMETER(x)		x = x
#endif

/*
// Dictionary of Acronyms, Keywords etc.,
//
//	R3d	- 3DR, misspelt, for compilation reasons.
//
//	RC	- Rendering Context, as in RCInfo
//	Pt	- Point, as in PtLong_T
//	Clr	- Color, as in ClrLong_T
//	Ptr	- Pointer, as in LongPtrToByte_T
//	Prm	- Primitive, as in R3dPrmType_T
//	Vtx	- Vertex, as in R3dVtxType_T
//	SRC	- Source, as in R3D_STATE_SRC_BLEND
//	DST	- Destination, as in R3D_STATE_DST_BLEND
//	ROP	- Raster (logical) Operation, as in R3D_STATE_ROP_FUNCTION
//	Msg	- Message, as in R3dMsgType
//	MSG	- Message, as in R3D_MSG_NOP
//	Pkt	- Packet, as in R3dPktType
//	PKT	- Packet, as in R3D_PKT_END
//	Hdr	- Header, as in MsgHdrType
//	Gen	- Generic, as in MsgGenHdr
//	Bmp	- Bitmap, as in MsgBmpHdr
//	Sta	- State, as in PktStaType
//	STA	- STATE, as in R3D_STA_ENABLES
//	DB	- DoubleBuffer, as in  R3D_DB_FRONT
//	ZF	- Z buffer Function, as in R3D_ZF_NEVER 
//	LT	- Less Then, as in R3D_ZF_LT
//	EQ	- EQual to, as in R3D_ZF_EQ
//	LE	- Less then or Equal to, as in R3D_ZF_LE
//	GT	- Greater Then, as in R3D_ZF_GT
//	NE	- Not Equal to, as in R3D_ZF_NE
//	GE	- Greater then or Equal to, as in R3D_ZF_GE
//	BL	- Blending Function, as in R3D_BL_SRC_INV 
//	INV	- INVerse, as in R3D_BL_SRC_INV
//	RP	- Raster oPeration function, as in R3D_RP_AND 
//	TF	- Texture Filter function, as in R3D_TF_MIPMAP 
//	TM	- Texture Modulation function, as in R3D_TF_MIPMAP 
//	TT	- Texture Type information , as in R3D_TT_KEEP 
//	BT	- Bitmap Type information , as in R3D_BT_ALPHA 
//	ST	- State Type information , as in R3D_ST_LEFT 
//	CT	- Clearbuffer Type information , as in R3D_CT_DRAWBUFFER 
*/

/*
// Typedefs used commonly by 3dr.
*/
typedef		 	 void		Void_t;
typedef		 	 void	 *	PVoid_t;

typedef	unsigned char		Byte_t;
typedef unsigned short		Word_t;
typedef unsigned long		Dword_t;

typedef	         char		Char_t;
typedef          short		Short_t;
typedef		 	 long		Long_t;

typedef			 float		Float_t;
typedef		 	 WORD		Fixed16_t;
typedef 	 	 LONG		Fixed32_t;

typedef			 Dword_t	(*DWProc_t)();

typedef			 Dword_t	R3dHandle_t;

#if	WATCOM
typedef			 LPVOID			LPVoid_t;

typedef			 LPBYTE			LPByte_t;
typedef	unsigned short     *	LPWord_t;
typedef	unsigned long      *	LPDword_t;

typedef		 	 char      *	LPChar_t;
typedef		 	 short     *	LPShort_t;
typedef		 	 long      *	LPLong_t;

typedef		 	 float     *	LPFloat_t;

typedef		 	 void  FAR *	FPVoid_t;

typedef	unsigned char  FAR *	FPByte_t;
typedef	unsigned short FAR *	FPWord_t;
typedef	unsigned long  FAR *	FPDword_t;

typedef		 	 char  FAR *	FPChar_t;
typedef		 	 short FAR *	FPShort_t;
typedef		 	 long  FAR *	FPLong_t;

typedef		 	 float FAR *	FPFloat_t;
#endif	/* WATCOM */

#if	WIN16
typedef		 	 void  FAR *	LPVoid_t;

typedef	unsigned char  FAR *	LPByte_t;
typedef	unsigned short FAR *	LPWord_t;
typedef	unsigned long  FAR *	LPDword_t;

typedef		 	 char  FAR *	LPChar_t;
typedef		 	 short FAR *	LPShort_t;
typedef		 	 long  FAR *	LPLong_t;

typedef		 	 float FAR *	LPFloat_t;

typedef		 	 void  FAR *	FPVoid_t;

typedef	unsigned char  FAR *	FPByte_t;
typedef	unsigned short FAR *	FPWord_t;
typedef	unsigned long  FAR *	FPDword_t;

typedef		 	 char  FAR *	FPChar_t;
typedef		 	 short FAR *	FPShort_t;
typedef		 	 long  FAR *	FPLong_t;

typedef		 	 float FAR *	FPFloat_t;
#endif	/* WIN16 */

#if	WIN32
typedef		 	 void      *	LPVoid_t;

typedef	unsigned char      *	LPByte_t;
typedef	unsigned short     *	LPWord_t;
typedef	unsigned long      *	LPDword_t;

typedef		 	 char      *	LPChar_t;
typedef		 	 short     *	LPShort_t;
typedef		 	 long      *	LPLong_t;

typedef		 	 float     *	LPFloat_t;

typedef		 	 void      *	FPVoid_t;

typedef	unsigned char      *	FPByte_t;
typedef	unsigned short     *	FPWord_t;
typedef	unsigned long      *	FPDword_t;

typedef		 	 char      *	FPChar_t;
typedef		 	 short     *	FPShort_t;
typedef		 	 long      *	FPLong_t;

typedef		 	 float     *	FPFloat_t;
#endif	/* WIN32 */

/*D*
// 3DR data types - Points
*D*/
typedef	struct 
{ 
	Fixed32_t x, y, z;				
} R3dFixedVtx_t;

typedef	struct 
{ 
	Fixed32_t x, y, z; 
	Fixed16_t r, g, b, a; 	
} R3dFixedVtxClr_t;

typedef	struct 
{ 
	Fixed32_t x, y, z;
	Fixed32_t q, u, v; 			
} R3dFixedVtxTex_t;

typedef	struct 
{ 
	Fixed32_t x, y, z; 
	Fixed32_t q, u, v; 
	Fixed16_t r, g, b, a;
} R3dFixedVtxTexClr_t;

typedef	struct 
{ 
	Float_t x, y, z; 			
} R3dFloatVtx_t;

typedef	struct 
{ 
	Float_t x, y, z; 
	Float_t r, g, b, a; 		
} R3dFloatVtxClr_t;

typedef	struct 
{ 
	Float_t x, y, z; 
	Float_t q, u, v;		
} R3dFloatVtxTex_t;

typedef	struct 
{ 
	Float_t x, y, z; 
	Float_t q, u, v; 
	Float_t r, g, b, a;	
} R3dFloatVtxTexClr_t;

/*D*
// 3DR data types - Message Header
*D*/

typedef	struct {
	Word_t		MsgHdrType;
	Word_t		MsgHdrVersion;
	Dword_t		MsgHdrSize;
	R3dHandle_t	MsgHdrRC;
} R3dMsgHdr_t;

/*D*
// 3DR data types - Generic Message definition
*D*/

typedef	struct {
	R3dMsgHdr_t	MsgGenHdr;
	Word_t		MsgGenInfo0;
	Word_t		MsgGenInfo1;
	Dword_t		MsgGenData;			/* Buffer-wide Modifier */
	Dword_t		MsgGenBuffer[1]; 	/* variable size data	*/
} R3dMsgGen_t; 

/*D*
// 3DR data types - Texture Message definition
*D*/

typedef	struct {
	R3dMsgHdr_t	MsgTexHdr;		
	Word_t		MsgTexInfo;
	Word_t		MsgTexBitsPixel;
	Word_t		MsgTexMipLevel;	
	Word_t		MsgTexWidth;
	Word_t		MsgTexRows;		
	Short_t		MsgTexWidthBytes;
	Dword_t		MsgTexId;
	Dword_t		MsgTexData;			/* Buffer-wide Modifier */
	Dword_t		MsgTexBuffer[1]; 	/* variable size data	*/
} R3dMsgTex_t;
	
/*D*
// 3DR data types - Bitmap Message definition
*D*/

typedef	struct {
	R3dMsgHdr_t	MsgBmpHdr;	
	Word_t		MsgBmpPad;
	Word_t		MsgBmpInfo;
	Word_t		MsgBmpBitsPixel; 
	Word_t		MsgBmpWidth;
	Word_t		MsgBmpHeight; 
	Short_t		MsgBmpWidthBytes; 
	Short_t		MsgBmpSrcX;
	Short_t		MsgBmpSrcY;
	Short_t		MsgBmpDstX;
	Short_t		MsgBmpDstY;
	Dword_t		MsgBmpData;			/* Buffer-wide Modifier */
	Dword_t		MsgBmpBuffer[1]; 	/* variable size data	*/
} R3dMsgBmp_t; 

/*D*
// 3DR data types - Packet definition
*D*/

typedef	struct {
	R3dMsgHdr_t	MsgPktHdr;
	Dword_t		MsgPktBuffer[1];	/* variable size data	*/
} R3dMsgPkt_t; 

/*D*
// 3DR data types - Packet (of primitives) definition
*D*/

typedef struct	{
	Word_t		PktPrmPktType;
	Word_t		PktPrmVtxInfo;
	Word_t		PktPrmVtxNum;
	Word_t		PktPrmVtxSize;
	Dword_t		PktPrmBuffer[1];	/* variable size data	*/
} R3dPktPrm_t; 

/*D*
// 3DR data types - Packet (of State Information) definition
*D*/

typedef	struct {
	Word_t		PktStaPktType;
	Word_t		PktStaState;
	Dword_t		PktStaData;
} R3dPktSta_t; 

/*D*
// 3DR data types - Packet (of Vertices) definition
*D*/

typedef	struct {
	Word_t		PktGenPktType;
	Word_t		PktGenInfo;
} R3dPktGen_t; 

/*
// 3DR data types - far pointer types for above structures.
// FAR versions of the above for 16 bit compilers, 
// FAR is reduced to NULL for 32 bit compilers.
*/

#if	WATCOM
typedef	R3dFixedVtx_t			    *LPR3dFixedVtx_t;
typedef	R3dFixedVtxClr_t		    *LPR3dFixedVtxClr_t;
typedef	R3dFixedVtxTex_t		    *LPR3dFixedVtxTex_t;
typedef	R3dFixedVtxTexClr_t		    *LPR3dFixedVtxTexClr_t;

typedef	R3dFloatVtx_t			    *LPR3dFloatVtx_t;
typedef	R3dFloatVtxClr_t		    *LPR3dFloatVtxClr_t;
typedef	R3dFloatVtxTex_t		    *LPR3dFloatVtxTex_t;
typedef	R3dFloatVtxTexClr_t		    *LPR3dFloatVtxTexClr_t;

typedef	R3dFixedVtx_t			FAR *FPR3dFixedVtx_t;
typedef	R3dFixedVtxClr_t		FAR *FPR3dFixedVtxClr_t;
typedef	R3dFixedVtxTex_t		FAR *FPR3dFixedVtxTex_t;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -