From a9ea8574d40746f1318b0dbf4fd35e32af96920a Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Mon, 16 Apr 2001 19:02:22 +0000 Subject: [PATCH] Direct3D header update. --- include/d3d.h | 44 +++++++++++++++++++++++++++++++++++--------- include/d3dtypes.h | 42 +++++++++++++++++++++++++++++++++++++----- include/d3dvec.inl | 12 ++++++++++++ 3 files changed, 84 insertions(+), 14 deletions(-) diff --git a/include/d3d.h b/include/d3d.h index d34b478d55d..5192f879940 100644 --- a/include/d3d.h +++ b/include/d3d.h @@ -130,6 +130,32 @@ typedef struct IDirect3DVertexBuffer7 IDirect3DVertexBuffer7, *LPDIRECT3DVERTEXB #define D3DERR_VIEWPORTDATANOTSET MAKE_DDHRESULT(773) #define D3DERR_VIEWPORTHASNODEVICE MAKE_DDHRESULT(774) #define D3DERR_NOCURRENTVIEWPORT MAKE_DDHRESULT(775) +#define D3DERR_INVALIDVERTEXFORMAT MAKE_DDHRESULT(2048) +#define D3DERR_VERTEXBUFFEROPTIMIZED MAKE_DDHRESULT(2060) +#define D3DERR_VBUF_CREATE_FAILED MAKE_DDHRESULT(2061) +#define D3DERR_VERTEXBUFFERLOCKED MAKE_DDHRESULT(2062) +#define D3DERR_VERTEXBUFFERUNLOCKFAILED MAKE_DDHRESULT(2063) +#define D3DERR_ZBUFFER_NOTPRESENT MAKE_DDHRESULT(2070) +#define D3DERR_STENCILBUFFER_NOTPRESENT MAKE_DDHRESULT(2071) + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_DDHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_DDHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_DDHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_DDHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_DDHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_DDHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_DDHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_DDHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_DDHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_DDHRESULT(2082) +#define D3DERR_TOOMANYPRIMITIVES MAKE_DDHRESULT(2083) +#define D3DERR_INVALIDMATRIX MAKE_DDHRESULT(2084) +#define D3DERR_TOOMANYVERTICES MAKE_DDHRESULT(2085) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_DDHRESULT(2086) + +#define D3DERR_INVALIDSTATEBLOCK MAKE_DDHRESULT(2100) +#define D3DERR_INBEGINSTATEBLOCK MAKE_DDHRESULT(2101) +#define D3DERR_NOTINBEGINSTATEBLOCK MAKE_DDHRESULT(2102) /* ******************************************************************** Enums @@ -299,7 +325,7 @@ ICOM_DEFINE(IDirect3DLight,IUnknown) ICOM_METHOD1(HRESULT,Initialize, LPDIRECT3D,lpDirect3D) \ ICOM_METHOD1(HRESULT,SetMaterial, LPD3DMATERIAL,lpMat) \ ICOM_METHOD1(HRESULT,GetMaterial, LPD3DMATERIAL,lpMat) \ - ICOM_METHOD2(HRESULT,GetHandle, LPDIRECT3DDEVICE2,lpDirect3DDevice2, LPD3DMATERIALHANDLE,lpHandle) \ + ICOM_METHOD2(HRESULT,GetHandle, LPDIRECT3DDEVICE,lpDirect3DDevice, LPD3DMATERIALHANDLE,lpHandle) \ ICOM_METHOD (HRESULT,Reserve) \ ICOM_METHOD (HRESULT,Unreserve) #define IDirect3DMaterial_IMETHODS \ @@ -511,7 +537,7 @@ ICOM_DEFINE(IDirect3DViewport2,IDirect3DViewport) #define IDirect3DViewport3_IMETHODS \ IDirect3DViewport2_IMETHODS \ IDirect3DViewport3_METHODS -ICOM_DEFINE(IDirect3DViewport3,IDirect3DViewport) +ICOM_DEFINE(IDirect3DViewport3,IDirect3DViewport2) #undef ICOM_INTERFACE /*** IUnknown methods ***/ @@ -816,16 +842,16 @@ ICOM_DEFINE(IDirect3DDevice3,IUnknown) ICOM_METHOD1(HRESULT,GetDirect3D, LPDIRECT3D7*,lplpDirect3D3) \ ICOM_METHOD2(HRESULT,SetRenderTarget, LPDIRECTDRAWSURFACE7,lpNewRenderTarget,DWORD,dwFlags) \ ICOM_METHOD1(HRESULT,GetRenderTarget, LPDIRECTDRAWSURFACE7*,lplpRenderTarget) \ - ICOM_METHOD6(HRESULT,Clear, DWORD,,LPD3DRECT,,DWORD,,D3DCOLOR,,D3DVALUE,,DWORD,) \ + ICOM_METHOD6(HRESULT,Clear, DWORD,dwCount,LPD3DRECT,lpRects,DWORD,dwFlags,D3DCOLOR,dwColor,D3DVALUE,dvZ,DWORD,dwStencil) \ ICOM_METHOD2(HRESULT,SetTransform, D3DTRANSFORMSTATETYPE,dtstTransformStateType, LPD3DMATRIX,lpD3DMatrix) \ ICOM_METHOD2(HRESULT,GetTransform, D3DTRANSFORMSTATETYPE,dtstTransformStateType, LPD3DMATRIX,lpD3DMatrix) \ + ICOM_METHOD1(HRESULT,SetViewport, LPD3DVIEWPORT7,lpData) \ ICOM_METHOD2(HRESULT,MultiplyTransform, D3DTRANSFORMSTATETYPE,,LPD3DMATRIX,) \ ICOM_METHOD1(HRESULT,GetViewport, LPD3DVIEWPORT7,lpData) \ - ICOM_METHOD1(HRESULT,SetViewport, LPD3DVIEWPORT7,lpData) \ ICOM_METHOD1(HRESULT,SetMaterial, LPD3DMATERIAL7,lpMat) \ ICOM_METHOD1(HRESULT,GetMaterial, LPD3DMATERIAL7,lpMat) \ - ICOM_METHOD2(HRESULT,SetLight, DWORD,,LPD3DLIGHT7,lpLight) \ - ICOM_METHOD2(HRESULT,GetLight, DWORD,,LPD3DLIGHT7,lpLight) \ + ICOM_METHOD2(HRESULT,SetLight, DWORD,dwLightIndex,LPD3DLIGHT7,lpLight) \ + ICOM_METHOD2(HRESULT,GetLight, DWORD,dwLightIndex,LPD3DLIGHT7,lpLight) \ ICOM_METHOD2(HRESULT,SetRenderState, D3DRENDERSTATETYPE,dwRenderStateType, DWORD,dwRenderState) \ ICOM_METHOD2(HRESULT,GetRenderState, D3DRENDERSTATETYPE,dwRenderStateType, LPDWORD,lpdwRenderState) \ ICOM_METHOD (HRESULT,BeginStateBlock) \ @@ -840,8 +866,8 @@ ICOM_DEFINE(IDirect3DDevice3,IUnknown) ICOM_METHOD5(HRESULT,DrawPrimitiveVB, D3DPRIMITIVETYPE,d3dptPrimitiveType,LPDIRECT3DVERTEXBUFFER7,lpD3DVertexBuf,DWORD,dwStartVertex,DWORD,dwNumVertices,DWORD,dwFlags) \ ICOM_METHOD7(HRESULT,DrawIndexedPrimitiveVB, D3DPRIMITIVETYPE,d3dptPrimitiveType,LPDIRECT3DVERTEXBUFFER7,lpD3DVertexBuf,DWORD,,DWORD,,LPWORD,lpwIndices,DWORD,dwIndexCount,DWORD,dwFlags) \ ICOM_METHOD5(HRESULT,ComputeSphereVisibility, LPD3DVECTOR,lpCenters,LPD3DVALUE,lpRadii,DWORD,dwNumSpheres,DWORD,dwFlags,LPDWORD,lpdwReturnValues) \ - ICOM_METHOD2(HRESULT,GetTexture, DWORD,dwStage,LPDIRECTDRAWSURFACE7*,) \ - ICOM_METHOD2(HRESULT,SetTexture, DWORD,dwStage,LPDIRECTDRAWSURFACE7,) \ + ICOM_METHOD2(HRESULT,GetTexture, DWORD,dwStage,LPDIRECTDRAWSURFACE7*,lpTexture) \ + ICOM_METHOD2(HRESULT,SetTexture, DWORD,dwStage,LPDIRECTDRAWSURFACE7,lpTexture) \ ICOM_METHOD3(HRESULT,GetTextureStageState, DWORD,dwStage,D3DTEXTURESTAGESTATETYPE,d3dTexStageStateType,LPDWORD,lpdwState) \ ICOM_METHOD3(HRESULT,SetTextureStageState, DWORD,dwStage,D3DTEXTURESTAGESTATETYPE,d3dTexStageStateType,DWORD,dwState) \ ICOM_METHOD1(HRESULT,ValidateDevice, LPDWORD,lpdwPasses) \ @@ -850,7 +876,7 @@ ICOM_DEFINE(IDirect3DDevice3,IUnknown) ICOM_METHOD1(HRESULT,DeleteStateBlock, DWORD,) \ ICOM_METHOD2(HRESULT,CreateStateBlock, D3DSTATEBLOCKTYPE,,LPDWORD,) \ ICOM_METHOD5(HRESULT,Load, LPDIRECTDRAWSURFACE7,,LPPOINT,,LPDIRECTDRAWSURFACE7,,LPRECT,,DWORD,) \ - ICOM_METHOD2(HRESULT,LightEnable, DWORD,,BOOL,) \ + ICOM_METHOD2(HRESULT,LightEnable, DWORD,dwLightIndex,BOOL,bEnable) \ ICOM_METHOD2(HRESULT,GetLightEnable, DWORD,,BOOL*,) \ ICOM_METHOD2(HRESULT,SetClipPlane, DWORD,,D3DVALUE*,) \ ICOM_METHOD2(HRESULT,GetClipPlane, DWORD,,D3DVALUE*,) \ diff --git a/include/d3dtypes.h b/include/d3dtypes.h index 955a5901d7c..9c741e5a320 100644 --- a/include/d3dtypes.h +++ b/include/d3dtypes.h @@ -133,6 +133,10 @@ public: _D3DVECTOR& operator *= (D3DVALUE s); _D3DVECTOR& operator /= (D3DVALUE s); + /*** unary operators ***/ + friend _D3DVECTOR operator + (const _D3DVECTOR& v); + friend _D3DVECTOR operator - (const _D3DVECTOR& v); + /*** binary operators ***/ friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2); friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2); @@ -170,7 +174,7 @@ typedef struct _D3DHVERTEX { /* * Transformed/lit vertices */ -typedef struct { +typedef struct _D3DTLVERTEX { union { D3DVALUE sx; D3DVALUE dvSX; @@ -203,7 +207,15 @@ typedef struct { D3DVALUE tv; D3DVALUE dvTV; } DUMMYUNIONNAME8; - /* There are C++ members associated with this class */ +#if defined(__cplusplus) && defined(D3D_OVERLOADS) +public: + _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 } D3DTLVERTEX, *LPD3DTLVERTEX; typedef struct _D3DLVERTEX { @@ -271,15 +283,31 @@ typedef struct _D3DVERTEX { D3DVALUE tv; D3DVALUE dvTV; } DUMMYUNIONNAME8; - /* FIXME: Some C++ stuff to go here */ +#if defined(__cplusplus) && defined(D3D_OVERLOADS) +public: + _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 } D3DVERTEX, *LPD3DVERTEX; -typedef struct { +typedef struct _D3DMATRIX { D3DVALUE _11, _12, _13, _14; D3DVALUE _21, _22, _23, _24; D3DVALUE _31, _32, _33, _34; D3DVALUE _41, _42, _43, _44; - /* FIXME: Some C++ stuff here */ +#if defined(__cplusplus) && defined(D3D_OVERLOADS) + _D3DMATRIX() { } + + /* This is different from MS, but avoids anonymous structs. */ + D3DVALUE &operator () (int r, int c) + { return ((D3DVALUE [4][4])&_11)[r][c]; } + const D3DVALUE &operator() (int r, int c) const + { return ((const D3DVALUE [4][4])&_11)[r][c]; } +#endif } D3DMATRIX, *LPD3DMATRIX; #if defined(__cplusplus) && defined(D3D_OVERLOADS) @@ -802,6 +830,9 @@ typedef enum { D3DRENDERSTATE_FOGTABLESTART = 36, D3DRENDERSTATE_FOGTABLEEND = 37, D3DRENDERSTATE_FOGTABLEDENSITY = 38, + D3DRENDERSTATE_FOGSTART = 36, + D3DRENDERSTATE_FOGEND = 37, + D3DRENDERSTATE_FOGDENSITY = 38, D3DRENDERSTATE_STIPPLEENABLE = 39, D3DRENDERSTATE_EDGEANTIALIAS = 40, D3DRENDERSTATE_COLORKEYENABLE = 41, @@ -813,6 +844,7 @@ typedef enum { D3DRENDERSTATE_RANGEFOGENABLE = 48, D3DRENDERSTATE_ANISOTROPY = 49, D3DRENDERSTATE_FLUSHBATCH = 50, + D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT = 51, D3DRENDERSTATE_STENCILENABLE = 52, D3DRENDERSTATE_STENCILFAIL = 53, diff --git a/include/d3dvec.inl b/include/d3dvec.inl index 03dc5f59a21..6621b9e1e35 100644 --- a/include/d3dvec.inl +++ b/include/d3dvec.inl @@ -51,6 +51,18 @@ inline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s) return *this; } +/*** unary operators ***/ + +inline _D3DVECTOR operator + (const _D3DVECTOR& v) +{ + return v; +} + +inline _D3DVECTOR operator - (const _D3DVECTOR& v) +{ + return _D3DVECTOR(-v.x, -v.y, -v.z); +} + /*** binary operators ***/ inline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)