📄 d3d8types.h
字号:
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: d3d8types.h
* Content: Direct3D capabilities include file
*
***************************************************************************/
#ifndef _D3D8TYPES_H_
#define _D3D8TYPES_H_
#ifndef DIRECT3D_VERSION
#define DIRECT3D_VERSION 0x0800
#endif //DIRECT3D_VERSION
// include this file content only if compiling for DX8 interfaces
#if(DIRECT3D_VERSION >= 0x0800)
#include <float.h>
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning(disable:4201) // anonymous unions warning
#if defined(_X86_) || defined(_IA64_)
#pragma pack(4)
#endif
// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8
#ifndef D3DCOLOR_DEFINED
typedef DWORD D3DCOLOR;
#define D3DCOLOR_DEFINED
#endif
// maps unsigned 8 bits/channel to D3DCOLOR
#define D3DCOLOR_ARGB(a,r,g,b) \
((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b)
// maps floating point channels (0.f to 1.f range) to D3DCOLOR
#define D3DCOLOR_COLORVALUE(r,g,b,a) \
D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
#ifndef D3DVECTOR_DEFINED
typedef struct _D3DVECTOR {
float x;
float y;
float z;
} D3DVECTOR;
#define D3DVECTOR_DEFINED
#endif
#ifndef D3DCOLORVALUE_DEFINED
typedef struct _D3DCOLORVALUE {
float r;
float g;
float b;
float a;
} D3DCOLORVALUE;
#define D3DCOLORVALUE_DEFINED
#endif
#ifndef D3DRECT_DEFINED
typedef struct _D3DRECT {
LONG x1;
LONG y1;
LONG x2;
LONG y2;
} D3DRECT;
#define D3DRECT_DEFINED
#endif
#ifndef D3DMATRIX_DEFINED
typedef struct _D3DMATRIX {
union {
struct {
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
};
float m[4][4];
};
} D3DMATRIX;
#define D3DMATRIX_DEFINED
#endif
typedef struct _D3DVIEWPORT8 {
DWORD X;
DWORD Y; /* Viewport Top left */
DWORD Width;
DWORD Height; /* Viewport Dimensions */
float MinZ; /* Min/max of clip Volume */
float MaxZ;
} D3DVIEWPORT8;
/*
* Values for clip fields.
*/
// Max number of user clipping planes, supported in D3D.
#define D3DMAXUSERCLIPPLANES 32
// These bits could be ORed together to use with D3DRS_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)
// The following bits are used in the ClipUnion and ClipIntersection
// members of the D3DCLIPSTATUS8
//
#define D3DCS_LEFT 0x00000001L
#define D3DCS_RIGHT 0x00000002L
#define D3DCS_TOP 0x00000004L
#define D3DCS_BOTTOM 0x00000008L
#define D3DCS_FRONT 0x00000010L
#define D3DCS_BACK 0x00000020L
#define D3DCS_PLANE0 0x00000040L
#define D3DCS_PLANE1 0x00000080L
#define D3DCS_PLANE2 0x00000100L
#define D3DCS_PLANE3 0x00000200L
#define D3DCS_PLANE4 0x00000400L
#define D3DCS_PLANE5 0x00000800L
#define D3DCS_ALL (D3DCS_LEFT | \
D3DCS_RIGHT | \
D3DCS_TOP | \
D3DCS_BOTTOM | \
D3DCS_FRONT | \
D3DCS_BACK | \
D3DCS_PLANE0 | \
D3DCS_PLANE1 | \
D3DCS_PLANE2 | \
D3DCS_PLANE3 | \
D3DCS_PLANE4 | \
D3DCS_PLANE5)
typedef struct _D3DCLIPSTATUS8 {
DWORD ClipUnion;
DWORD ClipIntersection;
} D3DCLIPSTATUS8;
typedef struct _D3DMATERIAL8 {
D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */
D3DCOLORVALUE Ambient; /* Ambient color RGB */
D3DCOLORVALUE Specular; /* Specular 'shininess' */
D3DCOLORVALUE Emissive; /* Emissive color RGB */
float Power; /* Sharpness if specular highlight */
} D3DMATERIAL8;
typedef enum _D3DLIGHTTYPE {
D3DLIGHT_POINT = 1,
D3DLIGHT_SPOT = 2,
D3DLIGHT_DIRECTIONAL = 3,
D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DLIGHTTYPE;
typedef struct _D3DLIGHT8 {
D3DLIGHTTYPE Type; /* Type of light source */
D3DCOLORVALUE Diffuse; /* Diffuse color of light */
D3DCOLORVALUE Specular; /* Specular color of light */
D3DCOLORVALUE Ambient; /* Ambient color of light */
D3DVECTOR Position; /* Position in world space */
D3DVECTOR Direction; /* Direction in world space */
float Range; /* Cutoff range */
float Falloff; /* Falloff */
float Attenuation0; /* Constant attenuation */
float Attenuation1; /* Linear attenuation */
float Attenuation2; /* Quadratic attenuation */
float Theta; /* Inner angle of spotlight cone */
float Phi; /* Outer angle of spotlight cone */
} D3DLIGHT8;
/*
* Options for clearing
*/
#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */
#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */
#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */
/*
* The following defines the rendering states
*/
typedef enum _D3DSHADEMODE {
D3DSHADE_FLAT = 1,
D3DSHADE_GOURAUD = 2,
D3DSHADE_PHONG = 3,
D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DSHADEMODE;
typedef enum _D3DFILLMODE {
D3DFILL_POINT = 1,
D3DFILL_WIREFRAME = 2,
D3DFILL_SOLID = 3,
D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DFILLMODE;
typedef struct _D3DLINEPATTERN {
WORD wRepeatFactor;
WORD wLinePattern;
} D3DLINEPATTERN;
typedef enum _D3DBLEND {
D3DBLEND_ZERO = 1,
D3DBLEND_ONE = 2,
D3DBLEND_SRCCOLOR = 3,
D3DBLEND_INVSRCCOLOR = 4,
D3DBLEND_SRCALPHA = 5,
D3DBLEND_INVSRCALPHA = 6,
D3DBLEND_DESTALPHA = 7,
D3DBLEND_INVDESTALPHA = 8,
D3DBLEND_DESTCOLOR = 9,
D3DBLEND_INVDESTCOLOR = 10,
D3DBLEND_SRCALPHASAT = 11,
D3DBLEND_BOTHSRCALPHA = 12,
D3DBLEND_BOTHINVSRCALPHA = 13,
D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DBLEND;
typedef enum _D3DBLENDOP {
D3DBLENDOP_ADD = 1,
D3DBLENDOP_SUBTRACT = 2,
D3DBLENDOP_REVSUBTRACT = 3,
D3DBLENDOP_MIN = 4,
D3DBLENDOP_MAX = 5,
D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DBLENDOP;
typedef enum _D3DTEXTUREADDRESS {
D3DTADDRESS_WRAP = 1,
D3DTADDRESS_MIRROR = 2,
D3DTADDRESS_CLAMP = 3,
D3DTADDRESS_BORDER = 4,
D3DTADDRESS_MIRRORONCE = 5,
D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DTEXTUREADDRESS;
typedef enum _D3DCULL {
D3DCULL_NONE = 1,
D3DCULL_CW = 2,
D3DCULL_CCW = 3,
D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DCULL;
typedef enum _D3DCMPFUNC {
D3DCMP_NEVER = 1,
D3DCMP_LESS = 2,
D3DCMP_EQUAL = 3,
D3DCMP_LESSEQUAL = 4,
D3DCMP_GREATER = 5,
D3DCMP_NOTEQUAL = 6,
D3DCMP_GREATEREQUAL = 7,
D3DCMP_ALWAYS = 8,
D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DCMPFUNC;
typedef enum _D3DSTENCILOP {
D3DSTENCILOP_KEEP = 1,
D3DSTENCILOP_ZERO = 2,
D3DSTENCILOP_REPLACE = 3,
D3DSTENCILOP_INCRSAT = 4,
D3DSTENCILOP_DECRSAT = 5,
D3DSTENCILOP_INVERT = 6,
D3DSTENCILOP_INCR = 7,
D3DSTENCILOP_DECR = 8,
D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DSTENCILOP;
typedef enum _D3DFOGMODE {
D3DFOG_NONE = 0,
D3DFOG_EXP = 1,
D3DFOG_EXP2 = 2,
D3DFOG_LINEAR = 3,
D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DFOGMODE;
typedef enum _D3DZBUFFERTYPE {
D3DZB_FALSE = 0,
D3DZB_TRUE = 1, // Z buffering
D3DZB_USEW = 2, // W buffering
D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DZBUFFERTYPE;
// Primitives supported by draw-primitive API
typedef enum _D3DPRIMITIVETYPE {
D3DPT_POINTLIST = 1,
D3DPT_LINELIST = 2,
D3DPT_LINESTRIP = 3,
D3DPT_TRIANGLELIST = 4,
D3DPT_TRIANGLESTRIP = 5,
D3DPT_TRIANGLEFAN = 6,
D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DPRIMITIVETYPE;
typedef enum _D3DTRANSFORMSTATETYPE {
D3DTS_VIEW = 2,
D3DTS_PROJECTION = 3,
D3DTS_TEXTURE0 = 16,
D3DTS_TEXTURE1 = 17,
D3DTS_TEXTURE2 = 18,
D3DTS_TEXTURE3 = 19,
D3DTS_TEXTURE4 = 20,
D3DTS_TEXTURE5 = 21,
D3DTS_TEXTURE6 = 22,
D3DTS_TEXTURE7 = 23,
D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */
} D3DTRANSFORMSTATETYPE;
#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
#define D3DTS_WORLD D3DTS_WORLDMATRIX(0)
#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1)
#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2)
#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3)
typedef enum _D3DRENDERSTATETYPE {
D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */
D3DRS_FILLMODE = 8, /* D3DFILLMODE */
D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */
D3DRS_LINEPATTERN = 10, /* D3DLINEPATTERN */
D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */
D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */
D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */
D3DRS_SRCBLEND = 19, /* D3DBLEND */
D3DRS_DESTBLEND = 20, /* D3DBLEND */
D3DRS_CULLMODE = 22, /* D3DCULL */
D3DRS_ZFUNC = 23, /* D3DCMPFUNC */
D3DRS_ALPHAREF = 24, /* D3DFIXED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -