wined3d: Merge D3DMATRIX types into one type in WINED3D namespace.

This commit is contained in:
Ivan Gyurdiev 2006-10-12 02:21:39 -04:00 committed by Alexandre Julliard
parent ec782c2b97
commit ac37163124
10 changed files with 58 additions and 32 deletions

View File

@ -678,21 +678,24 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(LPDIRECT3DDEVICE8 iface,
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
TRACE("(%p) Relay\n" , This);
return IWineD3DDevice_SetTransform(This->WineD3DDevice, State, lpMatrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix);
}
static HRESULT WINAPI IDirect3DDevice8Impl_GetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
TRACE("(%p) Relay\n" , This);
return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, pMatrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
}
static HRESULT WINAPI IDirect3DDevice8Impl_MultiplyTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
TRACE("(%p) Relay\n" , This);
return IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, pMatrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) pMatrix);
}
static HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(LPDIRECT3DDEVICE8 iface, CONST D3DVIEWPORT8* pViewport) {

View File

@ -464,19 +464,25 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface, DWOR
static HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) Relay\n" , This);
return IWineD3DDevice_SetTransform(This->WineD3DDevice, State, lpMatrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix);
}
static HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) Relay\n" , This);
return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, pMatrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
}
static HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) Relay\n" , This);
return IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, pMatrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) pMatrix);
}
static HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface, CONST D3DVIEWPORT9* pViewport) {

View File

@ -2589,9 +2589,10 @@ IDirect3DDeviceImpl_7_SetTransform(IDirect3DDevice7 *iface,
Unhandled: D3DTRANSFORMSTATE_WORLD3
*/
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_SetTransform(This->wineD3DDevice,
type,
Matrix);
(WINED3DMATRIX*) Matrix);
}
static HRESULT WINAPI
@ -2660,7 +2661,8 @@ IDirect3DDeviceImpl_7_GetTransform(IDirect3DDevice7 *iface,
Unhandled: D3DTRANSFORMSTATE_WORLD3
*/
return IWineD3DDevice_GetTransform(This->wineD3DDevice, type, Matrix);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_GetTransform(This->wineD3DDevice, type, (WINED3DMATRIX*) Matrix);
}
static HRESULT WINAPI
@ -2726,9 +2728,10 @@ IDirect3DDeviceImpl_7_MultiplyTransform(IDirect3DDevice7 *iface,
Unhandled: D3DTRANSFORMSTATE_WORLD3
*/
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
return IWineD3DDevice_MultiplyTransform(This->wineD3DDevice,
TransformStateType,
D3DMatrix);
(WINED3DMATRIX*) D3DMatrix);
}
static HRESULT WINAPI

View File

@ -325,17 +325,19 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
TRACE("PROCESSVERTICES (%d)\n", count);
/* Get the transform and world matrix */
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice,
D3DTRANSFORMSTATE_VIEW,
&view_mat);
(WINED3DMATRIX*) &view_mat);
IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice,
D3DTRANSFORMSTATE_PROJECTION,
&proj_mat);
(WINED3DMATRIX*) &proj_mat);
IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice,
D3DTRANSFORMSTATE_WORLD,
&world_mat);
(WINED3DMATRIX*) &world_mat);
for (i = 0; i < count; i++) {
LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr;

View File

@ -2506,7 +2506,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *ifa
/*****
* Get / Set & Multiply Transform
*****/
static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE d3dts, CONST D3DMATRIX* lpmatrix) {
static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE d3dts, CONST WINED3DMATRIX* lpmatrix) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* Most of this routine, comments included copied from ddraw tree initially: */
@ -2517,7 +2517,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
TRACE("Recording... not performing anything\n");
This->updateStateBlock->changed.transform[d3dts] = TRUE;
This->updateStateBlock->set.transform[d3dts] = TRUE;
memcpy(&This->updateStateBlock->transforms[d3dts], lpmatrix, sizeof(D3DMATRIX));
memcpy(&This->updateStateBlock->transforms[d3dts], lpmatrix, sizeof(WINED3DMATRIX));
return WINED3D_OK;
}
@ -2529,7 +2529,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
*
* From here on we assume that the new matrix is different, wherever it matters.
*/
if (!memcmp(&This->stateBlock->transforms[d3dts].u.m[0][0], lpmatrix, sizeof(D3DMATRIX))) {
if (!memcmp(&This->stateBlock->transforms[d3dts].u.m[0][0], lpmatrix, sizeof(WINED3DMATRIX))) {
TRACE("The app is setting the same matrix over again\n");
return WINED3D_OK;
} else {
@ -2610,16 +2610,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) {
static HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE State, WINED3DMATRIX* pMatrix) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : for Transform State %s\n", This, debug_d3dtstype(State));
memcpy(pMatrix, &This->stateBlock->transforms[State], sizeof(D3DMATRIX));
memcpy(pMatrix, &This->stateBlock->transforms[State], sizeof(WINED3DMATRIX));
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) {
D3DMATRIX *mat = NULL;
D3DMATRIX temp;
static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE State, CONST WINED3DMATRIX* pMatrix) {
WINED3DMATRIX *mat = NULL;
WINED3DMATRIX temp;
/* Note: Using 'updateStateBlock' rather than 'stateblock' in the code
* below means it will be recorded in a state block change, but it
@ -2636,7 +2636,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface
FIXME("Unhandled transform state!!\n");
}
multiply_matrix(&temp, mat, (D3DMATRIX *) pMatrix);
multiply_matrix(&temp, mat, (WINED3DMATRIX *) pMatrix);
/* Apply change via set transform - will reapply to eg. lights this way */
return IWineD3DDeviceImpl_SetTransform(iface, State, &temp);
@ -5084,7 +5084,7 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
unsigned int i;
DWORD DestFVF = dest->fvf;
WINED3DVIEWPORT vp;
D3DMATRIX mat, proj_mat, view_mat, world_mat;
WINED3DMATRIX mat, proj_mat, view_mat, world_mat;
BOOL doClip;
int numTextures;

View File

@ -182,7 +182,7 @@ void stateblock_copy(
memcpy(Dest->streamSource, This->streamSource, sizeof(IWineD3DVertexBuffer*) * MAX_STREAMS);
memcpy(Dest->streamFreq, This->streamFreq, sizeof(UINT) * MAX_STREAMS);
memcpy(Dest->streamFlags, This->streamFlags, sizeof(UINT) * MAX_STREAMS);
memcpy(Dest->transforms, This->transforms, sizeof(D3DMATRIX) * (HIGHEST_TRANSFORMSTATE + 1));
memcpy(Dest->transforms, This->transforms, sizeof(WINED3DMATRIX) * (HIGHEST_TRANSFORMSTATE + 1));
memcpy(Dest->clipplane, This->clipplane, sizeof(double) * MAX_CLIPPLANES * 4);
memcpy(Dest->renderState, This->renderState, sizeof(DWORD) * (WINEHIGHEST_RENDER_STATE + 1));
memcpy(Dest->textures, This->textures, sizeof(IWineD3DBaseTexture*) * MAX_SAMPLERS);
@ -487,9 +487,9 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
for (i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
if (This->set.transform[i] && memcmp(&targetStateBlock->transforms[i],
&This->transforms[i],
sizeof(D3DMATRIX)) != 0) {
sizeof(WINED3DMATRIX)) != 0) {
TRACE("Updating transform %d\n", i);
memcpy(&This->transforms[i], &targetStateBlock->transforms[i], sizeof(D3DMATRIX));
memcpy(&This->transforms[i], &targetStateBlock->transforms[i], sizeof(WINED3DMATRIX));
}
}

View File

@ -2450,8 +2450,8 @@ WINED3DFORMAT pixelformat_for_depth(DWORD depth) {
}
}
void multiply_matrix(D3DMATRIX *dest, D3DMATRIX *src1, D3DMATRIX *src2) {
D3DMATRIX temp;
void multiply_matrix(WINED3DMATRIX *dest, WINED3DMATRIX *src1, WINED3DMATRIX *src2) {
WINED3DMATRIX temp;
/* Now do the multiplication 'by hand'.
I know that all this could be optimised, but this will be done later :-) */

View File

@ -1111,7 +1111,7 @@ struct IWineD3DStateBlockImpl
UINT baseVertexIndex; /* Note: only used for d3d8 */
/* Transform */
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
WINED3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
/* Lights */
PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
@ -1269,7 +1269,7 @@ void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords)
int D3DFmtMakeGlCfg(WINED3DFORMAT BackBufferFormat, WINED3DFORMAT StencilBufferFormat, int *attribs, int* nAttribs, BOOL alternate);
/* Math utils */
void multiply_matrix(D3DMATRIX *dest, D3DMATRIX *src1, D3DMATRIX *src2);
void multiply_matrix(WINED3DMATRIX *dest, WINED3DMATRIX *src1, WINED3DMATRIX *src2);
/*****************************************************************************
* To enable calling of inherited functions, requires prototypes

View File

@ -425,8 +425,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD(GetTexture)(THIS_ DWORD Stage, struct IWineD3DBaseTexture** ppTexture) PURE;
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;
STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type,DWORD *pValue) PURE;
STDMETHOD(SetTransform)(THIS_ WINED3DTRANSFORMSTATETYPE State, CONST D3DMATRIX * pMatrix) PURE;
STDMETHOD(GetTransform)(THIS_ WINED3DTRANSFORMSTATETYPE State, D3DMATRIX * pMatrix) PURE;
STDMETHOD(SetTransform)(THIS_ WINED3DTRANSFORMSTATETYPE State, CONST WINED3DMATRIX * pMatrix) PURE;
STDMETHOD(GetTransform)(THIS_ WINED3DTRANSFORMSTATETYPE State, WINED3DMATRIX * pMatrix) PURE;
STDMETHOD(SetVertexDeclaration)(THIS_ struct IWineD3DVertexDeclaration* pDecl) PURE;
STDMETHOD(GetVertexDeclaration)(THIS_ struct IWineD3DVertexDeclaration** ppDecl) PURE;
STDMETHOD(SetVertexShader)(THIS_ struct IWineD3DVertexShader* pShader) PURE;
@ -439,7 +439,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister, float* pConstantData, UINT Vector4fCount) PURE;
STDMETHOD(SetViewport)(THIS_ CONST WINED3DVIEWPORT * pViewport) PURE;
STDMETHOD(GetViewport)(THIS_ WINED3DVIEWPORT * pViewport) PURE;
STDMETHOD(MultiplyTransform)(THIS_ WINED3DTRANSFORMSTATETYPE State, CONST D3DMATRIX * pMatrix) PURE;
STDMETHOD(MultiplyTransform)(THIS_ WINED3DTRANSFORMSTATETYPE State, CONST WINED3DMATRIX * pMatrix) PURE;
STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE;
STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, struct IWineD3DVertexBuffer* pDestBuffer, struct IWineD3DVertexBuffer* pVertexDecl, DWORD Flags) PURE;
STDMETHOD(BeginStateBlock)(THIS) PURE;

View File

@ -52,6 +52,18 @@ typedef struct _WINED3DVECTOR {
float z;
} WINED3DVECTOR;
typedef struct _WINED3DMATRIX {
union {
struct {
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
} DUMMYSTRUCTNAME;
float m[4][4];
} DUMMYUNIONNAME;
} WINED3DMATRIX;
typedef struct _WINED3DLIGHT {
WINED3DLIGHTTYPE Type;
WINED3DCOLORVALUE Diffuse;