d3dx8: Move some functions into core.c to match the header file layout.

This commit is contained in:
David Adam 2009-02-06 12:04:37 +01:00 committed by Alexandre Julliard
parent fb04bcf638
commit edef19f8d6
4 changed files with 78 additions and 85 deletions

View File

@ -7,8 +7,8 @@ IMPORTLIB = d3dx8
IMPORTS = dxguid uuid kernel32
C_SRCS = \
core.c \
d3dx8_main.c \
d3dxbuffer.c \
math.c \
mesh.c

View File

@ -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 <stdarg.h>
#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;
}

View File

@ -19,85 +19,10 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#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.

View File

@ -16,9 +16,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#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;