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

📄 3dg.h

📁 Windows上的MUD客户端程序
💻 H
📖 第 1 页 / 共 2 页
字号:
 /* Copyright (c) 1994, 1995 Intel Corporation. All Rights Reserved */


#ifndef  _3DG_H_
#define _3DG_H_

typedef LPVoid_t G3dHandle_t;

#define G3d_ONE				65536.0f
#define G3d_ZONE        	268435455.0f    
#define G3d_COLONE 			65535.0f
#define G3d_MAX_C			255
#define G3d_SMALL_NUMBER   	1.e-12f

#define G3D_OFF 		0
#define G3D_ON 			1

#ifdef	__cplusplus
extern "C" {
#endif

/*
// Dictionary of Acronyms, Keywords, etc.
//
// G3d 	- 3DG reordered for compilation reasons.
//
// 23F		- indicates a 2 by 3 floating point matrix
// A		- indicates alpha blending variable present as in
//			  ColorFA
// BMP		- bitmap image file format
// Coords	- coordinate system
// Eqns		- equations
// F		- indicates floating point 32 bit version
// FA		- indicates floating point 32 bit with alpha (for colors)
// FW		- indicates floating point 32 bit homogeneous coordinates
// GC		- Geometry Context
// Isect	- intersection such as the intersection of a line and
//			  a plane.
// L		- indicates Fixed point 32bit version
// LW		- indicates Fixed point 32bit homogeneous coordinates 
// luBackSub- lower, upper back substitution
// luDecomp	- lower triangular, upper triangular decomposition
//			  of a matrix.
// Matt		- material properties of a surface
// Mult		- multiply
// Norm,nrm	- normal vector perpendicular to a surface.
// Pow		- power or exponentiation
// prim		- drawing primitive such as a line or polygon
// prop		- property or attribute such as of a light source
// pt		- Point in some coordinate system
// Q		- quadratic.  2nd degree (3rd order) polynomial
// qd		- quasi definitive, or quadrature, or quick and dirty.
//			  Indicates that a function is a quick approximation.
// Sqrt		- square root
// S		- indicates short (16bit) components such as for colors
// SA		- indicates short (16bit) components with alpha
// trans	- transform, a 4x4 matrix for transforming points
// vec		- vector, usually x,y,z
// vtx		- vertex such as a polygon vertex
// Win		- window
// W		- indicates the homogeneous coordinate, w value is present
//			  as in PointFW_t
*/


/* ----------------------CONTEXT--------------------------- */
	typedef enum {
		G3D_NO_DRAW_ORDER
	}   G3dContextProps_t;

	typedef enum {
		G3DL_FACETED_NORMALS,
		G3DL_FLAT_SHADING,
		G3DL_TEXTURE_MOD,
		G3DL_FRONT_CCW,
		G3DL_NO_CLIPPING
	}   G3dState_t;

	Void_t WINAPI G3dSetState(G3dHandle_t hGC, G3dState_t st, Fixed32_t *data);
	Void_t WINAPI G3dGetState(G3dHandle_t hGC, G3dState_t st, Fixed32_t *data);

	typedef enum {
		G3DC_OBJECT_COORDS,
		G3DC_WINDOW_COORDS
	}   G3dCoords_t;

	typedef struct {
		Fixed32_t zbufferPlanes;
	}   G3dCapabilities_t;

	G3dHandle_t WINAPI G3dCreateGC(R3dHandle_t);
	Void_t WINAPI G3dDeleteGC(G3dHandle_t hGC);
	Void_t WINAPI G3dSetCoords(G3dHandle_t hGC, G3dCoords_t coordinates);

	Void_t WINAPI G3dQuerySystemCapabilities(G3dHandle_t hGC, G3dCapabilities_t cap);

/* ----------------------COLORS------------------------ */
	typedef struct {
		Float_t r, g, b;
	}   ColorF_t;
	typedef struct {
		Float_t r, g, b, a;
	}   ColorFA_t;
	typedef struct {
		Fixed16_t r, g, b, a;
	} ColorSA_t;

/* ----------------------POINTS------------------------ */
	typedef struct {
		Fixed32_t x, y, z;
	} PointL_t;
	typedef struct {
		Fixed32_t x, y, z, w;
	}   PointLW_t;
	typedef struct {
		Float_t x, y, z;
	}   PointF_t;
	typedef struct {
		Float_t x, y, z, w;
	}   PointFW_t;

	typedef struct {
		PointF_t point, vector;
	}   LineF_t;
	typedef struct {
		Float_t a, b, c, d;
	}   PlaneF_t;
	typedef struct {
		PointF_t center;
		Float_t r;
	}   SphereF_t;

	typedef struct {
		PointL_t point, vector;
	}   LineL_t;
	typedef struct {
		Fixed32_t a, b, c, d;
	}   PlaneL_t;
	typedef struct {
		PointL_t center;
		Fixed32_t r;
	}   SphereL_t;

/* ----------------------PRIMITIVES------------------------ */
#define	G3D_MAX_VERTICES	256
#define	G3D_MAX_LIST		4096
#define G3D_MAX_PLANES		(Fixed32_t)8

	typedef enum {
		G3DCP_DATA,
		G3DCP_SIGN
	}   G3dCPlaneProp_t;

	Void_t WINAPI G3dGetClipPlane(G3dHandle_t hGC, Fixed32_t wCPPNum, G3dCPlaneProp_t prop, Float_t *data);
	Void_t WINAPI G3dSetClipPlane(G3dHandle_t hGC, Fixed32_t wCPNum, G3dCPlaneProp_t prop, Float_t *data);

	typedef enum {
		G3D_PRM_POINTS = R3D_PRM_POINTS,
		G3D_PRM_LINES = R3D_PRM_LINES,
		G3D_PRM_POLYLINE = R3D_PRM_POLYLINE,
		G3D_PRM_TRIANGLES = R3D_PRM_TRIANGLES,
		G3D_PRM_QUADS = R3D_PKT_QUADS,
		G3D_PRM_TRISTRIP = R3D_PRM_TRISTRIP,
		G3D_PRM_QUADSTRIP = R3D_PKT_QUADSTRIP,
		G3D_PRM_POLYGON = R3D_PRM_POLYGON,
	}   G3dPrimitive_t;

	Void_t WINAPI G3dQPatchF(G3dHandle_t hGC, Fixed32_t un,  Fixed32_t vn, 
		    PointFW_t * p, Fixed32_t pstep, PointF_t * t, Fixed32_t tstep,
		    ColorFA_t * c, Fixed32_t cstep, int NormFlag);



	void WINAPI G3dQPatchListF(G3dHandle_t  hGC, Fixed32_t un, Fixed32_t vn,
       PointFW_t * qp, Fixed32_t qpstep,  PointF_t * qt, Fixed32_t qtstep,
       ColorFA_t * qc, Fixed32_t qcstep, int normFlag,
       PointF_t * p, Fixed32_t pstep,  PointF_t * n, Fixed32_t nstep, PointF_t * t, Fixed32_t tstep,
       ColorFA_t * c, Fixed32_t cstep,  Fixed16_t * idx);

	Void_t WINAPI G3dQPatchL(G3dHandle_t hGC, Fixed32_t un,  Fixed32_t vn, 
		    PointLW_t * p, Fixed32_t pstep, PointL_t * t, Fixed32_t tstep,
		    ColorSA_t * c, Fixed32_t cstep, int NormFlag);

	

	void WINAPI G3dQPatchListL(G3dHandle_t  hGC, Fixed32_t un, Fixed32_t vn,
       PointLW_t * qp, Fixed32_t qpstep,  PointL_t * qt, Fixed32_t qtstep,
       ColorSA_t * qc, Fixed32_t qcstep, int normFlag,
       PointL_t * p, Fixed32_t pstep,  PointL_t * n, Fixed32_t nstep, PointL_t * t, Fixed32_t tstep,
       ColorSA_t * c, Fixed32_t cstep,  Fixed16_t * idx);


	Void_t WINAPI G3dPrimitiveF(G3dHandle_t hGC, G3dPrimitive_t prim, Fixed32_t nvtx,
		    PointF_t * p, Fixed32_t pstep, PointF_t * n, Fixed32_t nstep,
		    PointF_t * t, Fixed32_t tstep, ColorFA_t * c, Fixed32_t cstep);
	Void_t WINAPI G3dPrimitiveL(G3dHandle_t hGC, G3dPrimitive_t prim, Fixed32_t nvtx,
		    PointL_t *p, Fixed32_t pstep, PointL_t *n, Fixed32_t nstep,
		    PointL_t *t, Fixed32_t tstep, ColorSA_t *c, Fixed32_t cstep);
	Void_t WINAPI G3dBeginPrim(G3dHandle_t hGC, G3dPrimitive_t prim, Fixed32_t nvtx);
	Void_t WINAPI G3dAddPrimVtxF(G3dHandle_t hGC, PointF_t * p, PointF_t * n, PointF_t * t, ColorFA_t * c);
	Void_t WINAPI G3dAddPrimVtxL(G3dHandle_t hGC, PointL_t *p, PointL_t *n, PointL_t *t, ColorSA_t *c);
	Void_t WINAPI G3dEndPrim(G3dHandle_t hGC);

⌨️ 快捷键说明

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