diff --git a/dlls/d3dx8/Makefile.in b/dlls/d3dx8/Makefile.in index 0f61ee293a3..a6edd23f9cb 100644 --- a/dlls/d3dx8/Makefile.in +++ b/dlls/d3dx8/Makefile.in @@ -7,8 +7,8 @@ IMPORTLIB = d3dx8 IMPORTS = dxguid uuid kernel32 C_SRCS = \ + core.c \ d3dx8_main.c \ - d3dxbuffer.c \ math.c \ mesh.c diff --git a/dlls/d3dx8/d3dxbuffer.c b/dlls/d3dx8/core.c similarity index 56% rename from dlls/d3dx8/d3dxbuffer.c rename to dlls/d3dx8/core.c index 56591c015eb..da821fc9d35 100644 --- a/dlls/d3dx8/d3dxbuffer.c +++ b/dlls/d3dx8/core.c @@ -1,5 +1,4 @@ /* - * ID3DXBuffer implementation * * Copyright 2002 Raphael Junqueira * @@ -18,27 +17,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #define COBJMACROS #include "windef.h" #include "winbase.h" -#include "winuser.h" #include "wingdi.h" #include "wine/debug.h" +#include "wine/unicode.h" -#include "d3d8.h" #include "d3dx8_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3dx); /* ID3DXBuffer IUnknown parts follow: */ static HRESULT WINAPI ID3DXBufferImpl_QueryInterface(LPD3DXBUFFER iface, REFIID riid, LPVOID* ppobj) { ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface; - + if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXBuffer)) { IUnknown_AddRef(iface); @@ -91,3 +86,63 @@ const ID3DXBufferVtbl D3DXBuffer_Vtbl = ID3DXBufferImpl_GetBufferPointer, ID3DXBufferImpl_GetBufferSize }; + +HRESULT WINAPI D3DXCreateBuffer(DWORD NumBytes, LPD3DXBUFFER* ppBuffer) { + ID3DXBufferImpl *object; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXBufferImpl)); + if (NULL == object) { + *ppBuffer = NULL; + return E_OUTOFMEMORY; + } + object->lpVtbl = &D3DXBuffer_Vtbl; + object->ref = 1; + object->bufferSize = NumBytes; + object->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, NumBytes); + if (NULL == object->buffer) { + HeapFree(GetProcessHeap(), 0, object); + *ppBuffer = NULL; + return E_OUTOFMEMORY; + } + *ppBuffer = (LPD3DXBUFFER)object; + return D3D_OK; +} + +HRESULT WINAPI D3DXAssembleShader(LPCVOID pSrcData, UINT SrcDataLen, DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors) { + FIXME("(void): stub\n"); + return D3D_OK; +} + +HRESULT WINAPI D3DXAssembleShaderFromFileA(LPCSTR pSrcFile, DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors) { + LPWSTR pSrcFileW = NULL; + DWORD len; + HRESULT ret; + + if (!pSrcFile) return D3DXERR_INVALIDDATA; + + len = MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, NULL, 0 ); + pSrcFileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, pSrcFileW, len ); + ret=D3DXAssembleShaderFromFileW(pSrcFileW, Flags, ppConstants, ppCompiledShader, ppCompilationErrors); + HeapFree( GetProcessHeap(), 0, pSrcFileW ); + return ret; +} + +HRESULT WINAPI D3DXAssembleShaderFromFileW(LPCWSTR pSrcFile, DWORD Flags, + LPD3DXBUFFER* ppConstants, + LPD3DXBUFFER* ppCompiledShader, + LPD3DXBUFFER* ppCompilationErrors) { + FIXME("(void): stub\n"); + return D3D_OK; +} + +HRESULT WINAPI D3DXCreateFont(LPDIRECT3DDEVICE8 pDevice, HFONT hFont, LPD3DXFONT* ppFont) { + FIXME("(void): stub\n"); + return D3D_OK; +} diff --git a/dlls/d3dx8/d3dx8_main.c b/dlls/d3dx8/d3dx8_main.c index dbb6dcd1e89..4fb860a7313 100644 --- a/dlls/d3dx8/d3dx8_main.c +++ b/dlls/d3dx8/d3dx8_main.c @@ -19,85 +19,10 @@ * */ -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" #include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "wine/debug.h" -#include "wine/unicode.h" -#include "d3dx8_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - -HRESULT WINAPI D3DXCreateBuffer(DWORD NumBytes, LPD3DXBUFFER* ppBuffer) { - ID3DXBufferImpl *object; - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXBufferImpl)); - if (NULL == object) { - *ppBuffer = NULL; - return E_OUTOFMEMORY; - } - object->lpVtbl = &D3DXBuffer_Vtbl; - object->ref = 1; - object->bufferSize = NumBytes; - object->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, NumBytes); - if (NULL == object->buffer) { - HeapFree(GetProcessHeap(), 0, object); - *ppBuffer = NULL; - return E_OUTOFMEMORY; - } - *ppBuffer = (LPD3DXBUFFER)object; - return D3D_OK; -} - -HRESULT WINAPI D3DXCreateFont(LPDIRECT3DDEVICE8 pDevice, HFONT hFont, LPD3DXFONT* ppFont) { - FIXME("(void): stub\n"); - return D3D_OK; -} - -UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF) { - FIXME("(void): stub\n"); - return 0; -} - -HRESULT WINAPI D3DXAssembleShader(LPCVOID pSrcData, UINT SrcDataLen, DWORD Flags, - LPD3DXBUFFER* ppConstants, - LPD3DXBUFFER* ppCompiledShader, - LPD3DXBUFFER* ppCompilationErrors) { - FIXME("(void): stub\n"); - return D3D_OK; -} - -HRESULT WINAPI D3DXAssembleShaderFromFileA(LPCSTR pSrcFile, DWORD Flags, - LPD3DXBUFFER* ppConstants, - LPD3DXBUFFER* ppCompiledShader, - LPD3DXBUFFER* ppCompilationErrors) { - LPWSTR pSrcFileW = NULL; - DWORD len; - HRESULT ret; - - if (!pSrcFile) return D3DXERR_INVALIDDATA; - - len = MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, NULL, 0 ); - pSrcFileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, pSrcFileW, len ); - ret=D3DXAssembleShaderFromFileW(pSrcFileW, Flags, ppConstants, ppCompiledShader, ppCompilationErrors); - HeapFree( GetProcessHeap(), 0, pSrcFileW ); - return ret; -} - -HRESULT WINAPI D3DXAssembleShaderFromFileW(LPCWSTR pSrcFile, DWORD Flags, - LPD3DXBUFFER* ppConstants, - LPD3DXBUFFER* ppCompiledShader, - LPD3DXBUFFER* ppCompilationErrors) { - FIXME("(void): stub\n"); - return D3D_OK; -} /*********************************************************************** * DllMain. diff --git a/dlls/d3dx8/mesh.c b/dlls/d3dx8/mesh.c index 88e9b87867f..456bad2e05e 100644 --- a/dlls/d3dx8/mesh.c +++ b/dlls/d3dx8/mesh.c @@ -16,9 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include + #include "windef.h" +#include "winbase.h" #include "wingdi.h" -#include "d3dx8.h" +#include "wine/debug.h" + +#include "d3dx8_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3dx); BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *pmin, CONST D3DXVECTOR3 *pmax, CONST D3DXVECTOR3 *prayposition, CONST D3DXVECTOR3 *praydirection) @@ -90,6 +97,12 @@ done we've got an intersection of the ray with the box. return TRUE; } +UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF) +{ + FIXME("(void): stub\n"); + return 0; +} + BOOL CDECL D3DXIntersectTri(CONST D3DXVECTOR3 *p0, CONST D3DXVECTOR3 *p1, CONST D3DXVECTOR3 *p2, CONST D3DXVECTOR3 *praypos, CONST D3DXVECTOR3 *praydir, FLOAT *pu, FLOAT *pv, FLOAT *pdist) { D3DXMATRIX m;