📄 d3dtypes.h
字号:
*/
typedef struct _D3DTLVERTEX {
union {
D3DVALUE sx; /* Screen coordinates */
D3DVALUE dvSX;
};
union {
D3DVALUE sy;
D3DVALUE dvSY;
};
union {
D3DVALUE sz;
D3DVALUE dvSZ;
};
union {
D3DVALUE rhw; /* Reciprocal of homogeneous w */
D3DVALUE dvRHW;
};
union {
D3DCOLOR color; /* Vertex color */
D3DCOLOR dcColor;
};
union {
D3DCOLOR specular; /* Specular component of vertex */
D3DCOLOR dcSpecular;
};
union {
D3DVALUE tu; /* Texture coordinates */
D3DVALUE dvTU;
};
union {
D3DVALUE tv;
D3DVALUE dvTV;
};
#if(DIRECT3D_VERSION >= 0x0500)
#if (defined __cplusplus) && (defined D3D_OVERLOADS)
_D3DTLVERTEX() { }
_D3DTLVERTEX(const D3DVECTOR& v, float _rhw,
D3DCOLOR _color, D3DCOLOR _specular,
float _tu, float _tv)
{ sx = v.x; sy = v.y; sz = v.z; rhw = _rhw;
color = _color; specular = _specular;
tu = _tu; tv = _tv;
}
#endif
#endif /* DIRECT3D_VERSION >= 0x0500 */
} D3DTLVERTEX, *LPD3DTLVERTEX;
/*
* Untransformed/lit vertices
*/
typedef struct _D3DLVERTEX {
union {
D3DVALUE x; /* Homogeneous coordinates */
D3DVALUE dvX;
};
union {
D3DVALUE y;
D3DVALUE dvY;
};
union {
D3DVALUE z;
D3DVALUE dvZ;
};
DWORD dwReserved;
union {
D3DCOLOR color; /* Vertex color */
D3DCOLOR dcColor;
};
union {
D3DCOLOR specular; /* Specular component of vertex */
D3DCOLOR dcSpecular;
};
union {
D3DVALUE tu; /* Texture coordinates */
D3DVALUE dvTU;
};
union {
D3DVALUE tv;
D3DVALUE dvTV;
};
#if(DIRECT3D_VERSION >= 0x0500)
#if (defined __cplusplus) && (defined D3D_OVERLOADS)
_D3DLVERTEX() { }
_D3DLVERTEX(const D3DVECTOR& v,
D3DCOLOR _color, D3DCOLOR _specular,
float _tu, float _tv)
{ x = v.x; y = v.y; z = v.z; dwReserved = 0;
color = _color; specular = _specular;
tu = _tu; tv = _tv;
}
#endif
#endif /* DIRECT3D_VERSION >= 0x0500 */
} D3DLVERTEX, *LPD3DLVERTEX;
/*
* Untransformed/unlit vertices
*/
typedef struct _D3DVERTEX {
union {
D3DVALUE x; /* Homogeneous coordinates */
D3DVALUE dvX;
};
union {
D3DVALUE y;
D3DVALUE dvY;
};
union {
D3DVALUE z;
D3DVALUE dvZ;
};
union {
D3DVALUE nx; /* Normal */
D3DVALUE dvNX;
};
union {
D3DVALUE ny;
D3DVALUE dvNY;
};
union {
D3DVALUE nz;
D3DVALUE dvNZ;
};
union {
D3DVALUE tu; /* Texture coordinates */
D3DVALUE dvTU;
};
union {
D3DVALUE tv;
D3DVALUE dvTV;
};
#if(DIRECT3D_VERSION >= 0x0500)
#if (defined __cplusplus) && (defined D3D_OVERLOADS)
_D3DVERTEX() { }
_D3DVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, float _tu, float _tv)
{ x = v.x; y = v.y; z = v.z;
nx = n.x; ny = n.y; nz = n.z;
tu = _tu; tv = _tv;
}
#endif
#endif /* DIRECT3D_VERSION >= 0x0500 */
} D3DVERTEX, *LPD3DVERTEX;
/*
* Matrix, viewport, and tranformation structures and definitions.
*/
#ifndef D3DMATRIX_DEFINED
typedef struct _D3DMATRIX {
#if(DIRECT3D_VERSION >= 0x0500)
#if (defined __cplusplus) && (defined D3D_OVERLOADS)
union {
struct {
#endif
#endif /* DIRECT3D_VERSION >= 0x0500 */
D3DVALUE _11, _12, _13, _14;
D3DVALUE _21, _22, _23, _24;
D3DVALUE _31, _32, _33, _34;
D3DVALUE _41, _42, _43, _44;
#if(DIRECT3D_VERSION >= 0x0500)
#if (defined __cplusplus) && (defined D3D_OVERLOADS)
};
D3DVALUE m[4][4];
};
_D3DMATRIX() { }
_D3DMATRIX( D3DVALUE _m00, D3DVALUE _m01, D3DVALUE _m02, D3DVALUE _m03,
D3DVALUE _m10, D3DVALUE _m11, D3DVALUE _m12, D3DVALUE _m13,
D3DVALUE _m20, D3DVALUE _m21, D3DVALUE _m22, D3DVALUE _m23,
D3DVALUE _m30, D3DVALUE _m31, D3DVALUE _m32, D3DVALUE _m33
)
{
m[0][0] = _m00; m[0][1] = _m01; m[0][2] = _m02; m[0][3] = _m03;
m[1][0] = _m10; m[1][1] = _m11; m[1][2] = _m12; m[1][3] = _m13;
m[2][0] = _m20; m[2][1] = _m21; m[2][2] = _m22; m[2][3] = _m23;
m[3][0] = _m30; m[3][1] = _m31; m[3][2] = _m32; m[3][3] = _m33;
}
D3DVALUE& operator()(int iRow, int iColumn) { return m[iRow][iColumn]; }
const D3DVALUE& operator()(int iRow, int iColumn) const { return m[iRow][iColumn]; }
#if(DIRECT3D_VERSION >= 0x0600)
friend _D3DMATRIX operator* (const _D3DMATRIX&, const _D3DMATRIX&);
#endif /* DIRECT3D_VERSION >= 0x0600 */
#endif
#endif /* DIRECT3D_VERSION >= 0x0500 */
} D3DMATRIX;
#define D3DMATRIX_DEFINED
#endif
typedef struct _D3DMATRIX *LPD3DMATRIX;
#if (defined __cplusplus) && (defined D3D_OVERLOADS)
#include "d3dvec.inl"
#endif
typedef struct _D3DVIEWPORT {
DWORD dwSize;
DWORD dwX;
DWORD dwY; /* Top left */
DWORD dwWidth;
DWORD dwHeight; /* Dimensions */
D3DVALUE dvScaleX; /* Scale homogeneous to screen */
D3DVALUE dvScaleY; /* Scale homogeneous to screen */
D3DVALUE dvMaxX; /* Min/max homogeneous x coord */
D3DVALUE dvMaxY; /* Min/max homogeneous y coord */
D3DVALUE dvMinZ;
D3DVALUE dvMaxZ; /* Min/max homogeneous z coord */
} D3DVIEWPORT, *LPD3DVIEWPORT;
#if(DIRECT3D_VERSION >= 0x0500)
typedef struct _D3DVIEWPORT2 {
DWORD dwSize;
DWORD dwX;
DWORD dwY; /* Viewport Top left */
DWORD dwWidth;
DWORD dwHeight; /* Viewport Dimensions */
D3DVALUE dvClipX; /* Top left of clip volume */
D3DVALUE dvClipY;
D3DVALUE dvClipWidth; /* Clip Volume Dimensions */
D3DVALUE dvClipHeight;
D3DVALUE dvMinZ; /* Min/max of clip Volume */
D3DVALUE dvMaxZ;
} D3DVIEWPORT2, *LPD3DVIEWPORT2;
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0700)
typedef struct _D3DVIEWPORT7 {
DWORD dwX;
DWORD dwY; /* Viewport Top left */
DWORD dwWidth;
DWORD dwHeight; /* Viewport Dimensions */
D3DVALUE dvMinZ; /* Min/max of clip Volume */
D3DVALUE dvMaxZ;
} D3DVIEWPORT7, *LPD3DVIEWPORT7;
#endif /* DIRECT3D_VERSION >= 0x0700 */
/*
* Values for clip fields.
*/
#if(DIRECT3D_VERSION >= 0x0700)
// Max number of user clipping planes, supported in D3D.
#define D3DMAXUSERCLIPPLANES 32
// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
//
#define D3DCLIPPLANE0 (1 << 0)
#define D3DCLIPPLANE1 (1 << 1)
#define D3DCLIPPLANE2 (1 << 2)
#define D3DCLIPPLANE3 (1 << 3)
#define D3DCLIPPLANE4 (1 << 4)
#define D3DCLIPPLANE5 (1 << 5)
#endif /* DIRECT3D_VERSION >= 0x0700 */
#define D3DCLIP_LEFT 0x00000001L
#define D3DCLIP_RIGHT 0x00000002L
#define D3DCLIP_TOP 0x00000004L
#define D3DCLIP_BOTTOM 0x00000008L
#define D3DCLIP_FRONT 0x00000010L
#define D3DCLIP_BACK 0x00000020L
#define D3DCLIP_GEN0 0x00000040L
#define D3DCLIP_GEN1 0x00000080L
#define D3DCLIP_GEN2 0x00000100L
#define D3DCLIP_GEN3 0x00000200L
#define D3DCLIP_GEN4 0x00000400L
#define D3DCLIP_GEN5 0x00000800L
/*
* Values for d3d status.
*/
#define D3DSTATUS_CLIPUNIONLEFT D3DCLIP_LEFT
#define D3DSTATUS_CLIPUNIONRIGHT D3DCLIP_RIGHT
#define D3DSTATUS_CLIPUNIONTOP D3DCLIP_TOP
#define D3DSTATUS_CLIPUNIONBOTTOM D3DCLIP_BOTTOM
#define D3DSTATUS_CLIPUNIONFRONT D3DCLIP_FRONT
#define D3DSTATUS_CLIPUNIONBACK D3DCLIP_BACK
#define D3DSTATUS_CLIPUNIONGEN0 D3DCLIP_GEN0
#define D3DSTATUS_CLIPUNIONGEN1 D3DCLIP_GEN1
#define D3DSTATUS_CLIPUNIONGEN2 D3DCLIP_GEN2
#define D3DSTATUS_CLIPUNIONGEN3 D3DCLIP_GEN3
#define D3DSTATUS_CLIPUNIONGEN4 D3DCLIP_GEN4
#define D3DSTATUS_CLIPUNIONGEN5 D3DCLIP_GEN5
#define D3DSTATUS_CLIPINTERSECTIONLEFT 0x00001000L
#define D3DSTATUS_CLIPINTERSECTIONRIGHT 0x00002000L
#define D3DSTATUS_CLIPINTERSECTIONTOP 0x00004000L
#define D3DSTATUS_CLIPINTERSECTIONBOTTOM 0x00008000L
#define D3DSTATUS_CLIPINTERSECTIONFRONT 0x00010000L
#define D3DSTATUS_CLIPINTERSECTIONBACK 0x00020000L
#define D3DSTATUS_CLIPINTERSECTIONGEN0 0x00040000L
#define D3DSTATUS_CLIPINTERSECTIONGEN1 0x00080000L
#define D3DSTATUS_CLIPINTERSECTIONGEN2 0x00100000L
#define D3DSTATUS_CLIPINTERSECTIONGEN3 0x00200000L
#define D3DSTATUS_CLIPINTERSECTIONGEN4 0x00400000L
#define D3DSTATUS_CLIPINTERSECTIONGEN5 0x00800000L
#define D3DSTATUS_ZNOTVISIBLE 0x01000000L
/* Do not use 0x80000000 for any status flags in future as it is reserved */
#define D3DSTATUS_CLIPUNIONALL ( \
D3DSTATUS_CLIPUNIONLEFT | \
D3DSTATUS_CLIPUNIONRIGHT | \
D3DSTATUS_CLIPUNIONTOP | \
D3DSTATUS_CLIPUNIONBOTTOM | \
D3DSTATUS_CLIPUNIONFRONT | \
D3DSTATUS_CLIPUNIONBACK | \
D3DSTATUS_CLIPUNIONGEN0 | \
D3DSTATUS_CLIPUNIONGEN1 | \
D3DSTATUS_CLIPUNIONGEN2 | \
D3DSTATUS_CLIPUNIONGEN3 | \
D3DSTATUS_CLIPUNIONGEN4 | \
D3DSTATUS_CLIPUNIONGEN5 \
)
#define D3DSTATUS_CLIPINTERSECTIONALL ( \
D3DSTATUS_CLIPINTERSECTIONLEFT | \
D3DSTATUS_CLIPINTERSECTIONRIGHT | \
D3DSTATUS_CLIPINTERSECTIONTOP | \
D3DSTATUS_CLIPINTERSECTIONBOTTOM | \
D3DSTATUS_CLIPINTERSECTIONFRONT | \
D3DSTATUS_CLIPINTERSECTIONBACK | \
D3DSTATUS_CLIPINTERSECTIONGEN0 | \
D3DSTATUS_CLIPINTERSECTIONGEN1 | \
D3DSTATUS_CLIPINTERSECTIONGEN2 | \
D3DSTATUS_CLIPINTERSECTIONGEN3 | \
D3DSTATUS_CLIPINTERSECTIONGEN4 | \
D3DSTATUS_CLIPINTERSECTIONGEN5 \
)
#define D3DSTATUS_DEFAULT ( \
D3DSTATUS_CLIPINTERSECTIONALL | \
D3DSTATUS_ZNOTVISIBLE)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -