d3dx8: Remove the d3dx8 dll.

This commit is contained in:
David Adam 2009-07-11 18:12:12 +02:00 committed by Alexandre Julliard
parent 245dbcf1f7
commit 14a98e3dc6
13 changed files with 0 additions and 4187 deletions

18
configure vendored
View File

@ -25176,22 +25176,6 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
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 \\
@ -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" ;;

View File

@ -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])

View File

@ -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 $@`

View File

@ -1,17 +0,0 @@
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

View File

@ -1,148 +0,0 @@
/*
*
* 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;
}

View File

@ -1,156 +0,0 @@
@ 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

View File

@ -1,43 +0,0 @@
/*
* 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;
}

View File

@ -1,94 +0,0 @@
/*
* 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 */

File diff suppressed because it is too large Load Diff

View File

@ -1,247 +0,0 @@
/*
* 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;
}

View File

@ -1,14 +0,0 @@
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

File diff suppressed because it is too large Load Diff

View File

@ -1,396 +0,0 @@
/*
* Copyright 2008 David Adam
* Copyright 2008 Luis Busquets
*
* 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 "d3dx8.h"
#include "wine/test.h"
#define admitted_error 0.0001f
#define compare_vertex_sizes(type, exp) \
got=D3DXGetFVFVertexSize(type); \
ok(got==exp, "Expected: %d, Got: %d\n", exp, got);
static BOOL compare(FLOAT u, FLOAT v)
{
return (fabs(u-v) < admitted_error);
}
static BOOL compare_vec3(D3DXVECTOR3 u, D3DXVECTOR3 v)
{
return ( compare(u.x, v.x) && compare(u.y, v.y) && compare(u.z, v.z) );
}
static void D3DXBoundProbeTest(void)
{
BOOL result;
D3DXVECTOR3 bottom_point, center, top_point, raydirection, rayposition;
FLOAT radius;
/*____________Test the Box case___________________________*/
bottom_point.x = -3.0f; bottom_point.y = -2.0f; bottom_point.z = -1.0f;
top_point.x = 7.0f; top_point.y = 8.0f; top_point.z = 9.0f;
raydirection.x = -4.0f; raydirection.y = -5.0f; raydirection.z = -6.0f;
rayposition.x = 5.0f; rayposition.y = 5.0f; rayposition.z = 11.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == TRUE, "expected TRUE, received FALSE\n");
raydirection.x = 4.0f; raydirection.y = 5.0f; raydirection.z = 6.0f;
rayposition.x = 5.0f; rayposition.y = 5.0f; rayposition.z = 11.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == FALSE, "expected FALSE, received TRUE\n");
rayposition.x = -4.0f; rayposition.y = 1.0f; rayposition.z = -2.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == TRUE, "expected TRUE, received FALSE\n");
bottom_point.x = 1.0f; bottom_point.y = 0.0f; bottom_point.z = 0.0f;
top_point.x = 1.0f; top_point.y = 0.0f; top_point.z = 0.0f;
rayposition.x = 0.0f; rayposition.y = 1.0f; rayposition.z = 0.0f;
raydirection.x = 0.0f; raydirection.y = 3.0f; raydirection.z = 0.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == FALSE, "expected FALSE, received TRUE\n");
bottom_point.x = 1.0f; bottom_point.y = 2.0f; bottom_point.z = 3.0f;
top_point.x = 10.0f; top_point.y = 15.0f; top_point.z = 20.0f;
raydirection.x = 7.0f; raydirection.y = 8.0f; raydirection.z = 9.0f;
rayposition.x = 3.0f; rayposition.y = 7.0f; rayposition.z = -6.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == TRUE, "expected TRUE, received FALSE\n");
bottom_point.x = 0.0f; bottom_point.y = 0.0f; bottom_point.z = 0.0f;
top_point.x = 1.0f; top_point.y = 1.0f; top_point.z = 1.0f;
raydirection.x = 0.0f; raydirection.y = 1.0f; raydirection.z = .0f;
rayposition.x = -3.0f; rayposition.y = 0.0f; rayposition.z = 0.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == FALSE, "expected FALSE, received TRUE\n");
raydirection.x = 1.0f; raydirection.y = 0.0f; raydirection.z = .0f;
rayposition.x = -3.0f; rayposition.y = 0.0f; rayposition.z = 0.0f;
result = D3DXBoxBoundProbe(&bottom_point, &top_point, &rayposition, &raydirection);
ok(result == TRUE, "expected TRUE, received FALSE\n");
/*____________Test the Sphere case________________________*/
radius = sqrt(77.0f);
center.x = 1.0f; center.y = 2.0f; center.z = 3.0f;
raydirection.x = 2.0f; raydirection.y = -4.0f; raydirection.z = 2.0f;
rayposition.x = 5.0f; rayposition.y = 5.0f; rayposition.z = 9.0f;
result = D3DXSphereBoundProbe(&center, radius, &rayposition, &raydirection);
ok(result == TRUE, "expected TRUE, received FALSE\n");
rayposition.x = 45.0f; rayposition.y = -75.0f; rayposition.z = 49.0f;
result = D3DXSphereBoundProbe(&center, radius, &rayposition, &raydirection);
ok(result == FALSE, "expected FALSE, received TRUE\n");
rayposition.x = 5.0f; rayposition.y = 7.0f; rayposition.z = 9.0f;
result = D3DXSphereBoundProbe(&center, radius, &rayposition, &raydirection);
ok(result == FALSE, "expected FALSE, received TRUE\n");
rayposition.x = 5.0f; rayposition.y = 11.0f; rayposition.z = 9.0f;
result = D3DXSphereBoundProbe(&center, radius, &rayposition, &raydirection);
ok(result == FALSE, "expected FALSE, received TRUE\n");
}
static void D3DXComputeBoundingBoxTest(void)
{
D3DXVECTOR3 exp_max, exp_min, got_max, got_min, vertex[5];
HRESULT hr;
vertex[0].x = 1.0f; vertex[0].y = 1.0f; vertex[0].z = 1.0f;
vertex[1].x = 1.0f; vertex[1].y = 1.0f; vertex[1].z = 1.0f;
vertex[2].x = 1.0f; vertex[2].y = 1.0f; vertex[2].z = 1.0f;
vertex[3].x = 1.0f; vertex[3].y = 1.0f; vertex[3].z = 1.0f;
vertex[4].x = 9.0f; vertex[4].y = 9.0f; vertex[4].z = 9.0f;
exp_min.x = 1.0f; exp_min.y = 1.0f; exp_min.z = 1.0f;
exp_max.x = 1.0f; exp_max.y = 1.0f; exp_max.z = 1.0f;
hr = D3DXComputeBoundingBox(&vertex[3],2,D3DFVF_XYZ,&got_min,&got_max);
ok( hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
ok( compare_vec3(exp_min,got_min), "Expected min: (%f, %f, %f), got: (%f, %f, %f)\n", exp_min.x,exp_min.y,exp_min.z,got_min.x,got_min.y,got_min.z);
ok( compare_vec3(exp_max,got_max), "Expected max: (%f, %f, %f), got: (%f, %f, %f)\n", exp_max.x,exp_max.y,exp_max.z,got_max.x,got_max.y,got_max.z);
/*________________________*/
vertex[0].x = 2.0f; vertex[0].y = 5.9f; vertex[0].z = -1.2f;
vertex[1].x = -1.87f; vertex[1].y = 7.9f; vertex[1].z = 7.4f;
vertex[2].x = 7.43f; vertex[2].y = -0.9f; vertex[2].z = 11.9f;
vertex[3].x = -6.92f; vertex[3].y = 6.3f; vertex[3].z = -3.8f;
vertex[4].x = 11.4f; vertex[4].y = -8.1f; vertex[4].z = 4.5f;
exp_min.x = -6.92f; exp_min.y = -0.90f; exp_min.z = -3.80f;
exp_max.x = 7.43f; exp_max.y = 7.90f; exp_max.z = 11.9f;
hr = D3DXComputeBoundingBox(&vertex[0],5,D3DFVF_XYZ,&got_min,&got_max);
ok( hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
ok( compare_vec3(exp_min,got_min), "Expected min: (%f, %f, %f), got: (%f, %f, %f)\n", exp_min.x,exp_min.y,exp_min.z,got_min.x,got_min.y,got_min.z);
ok( compare_vec3(exp_max,got_max), "Expected max: (%f, %f, %f), got: (%f, %f, %f)\n", exp_max.x,exp_max.y,exp_max.z,got_max.x,got_max.y,got_max.z);
/*________________________*/
vertex[0].x = 2.0f; vertex[0].y = 5.9f; vertex[0].z = -1.2f;
vertex[1].x = -1.87f; vertex[1].y = 7.9f; vertex[1].z = 7.4f;
vertex[2].x = 7.43f; vertex[2].y = -0.9f; vertex[2].z = 11.9f;
vertex[3].x = -6.92f; vertex[3].y = 6.3f; vertex[3].z = -3.8f;
vertex[4].x = 11.4f; vertex[4].y = -8.1f; vertex[4].z = 4.5f;
exp_min.x = -1.87f; exp_min.y = -0.90f; exp_min.z = -1.20f;
exp_max.x = 7.43f; exp_max.y = 7.90f; exp_max.z = 11.9f;
hr = D3DXComputeBoundingBox(&vertex[0],4,D3DFVF_XYZ,&got_min,&got_max);
ok( hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
ok( compare_vec3(exp_min,got_min), "Expected min: (%f, %f, %f), got: (%f, %f, %f)\n", exp_min.x,exp_min.y,exp_min.z,got_min.x,got_min.y,got_min.z);
ok( compare_vec3(exp_max,got_max), "Expected max: (%f, %f, %f), got: (%f, %f, %f)\n", exp_max.x,exp_max.y,exp_max.z,got_max.x,got_max.y,got_max.z);
/*________________________*/
hr = D3DXComputeBoundingBox(NULL,5,D3DFVF_XYZ,&got_min,&got_max);
ok( hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
/*________________________*/
hr = D3DXComputeBoundingBox(&vertex[3],5,D3DFVF_XYZ,NULL,&got_max);
ok( hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
/*________________________*/
hr = D3DXComputeBoundingBox(&vertex[3],5,D3DFVF_XYZ,&got_min,NULL);
ok( hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
}
static void D3DXComputeBoundingSphereTest(void)
{
D3DXVECTOR3 exp_cen, got_cen, vertex[5];
FLOAT exp_rad, got_rad;
HRESULT hr;
vertex[0].x = 1.0f; vertex[0].y = 1.0f; vertex[0].z = 1.0f;
vertex[1].x = 1.0f; vertex[1].y = 1.0f; vertex[1].z = 1.0f;
vertex[2].x = 1.0f; vertex[2].y = 1.0f; vertex[2].z = 1.0f;
vertex[3].x = 1.0f; vertex[3].y = 1.0f; vertex[3].z = 1.0f;
vertex[4].x = 9.0f; vertex[4].y = 9.0f; vertex[4].z = 9.0f;
exp_rad = 6.928203f;
exp_cen.x = 5.0; exp_cen.y = 5.0; exp_cen.z = 5.0;
hr = D3DXComputeBoundingSphere(&vertex[3],2,D3DFVF_XYZ,&got_cen,&got_rad);
ok( hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
ok( compare(exp_rad, got_rad), "Expected radius: %f, got radius: %f\n", exp_rad, got_rad);
ok( compare_vec3(exp_cen,got_cen), "Expected center: (%f, %f, %f), got center: (%f, %f, %f)\n", exp_cen.x,exp_cen.y,exp_cen.z,got_cen.x,got_cen.y,got_cen.z);
/*________________________*/
vertex[0].x = 2.0f; vertex[0].y = 5.9f; vertex[0].z = -1.2f;
vertex[1].x = -1.87f; vertex[1].y = 7.9f; vertex[1].z = 7.4f;
vertex[2].x = 7.43f; vertex[2].y = -0.9f; vertex[2].z = 11.9f;
vertex[3].x = -6.92f; vertex[3].y = 6.3f; vertex[3].z = -3.8f;
vertex[4].x = 11.4f; vertex[4].y = -8.1f; vertex[4].z = 4.5f;
exp_rad = 13.707883f;
exp_cen.x = 2.408f; exp_cen.y = 2.22f; exp_cen.z = 3.76f;
hr = D3DXComputeBoundingSphere(&vertex[0],5,D3DFVF_XYZ,&got_cen,&got_rad);
ok( hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr);
ok( compare(exp_rad, got_rad), "Expected radius: %f, got radius: %f\n", exp_rad, got_rad);
ok( compare_vec3(exp_cen,got_cen), "Expected center: (%f, %f, %f), got center: (%f, %f, %f)\n", exp_cen.x,exp_cen.y,exp_cen.z,got_cen.x,got_cen.y,got_cen.z);
/*________________________*/
hr = D3DXComputeBoundingSphere(NULL,5,D3DFVF_XYZ,&got_cen,&got_rad);
ok( hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
/*________________________*/
hr = D3DXComputeBoundingSphere(&vertex[3],5,D3DFVF_XYZ,NULL,&got_rad);
ok( hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
/*________________________*/
hr = D3DXComputeBoundingSphere(&vertex[3],5,D3DFVF_XYZ,&got_cen,NULL);
ok( hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
}
static void D3DXGetFVFVertexSizeTest(void)
{
UINT got;
compare_vertex_sizes (D3DFVF_XYZ, 12);
compare_vertex_sizes (D3DFVF_XYZB3, 24);
compare_vertex_sizes (D3DFVF_XYZB5, 32);
compare_vertex_sizes (D3DFVF_XYZ | D3DFVF_NORMAL, 24);
compare_vertex_sizes (D3DFVF_XYZ | D3DFVF_DIFFUSE, 16);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX1 |
D3DFVF_TEXCOORDSIZE1(0), 16);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX2 |
D3DFVF_TEXCOORDSIZE1(0) |
D3DFVF_TEXCOORDSIZE1(1), 20);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX1 |
D3DFVF_TEXCOORDSIZE2(0), 20);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX2 |
D3DFVF_TEXCOORDSIZE2(0) |
D3DFVF_TEXCOORDSIZE2(1), 28);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX6 |
D3DFVF_TEXCOORDSIZE2(0) |
D3DFVF_TEXCOORDSIZE2(1) |
D3DFVF_TEXCOORDSIZE2(2) |
D3DFVF_TEXCOORDSIZE2(3) |
D3DFVF_TEXCOORDSIZE2(4) |
D3DFVF_TEXCOORDSIZE2(5), 60);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX8 |
D3DFVF_TEXCOORDSIZE2(0) |
D3DFVF_TEXCOORDSIZE2(1) |
D3DFVF_TEXCOORDSIZE2(2) |
D3DFVF_TEXCOORDSIZE2(3) |
D3DFVF_TEXCOORDSIZE2(4) |
D3DFVF_TEXCOORDSIZE2(5) |
D3DFVF_TEXCOORDSIZE2(6) |
D3DFVF_TEXCOORDSIZE2(7), 76);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX1 |
D3DFVF_TEXCOORDSIZE3(0), 24);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX4 |
D3DFVF_TEXCOORDSIZE3(0) |
D3DFVF_TEXCOORDSIZE3(1) |
D3DFVF_TEXCOORDSIZE3(2) |
D3DFVF_TEXCOORDSIZE3(3), 60);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX1 |
D3DFVF_TEXCOORDSIZE4(0), 28);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX2 |
D3DFVF_TEXCOORDSIZE4(0) |
D3DFVF_TEXCOORDSIZE4(1), 44);
compare_vertex_sizes (
D3DFVF_XYZ |
D3DFVF_TEX3 |
D3DFVF_TEXCOORDSIZE4(0) |
D3DFVF_TEXCOORDSIZE4(1) |
D3DFVF_TEXCOORDSIZE4(2), 60);
compare_vertex_sizes (
D3DFVF_XYZB5 |
D3DFVF_NORMAL |
D3DFVF_DIFFUSE |
D3DFVF_SPECULAR |
D3DFVF_TEX8 |
D3DFVF_TEXCOORDSIZE4(0) |
D3DFVF_TEXCOORDSIZE4(1) |
D3DFVF_TEXCOORDSIZE4(2) |
D3DFVF_TEXCOORDSIZE4(3) |
D3DFVF_TEXCOORDSIZE4(4) |
D3DFVF_TEXCOORDSIZE4(5) |
D3DFVF_TEXCOORDSIZE4(6) |
D3DFVF_TEXCOORDSIZE4(7), 180);
}
static void D3DXIntersectTriTest(void)
{
BOOL exp_res, got_res;
D3DXVECTOR3 position, ray, vertex[3];
FLOAT exp_dist, got_dist, exp_u, got_u, exp_v, got_v;
vertex[0].x = 1.0f; vertex[0].y = 0.0f; vertex[0].z = 0.0f;
vertex[1].x = 2.0f; vertex[1].y = 0.0f; vertex[1].z = 0.0f;
vertex[2].x = 1.0f; vertex[2].y = 1.0f; vertex[2].z = 0.0f;
position.x = -14.5f; position.y = -23.75f; position.z = -32.0f;
ray.x = 2.0f; ray.y = 3.0f; ray.z = 4.0f;
exp_res = TRUE; exp_u = 0.5f; exp_v = 0.25f; exp_dist = 8.0f;
got_res = D3DXIntersectTri(&vertex[0],&vertex[1],&vertex[2],&position,&ray,&got_u,&got_v,&got_dist);
ok( got_res == exp_res, "Expected result = %d, got %d\n",exp_res,got_res);
ok( compare(exp_u,got_u), "Expected u = %f, got %f\n",exp_u,got_u);
ok( compare(exp_v,got_v), "Expected v = %f, got %f\n",exp_v,got_v);
ok( compare(exp_dist,got_dist), "Expected distance = %f, got %f\n",exp_dist,got_dist);
/*Only positive ray is taken in account*/
vertex[0].x = 1.0f; vertex[0].y = 0.0f; vertex[0].z = 0.0f;
vertex[1].x = 2.0f; vertex[1].y = 0.0f; vertex[1].z = 0.0f;
vertex[2].x = 1.0f; vertex[2].y = 1.0f; vertex[2].z = 0.0f;
position.x = 17.5f; position.y = 24.25f; position.z = 32.0f;
ray.x = 2.0f; ray.y = 3.0f; ray.z = 4.0f;
exp_res = FALSE;
got_res = D3DXIntersectTri(&vertex[0],&vertex[1],&vertex[2],&position,&ray,&got_u,&got_v,&got_dist);
ok( got_res == exp_res, "Expected result = %d, got %d\n",exp_res,got_res);
/*Intersection between ray and triangle in a same plane is considered as empty*/
vertex[0].x = 4.0f; vertex[0].y = 0.0f; vertex[0].z = 0.0f;
vertex[1].x = 6.0f; vertex[1].y = 0.0f; vertex[1].z = 0.0f;
vertex[2].x = 4.0f; vertex[2].y = 2.0f; vertex[2].z = 0.0f;
position.x = 1.0f; position.y = 1.0f; position.z = 0.0f;
ray.x = 1.0f; ray.y = 0.0f; ray.z = 0.0f;
exp_res = FALSE;
got_res = D3DXIntersectTri(&vertex[0],&vertex[1],&vertex[2],&position,&ray,&got_u,&got_v,&got_dist);
ok( got_res == exp_res, "Expected result = %d, got %d\n",exp_res,got_res);
}
START_TEST(mesh)
{
D3DXBoundProbeTest();
D3DXComputeBoundingBoxTest();
D3DXComputeBoundingSphereTest();
D3DXGetFVFVertexSizeTest();
D3DXIntersectTriTest();
}