Commit 14a98e3d authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Remove the d3dx8 dll.

parent 245dbcf1
......@@ -25177,22 +25177,6 @@ dlls/d3drm/tests/Makefile: dlls/d3drm/tests/Makefile.in dlls/Maketest.rules"
ac_config_files="$ac_config_files dlls/d3drm/tests/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/d3dx8/Makefile"
test "x$enable_d3dx8" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
d3dx8"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/d3dx8/Makefile: dlls/d3dx8/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/d3dx8/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/d3dx8/tests/Makefile"
test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\
d3dx8/tests"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/d3dx8/tests/Makefile: dlls/d3dx8/tests/Makefile.in dlls/Maketest.rules"
ac_config_files="$ac_config_files dlls/d3dx8/tests/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/d3dx9_24/Makefile"
test "x$enable_d3dx9_24" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
d3dx9_24"
......@@ -29449,8 +29433,6 @@ do
"dlls/d3dim/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dim/Makefile" ;;
"dlls/d3drm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3drm/Makefile" ;;
"dlls/d3drm/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3drm/tests/Makefile" ;;
"dlls/d3dx8/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx8/Makefile" ;;
"dlls/d3dx8/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx8/tests/Makefile" ;;
"dlls/d3dx9_24/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx9_24/Makefile" ;;
"dlls/d3dx9_25/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx9_25/Makefile" ;;
"dlls/d3dx9_26/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx9_26/Makefile" ;;
......
......@@ -2078,8 +2078,6 @@ WINE_CONFIG_MAKEFILE([dlls/d3d9/tests/Makefile],[dlls/Maketest.rules],[dlls],[AL
WINE_CONFIG_MAKEFILE([dlls/d3dim/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/d3drm/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/d3drm/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
WINE_CONFIG_MAKEFILE([dlls/d3dx8/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/d3dx8/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
WINE_CONFIG_MAKEFILE([dlls/d3dx9_24/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/d3dx9_25/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/d3dx9_26/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
......
......@@ -116,7 +116,6 @@ IMPORT_LIBS = \
d3d9/libd3d9.$(IMPLIBEXT) \
d3dim/libd3dim.$(IMPLIBEXT) \
d3drm/libd3drm.$(IMPLIBEXT) \
d3dx8/libd3dx8.$(IMPLIBEXT) \
d3dx9_36/libd3dx9.$(IMPLIBEXT) \
d3dxof/libd3dxof.$(IMPLIBEXT) \
dbghelp/libdbghelp.$(IMPLIBEXT) \
......@@ -263,7 +262,6 @@ CROSS_IMPLIBS = \
d3d9/libd3d9.a \
d3dim/libd3dim.a \
d3drm/libd3drm.a \
d3dx8/libd3dx8.a \
d3dx9_36/libd3dx9.a \
d3dxof/libd3dxof.a \
dbghelp/libdbghelp.a \
......@@ -468,9 +466,6 @@ d3dim/libd3dim.def d3dim/libd3dim.a: d3dim/d3dim.spec $(WINEBUILD)
d3drm/libd3drm.def d3drm/libd3drm.a: d3drm/d3drm.spec $(WINEBUILD)
@cd d3drm && $(MAKE) `basename $@`
d3dx8/libd3dx8.def d3dx8/libd3dx8.a: d3dx8/d3dx8.spec $(WINEBUILD)
@cd d3dx8 && $(MAKE) `basename $@`
d3dx9_36/libd3dx9.def d3dx9_36/libd3dx9.a: d3dx9_36/d3dx9_36.spec $(WINEBUILD)
@cd d3dx9_36 && $(MAKE) `basename $@`
......
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = d3dx8.dll
IMPORTLIB = d3dx8
IMPORTS = dxguid uuid kernel32
C_SRCS = \
core.c \
d3dx8_main.c \
math.c \
mesh.c
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
/*
*
* Copyright 2002 Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "d3dx8_private.h"
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);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI ID3DXBufferImpl_AddRef(LPD3DXBUFFER iface) {
ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) : AddRef from %d\n", This, ref - 1);
return ref;
}
static ULONG WINAPI ID3DXBufferImpl_Release(LPD3DXBUFFER iface) {
ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This->buffer);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* ID3DXBuffer Interface follow: */
static LPVOID WINAPI ID3DXBufferImpl_GetBufferPointer(LPD3DXBUFFER iface) {
ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
return This->buffer;
}
static DWORD WINAPI ID3DXBufferImpl_GetBufferSize(LPD3DXBUFFER iface) {
ID3DXBufferImpl *This = (ID3DXBufferImpl *)iface;
return This->bufferSize;
}
const ID3DXBufferVtbl D3DXBuffer_Vtbl =
{
ID3DXBufferImpl_QueryInterface,
ID3DXBufferImpl_AddRef,
ID3DXBufferImpl_Release,
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;
}
@ stdcall D3DXVec2Normalize(ptr ptr)
@ stdcall D3DXVec2Hermite(ptr ptr ptr ptr ptr long)
@ stdcall D3DXVec2CatmullRom(ptr ptr ptr ptr ptr long)
@ stdcall D3DXVec2BaryCentric(ptr ptr ptr ptr long long)
@ stdcall D3DXVec2Transform(ptr ptr ptr)
@ stdcall D3DXVec2TransformCoord(ptr ptr ptr)
@ stdcall D3DXVec2TransformNormal(ptr ptr ptr)
@ stdcall D3DXVec3Normalize(ptr ptr)
@ stdcall D3DXVec3Hermite(ptr ptr ptr ptr ptr long)
@ stdcall D3DXVec3CatmullRom(ptr ptr ptr ptr ptr long)
@ stdcall D3DXVec3BaryCentric(ptr ptr ptr ptr long long)
@ stdcall D3DXVec3Transform(ptr ptr ptr)
@ stdcall D3DXVec3TransformCoord(ptr ptr ptr)
@ stdcall D3DXVec3TransformNormal(ptr ptr ptr)
@ stdcall D3DXVec3Project(ptr ptr ptr ptr ptr ptr)
@ stdcall D3DXVec3Unproject(ptr ptr ptr ptr ptr ptr)
@ stdcall D3DXVec4Cross(ptr ptr ptr ptr)
@ stdcall D3DXVec4Normalize(ptr ptr)
@ stdcall D3DXVec4Hermite(ptr ptr ptr ptr ptr long)
@ stdcall D3DXVec4CatmullRom(ptr ptr ptr ptr ptr long)
@ stdcall D3DXVec4BaryCentric(ptr ptr ptr ptr long long)
@ stdcall D3DXVec4Transform(ptr ptr ptr)
@ stdcall D3DXMatrixfDeterminant(ptr)
@ stdcall D3DXMatrixMultiply(ptr ptr ptr)
@ stdcall D3DXMatrixMultiplyTranspose(ptr ptr ptr)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXMatrixInverse(ptr ptr ptr)
@ stdcall D3DXMatrixScaling(ptr long long long)
@ stdcall D3DXMatrixTranslation(ptr long long long)
@ stdcall D3DXMatrixRotationX(ptr long)
@ stdcall D3DXMatrixRotationY(ptr long)
@ stdcall D3DXMatrixRotationZ(ptr long)
@ stdcall D3DXMatrixRotationAxis(ptr ptr long)
@ stdcall D3DXMatrixRotationQuaternion(ptr ptr)
@ stdcall D3DXMatrixRotationYawPitchRoll(ptr long long long)
@ stdcall D3DXMatrixTransformation(ptr ptr ptr ptr ptr ptr ptr)
@ stdcall D3DXMatrixAffineTransformation(ptr long ptr ptr ptr)
@ stdcall D3DXMatrixLookAtRH(ptr ptr ptr ptr)
@ stdcall D3DXMatrixLookAtLH(ptr ptr ptr ptr)
@ stdcall D3DXMatrixPerspectiveRH(ptr long long long long)
@ stdcall D3DXMatrixPerspectiveLH(ptr long long long long)
@ stdcall D3DXMatrixPerspectiveFovRH(ptr long long long long)
@ stdcall D3DXMatrixPerspectiveFovLH(ptr long long long long)
@ stdcall D3DXMatrixPerspectiveOffCenterRH(ptr long long long long long long)
@ stdcall D3DXMatrixPerspectiveOffCenterLH(ptr long long long long long long)
@ stdcall D3DXMatrixOrthoRH(ptr long long long long)
@ stdcall D3DXMatrixOrthoLH(ptr long long long long)
@ stdcall D3DXMatrixOrthoOffCenterRH(ptr long long long long long long)
@ stdcall D3DXMatrixOrthoOffCenterLH(ptr long long long long long long)
@ stdcall D3DXMatrixShadow(ptr ptr ptr)
@ stdcall D3DXMatrixReflect(ptr ptr)
@ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr)
@ stdcall D3DXQuaternionRotationMatrix(ptr ptr)
@ stdcall D3DXQuaternionRotationAxis(ptr ptr long)
@ stdcall D3DXQuaternionRotationYawPitchRoll(ptr long long long)
@ stdcall D3DXQuaternionMultiply(ptr ptr ptr)
@ stdcall D3DXQuaternionNormalize(ptr ptr)
@ stdcall D3DXQuaternionInverse(ptr ptr)
@ stdcall D3DXQuaternionLn(ptr ptr)
@ stdcall D3DXQuaternionExp(ptr ptr)
@ stdcall D3DXQuaternionSlerp(ptr ptr ptr long)
@ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr long)
@ stdcall D3DXQuaternionBaryCentric(ptr ptr ptr ptr long long)
@ stdcall D3DXPlaneNormalize(ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneTransform(ptr ptr ptr)
@ stdcall D3DXColorAdjustSaturation(ptr ptr long)
@ stdcall D3DXColorAdjustContrast(ptr ptr long)
@ stdcall D3DXFresnelTerm(long long)
@ stdcall D3DXCreateMatrixStack(long ptr)
@ stdcall D3DXCreateFont(ptr ptr ptr)
@ stub D3DXCreateFontIndirect
@ stub D3DXCreateSprite
@ stub D3DXCreateRenderToSurface
@ stub D3DXCreateRenderToEnvMap
@ stdcall D3DXAssembleShaderFromFileA(ptr long ptr ptr ptr)
@ stdcall D3DXAssembleShaderFromFileW(ptr long ptr ptr ptr)
@ stdcall D3DXGetFVFVertexSize(long)
@ stub D3DXGetErrorStringA
@ stub D3DXGetErrorStringW
@ stdcall D3DXAssembleShader(ptr long long ptr ptr ptr)
@ stub D3DXCompileEffectFromFileA
@ stub D3DXCompileEffectFromFileW
@ stub D3DXCompileEffect
@ stub D3DXCreateEffect
@ stub D3DXCreateMesh
@ stub D3DXCreateMeshFVF
@ stub D3DXCreateSPMesh
@ stub D3DXCleanMesh
@ stub D3DXValidMesh
@ stub D3DXGeneratePMesh
@ stub D3DXSimplifyMesh
@ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
@ stdcall D3DXComputeBoundingBox(ptr long long ptr ptr)
@ stub D3DXComputeNormals
@ stdcall D3DXCreateBuffer(long ptr)
@ stub D3DXLoadMeshFromX
@ stub D3DXSaveMeshToX
@ stub D3DXCreatePMeshFromStream
@ stub D3DXCreateSkinMesh
@ stub D3DXCreateSkinMeshFVF
@ stub D3DXCreateSkinMeshFromMesh
@ stub D3DXLoadMeshFromXof
@ stub D3DXLoadSkinMeshFromXof
@ stub D3DXTesselateMesh
@ stub D3DXDeclaratorFromFVF
@ stub D3DXFVFFromDeclarator
@ stub D3DXWeldVertices
@ stub D3DXIntersect
@ cdecl D3DXIntersectTri(ptr ptr ptr ptr ptr ptr ptr ptr)
@ stdcall D3DXSphereBoundProbe(ptr long ptr ptr)
@ stdcall D3DXBoxBoundProbe(ptr ptr ptr ptr)
@ stub D3DXCreatePolygon
@ stub D3DXCreateBox
@ stub D3DXCreateCylinder
@ stub D3DXCreateSphere
@ stub D3DXCreateTorus
@ stub D3DXCreateTeapot
@ stub D3DXCreateTextA
@ stub D3DXCreateTextW
@ stub D3DXLoadSurfaceFromFileA
@ stub D3DXLoadSurfaceFromFileW
@ stub D3DXLoadSurfaceFromResourceA
@ stub D3DXLoadSurfaceFromResourceW
@ stub D3DXLoadSurfaceFromFileInMemory
@ stub D3DXLoadSurfaceFromSurface
@ stub D3DXLoadSurfaceFromMemory
@ stub D3DXLoadVolumeFromVolume
@ stub D3DXLoadVolumeFromMemory
@ stub D3DXCheckTextureRequirements
@ stub D3DXCreateTexture
@ stub D3DXCreateTextureFromFileA
@ stub D3DXCreateTextureFromFileW
@ stub D3DXCreateTextureFromResourceA
@ stub D3DXCreateTextureFromResourceW
@ stub D3DXCreateTextureFromFileExA
@ stub D3DXCreateTextureFromFileExW
@ stub D3DXCreateTextureFromResourceExA
@ stub D3DXCreateTextureFromResourceExW
@ stub D3DXCreateTextureFromFileInMemory
@ stub D3DXCreateTextureFromFileInMemoryEx
@ stub D3DXFilterTexture
@ stub D3DXCheckCubeTextureRequirements
@ stub D3DXCreateCubeTexture
@ stub D3DXCreateCubeTextureFromFileA
@ stub D3DXCreateCubeTextureFromFileW
@ stub D3DXCreateCubeTextureFromFileExA
@ stub D3DXCreateCubeTextureFromFileExW
@ stub D3DXCreateCubeTextureFromFileInMemory
@ stub D3DXCreateCubeTextureFromFileInMemoryEx
@ stub D3DXFilterCubeTexture
@ stub D3DXCheckVolumeTextureRequirements
@ stub D3DXCreateVolumeTexture
@ stub D3DXFilterVolumeTexture
/*
* Direct3D X 8 main file
*
* Copyright (C) 2002 Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
/***********************************************************************
* DllMain.
*/
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{
switch(reason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(inst);
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
/*
* Direct3D X 8 private include file
*
* Copyright 2002 Raphael Junqueira
* Copyright 2007 David Adam
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_D3DX8_PRIVATE_H
#define __WINE_D3DX8_PRIVATE_H
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "d3dx8.h"
/* Interfaces */
typedef struct ID3DXBufferImpl ID3DXBufferImpl;
typedef struct ID3DXFontImpl ID3DXFontImpl;
typedef struct ID3DXMatrixStackImpl ID3DXMatrixStackImpl;
/* ----------- */
/* ID3DXBuffer */
/* ----------- */
/*****************************************************************************
* Predeclare the interface implementation structures
*/
extern const ID3DXBufferVtbl D3DXBuffer_Vtbl;
/*****************************************************************************
* ID3DXBufferImpl implementation structure
*/
struct ID3DXBufferImpl
{
/* IUnknown fields */
const ID3DXBufferVtbl *lpVtbl;
LONG ref;
/* ID3DXBuffer fields */
DWORD *buffer;
DWORD bufferSize;
};
/* --------- */
/* ID3DXFont */
/* --------- */
/*****************************************************************************
* ID3DXFontImpl implementation structure
*/
struct ID3DXFontImpl
{
/* IUnknown fields */
const ID3DXFontVtbl *lpVtbl;
LONG ref;
/* ID3DXFont fields */
};
/* ----------- */
/* ID3DXMatrix */
/* ----------- */
/*****************************************************************************
* ID3DXMatrixStackImpl implementation structure
*/
struct ID3DXMatrixStackImpl
{
/* IUnknown fields */
const ID3DXMatrixStackVtbl *lpVtbl;
LONG ref;
/* ID3DXMatrixStack fields */
unsigned int current;
unsigned int stack_size;
D3DXMATRIX *stack;
};
#endif /*__WINE_D3DX8_PRIVATE_H */
/*
* Copyright 2008 David Adam
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* 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_private.h"
BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *pmin, CONST D3DXVECTOR3 *pmax, CONST D3DXVECTOR3 *prayposition, CONST D3DXVECTOR3 *praydirection)
/* Algorithm taken from the article: An Efficient and Robust Ray-Box Intersection Algoritm
Amy Williams University of Utah
Steve Barrus University of Utah
R. Keith Morley University of Utah
Peter Shirley University of Utah
International Conference on Computer Graphics and Interactive Techniques archive
ACM SIGGRAPH 2005 Courses
Los Angeles, California
This algorithm is free of patents or of copyrights, as confirmed by Peter Shirley himself.
Algorithm: Consider the box as the intersection of three slabs. Clip the ray
against each slab, if there's anything left of the ray after we're
done we've got an intersection of the ray with the box.
*/
{
FLOAT div, tmin, tmax, tymin, tymax, tzmin, tzmax;
div = 1.0f / praydirection->x;
if ( div >= 0.0f )
{
tmin = ( pmin->x - prayposition->x ) * div;
tmax = ( pmax->x - prayposition->x ) * div;
}
else
{
tmin = ( pmax->x - prayposition->x ) * div;
tmax = ( pmin->x - prayposition->x ) * div;
}
if ( tmax < 0.0f ) return FALSE;
div = 1.0f / praydirection->y;
if ( div >= 0.0f )
{
tymin = ( pmin->y - prayposition->y ) * div;
tymax = ( pmax->y - prayposition->y ) * div;
}
else
{
tymin = ( pmax->y - prayposition->y ) * div;
tymax = ( pmin->y - prayposition->y ) * div;
}
if ( ( tymax < 0.0f ) || ( tmin > tymax ) || ( tymin > tmax ) ) return FALSE;
if ( tymin > tmin ) tmin = tymin;
if ( tymax < tmax ) tmax = tymax;
div = 1.0f / praydirection->z;
if ( div >= 0.0f )
{
tzmin = ( pmin->z - prayposition->z ) * div;
tzmax = ( pmax->z - prayposition->z ) * div;
}
else
{
tzmin = ( pmax->z - prayposition->z ) * div;
tzmax = ( pmin->z - prayposition->z ) * div;
}
if ( (tzmax < 0.0f ) || ( tmin > tzmax ) || ( tzmin > tmax ) ) return FALSE;
return TRUE;
}
HRESULT WINAPI D3DXComputeBoundingBox(PVOID ppointsFVF, DWORD numvertices, DWORD FVF, D3DXVECTOR3 *pmin, D3DXVECTOR3 *pmax)
{
D3DXVECTOR3 vec;
unsigned int i;
if( !ppointsFVF || !pmin || !pmax ) return D3DERR_INVALIDCALL;
*pmin = *(D3DXVECTOR3*)((char*)ppointsFVF);
*pmax = *pmin;
/* It looks like that D3DXComputeBoundingBox does not take in account the last vertex. */
for(i=0; i<numvertices-1; i++)
{
vec = *(D3DXVECTOR3*)((char*)ppointsFVF + D3DXGetFVFVertexSize(FVF) * i);
if ( vec.x < pmin->x ) pmin->x = vec.x;
if ( vec.x > pmax->x ) pmax->x = vec.x;
if ( vec.y < pmin->y ) pmin->y = vec.y;
if ( vec.y > pmax->y ) pmax->y = vec.y;
if ( vec.z < pmin->z ) pmin->z = vec.z;
if ( vec.z > pmax->z ) pmax->z = vec.z;
}
return D3D_OK;
}
HRESULT WINAPI D3DXComputeBoundingSphere(PVOID ppointsFVF, DWORD numvertices, DWORD FVF, D3DXVECTOR3 *pcenter, FLOAT *pradius)
{
D3DXVECTOR3 temp, temp1;
FLOAT d;
unsigned int i;
if( !ppointsFVF || !pcenter || !pradius ) return D3DERR_INVALIDCALL;
temp.x = 0.0f;
temp.y = 0.0f;
temp.z = 0.0f;
temp1 = temp;
d = 0.0f;
*pradius = 0.0f;
for(i=0; i<numvertices; i++)
{
D3DXVec3Add(&temp1, &temp, (D3DXVECTOR3*)((char*)ppointsFVF + D3DXGetFVFVertexSize(FVF) * i));
temp = temp1;
}
D3DXVec3Scale(pcenter, &temp, 1.0f/((FLOAT)numvertices));
for(i=0; i<numvertices; i++)
{
d = D3DXVec3Length(D3DXVec3Subtract(&temp, (D3DXVECTOR3*)((char*)ppointsFVF + D3DXGetFVFVertexSize(FVF) * i), pcenter));
if ( d > *pradius ) *pradius = d;
}
return D3D_OK;
}
static UINT Get_TexCoord_Size_From_FVF(DWORD FVF, int tex_num)
{
return (((((FVF) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1);
}
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF)
{
DWORD size = 0;
UINT i;
UINT numTextures = (FVF & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT;
if (FVF & D3DFVF_NORMAL) size += sizeof(D3DXVECTOR3);
if (FVF & D3DFVF_DIFFUSE) size += sizeof(DWORD);
if (FVF & D3DFVF_SPECULAR) size += sizeof(DWORD);
if (FVF & D3DFVF_PSIZE) size += sizeof(DWORD);
switch (FVF & D3DFVF_POSITION_MASK)
{
case D3DFVF_XYZ: size += sizeof(D3DXVECTOR3); break;
case D3DFVF_XYZRHW: size += 4 * sizeof(FLOAT); break;
case D3DFVF_XYZB1: size += 4 * sizeof(FLOAT); break;
case D3DFVF_XYZB2: size += 5 * sizeof(FLOAT); break;
case D3DFVF_XYZB3: size += 6 * sizeof(FLOAT); break;
case D3DFVF_XYZB4: size += 7 * sizeof(FLOAT); break;
case D3DFVF_XYZB5: size += 8 * sizeof(FLOAT); break;
}
for (i = 0; i < numTextures; i++)
{
size += Get_TexCoord_Size_From_FVF(FVF, i) * sizeof(FLOAT);
}
return size;
}
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;
D3DXVECTOR4 vec;
m.m[0][0] = p1->x - p0->x;
m.m[1][0] = p2->x - p0->x;
m.m[2][0] = -praydir->x;
m.m[3][0] = 0.0f;
m.m[0][1] = p1->y - p0->z;
m.m[1][1] = p2->y - p0->z;
m.m[2][1] = -praydir->y;
m.m[3][1] = 0.0f;
m.m[0][2] = p1->z - p0->z;
m.m[1][2] = p2->z - p0->z;
m.m[2][2] = -praydir->z;
m.m[3][2] = 0.0f;
m.m[0][3] = 0.0f;
m.m[1][3] = 0.0f;
m.m[2][3] = 0.0f;
m.m[3][3] = 1.0f;
vec.x = praypos->x - p0->x;
vec.y = praypos->y - p0->y;
vec.z = praypos->z - p0->z;
vec.w = 0.0f;
if ( D3DXMatrixInverse(&m, NULL, &m) )
{
D3DXVec4Transform(&vec, &vec, &m);
if ( (vec.x >= 0.0f) && (vec.y >= 0.0f) && (vec.x + vec.y <= 1.0f) && (vec.z >= 0.0f) )
{
*pu = vec.x;
*pv = vec.y;
*pdist = fabs( vec.z );
return TRUE;
}
}
return FALSE;
}
BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *pcenter, FLOAT radius, CONST D3DXVECTOR3 *prayposition, CONST D3DXVECTOR3 *praydirection)
{
D3DXVECTOR3 difference;
FLOAT a, b, c, d;
a = D3DXVec3LengthSq(praydirection);
if (!D3DXVec3Subtract(&difference, prayposition, pcenter)) return FALSE;
b = D3DXVec3Dot(&difference, praydirection);
c = D3DXVec3LengthSq(&difference) - radius * radius;
d = b * b - a * c;
if ( ( d <= 0.0f ) || ( sqrt(d) <= b ) ) return FALSE;
return TRUE;
}
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = d3dx8.dll
IMPORTS = d3dx8 kernel32
CTESTS = \
math.c \
mesh.c
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment