📄 d3dtypes.h
字号:
/*==========================================================================; * * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. * * File: d3dtypes.h * Content: Direct3D types include file * ***************************************************************************/#ifndef _D3DTYPES_H_#define _D3DTYPES_H_#ifndef WIN32#include "subwtype.h"#else#include <windows.h>#endif#include <ddraw.h>#pragma pack(4)#if defined(__cplusplus)extern "C"{#endif/* D3DVALUE is the fundamental Direct3D fractional data type */#define D3DVALP(val, prec) ((float)(val))#define D3DVAL(val) ((float)(val))typedef float D3DVALUE, *LPD3DVALUE;#define D3DDivide(a, b) (float)((double) (a) / (double) (b))#define D3DMultiply(a, b) ((a) * (b))typedef LONG D3DFIXED;#ifndef RGB_MAKE/* * Format of CI colors is * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | alpha | color index | fraction | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */#define CI_GETALPHA(ci) ((ci) >> 24)#define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff)#define CI_GETFRACTION(ci) ((ci) & 0xff)#define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80)#define CI_MASKALPHA(ci) ((ci) & 0xffffff)#define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f))/* * Format of RGBA colors is * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | alpha | red | green | blue | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */#define RGBA_GETALPHA(rgb) ((rgb) >> 24)#define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff)#define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff)#define RGBA_GETBLUE(rgb) ((rgb) & 0xff)#define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))/* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs * The float values must be in the range 0..1 */#define D3DRGB(r, g, b) \ (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))#define D3DRGBA(r, g, b, a) \ ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ )/* * Format of RGB colors is * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | ignored | red | green | blue | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */#define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff)#define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff)#define RGB_GETBLUE(rgb) ((rgb) & 0xff)#define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))#define RGB_MAKE(r, g, b) ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b)))#define RGBA_TORGB(rgba) ((D3DCOLOR) ((rgba) & 0xffffff))#define RGB_TORGBA(rgb) ((D3DCOLOR) ((rgb) | 0xff000000))#endif/* * Flags for Enumerate functions *//* * Stop the enumeration */#define D3DENUMRET_CANCEL DDENUMRET_CANCEL/* * Continue the enumeration */#define D3DENUMRET_OK DDENUMRET_OKtypedef HRESULT (WINAPI* LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset);typedef HRESULT (WINAPI* LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext);typedef DWORD D3DCOLOR, D3DCOLOR, *LPD3DCOLOR;typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE;typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE;typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE;typedef struct _D3DCOLORVALUE { union { D3DVALUE r; D3DVALUE dvR; }; union { D3DVALUE g; D3DVALUE dvG; }; union { D3DVALUE b; D3DVALUE dvB; }; union { D3DVALUE a; D3DVALUE dvA; };} D3DCOLORVALUE;typedef struct _D3DRECT { union { LONG x1; LONG lX1; }; union { LONG y1; LONG lY1; }; union { LONG x2; LONG lX2; }; union { LONG y2; LONG lY2; };} D3DRECT, *LPD3DRECT;typedef struct _D3DVECTOR { union { D3DVALUE x; D3DVALUE dvX; }; union { D3DVALUE y; D3DVALUE dvY; }; union { D3DVALUE z; D3DVALUE dvZ; };} D3DVECTOR, *LPD3DVECTOR;/* * Vertex data types supported in an ExecuteBuffer. *//* * Homogeneous vertices */typedef struct _D3DHVERTEX { DWORD dwFlags; /* Homogeneous clipping flags */ union { D3DVALUE hx; D3DVALUE dvHX; }; union { D3DVALUE hy; D3DVALUE dvHY; }; union { D3DVALUE hz; D3DVALUE dvHZ; };} D3DHVERTEX, *LPD3DHVERTEX;/* * Transformed/lit vertices */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; };} 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; };} 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; };} D3DVERTEX, *LPD3DVERTEX;/* * Matrix, viewport, and tranformation structures and definitions. */typedef struct _D3DMATRIX { D3DVALUE _11, _12, _13, _14; D3DVALUE _21, _22, _23, _24; D3DVALUE _31, _32, _33, _34; D3DVALUE _41, _42, _43, _44;} D3DMATRIX, *LPD3DMATRIX;typedef struct _D3DVIEWPORT { DWORD dwSize; DWORD dwX; DWORD dwY; /* Top left */ DWORD dwWidth; DWORD dwHeight; /* Dimensions */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -