d3dx8: Remove the d3dx8 dll.
diff --git a/configure b/configure
index aa0ade1..f082f38 100755
--- a/configure
+++ b/configure
Binary files differ
diff --git a/configure.ac b/configure.ac
index e07de2b..b271773 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2078,8 +2078,6 @@
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])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index edb73cb..8f2a977 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -116,7 +116,6 @@
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 @@
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 @@
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 $@`
diff --git a/dlls/d3dx8/Makefile.in b/dlls/d3dx8/Makefile.in
deleted file mode 100644
index a6edd23..0000000
--- a/dlls/d3dx8/Makefile.in
+++ /dev/null
@@ -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
diff --git a/dlls/d3dx8/core.c b/dlls/d3dx8/core.c
deleted file mode 100644
index da821fc..0000000
--- a/dlls/d3dx8/core.c
+++ /dev/null
@@ -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;
-}
diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec
deleted file mode 100644
index 88666f7..0000000
--- a/dlls/d3dx8/d3dx8.spec
+++ /dev/null
@@ -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
diff --git a/dlls/d3dx8/d3dx8_main.c b/dlls/d3dx8/d3dx8_main.c
deleted file mode 100644
index 4fb860a..0000000
--- a/dlls/d3dx8/d3dx8_main.c
+++ /dev/null
@@ -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;
-}
diff --git a/dlls/d3dx8/d3dx8_private.h b/dlls/d3dx8/d3dx8_private.h
deleted file mode 100644
index 01174dc..0000000
--- a/dlls/d3dx8/d3dx8_private.h
+++ /dev/null
@@ -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 */
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
deleted file mode 100644
index 34f6fed..0000000
--- a/dlls/d3dx8/math.c
+++ /dev/null
@@ -1,1524 +0,0 @@
-/*
- * Copyright 2007 David Adam
- * Copyright 2008 Jérôme Gardou
- *
- * 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 NONAMELESSUNION
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "d3dx8_private.h"
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
-
-static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl;
-
-/*_________________D3DXColor____________________*/
-
-D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s)
-{
- pout->r = 0.5f + s * (pc->r - 0.5f);
- pout->g = 0.5f + s * (pc->g - 0.5f);
- pout->b = 0.5f + s * (pc->b - 0.5f);
- pout->a = pc->a;
- return pout;
-}
-
-D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s)
-{
- FLOAT grey;
-
- grey = pc->r * 0.2125f + pc->g * 0.7154f + pc->b * 0.0721f;
- pout->r = grey + s * (pc->r - grey);
- pout->g = grey + s * (pc->g - grey);
- pout->b = grey + s * (pc->b - grey);
- pout->a = pc->a;
- return pout;
-}
-
-/*_________________Misc__________________________*/
-
-FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex)
-{
- FLOAT a, d, g, result;
-
- g = sqrt(refractionindex * refractionindex + costheta * costheta - 1.0f);
- a = g + costheta;
- d = g - costheta;
- result = ( costheta * a - 1.0f ) * ( costheta * a - 1.0f ) / ( ( costheta * d + 1.0f ) * ( costheta * d + 1.0f ) ) + 1.0f;
- result = result * 0.5f * d * d / ( a * a );
- return result;
-}
-
-/*_________________D3DXMatrix____________________*/
-
-D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation)
-{
- D3DXMATRIX m1, m2, m3, m4, m5;
-
- D3DXMatrixScaling(&m1, scaling, scaling, scaling);
- if ( !rotationcenter )
- {
- D3DXMatrixIdentity(&m2);
- D3DXMatrixIdentity(&m4);
- }
- else
- {
- D3DXMatrixTranslation(&m2, -rotationcenter->x, -rotationcenter->y, -rotationcenter->z);
- D3DXMatrixTranslation(&m4, rotationcenter->x, rotationcenter->y, rotationcenter->z);
- }
- if ( !rotation )
- {
- D3DXMatrixIdentity(&m3);
- }
- else
- {
- D3DXMatrixRotationQuaternion(&m3, rotation);
- }
- if ( !translation )
- {
- D3DXMatrixIdentity(&m5);
- }
- else
- {
- D3DXMatrixTranslation(&m5, translation->x, translation->y, translation->z);
- }
- D3DXMatrixMultiply(&m1, &m1, &m2);
- D3DXMatrixMultiply(&m1, &m1, &m3);
- D3DXMatrixMultiply(&m1, &m1, &m4);
- D3DXMatrixMultiply(pout, &m1, &m5);
- return pout;
-}
-
-FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm)
-{
- D3DXVECTOR4 minor, v1, v2, v3;
- FLOAT det;
-
- v1.x = pm->u.m[0][0]; v1.y = pm->u.m[1][0]; v1.z = pm->u.m[2][0]; v1.w = pm->u.m[3][0];
- v2.x = pm->u.m[0][1]; v2.y = pm->u.m[1][1]; v2.z = pm->u.m[2][1]; v2.w = pm->u.m[3][1];
- v3.x = pm->u.m[0][2]; v3.y = pm->u.m[1][2]; v3.z = pm->u.m[2][2]; v3.w = pm->u.m[3][2];
- D3DXVec4Cross(&minor, &v1, &v2, &v3);
- det = - (pm->u.m[0][3] * minor.x + pm->u.m[1][3] * minor.y + pm->u.m[2][3] * minor.z + pm->u.m[3][3] * minor.w);
- return det;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm)
-{
- int a, i, j;
- D3DXMATRIX out;
- D3DXVECTOR4 v, vec[3];
- FLOAT det;
-
- det = D3DXMatrixfDeterminant(pm);
- if ( !det ) return NULL;
- if ( pdeterminant ) *pdeterminant = det;
- for (i=0; i<4; i++)
- {
- for (j=0; j<4; j++)
- {
- if (j != i )
- {
- a = j;
- if ( j > i ) a = a-1;
- vec[a].x = pm->u.m[j][0];
- vec[a].y = pm->u.m[j][1];
- vec[a].z = pm->u.m[j][2];
- vec[a].w = pm->u.m[j][3];
- }
- }
- D3DXVec4Cross(&v, &vec[0], &vec[1], &vec[2]);
- out.u.m[0][i] = pow(-1.0f, i) * v.x / det;
- out.u.m[1][i] = pow(-1.0f, i) * v.y / det;
- out.u.m[2][i] = pow(-1.0f, i) * v.z / det;
- out.u.m[3][i] = pow(-1.0f, i) * v.w / det;
- }
- *pout = out;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup)
-{
- D3DXVECTOR3 right, rightn, up, upn, vec, vec2;
-
- D3DXVec3Subtract(&vec2, pat, peye);
- D3DXVec3Normalize(&vec, &vec2);
- D3DXVec3Cross(&right, pup, &vec);
- D3DXVec3Cross(&up, &vec, &right);
- D3DXVec3Normalize(&rightn, &right);
- D3DXVec3Normalize(&upn, &up);
- pout->u.m[0][0] = rightn.x;
- pout->u.m[1][0] = rightn.y;
- pout->u.m[2][0] = rightn.z;
- pout->u.m[3][0] = -D3DXVec3Dot(&rightn,peye);
- pout->u.m[0][1] = upn.x;
- pout->u.m[1][1] = upn.y;
- pout->u.m[2][1] = upn.z;
- pout->u.m[3][1] = -D3DXVec3Dot(&upn, peye);
- pout->u.m[0][2] = vec.x;
- pout->u.m[1][2] = vec.y;
- pout->u.m[2][2] = vec.z;
- pout->u.m[3][2] = -D3DXVec3Dot(&vec, peye);
- pout->u.m[0][3] = 0.0f;
- pout->u.m[1][3] = 0.0f;
- pout->u.m[2][3] = 0.0f;
- pout->u.m[3][3] = 1.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup)
-{
- D3DXVECTOR3 right, rightn, up, upn, vec, vec2;
-
- D3DXVec3Subtract(&vec2, pat, peye);
- D3DXVec3Normalize(&vec, &vec2);
- D3DXVec3Cross(&right, pup, &vec);
- D3DXVec3Cross(&up, &vec, &right);
- D3DXVec3Normalize(&rightn, &right);
- D3DXVec3Normalize(&upn, &up);
- pout->u.m[0][0] = -rightn.x;
- pout->u.m[1][0] = -rightn.y;
- pout->u.m[2][0] = -rightn.z;
- pout->u.m[3][0] = D3DXVec3Dot(&rightn,peye);
- pout->u.m[0][1] = upn.x;
- pout->u.m[1][1] = upn.y;
- pout->u.m[2][1] = upn.z;
- pout->u.m[3][1] = -D3DXVec3Dot(&upn, peye);
- pout->u.m[0][2] = -vec.x;
- pout->u.m[1][2] = -vec.y;
- pout->u.m[2][2] = -vec.z;
- pout->u.m[3][2] = D3DXVec3Dot(&vec, peye);
- pout->u.m[0][3] = 0.0f;
- pout->u.m[1][3] = 0.0f;
- pout->u.m[2][3] = 0.0f;
- pout->u.m[3][3] = 1.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, CONST D3DXMATRIX *pm1, CONST D3DXMATRIX *pm2)
-{
- D3DXMATRIX out;
- int i,j;
-
- for (i=0; i<4; i++)
- {
- for (j=0; j<4; j++)
- {
- out.u.m[i][j] = pm1->u.m[i][0] * pm2->u.m[0][j] + pm1->u.m[i][1] * pm2->u.m[1][j] + pm1->u.m[i][2] * pm2->u.m[2][j] + pm1->u.m[i][3] * pm2->u.m[3][j];
- }
- }
- *pout = out;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *pm1, CONST D3DXMATRIX *pm2)
-{
- D3DXMatrixMultiply(pout, pm1, pm2);
- D3DXMatrixTranspose(pout, pout);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f / w;
- pout->u.m[1][1] = 2.0f / h;
- pout->u.m[2][2] = 1.0f / (zf - zn);
- pout->u.m[3][2] = zn / (zn - zf);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f / (r - l);
- pout->u.m[1][1] = 2.0f / (t - b);
- pout->u.m[2][2] = 1.0f / (zf -zn);
- pout->u.m[3][0] = -1.0f -2.0f *l / (r - l);
- pout->u.m[3][1] = 1.0f + 2.0f * t / (b - t);
- pout->u.m[3][2] = zn / (zn -zf);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f / (r - l);
- pout->u.m[1][1] = 2.0f / (t - b);
- pout->u.m[2][2] = 1.0f / (zn -zf);
- pout->u.m[3][0] = -1.0f -2.0f *l / (r - l);
- pout->u.m[3][1] = 1.0f + 2.0f * t / (b - t);
- pout->u.m[3][2] = zn / (zn -zf);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f / w;
- pout->u.m[1][1] = 2.0f / h;
- pout->u.m[2][2] = 1.0f / (zn - zf);
- pout->u.m[3][2] = zn / (zn - zf);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 1.0f / (aspect * tan(fovy/2.0f));
- pout->u.m[1][1] = 1.0f / tan(fovy/2.0f);
- pout->u.m[2][2] = zf / (zf - zn);
- pout->u.m[2][3] = 1.0f;
- pout->u.m[3][2] = (zf * zn) / (zn - zf);
- pout->u.m[3][3] = 0.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 1.0f / (aspect * tan(fovy/2.0f));
- pout->u.m[1][1] = 1.0f / tan(fovy/2.0f);
- pout->u.m[2][2] = zf / (zn - zf);
- pout->u.m[2][3] = -1.0f;
- pout->u.m[3][2] = (zf * zn) / (zn - zf);
- pout->u.m[3][3] = 0.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f * zn / w;
- pout->u.m[1][1] = 2.0f * zn / h;
- pout->u.m[2][2] = zf / (zf - zn);
- pout->u.m[3][2] = (zn * zf) / (zn - zf);
- pout->u.m[2][3] = 1.0f;
- pout->u.m[3][3] = 0.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f * zn / (r - l);
- pout->u.m[1][1] = -2.0f * zn / (b - t);
- pout->u.m[2][0] = -1.0f - 2.0f * l / (r - l);
- pout->u.m[2][1] = 1.0f + 2.0f * t / (b - t);
- pout->u.m[2][2] = - zf / (zn - zf);
- pout->u.m[3][2] = (zn * zf) / (zn -zf);
- pout->u.m[2][3] = 1.0f;
- pout->u.m[3][3] = 0.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f * zn / (r - l);
- pout->u.m[1][1] = -2.0f * zn / (b - t);
- pout->u.m[2][0] = 1.0f + 2.0f * l / (r - l);
- pout->u.m[2][1] = -1.0f -2.0f * t / (b - t);
- pout->u.m[2][2] = zf / (zn - zf);
- pout->u.m[3][2] = (zn * zf) / (zn -zf);
- pout->u.m[2][3] = -1.0f;
- pout->u.m[3][3] = 0.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 2.0f * zn / w;
- pout->u.m[1][1] = 2.0f * zn / h;
- pout->u.m[2][2] = zf / (zn - zf);
- pout->u.m[3][2] = (zn * zf) / (zn - zf);
- pout->u.m[2][3] = -1.0f;
- pout->u.m[3][3] = 0.0f;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, CONST D3DXPLANE *pplane)
-{
- D3DXPLANE Nplane;
-
- D3DXPlaneNormalize(&Nplane, pplane);
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 1.0f - 2.0f * Nplane.a * Nplane.a;
- pout->u.m[0][1] = -2.0f * Nplane.a * Nplane.b;
- pout->u.m[0][2] = -2.0f * Nplane.a * Nplane.c;
- pout->u.m[1][0] = -2.0f * Nplane.a * Nplane.b;
- pout->u.m[1][1] = 1.0f - 2.0f * Nplane.b * Nplane.b;
- pout->u.m[1][2] = -2.0f * Nplane.b * Nplane.c;
- pout->u.m[2][0] = -2.0f * Nplane.c * Nplane.a;
- pout->u.m[2][1] = -2.0f * Nplane.c * Nplane.b;
- pout->u.m[2][2] = 1.0f - 2.0f * Nplane.c * Nplane.c;
- pout->u.m[3][0] = -2.0f * Nplane.d * Nplane.a;
- pout->u.m[3][1] = -2.0f * Nplane.d * Nplane.b;
- pout->u.m[3][2] = -2.0f * Nplane.d * Nplane.c;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pv, FLOAT angle)
-{
- D3DXVECTOR3 v;
-
- D3DXVec3Normalize(&v,pv);
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle);
- pout->u.m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z;
- pout->u.m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y;
- pout->u.m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z;
- pout->u.m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle);
- pout->u.m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x;
- pout->u.m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y;
- pout->u.m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x;
- pout->u.m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3DXQUATERNION *pq)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = 1.0f - 2.0f * (pq->y * pq->y + pq->z * pq->z);
- pout->u.m[0][1] = 2.0f * (pq->x *pq->y + pq->z * pq->w);
- pout->u.m[0][2] = 2.0f * (pq->x * pq->z - pq->y * pq->w);
- pout->u.m[1][0] = 2.0f * (pq->x * pq->y - pq->z * pq->w);
- pout->u.m[1][1] = 1.0f - 2.0f * (pq->x * pq->x + pq->z * pq->z);
- pout->u.m[1][2] = 2.0f * (pq->y *pq->z + pq->x *pq->w);
- pout->u.m[2][0] = 2.0f * (pq->x * pq->z + pq->y * pq->w);
- pout->u.m[2][1] = 2.0f * (pq->y *pq->z - pq->x *pq->w);
- pout->u.m[2][2] = 1.0f - 2.0f * (pq->x * pq->x + pq->y * pq->y);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[1][1] = cos(angle);
- pout->u.m[2][2] = cos(angle);
- pout->u.m[1][2] = sin(angle);
- pout->u.m[2][1] = -sin(angle);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = cos(angle);
- pout->u.m[2][2] = cos(angle);
- pout->u.m[0][2] = -sin(angle);
- pout->u.m[2][0] = sin(angle);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, FLOAT pitch, FLOAT roll)
-{
- D3DXMATRIX m;
-
- D3DXMatrixIdentity(pout);
- D3DXMatrixRotationZ(&m, roll);
- D3DXMatrixMultiply(pout, pout, &m);
- D3DXMatrixRotationX(&m, pitch);
- D3DXMatrixMultiply(pout, pout, &m);
- D3DXMatrixRotationY(&m, yaw);
- D3DXMatrixMultiply(pout, pout, &m);
- return pout;
-}
-D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = cos(angle);
- pout->u.m[1][1] = cos(angle);
- pout->u.m[0][1] = sin(angle);
- pout->u.m[1][0] = -sin(angle);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[0][0] = sx;
- pout->u.m[1][1] = sy;
- pout->u.m[2][2] = sz;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, CONST D3DXVECTOR4 *plight, CONST D3DXPLANE *pplane)
-{
- D3DXPLANE Nplane;
- FLOAT dot;
-
- D3DXPlaneNormalize(&Nplane, pplane);
- dot = D3DXPlaneDot(&Nplane, plight);
- pout->u.m[0][0] = dot - Nplane.a * plight->x;
- pout->u.m[0][1] = -Nplane.a * plight->y;
- pout->u.m[0][2] = -Nplane.a * plight->z;
- pout->u.m[0][3] = -Nplane.a * plight->w;
- pout->u.m[1][0] = -Nplane.b * plight->x;
- pout->u.m[1][1] = dot - Nplane.b * plight->y;
- pout->u.m[1][2] = -Nplane.b * plight->z;
- pout->u.m[1][3] = -Nplane.b * plight->w;
- pout->u.m[2][0] = -Nplane.c * plight->x;
- pout->u.m[2][1] = -Nplane.c * plight->y;
- pout->u.m[2][2] = dot - Nplane.c * plight->z;
- pout->u.m[2][3] = -Nplane.c * plight->w;
- pout->u.m[3][0] = -Nplane.d * plight->x;
- pout->u.m[3][1] = -Nplane.d * plight->y;
- pout->u.m[3][2] = -Nplane.d * plight->z;
- pout->u.m[3][3] = dot - Nplane.d * plight->w;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixTransformation(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pscalingcenter, CONST D3DXQUATERNION *pscalingrotation, CONST D3DXVECTOR3 *pscaling, CONST D3DXVECTOR3 *protationcenter, CONST D3DXQUATERNION *protation, CONST D3DXVECTOR3 *ptranslation)
-{
- D3DXMATRIX m1, m2, m3, m4, m5, m6, m7;
- D3DXQUATERNION prc;
- D3DXVECTOR3 psc, pt;
-
- if ( !pscalingcenter )
- {
- psc.x = 0.0f;
- psc.y = 0.0f;
- psc.z = 0.0f;
- }
- else
- {
- psc.x = pscalingcenter->x;
- psc.y = pscalingcenter->y;
- psc.z = pscalingcenter->z;
- }
- if ( !protationcenter )
- {
- prc.x = 0.0f;
- prc.y = 0.0f;
- prc.z = 0.0f;
- }
- else
- {
- prc.x = protationcenter->x;
- prc.y = protationcenter->y;
- prc.z = protationcenter->z;
- }
- if ( !ptranslation )
- {
- pt.x = 0.0f;
- pt.y = 0.0f;
- pt.z = 0.0f;
- }
- else
- {
- pt.x = ptranslation->x;
- pt.y = ptranslation->y;
- pt.z = ptranslation->z;
- }
- D3DXMatrixTranslation(&m1, -psc.x, -psc.y, -psc.z);
- if ( !pscalingrotation )
- {
- D3DXMatrixIdentity(&m2);
- D3DXMatrixIdentity(&m4);
- }
- else
- {
- D3DXMatrixRotationQuaternion(&m4, pscalingrotation);
- D3DXMatrixInverse(&m2, NULL, &m4);
- }
- if ( !pscaling )
- {
- D3DXMatrixIdentity(&m3);
- }
- else
- {
- D3DXMatrixScaling(&m3, pscaling->x, pscaling->y, pscaling->z);
- }
- if ( !protation )
- {
- D3DXMatrixIdentity(&m6);
- }
- else
- {
- D3DXMatrixRotationQuaternion(&m6, protation);
- }
- D3DXMatrixTranslation(&m5, psc.x - prc.x, psc.y - prc.y, psc.z - prc.z);
- D3DXMatrixTranslation(&m7, prc.x + pt.x, prc.y + pt.y, prc.z + pt.z);
- D3DXMatrixMultiply(&m1, &m1, &m2);
- D3DXMatrixMultiply(&m1, &m1, &m3);
- D3DXMatrixMultiply(&m1, &m1, &m4);
- D3DXMatrixMultiply(&m1, &m1, &m5);
- D3DXMatrixMultiply(&m1, &m1, &m6);
- D3DXMatrixMultiply(pout, &m1, &m7);
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMatrixIdentity(pout);
- pout->u.m[3][0] = x;
- pout->u.m[3][1] = y;
- pout->u.m[3][2] = z;
- return pout;
-}
-
-D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *pm)
-{
- CONST D3DXMATRIX m = *pm;
- int i,j;
-
- for (i=0; i<4; i++)
- {
- for (j=0; j<4; j++)
- {
- pout->u.m[i][j] = m.u.m[j][i];
- }
- }
- return pout;
-}
-
-/*_________________D3DXMatrixStack____________________*/
-
-static const unsigned int INITIAL_STACK_SIZE = 32;
-
-HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, LPD3DXMATRIXSTACK* ppstack)
-{
- ID3DXMatrixStackImpl* object;
-
- TRACE("flags %#x, ppstack %p\n", flags, ppstack);
-
- object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXMatrixStackImpl));
- if ( object == NULL )
- {
- *ppstack = NULL;
- return E_OUTOFMEMORY;
- }
- object->lpVtbl = &ID3DXMatrixStack_Vtbl;
- object->ref = 1;
-
- object->stack = HeapAlloc(GetProcessHeap(), 0, INITIAL_STACK_SIZE * sizeof(D3DXMATRIX));
- if (!object->stack)
- {
- HeapFree(GetProcessHeap(), 0, object);
- *ppstack = NULL;
- return E_OUTOFMEMORY;
- }
-
- object->current = 0;
- object->stack_size = INITIAL_STACK_SIZE;
- D3DXMatrixIdentity(&object->stack[0]);
-
- TRACE("Created matrix stack %p\n", object);
-
- *ppstack = (LPD3DXMATRIXSTACK)object;
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_QueryInterface(ID3DXMatrixStack *iface, REFIID riid, void **ppobj)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
- if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXMatrixStack))
- {
- ID3DXMatrixStack_AddRef(iface);
- *ppobj = This;
- return S_OK;
- }
- *ppobj = NULL;
- ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI ID3DXMatrixStackImpl_AddRef(ID3DXMatrixStack *iface)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
- ULONG ref = InterlockedIncrement(&This->ref);
- TRACE("(%p) : AddRef from %d\n", This, ref - 1);
- return ref;
-}
-
-static ULONG WINAPI ID3DXMatrixStackImpl_Release(ID3DXMatrixStack* iface)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
- ULONG ref = InterlockedDecrement(&This->ref);
- if (!ref)
- {
- HeapFree(GetProcessHeap(), 0, This->stack);
- HeapFree(GetProcessHeap(), 0, This);
- }
- TRACE("(%p) : ReleaseRef to %d\n", This, ref);
- return ref;
-}
-
-static D3DXMATRIX* WINAPI ID3DXMatrixStackImpl_GetTop(ID3DXMatrixStack *iface)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- return &This->stack[This->current];
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_LoadIdentity(ID3DXMatrixStack *iface)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixIdentity(&This->stack[This->current]);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_LoadMatrix(ID3DXMatrixStack *iface, CONST D3DXMATRIX *pm)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- if (!pm) return D3DERR_INVALIDCALL;
- This->stack[This->current] = *pm;
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_MultMatrix(ID3DXMatrixStack *iface, CONST D3DXMATRIX *pm)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- if (!pm) return D3DERR_INVALIDCALL;
- D3DXMatrixMultiply(&This->stack[This->current], &This->stack[This->current], pm);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_MultMatrixLocal(ID3DXMatrixStack *iface, CONST D3DXMATRIX *pm)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- if (!pm) return D3DERR_INVALIDCALL;
- D3DXMatrixMultiply(&This->stack[This->current], pm, &This->stack[This->current]);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_Pop(ID3DXMatrixStack *iface)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- /* Popping the last element on the stack returns D3D_OK, but does nothing. */
- if (!This->current) return D3D_OK;
-
- if (This->current <= This->stack_size / 4 && This->stack_size >= INITIAL_STACK_SIZE * 2)
- {
- unsigned int new_size;
- D3DXMATRIX *new_stack;
-
- new_size = This->stack_size / 2;
- new_stack = HeapReAlloc(GetProcessHeap(), 0, This->stack, new_size * sizeof(D3DXMATRIX));
- if (new_stack)
- {
- This->stack_size = new_size;
- This->stack = new_stack;
- }
- }
-
- --This->current;
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_Push(ID3DXMatrixStack *iface)
-{
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- if (This->current == This->stack_size - 1)
- {
- unsigned int new_size;
- D3DXMATRIX *new_stack;
-
- if (This->stack_size > UINT_MAX / 2) return E_OUTOFMEMORY;
-
- new_size = This->stack_size * 2;
- new_stack = HeapReAlloc(GetProcessHeap(), 0, This->stack, new_size * sizeof(D3DXMATRIX));
- if (!new_stack) return E_OUTOFMEMORY;
-
- This->stack_size = new_size;
- This->stack = new_stack;
- }
-
- ++This->current;
- This->stack[This->current] = This->stack[This->current - 1];
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_RotateAxis(ID3DXMatrixStack *iface, CONST D3DXVECTOR3 *pv, FLOAT angle)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- if (!pv) return D3DERR_INVALIDCALL;
- D3DXMatrixRotationAxis(&temp, pv, angle);
- D3DXMatrixMultiply(&This->stack[This->current], &This->stack[This->current], &temp);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_RotateAxisLocal(ID3DXMatrixStack *iface, CONST D3DXVECTOR3 *pv, FLOAT angle)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- if (!pv) return D3DERR_INVALIDCALL;
- D3DXMatrixRotationAxis(&temp, pv, angle);
- D3DXMatrixMultiply(&This->stack[This->current], &temp, &This->stack[This->current]);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_RotateYawPitchRoll(ID3DXMatrixStack *iface, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixRotationYawPitchRoll(&temp, x, y, z);
- D3DXMatrixMultiply(&This->stack[This->current], &This->stack[This->current], &temp);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_RotateYawPitchRollLocal(ID3DXMatrixStack *iface, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixRotationYawPitchRoll(&temp, x, y, z);
- D3DXMatrixMultiply(&This->stack[This->current], &temp, &This->stack[This->current]);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_Scale(ID3DXMatrixStack *iface, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixScaling(&temp, x, y, z);
- D3DXMatrixMultiply(&This->stack[This->current], &This->stack[This->current], &temp);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_ScaleLocal(ID3DXMatrixStack *iface, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixScaling(&temp, x, y, z);
- D3DXMatrixMultiply(&This->stack[This->current], &temp, &This->stack[This->current]);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_Translate(ID3DXMatrixStack *iface, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixTranslation(&temp, x, y, z);
- D3DXMatrixMultiply(&This->stack[This->current], &This->stack[This->current], &temp);
-
- return D3D_OK;
-}
-
-static HRESULT WINAPI ID3DXMatrixStackImpl_TranslateLocal(ID3DXMatrixStack *iface, FLOAT x, FLOAT y, FLOAT z)
-{
- D3DXMATRIX temp;
- ID3DXMatrixStackImpl *This = (ID3DXMatrixStackImpl *)iface;
-
- TRACE("iface %p\n", iface);
-
- D3DXMatrixTranslation(&temp, x, y, z);
- D3DXMatrixMultiply(&This->stack[This->current], &temp,&This->stack[This->current]);
-
- return D3D_OK;
-}
-
-static const ID3DXMatrixStackVtbl ID3DXMatrixStack_Vtbl =
-{
- ID3DXMatrixStackImpl_QueryInterface,
- ID3DXMatrixStackImpl_AddRef,
- ID3DXMatrixStackImpl_Release,
- ID3DXMatrixStackImpl_Pop,
- ID3DXMatrixStackImpl_Push,
- ID3DXMatrixStackImpl_LoadIdentity,
- ID3DXMatrixStackImpl_LoadMatrix,
- ID3DXMatrixStackImpl_MultMatrix,
- ID3DXMatrixStackImpl_MultMatrixLocal,
- ID3DXMatrixStackImpl_RotateAxis,
- ID3DXMatrixStackImpl_RotateAxisLocal,
- ID3DXMatrixStackImpl_RotateYawPitchRoll,
- ID3DXMatrixStackImpl_RotateYawPitchRollLocal,
- ID3DXMatrixStackImpl_Scale,
- ID3DXMatrixStackImpl_ScaleLocal,
- ID3DXMatrixStackImpl_Translate,
- ID3DXMatrixStackImpl_TranslateLocal,
- ID3DXMatrixStackImpl_GetTop
-};
-
-/*_________________D3DXPLANE________________*/
-
-D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, CONST D3DXVECTOR3 *pvpoint, CONST D3DXVECTOR3 *pvnormal)
-{
- pout->a = pvnormal->x;
- pout->b = pvnormal->y;
- pout->c = pvnormal->z;
- pout->d = -D3DXVec3Dot(pvpoint, pvnormal);
- return pout;
-}
-
-D3DXPLANE* WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3)
-{
- D3DXVECTOR3 edge1, edge2, normal, Nnormal;
-
- edge1.x = 0.0f; edge1.y = 0.0f; edge1.z = 0.0f;
- edge2.x = 0.0f; edge2.y = 0.0f; edge2.z = 0.0f;
- D3DXVec3Subtract(&edge1, pv2, pv1);
- D3DXVec3Subtract(&edge2, pv3, pv1);
- D3DXVec3Cross(&normal, &edge1, &edge2);
- D3DXVec3Normalize(&Nnormal, &normal);
- D3DXPlaneFromPointNormal(pout, pv1, &Nnormal);
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, CONST D3DXPLANE *pp, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
-{
- D3DXVECTOR3 direction, normal;
- FLOAT dot, temp;
-
- normal.x = pp->a;
- normal.y = pp->b;
- normal.z = pp->c;
- direction.x = pv2->x - pv1->x;
- direction.y = pv2->y - pv1->y;
- direction.z = pv2->z - pv1->z;
- dot = D3DXVec3Dot(&normal, &direction);
- if ( !dot ) return NULL;
- temp = ( pp->d + D3DXVec3Dot(&normal, pv1) ) / dot;
- pout->x = pv1->x - temp * direction.x;
- pout->y = pv1->y - temp * direction.y;
- pout->z = pv1->z - temp * direction.z;
- return pout;
-}
-
-D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, CONST D3DXPLANE *pp)
-{
- D3DXPLANE out;
- FLOAT norm;
-
- norm = sqrt(pp->a * pp->a + pp->b * pp->b + pp->c * pp->c);
- if ( norm )
- {
- out.a = pp->a / norm;
- out.b = pp->b / norm;
- out.c = pp->c / norm;
- out.d = pp->d / norm;
- }
- else
- {
- out.a = 0.0f;
- out.b = 0.0f;
- out.c = 0.0f;
- out.d = 0.0f;
- }
- *pout = out;
- return pout;
-}
-
-D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *pplane, CONST D3DXMATRIX *pm)
-{
- CONST D3DXPLANE plane = *pplane;
- pout->a = pm->u.m[0][0] * plane.a + pm->u.m[1][0] * plane.b + pm->u.m[2][0] * plane.c + pm->u.m[3][0] * plane.d;
- pout->b = pm->u.m[0][1] * plane.a + pm->u.m[1][1] * plane.b + pm->u.m[2][1] * plane.c + pm->u.m[3][1] * plane.d;
- pout->c = pm->u.m[0][2] * plane.a + pm->u.m[1][2] * plane.b + pm->u.m[2][2] * plane.c + pm->u.m[3][2] * plane.d;
- pout->d = pm->u.m[0][3] * plane.a + pm->u.m[1][3] * plane.b + pm->u.m[2][3] * plane.c + pm->u.m[3][3] * plane.d;
- return pout;
-}
-
-/*_________________D3DXQUATERNION________________*/
-
-D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, FLOAT f, FLOAT g)
-{
- D3DXQUATERNION temp1, temp2;
- D3DXQuaternionSlerp(pout, D3DXQuaternionSlerp(&temp1, pq1, pq2, f + g), D3DXQuaternionSlerp(&temp2, pq1, pq3, f+g), g / (f + g));
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
-{
- FLOAT norm;
-
- norm = sqrt(pq->x * pq->x + pq->y * pq->y + pq->z * pq->z);
- if (norm )
- {
- pout->x = sin(norm) * pq->x / norm;
- pout->y = sin(norm) * pq->y / norm;
- pout->z = sin(norm) * pq->z / norm;
- pout->w = cos(norm);
- }
- else
- {
- pout->x = 0.0f;
- pout->y = 0.0f;
- pout->z = 0.0f;
- pout->w = 1.0f;
- }
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
-{
- FLOAT norm;
-
- norm = D3DXQuaternionLengthSq(pq);
- if ( !norm )
- {
- pout->x = 0.0f;
- pout->y = 0.0f;
- pout->z = 0.0f;
- pout->w = 0.0f;
- }
- else
- {
- pout->x = -pq->x / norm;
- pout->y = -pq->y / norm;
- pout->z = -pq->z / norm;
- pout->w = pq->w / norm;
- }
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
-{
- FLOAT norm, normvec, theta;
-
- norm = D3DXQuaternionLengthSq(pq);
- if ( norm > 1.0001f )
- {
- pout->x = pq->x;
- pout->y = pq->y;
- pout->z = pq->z;
- pout->w = 0.0f;
- }
- else if( norm > 0.99999f)
- {
- normvec = sqrt( pq->x * pq->x + pq->y * pq->y + pq->z * pq->z );
- theta = atan2(normvec, pq->w) / normvec;
- pout->x = theta * pq->x;
- pout->y = theta * pq->y;
- pout->z = theta * pq->z;
- pout->w = 0.0f;
- }
- else
- {
- FIXME("The quaternion (%f, %f, %f, %f) has a norm <1. This should not happen. Windows returns a result anyway. This case is not implemented yet.\n", pq->x, pq->y, pq->z, pq->w);
- }
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2)
-{
- D3DXQUATERNION out;
- out.x = pq2->w * pq1->x + pq2->x * pq1->w + pq2->y * pq1->z - pq2->z * pq1->y;
- out.y = pq2->w * pq1->y - pq2->x * pq1->z + pq2->y * pq1->w + pq2->z * pq1->x;
- out.z = pq2->w * pq1->z + pq2->x * pq1->y - pq2->y * pq1->x + pq2->z * pq1->w;
- out.w = pq2->w * pq1->w - pq2->x * pq1->x - pq2->y * pq1->y - pq2->z * pq1->z;
- *pout = out;
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
-{
- D3DXQUATERNION out;
- FLOAT norm;
-
- norm = D3DXQuaternionLength(pq);
- if ( !norm )
- {
- out.x = 0.0f;
- out.y = 0.0f;
- out.z = 0.0f;
- out.w = 0.0f;
- }
- else
- {
- out.x = pq->x / norm;
- out.y = pq->y / norm;
- out.z = pq->z / norm;
- out.w = pq->w / norm;
- }
- *pout=out;
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle)
-{
- D3DXVECTOR3 temp;
-
- D3DXVec3Normalize(&temp, pv);
- pout->x = sin( angle / 2.0f ) * temp.x;
- pout->y = sin( angle / 2.0f ) * temp.y;
- pout->z = sin( angle / 2.0f ) * temp.z;
- pout->w = cos( angle / 2.0f );
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXMATRIX *pm)
-{
- int i, maxi;
- FLOAT maxdiag, S, trace;
-
- trace = pm->u.m[0][0] + pm->u.m[1][1] + pm->u.m[2][2] + 1.0f;
- if ( trace > 1.0f)
- {
- pout->x = ( pm->u.m[1][2] - pm->u.m[2][1] ) / ( 2.0f * sqrt(trace) );
- pout->y = ( pm->u.m[2][0] - pm->u.m[0][2] ) / ( 2.0f * sqrt(trace) );
- pout->z = ( pm->u.m[0][1] - pm->u.m[1][0] ) / ( 2.0f * sqrt(trace) );
- pout->w = sqrt(trace) / 2.0f;
- return pout;
- }
- maxi = 0;
- maxdiag = pm->u.m[0][0];
- for (i=1; i<3; i++)
- {
- if ( pm->u.m[i][i] > maxdiag )
- {
- maxi = i;
- maxdiag = pm->u.m[i][i];
- }
- }
- switch( maxi )
- {
- case 0:
- S = 2.0f * sqrt(1.0f + pm->u.m[0][0] - pm->u.m[1][1] - pm->u.m[2][2]);
- pout->x = 0.25f * S;
- pout->y = ( pm->u.m[0][1] + pm->u.m[1][0] ) / S;
- pout->z = ( pm->u.m[0][2] + pm->u.m[2][0] ) / S;
- pout->w = ( pm->u.m[1][2] - pm->u.m[2][1] ) / S;
- break;
- case 1:
- S = 2.0f * sqrt(1.0f + pm->u.m[1][1] - pm->u.m[0][0] - pm->u.m[2][2]);
- pout->x = ( pm->u.m[0][1] + pm->u.m[1][0] ) / S;
- pout->y = 0.25f * S;
- pout->z = ( pm->u.m[1][2] + pm->u.m[2][1] ) / S;
- pout->w = ( pm->u.m[2][0] - pm->u.m[0][2] ) / S;
- break;
- case 2:
- S = 2.0f * sqrt(1.0f + pm->u.m[2][2] - pm->u.m[0][0] - pm->u.m[1][1]);
- pout->x = ( pm->u.m[0][2] + pm->u.m[2][0] ) / S;
- pout->y = ( pm->u.m[1][2] + pm->u.m[2][1] ) / S;
- pout->z = 0.25f * S;
- pout->w = ( pm->u.m[0][1] - pm->u.m[1][0] ) / S;
- break;
- }
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll)
-{
- pout->x = sin( yaw / 2.0f) * cos(pitch / 2.0f) * sin(roll / 2.0f) + cos(yaw / 2.0f) * sin(pitch / 2.0f) * cos(roll / 2.0f);
- pout->y = sin( yaw / 2.0f) * cos(pitch / 2.0f) * cos(roll / 2.0f) - cos(yaw / 2.0f) * sin(pitch / 2.0f) * sin(roll / 2.0f);
- pout->z = cos(yaw / 2.0f) * cos(pitch / 2.0f) * sin(roll / 2.0f) - sin( yaw / 2.0f) * sin(pitch / 2.0f) * cos(roll / 2.0f);
- pout->w = cos( yaw / 2.0f) * cos(pitch / 2.0f) * cos(roll / 2.0f) + sin(yaw / 2.0f) * sin(pitch / 2.0f) * sin(roll / 2.0f);
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t)
-{
- FLOAT dot, epsilon, temp, theta, u;
-
- epsilon = 1.0f;
- temp = 1.0f - t;
- u = t;
- dot = D3DXQuaternionDot(pq1, pq2);
- if ( dot < 0.0f )
- {
- epsilon = -1.0f;
- dot = -dot;
- }
- if( 1.0f - dot > 0.001f )
- {
- theta = acos(dot);
- temp = sin(theta * temp) / sin(theta);
- u = sin(theta * u) / sin(theta);
- }
- pout->x = temp * pq1->x + epsilon * u * pq2->x;
- pout->y = temp * pq1->y + epsilon * u * pq2->y;
- pout->z = temp * pq1->z + epsilon * u * pq2->z;
- pout->w = temp * pq1->w + epsilon * u * pq2->w;
- return pout;
-}
-
-D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST D3DXQUATERNION *pq4, FLOAT t)
-{
- D3DXQUATERNION temp1, temp2;
-
- D3DXQuaternionSlerp(pout, D3DXQuaternionSlerp(&temp1, pq1, pq4, t), D3DXQuaternionSlerp(&temp2, pq2, pq3, t), 2.0f * t * (1.0f - t));
- return pout;
-}
-
-void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle)
-{
- FLOAT norm;
-
- *pangle = 0.0f;
- norm = D3DXQuaternionLength(pq);
- if ( norm )
- {
- paxis->x = pq->x / norm;
- paxis->y = pq->y / norm;
- paxis->z = pq->z / norm;
- if ( fabs( pq->w ) <= 1.0f ) *pangle = 2.0f * acos(pq->w);
- }
- else
- {
- paxis->x = 1.0f;
- paxis->y = 0.0f;
- paxis->z = 0.0f;
- }
-}
-
-/*_________________D3DXVec2_____________________*/
-
-D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g)
-{
- pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x);
- pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y);
- return pout;
-}
-
-D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT s)
-{
- pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s);
- pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s);
- return pout;
-}
-
-D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pt1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pt2, FLOAT s)
-{
- FLOAT h1, h2, h3, h4;
-
- h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f;
- h2 = s * s * s - 2.0f * s * s + s;
- h3 = -2.0f * s * s * s + 3.0f * s * s;
- h4 = s * s * s - s * s;
-
- pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x);
- pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y);
- return pout;
-}
-
-D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv)
-{
- D3DXVECTOR2 out;
- FLOAT norm;
-
- norm = D3DXVec2Length(pv);
- if ( !norm )
- {
- out.x = 0.0f;
- out.y = 0.0f;
- }
- else
- {
- out.x = pv->x / norm;
- out.y = pv->y / norm;
- }
- *pout=out;
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm)
-{
- pout->x = pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[3][0];
- pout->y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[3][1];
- pout->z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[3][2];
- pout->w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[3][3];
- return pout;
-}
-
-D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm)
-{
- FLOAT norm;
-
- norm = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[3][3];
- if ( norm )
- {
- CONST D3DXVECTOR2 v = *pv;
- pout->x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[3][0]) / norm;
- pout->y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[3][1]) / norm;
- }
- else
- {
- pout->x = 0.0f;
- pout->y = 0.0f;
- }
- return pout;
-}
-
-D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm)
-{
- CONST D3DXVECTOR2 v = *pv;
- pout->x = pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y;
- pout->y = pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y;
- return pout;
-}
-
-/*_________________D3DXVec3_____________________*/
-
-D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g)
-{
- pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x);
- pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y);
- pout->z = (1.0f-f-g) * (pv1->z) + f * (pv2->z) + g * (pv3->z);
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT s)
-{
- pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s);
- pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s);
- pout->z = 0.5f * (2.0f * pv1->z + (pv2->z - pv0->z) *s + (2.0f *pv0->z - 5.0f * pv1->z + 4.0f * pv2->z - pv3->z) * s * s + (pv3->z -3.0f * pv2->z + 3.0f * pv1->z - pv0->z) * s * s * s);
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pt1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pt2, FLOAT s)
-{
- FLOAT h1, h2, h3, h4;
-
- h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f;
- h2 = s * s * s - 2.0f * s * s + s;
- h3 = -2.0f * s * s * s + 3.0f * s * s;
- h4 = s * s * s - s * s;
-
- pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x);
- pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y);
- pout->z = h1 * (pv1->z) + h2 * (pt1->z) + h3 * (pv2->z) + h4 * (pt2->z);
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv)
-{
- D3DXVECTOR3 out;
- FLOAT norm;
-
- norm = D3DXVec3Length(pv);
- if ( !norm )
- {
- out.x = 0.0f;
- out.y = 0.0f;
- out.z = 0.0f;
- }
- else
- {
- out.x = pv->x / norm;
- out.y = pv->y / norm;
- out.z = pv->z / norm;
- }
- *pout = out;
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld)
-{
- D3DXMATRIX m;
- D3DXVECTOR3 out;
-
- D3DXMatrixMultiply(&m, pworld, pview);
- D3DXMatrixMultiply(&m, &m, pprojection);
- D3DXVec3TransformCoord(&out, pv, &m);
- out.x = pviewport->X + ( 1.0f + out.x ) * pviewport->Width / 2.0f;
- out.y = pviewport->Y + ( 1.0f - out.y ) * pviewport->Height / 2.0f;
- out.z = pviewport->MinZ + out.z * ( pviewport->MaxZ - pviewport->MinZ );
- *pout = out;
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm)
-{
- pout->x = pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[2][0] * pv->z + pm->u.m[3][0];
- pout->y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[2][1] * pv->z + pm->u.m[3][1];
- pout->z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[2][2] * pv->z + pm->u.m[3][2];
- pout->w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] * pv->z + pm->u.m[3][3];
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm)
-{
- D3DXVECTOR3 out;
- FLOAT norm;
-
- norm = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] *pv->z + pm->u.m[3][3];
-
- if ( norm )
- {
- CONST D3DXVECTOR3 v = *pv;
- out.x = (pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[2][0] * v.z + pm->u.m[3][0]) / norm;
- out.y = (pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[2][1] * v.z + pm->u.m[3][1]) / norm;
- out.z = (pm->u.m[0][2] * v.x + pm->u.m[1][2] * v.y + pm->u.m[2][2] * v.z + pm->u.m[3][2]) / norm;
- }
- else
- {
- out.x = 0.0f;
- out.y = 0.0f;
- out.z = 0.0f;
- }
- *pout = out;
- return pout;
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm)
-{
- CONST D3DXVECTOR3 v = *pv;
- pout->x = pm->u.m[0][0] * v.x + pm->u.m[1][0] * v.y + pm->u.m[2][0] * v.z;
- pout->y = pm->u.m[0][1] * v.x + pm->u.m[1][1] * v.y + pm->u.m[2][1] * v.z;
- pout->z = pm->u.m[0][2] * v.x + pm->u.m[1][2] * v.y + pm->u.m[2][2] * v.z;
- return pout;
-
-}
-
-D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DVIEWPORT8 *pviewport, CONST D3DXMATRIX *pprojection, CONST D3DXMATRIX *pview, CONST D3DXMATRIX *pworld)
-{
- D3DXMATRIX m;
- D3DXVECTOR3 out;
-
- D3DXMatrixMultiply(&m, pworld, pview);
- D3DXMatrixMultiply(&m, &m, pprojection);
- D3DXMatrixInverse(&m, NULL, &m);
- out.x = 2.0f * ( pv->x - pviewport->X ) / pviewport->Width - 1.0f;
- out.y = 1.0f - 2.0f * ( pv->y - pviewport->Y ) / pviewport->Height;
- out.z = ( pv->z - pviewport->MinZ) / ( pviewport->MaxZ - pviewport->MinZ );
- D3DXVec3TransformCoord(&out, &out, &m);
- *pout = out;
- return pout;
-}
-
-/*_________________D3DXVec4_____________________*/
-
-D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g)
-{
- pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x);
- pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y);
- pout->z = (1.0f-f-g) * (pv1->z) + f * (pv2->z) + g * (pv3->z);
- pout->w = (1.0f-f-g) * (pv1->w) + f * (pv2->w) + g * (pv3->w);
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv0, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT s)
-{
- pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s);
- pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s);
- pout->z = 0.5f * (2.0f * pv1->z + (pv2->z - pv0->z) *s + (2.0f *pv0->z - 5.0f * pv1->z + 4.0f * pv2->z - pv3->z) * s * s + (pv3->z -3.0f * pv2->z + 3.0f * pv1->z - pv0->z) * s * s * s);
- pout->w = 0.5f * (2.0f * pv1->w + (pv2->w - pv0->w) *s + (2.0f *pv0->w - 5.0f * pv1->w + 4.0f * pv2->w - pv3->w) * s * s + (pv3->w -3.0f * pv2->w + 3.0f * pv1->w - pv0->w) * s * s * s);
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3)
-{
- D3DXVECTOR4 out;
- out.x = pv1->y * (pv2->z * pv3->w - pv3->z * pv2->w) - pv1->z * (pv2->y * pv3->w - pv3->y * pv2->w) + pv1->w * (pv2->y * pv3->z - pv2->z *pv3->y);
- out.y = -(pv1->x * (pv2->z * pv3->w - pv3->z * pv2->w) - pv1->z * (pv2->x * pv3->w - pv3->x * pv2->w) + pv1->w * (pv2->x * pv3->z - pv3->x * pv2->z));
- out.z = pv1->x * (pv2->y * pv3->w - pv3->y * pv2->w) - pv1->y * (pv2->x *pv3->w - pv3->x * pv2->w) + pv1->w * (pv2->x * pv3->y - pv3->x * pv2->y);
- out.w = -(pv1->x * (pv2->y * pv3->z - pv3->y * pv2->z) - pv1->y * (pv2->x * pv3->z - pv3->x *pv2->z) + pv1->z * (pv2->x * pv3->y - pv3->x * pv2->y));
- *pout = out;
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pt1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pt2, FLOAT s)
-{
- FLOAT h1, h2, h3, h4;
-
- h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f;
- h2 = s * s * s - 2.0f * s * s + s;
- h3 = -2.0f * s * s * s + 3.0f * s * s;
- h4 = s * s * s - s * s;
-
- pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x);
- pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y);
- pout->z = h1 * (pv1->z) + h2 * (pt1->z) + h3 * (pv2->z) + h4 * (pt2->z);
- pout->w = h1 * (pv1->w) + h2 * (pt1->w) + h3 * (pv2->w) + h4 * (pt2->w);
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv)
-{
- D3DXVECTOR4 out;
- FLOAT norm;
-
- norm = D3DXVec4Length(pv);
- if ( !norm )
- {
- out.x = 0.0f;
- out.y = 0.0f;
- out.z = 0.0f;
- out.w = 0.0f;
- }
- else
- {
- out.x = pv->x / norm;
- out.y = pv->y / norm;
- out.z = pv->z / norm;
- out.w = pv->w / norm;
- }
- *pout = out;
- return pout;
-}
-
-D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, CONST D3DXMATRIX *pm)
-{
- D3DXVECTOR4 out;
- out.x = pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[2][0] * pv->z + pm->u.m[3][0] * pv->w;
- out.y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[2][1] * pv->z + pm->u.m[3][1] * pv->w;
- out.z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[2][2] * pv->z + pm->u.m[3][2] * pv->w;
- out.w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] * pv->z + pm->u.m[3][3] * pv->w;
- *pout = out;
- return pout;
-}
diff --git a/dlls/d3dx8/mesh.c b/dlls/d3dx8/mesh.c
deleted file mode 100644
index b0562c7..0000000
--- a/dlls/d3dx8/mesh.c
+++ /dev/null
@@ -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;
-}
diff --git a/dlls/d3dx8/tests/Makefile.in b/dlls/d3dx8/tests/Makefile.in
deleted file mode 100644
index 8869d71..0000000
--- a/dlls/d3dx8/tests/Makefile.in
+++ /dev/null
@@ -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
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
deleted file mode 100644
index 12236bc..0000000
--- a/dlls/d3dx8/tests/math.c
+++ /dev/null
@@ -1,1523 +0,0 @@
-/*
- * 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
- */
-
-#include <assert.h>
-#include "d3dx8.h"
-
-#include "wine/test.h"
-
-#define admitted_error 0.0001f
-
-#define expect_color(expectedcolor,gotcolor) ok((fabs(expectedcolor.r-gotcolor.r)<admitted_error)&&(fabs(expectedcolor.g-gotcolor.g)<admitted_error)&&(fabs(expectedcolor.b-gotcolor.b)<admitted_error)&&(fabs(expectedcolor.a-gotcolor.a)<admitted_error),"Expected Color= (%f, %f, %f, %f)\n , Got Color= (%f, %f, %f, %f)\n", expectedcolor.r, expectedcolor.g, expectedcolor.b, expectedcolor.a, gotcolor.r, gotcolor.g, gotcolor.b, gotcolor.a);
-
-static inline BOOL compare_matrix(const D3DXMATRIX *m1, const D3DXMATRIX *m2)
-{
- int i, j;
-
- for (i = 0; i < 4; ++i)
- {
- for (j = 0; j < 4; ++j)
- {
- if (fabs(U(*m1).m[i][j] - U(*m2).m[i][j]) > admitted_error)
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-#define expect_mat(expectedmat, gotmat) \
-do { \
- const D3DXMATRIX *__m1 = (expectedmat); \
- const D3DXMATRIX *__m2 = (gotmat); \
- ok(compare_matrix(__m1, __m2), "Expected matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n)\n\n" \
- "Got matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f)\n", \
- U(*__m1).m[0][0], U(*__m1).m[0][1], U(*__m1).m[0][2], U(*__m1).m[0][3], \
- U(*__m1).m[1][0], U(*__m1).m[1][1], U(*__m1).m[1][2], U(*__m1).m[1][3], \
- U(*__m1).m[2][0], U(*__m1).m[2][1], U(*__m1).m[2][2], U(*__m1).m[2][3], \
- U(*__m1).m[3][0], U(*__m1).m[3][1], U(*__m1).m[3][2], U(*__m1).m[3][3], \
- U(*__m2).m[0][0], U(*__m2).m[0][1], U(*__m2).m[0][2], U(*__m2).m[0][3], \
- U(*__m2).m[1][0], U(*__m2).m[1][1], U(*__m2).m[1][2], U(*__m2).m[1][3], \
- U(*__m2).m[2][0], U(*__m2).m[2][1], U(*__m2).m[2][2], U(*__m2).m[2][3], \
- U(*__m2).m[3][0], U(*__m2).m[3][1], U(*__m2).m[3][2], U(*__m2).m[3][3]); \
-} while(0)
-
-#define expect_plane(expectedplane,gotplane) ok((fabs(expectedplane.a-gotplane.a)<admitted_error)&&(fabs(expectedplane.b-gotplane.b)<admitted_error)&&(fabs(expectedplane.c-gotplane.c)<admitted_error)&&(fabs(expectedplane.d-gotplane.d)<admitted_error),"Expected Plane= (%f, %f, %f, %f)\n , Got Plane= (%f, %f, %f, %f)\n", expectedplane.a, expectedplane.b, expectedplane.c, expectedplane.d, gotplane.a, gotplane.b, gotplane.c, gotplane.d);
-
-#define expect_vec(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error),"Expected Vector= (%f, %f)\n , Got Vector= (%f, %f)\n", expectedvec.x, expectedvec.y, gotvec.x, gotvec.y);
-
-#define expect_vec3(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error)&&(fabs(expectedvec.z-gotvec.z)<admitted_error),"Expected Vector= (%f, %f, %f)\n , Got Vector= (%f, %f, %f)\n", expectedvec.x, expectedvec.y, expectedvec.z, gotvec.x, gotvec.y, gotvec.z);
-
-#define expect_vec4(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error)&&(fabs(expectedvec.z-gotvec.z)<admitted_error)&&(fabs(expectedvec.w-gotvec.w)<admitted_error),"Expected Vector= (%f, %f, %f, %f)\n , Got Vector= (%f, %f, %f, %f)\n", expectedvec.x, expectedvec.y, expectedvec.z, expectedvec.w, gotvec.x, gotvec.y, gotvec.z, gotvec.w);
-
-static void D3DXColorTest(void)
-{
- D3DXCOLOR color, color1, color2, expected, got;
- LPD3DXCOLOR funcpointer;
- FLOAT scale;
-
- color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
- color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
- color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f;
-
- scale = 0.3f;
-
-/*_______________D3DXColorAdd________________*/
- expected.r = 0.9f; expected.g = 1.05f; expected.b = 0.99f, expected.a = 0.93f;
- D3DXColorAdd(&got,&color1,&color2);
- expect_color(expected,got);
- /* Test the NULL case */
- funcpointer = D3DXColorAdd(&got,NULL,&color2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorAdd(NULL,NULL,&color2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorAdd(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXColorAdjustContrast______*/
- expected.r = 0.41f; expected.g = 0.575f; expected.b = 0.473f, expected.a = 0.93f;
- D3DXColorAdjustContrast(&got,&color,scale);
- expect_color(expected,got);
-
-/*_______________D3DXColorAdjustSaturation______*/
- expected.r = 0.486028f; expected.g = 0.651028f; expected.b = 0.549028f, expected.a = 0.93f;
- D3DXColorAdjustSaturation(&got,&color,scale);
- expect_color(expected,got);
-
-/*_______________D3DXColorLerp________________*/
- expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f;
- D3DXColorLerp(&got,&color,&color1,scale);
- expect_color(expected,got);
- /* Test the NULL case */
- funcpointer = D3DXColorLerp(&got,NULL,&color1,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorLerp(NULL,NULL,&color1,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorLerp(NULL,NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXColorModulate________________*/
- expected.r = 0.18f; expected.g = 0.275f; expected.b = 0.1748f; expected.a = 0.0902f;
- D3DXColorModulate(&got,&color1,&color2);
- expect_color(expected,got);
- /* Test the NULL case */
- funcpointer = D3DXColorModulate(&got,NULL,&color2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorModulate(NULL,NULL,&color2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorModulate(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXColorNegative________________*/
- expected.r = 0.8f; expected.g = 0.25f; expected.b = 0.59f; expected.a = 0.93f;
- D3DXColorNegative(&got,&color);
- expect_color(got,expected);
- /* Test the greater than 1 case */
- color1.r = 0.2f; color1.g = 1.75f; color1.b = 0.41f; color1.a = 0.93f;
- expected.r = 0.8f; expected.g = -0.75f; expected.b = 0.59f; expected.a = 0.93f;
- D3DXColorNegative(&got,&color1);
- expect_color(got,expected);
- /* Test the negative case */
- color1.r = 0.2f; color1.g = -0.75f; color1.b = 0.41f; color1.a = 0.93f;
- expected.r = 0.8f; expected.g = 1.75f; expected.b = 0.59f; expected.a = 0.93f;
- D3DXColorNegative(&got,&color1);
- expect_color(got,expected);
- /* Test the NULL case */
- funcpointer = D3DXColorNegative(&got,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorNegative(NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXColorScale________________*/
- expected.r = 0.06f; expected.g = 0.225f; expected.b = 0.123f; expected.a = 0.279f;
- D3DXColorScale(&got,&color,scale);
- expect_color(expected,got);
- /* Test the NULL case */
- funcpointer = D3DXColorScale(&got,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorScale(NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXColorSubtract_______________*/
- expected.r = -0.1f; expected.g = 0.25f; expected.b = -0.35f, expected.a = 0.82f;
- D3DXColorSubtract(&got,&color,&color2);
- expect_color(expected,got);
- /* Test the NULL case */
- funcpointer = D3DXColorSubtract(&got,NULL,&color2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorSubtract(NULL,NULL,&color2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXColorSubtract(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-}
-
-static void D3DXFresnelTest(void)
-{
- FLOAT expected, got;
-
- expected = 0.089187;
- got = D3DXFresnelTerm(0.5f,1.5);
- ok( fabs(got - expected) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-}
-
-static void D3DXMatrixTest(void)
-{
- D3DXMATRIX expectedmat, gotmat, mat, mat2, mat3;
- LPD3DXMATRIX funcpointer;
- D3DXPLANE plane;
- D3DXQUATERNION q, r;
- D3DXVECTOR3 at, axis, eye, last, scaling;
- D3DXVECTOR4 light;
- BOOL expected, got;
- FLOAT angle, determinant, expectedfloat, gotfloat;
-
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f;
- U(mat).m[3][3] = -40.0f;
-
- U(mat2).m[0][0] = 1.0f; U(mat2).m[1][0] = 2.0f; U(mat2).m[2][0] = 3.0f;
- U(mat2).m[3][0] = 4.0f; U(mat2).m[0][1] = 5.0f; U(mat2).m[1][1] = 6.0f;
- U(mat2).m[2][1] = 7.0f; U(mat2).m[3][1] = 8.0f; U(mat2).m[0][2] = -8.0f;
- U(mat2).m[1][2] = -7.0f; U(mat2).m[2][2] = -6.0f; U(mat2).m[3][2] = -5.0f;
- U(mat2).m[0][3] = -4.0f; U(mat2).m[1][3] = -3.0f; U(mat2).m[2][3] = -2.0f;
- U(mat2).m[3][3] = -1.0f;
-
- plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f;
-
- q.x = 1.0f; q.y = -4.0f; q.z =7.0f; q.w = -11.0f;
- r.x = 0.87f; r.y = 0.65f; r.z =0.43f; r.w= 0.21f;
-
- at.x = -2.0f; at.y = 13.0f; at.z = -9.0f;
- axis.x = 1.0f; axis.y = -3.0f; axis.z = 7.0f;
- eye.x = 8.0f; eye.y = -5.0f; eye.z = 5.75f;
- last.x = 9.7f; last.y = -8.6; last.z = 1.3f;
- scaling.x = 0.03f; scaling.y =0.05f; scaling.z = 0.06f;
-
- light.x = 9.6f; light.y = 8.5f; light.z = 7.4; light.w = 6.3;
-
- angle = D3DX_PI/3.0f;
-
-/*____________D3DXMatrixAffineTransformation______*/
- U(expectedmat).m[0][0] = -459.239990f; U(expectedmat).m[0][1] = -576.719971f; U(expectedmat).m[0][2] = -263.440002f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 519.760010f; U(expectedmat).m[1][1] = -352.440002f; U(expectedmat).m[1][2] = -277.679993f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 363.119995f; U(expectedmat).m[2][1] = -121.040001f; U(expectedmat).m[2][2] = -117.479996f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = -1239.0f; U(expectedmat).m[3][1] = 667.0f; U(expectedmat).m[3][2] = 567.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixAffineTransformation(&gotmat,3.56f,&at,&q,&axis);
- expect_mat(&expectedmat, &gotmat);
-/* Test the NULL case */
- U(expectedmat).m[0][0] = -459.239990f; U(expectedmat).m[0][1] = -576.719971f; U(expectedmat).m[0][2] = -263.440002f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 519.760010f; U(expectedmat).m[1][1] = -352.440002f; U(expectedmat).m[1][2] = -277.679993f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 363.119995f; U(expectedmat).m[2][1] = -121.040001f; U(expectedmat).m[2][2] = -117.479996f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 1.0f; U(expectedmat).m[3][1] = -3.0f; U(expectedmat).m[3][2] = 7.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixAffineTransformation(&gotmat,3.56f,NULL,&q,&axis);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixfDeterminant_____________*/
- expectedfloat = -147888.0f;
- gotfloat = D3DXMatrixfDeterminant(&mat);
- ok(fabs( gotfloat - expectedfloat ) < admitted_error, "Expected: %f, Got: %f\n", expectedfloat, gotfloat);
-
-/*____________D3DXMatrixInverse______________*/
- U(expectedmat).m[0][0] = 16067.0f/73944.0f; U(expectedmat).m[0][1] = -10165.0f/147888.0f; U(expectedmat).m[0][2] = -2729.0f/147888.0f; U(expectedmat).m[0][3] = -1631.0f/49296.0f;
- U(expectedmat).m[1][0] = -565.0f/36972.0f; U(expectedmat).m[1][1] = 2723.0f/73944.0f; U(expectedmat).m[1][2] = -1073.0f/73944.0f; U(expectedmat).m[1][3] = 289.0f/24648.0f;
- U(expectedmat).m[2][0] = -389.0f/2054.0f; U(expectedmat).m[2][1] = 337.0f/4108.0f; U(expectedmat).m[2][2] = 181.0f/4108.0f; U(expectedmat).m[2][3] = 317.0f/4108.0f;
- U(expectedmat).m[3][0] = 163.0f/5688.0f; U(expectedmat).m[3][1] = -101.0f/11376.0f; U(expectedmat).m[3][2] = -73.0f/11376.0f; U(expectedmat).m[3][3] = -127.0f/3792.0f;
- expectedfloat = -147888.0f;
- D3DXMatrixInverse(&gotmat,&determinant,&mat);
- expect_mat(&expectedmat, &gotmat);
- ok(fabs( determinant - expectedfloat ) < admitted_error, "Expected: %f, Got: %f\n", expectedfloat, determinant);
- funcpointer = D3DXMatrixInverse(&gotmat,NULL,&mat2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*____________D3DXMatrixIsIdentity______________*/
- expected = FALSE;
- memset(&mat3, 0, sizeof(mat3));
- got = D3DXMatrixIsIdentity(&mat3);
- ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
- D3DXMatrixIdentity(&mat3);
- expected = TRUE;
- got = D3DXMatrixIsIdentity(&mat3);
- ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
- U(mat3).m[0][0] = 0.000009f;
- expected = FALSE;
- got = D3DXMatrixIsIdentity(&mat3);
- ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
- /* Test the NULL case */
- expected = FALSE;
- got = D3DXMatrixIsIdentity(NULL);
- ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
-
-/*____________D3DXMatrixLookatLH_______________*/
- U(expectedmat).m[0][0] = -0.822465f; U(expectedmat).m[0][1] = -0.409489f; U(expectedmat).m[0][2] = -0.394803f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = -0.555856f; U(expectedmat).m[1][1] = 0.431286f; U(expectedmat).m[1][2] = 0.710645f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = -0.120729f; U(expectedmat).m[2][1] = 0.803935f; U(expectedmat).m[2][2] = -0.582335f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 4.494634f; U(expectedmat).m[3][1] = 0.809719f; U(expectedmat).m[3][2] = 10.060076f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixLookAtLH(&gotmat,&eye,&at,&axis);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixLookatRH_______________*/
- U(expectedmat).m[0][0] = 0.822465f; U(expectedmat).m[0][1] = -0.409489f; U(expectedmat).m[0][2] = 0.394803f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.555856f; U(expectedmat).m[1][1] = 0.431286f; U(expectedmat).m[1][2] = -0.710645f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.120729f; U(expectedmat).m[2][1] = 0.803935f; U(expectedmat).m[2][2] = 0.582335f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = -4.494634f; U(expectedmat).m[3][1] = 0.809719f; U(expectedmat).m[3][2] = -10.060076f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixLookAtRH(&gotmat,&eye,&at,&axis);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixMultiply______________*/
- U(expectedmat).m[0][0] = 73.0f; U(expectedmat).m[0][1] = 193.0f; U(expectedmat).m[0][2] = -197.0f; U(expectedmat).m[0][3] = -77.0f;
- U(expectedmat).m[1][0] = 231.0f; U(expectedmat).m[1][1] = 551.0f; U(expectedmat).m[1][2] = -489.0f; U(expectedmat).m[1][3] = -169.0;
- U(expectedmat).m[2][0] = 239.0f; U(expectedmat).m[2][1] = 523.0f; U(expectedmat).m[2][2] = -400.0f; U(expectedmat).m[2][3] = -116.0f;
- U(expectedmat).m[3][0] = -164.0f; U(expectedmat).m[3][1] = -320.0f; U(expectedmat).m[3][2] = 187.0f; U(expectedmat).m[3][3] = 31.0f;
- D3DXMatrixMultiply(&gotmat,&mat,&mat2);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixMultiplyTranspose____*/
- U(expectedmat).m[0][0] = 73.0f; U(expectedmat).m[0][1] = 231.0f; U(expectedmat).m[0][2] = 239.0f; U(expectedmat).m[0][3] = -164.0f;
- U(expectedmat).m[1][0] = 193.0f; U(expectedmat).m[1][1] = 551.0f; U(expectedmat).m[1][2] = 523.0f; U(expectedmat).m[1][3] = -320.0;
- U(expectedmat).m[2][0] = -197.0f; U(expectedmat).m[2][1] = -489.0f; U(expectedmat).m[2][2] = -400.0f; U(expectedmat).m[2][3] = 187.0f;
- U(expectedmat).m[3][0] = -77.0f; U(expectedmat).m[3][1] = -169.0f; U(expectedmat).m[3][2] = -116.0f; U(expectedmat).m[3][3] = 31.0f;
- D3DXMatrixMultiplyTranspose(&gotmat,&mat,&mat2);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixOrthoLH_______________*/
- U(expectedmat).m[0][0] = 0.8f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 0.270270f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.151515f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -0.484848f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixOrthoLH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixOrthoOffCenterLH_______________*/
- U(expectedmat).m[0][0] = 3.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 0.180180f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.045662f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = -1.727272f; U(expectedmat).m[3][1] = -0.567568f; U(expectedmat).m[3][2] = 0.424658f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixOrthoOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixOrthoOffCenterRH_______________*/
- U(expectedmat).m[0][0] = 3.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 0.180180f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.045662f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = -1.727272f; U(expectedmat).m[3][1] = -0.567568f; U(expectedmat).m[3][2] = 0.424658f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixOrthoOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixOrthoRH_______________*/
- U(expectedmat).m[0][0] = 0.8f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 0.270270f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.151515f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -0.484848f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixOrthoRH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixPerspectiveFovLH_______________*/
- U(expectedmat).m[0][0] = 13.288858f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 9.966644f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.783784f; U(expectedmat).m[2][3] = 1.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
- D3DXMatrixPerspectiveFovLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixPerspectiveFovRH_______________*/
- U(expectedmat).m[0][0] = 13.288858f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 9.966644f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.783784f; U(expectedmat).m[2][3] = -1.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
- D3DXMatrixPerspectiveFovRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixPerspectiveLH_______________*/
- U(expectedmat).m[0][0] = -24.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = -6.4f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.783784f; U(expectedmat).m[2][3] = 1.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
- D3DXMatrixPerspectiveLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixPerspectiveOffCenterLH_______________*/
- U(expectedmat).m[0][0] = 11.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 0.576577f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = -1.727273f; U(expectedmat).m[2][1] = -0.567568f; U(expectedmat).m[2][2] = 0.840796f; U(expectedmat).m[2][3] = 1.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -2.690547f; U(expectedmat).m[3][3] = 0.0f;
- D3DXMatrixPerspectiveOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixPerspectiveOffCenterRH_______________*/
- U(expectedmat).m[0][0] = 11.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = 0.576577f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 1.727273f; U(expectedmat).m[2][1] = 0.567568f; U(expectedmat).m[2][2] = -0.840796f; U(expectedmat).m[2][3] = -1.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -2.690547f; U(expectedmat).m[3][3] = 0.0f;
- D3DXMatrixPerspectiveOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixPerspectiveRH_______________*/
- U(expectedmat).m[0][0] = -24.0f; U(expectedmat).m[0][1] = -0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0f; U(expectedmat).m[1][1] = -6.4f; U(expectedmat).m[1][2] = 0.0; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.783784f; U(expectedmat).m[2][3] = -1.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
- D3DXMatrixPerspectiveRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixReflect______________*/
- U(expectedmat).m[0][0] = 0.307692f; U(expectedmat).m[0][1] = -0.230769f; U(expectedmat).m[0][2] = 0.923077f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = -0.230769; U(expectedmat).m[1][1] = 0.923077f; U(expectedmat).m[1][2] = 0.307693f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.923077f; U(expectedmat).m[2][1] = 0.307693f; U(expectedmat).m[2][2] = -0.230769f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 1.615385f; U(expectedmat).m[3][1] = 0.538462f; U(expectedmat).m[3][2] = -2.153846f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixReflect(&gotmat,&plane);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixRotationAxis_____*/
- U(expectedmat).m[0][0] = 0.508475f; U(expectedmat).m[0][1] = 0.763805f; U(expectedmat).m[0][2] = 0.397563f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = -0.814652f; U(expectedmat).m[1][1] = 0.576271f; U(expectedmat).m[1][2] = -0.065219f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = -0.278919f; U(expectedmat).m[2][1] = -0.290713f; U(expectedmat).m[2][2] = 0.915254f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixRotationAxis(&gotmat,&axis,angle);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixRotationQuaternion______________*/
- U(expectedmat).m[0][0] = -129.0f; U(expectedmat).m[0][1] = -162.0f; U(expectedmat).m[0][2] = -74.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 146.0f; U(expectedmat).m[1][1] = -99.0f; U(expectedmat).m[1][2] = -78.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 102.0f; U(expectedmat).m[2][1] = -34.0f; U(expectedmat).m[2][2] = -33.0f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixRotationQuaternion(&gotmat,&q);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixRotationX______________*/
- U(expectedmat).m[0][0] = 1.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0; U(expectedmat).m[1][1] = 0.5f; U(expectedmat).m[1][2] = sqrt(3.0f)/2.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = -sqrt(3.0f)/2.0f; U(expectedmat).m[2][2] = 0.5f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixRotationX(&gotmat,angle);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixRotationY______________*/
- U(expectedmat).m[0][0] = 0.5f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = -sqrt(3.0f)/2.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0; U(expectedmat).m[1][1] = 1.0f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = sqrt(3.0f)/2.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.5f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixRotationY(&gotmat,angle);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixRotationYawPitchRoll____*/
- U(expectedmat).m[0][0] = 0.888777f; U(expectedmat).m[0][1] = 0.091875f; U(expectedmat).m[0][2] = -0.449037f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.351713f; U(expectedmat).m[1][1] = 0.491487f; U(expectedmat).m[1][2] = 0.796705f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.293893f; U(expectedmat).m[2][1] = -0.866025f; U(expectedmat).m[2][2] = 0.404509f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixRotationYawPitchRoll(&gotmat, 3.0f*angle/5.0f, angle, 3.0f*angle/17.0f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixRotationZ______________*/
- U(expectedmat).m[0][0] = 0.5f; U(expectedmat).m[0][1] = sqrt(3.0f)/2.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = -sqrt(3.0f)/2.0f; U(expectedmat).m[1][1] = 0.5f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 1.0f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixRotationZ(&gotmat,angle);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixScaling______________*/
- U(expectedmat).m[0][0] = 0.69f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0; U(expectedmat).m[1][1] = 0.53f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 4.11f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixScaling(&gotmat,0.69f,0.53f,4.11f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixShadow______________*/
- U(expectedmat).m[0][0] = 12.786773f; U(expectedmat).m[0][1] = 5.000961f; U(expectedmat).m[0][2] = 4.353778f; U(expectedmat).m[0][3] = 3.706595f;
- U(expectedmat).m[1][0] = 1.882715; U(expectedmat).m[1][1] = 8.805615f; U(expectedmat).m[1][2] = 1.451259f; U(expectedmat).m[1][3] = 1.235532f;
- U(expectedmat).m[2][0] = -7.530860f; U(expectedmat).m[2][1] = -6.667949f; U(expectedmat).m[2][2] = 1.333590f; U(expectedmat).m[2][3] = -4.942127f;
- U(expectedmat).m[3][0] = -13.179006f; U(expectedmat).m[3][1] = -11.668910f; U(expectedmat).m[3][2] = -10.158816f; U(expectedmat).m[3][3] = -1.510094f;
- D3DXMatrixShadow(&gotmat,&light,&plane);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixTransformation______________*/
- U(expectedmat).m[0][0] = -0.2148f; U(expectedmat).m[0][1] = 1.3116f; U(expectedmat).m[0][2] = 0.4752f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.9504f; U(expectedmat).m[1][1] = -0.8836f; U(expectedmat).m[1][2] = 0.9244f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 1.0212f; U(expectedmat).m[2][1] = 0.1936f; U(expectedmat).m[2][2] = -1.3588f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 18.2985f; U(expectedmat).m[3][1] = -29.624001f; U(expectedmat).m[3][2] = 15.683499f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixTransformation(&gotmat,&at,&q,NULL,&eye,&r,&last);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixTranslation______________*/
- U(expectedmat).m[0][0] = 1.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
- U(expectedmat).m[1][0] = 0.0; U(expectedmat).m[1][1] = 1.0f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f;
- U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 1.0f; U(expectedmat).m[2][3] = 0.0f;
- U(expectedmat).m[3][0] = 0.69f; U(expectedmat).m[3][1] = 0.53f; U(expectedmat).m[3][2] = 4.11f; U(expectedmat).m[3][3] = 1.0f;
- D3DXMatrixTranslation(&gotmat,0.69f,0.53f,4.11f);
- expect_mat(&expectedmat, &gotmat);
-
-/*____________D3DXMatrixTranspose______________*/
- U(expectedmat).m[0][0] = 10.0f; U(expectedmat).m[0][1] = 11.0f; U(expectedmat).m[0][2] = 19.0f; U(expectedmat).m[0][3] = 2.0f;
- U(expectedmat).m[1][0] = 5.0; U(expectedmat).m[1][1] = 20.0f; U(expectedmat).m[1][2] = -21.0f; U(expectedmat).m[1][3] = 3.0f;
- U(expectedmat).m[2][0] = 7.0f; U(expectedmat).m[2][1] = 16.0f; U(expectedmat).m[2][2] = 30.f; U(expectedmat).m[2][3] = -4.0f;
- U(expectedmat).m[3][0] = 8.0f; U(expectedmat).m[3][1] = 33.0f; U(expectedmat).m[3][2] = 43.0f; U(expectedmat).m[3][3] = -40.0f;
- D3DXMatrixTranspose(&gotmat,&mat);
- expect_mat(&expectedmat, &gotmat);
-}
-
-static void D3DXPlaneTest(void)
-{
- D3DXMATRIX mat;
- D3DXPLANE expectedplane, gotplane, nulplane, plane;
- D3DXVECTOR3 expectedvec, gotvec, vec1, vec2, vec3;
- LPD3DXVECTOR3 funcpointer;
- D3DXVECTOR4 vec;
- FLOAT expected, got;
-
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f;
- U(mat).m[3][3] = -40.0f;
-
- plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f;
-
- vec.x = 2.0f; vec.y = 5.0f; vec.z = -6.0f; vec.w = 11.0f;
-
-/*_______________D3DXPlaneDot________________*/
- expected = 42.0f;
- got = D3DXPlaneDot(&plane,&vec),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
- expected = 0.0f;
- got = D3DXPlaneDot(NULL,&vec),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
- expected = 0.0f;
- got = D3DXPlaneDot(NULL,NULL),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
-
-/*_______________D3DXPlaneDotCoord________________*/
- expected = -28.0f;
- got = D3DXPlaneDotCoord(&plane,&vec),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
- expected = 0.0f;
- got = D3DXPlaneDotCoord(NULL,&vec),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
- expected = 0.0f;
- got = D3DXPlaneDotCoord(NULL,NULL),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
-
-/*_______________D3DXPlaneDotNormal______________*/
- expected = -35.0f;
- got = D3DXPlaneDotNormal(&plane,&vec),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
- expected = 0.0f;
- got = D3DXPlaneDotNormal(NULL,&vec),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
- expected = 0.0f;
- got = D3DXPlaneDotNormal(NULL,NULL),
- ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
-
-/*_______________D3DXPlaneFromPointNormal_______*/
- vec1.x = 11.0f; vec1.y = 13.0f; vec1.z = 15.0f;
- vec2.x = 17.0f; vec2.y = 31.0f; vec2.z = 24.0f;
- expectedplane.a = 17.0f; expectedplane.b = 31.0f; expectedplane.c = 24.0f; expectedplane.d = -950.0f;
- D3DXPlaneFromPointNormal(&gotplane,&vec1,&vec2);
- expect_plane(expectedplane, gotplane);
-
-/*_______________D3DXPlaneFromPoints_______*/
- vec1.x = 1.0f; vec1.y = 2.0f; vec1.z = 3.0f;
- vec2.x = 1.0f; vec2.y = -6.0f; vec2.z = -5.0f;
- vec3.x = 83.0f; vec3.y = 74.0f; vec3.z = 65.0f;
- expectedplane.a = 0.085914f; expectedplane.b = -0.704492f; expectedplane.c = 0.704492f; expectedplane.d = -0.790406f;
- D3DXPlaneFromPoints(&gotplane,&vec1,&vec2,&vec3);
- expect_plane(expectedplane, gotplane);
- /* Test if 2 vectors are parallels */
- vec3.x = 1.0f; vec3.y = 1.0f; vec3.z = 2.0f;
- expectedplane.a = 0.0f; expectedplane.b = 0.0f; expectedplane.c = 0.0f; expectedplane.d = 0.0f;
- D3DXPlaneFromPoints(&gotplane,&vec1,&vec2,&vec3);
- expect_plane(expectedplane, gotplane);
-
-/*_______________D3DXPlaneIntersectLine___________*/
- vec1.x = 9.0f; vec1.y = 6.0f; vec1.z = 3.0f;
- vec2.x = 2.0f; vec2.y = 5.0f; vec2.z = 8.0f;
- expectedvec.x = 20.0f/3.0f; expectedvec.y = 17.0f/3.0f; expectedvec.z = 14.0f/3.0f;
- D3DXPlaneIntersectLine(&gotvec,&plane,&vec1,&vec2);
- expect_vec3(expectedvec, gotvec);
- /* Test a parallel line */
- vec1.x = 11.0f; vec1.y = 13.0f; vec1.z = 15.0f;
- vec2.x = 17.0f; vec2.y = 31.0f; vec2.z = 24.0f;
- expectedvec.x = 20.0f/3.0f; expectedvec.y = 17.0f/3.0f; expectedvec.z = 14.0f/3.0f;
- funcpointer = D3DXPlaneIntersectLine(&gotvec,&plane,&vec1,&vec2);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXPlaneNormalize______________*/
- expectedplane.a = -3.0f/sqrt(26.0f); expectedplane.b = -1.0f/sqrt(26.0f); expectedplane.c = 4.0f/sqrt(26.0f); expectedplane.d = 7.0/sqrt(26.0f);
- D3DXPlaneNormalize(&gotplane, &plane);
- expect_plane(expectedplane, gotplane);
- nulplane.a = 0.0; nulplane.b = 0.0f, nulplane.c = 0.0f; nulplane.d = 0.0f;
- expectedplane.a = 0.0f; expectedplane.b = 0.0f; expectedplane.c = 0.0f; expectedplane.d = 0.0f;
- D3DXPlaneNormalize(&gotplane, &nulplane);
- expect_plane(expectedplane, gotplane);
- nulplane.a = 0.0; nulplane.b = 0.0f, nulplane.c = 0.0f; nulplane.d = 4.3f;
- expectedplane.a = 0.0f; expectedplane.b = 0.0f; expectedplane.c = 0.0f; expectedplane.d = 0.0f;
- D3DXPlaneNormalize(&gotplane, &nulplane);
- expect_plane(expectedplane, gotplane);
-
-/*_______________D3DXPlaneTransform____________*/
- expectedplane.a = 49.0f; expectedplane.b = -98.0f; expectedplane.c = 55.0f; expectedplane.d = -165.0f;
- D3DXPlaneTransform(&gotplane,&plane,&mat);
- expect_plane(expectedplane, gotplane);
-}
-
-static void D3X8QuaternionTest(void)
-{
- D3DXMATRIX mat;
- D3DXQUATERNION expectedquat, gotquat, Nq, Nq1, nul, smallq, smallr, q, r, s, t, u;
- LPD3DXQUATERNION funcpointer;
- D3DXVECTOR3 axis, expectedvec;
- FLOAT angle, expected, got, scale, scale2;
- BOOL expectedbool, gotbool;
-
- nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f; nul.w = 0.0f;
- q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
- r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
- t.x = -1111.0f, t.y = 111.0f; t.z = -11.0f; t.w = 1.0f;
- u.x = 91.0f; u.y = - 82.0f; u.z = 7.3f; u.w = -6.4f;
- smallq.x = 0.1f; smallq.y = 0.2f; smallq.z= 0.3f; smallq.w = 0.4f;
- smallr.x = 0.5f; smallr.y = 0.6f; smallr.z= 0.7f; smallr.w = 0.8f;
-
- scale = 0.3f;
- scale2 = 0.78f;
-
-/*_______________D3DXQuaternionBaryCentric________________________*/
- expectedquat.x = -867.444458; expectedquat.y = 87.851111f; expectedquat.z = -9.937778f; expectedquat.w = 3.235555f;
- D3DXQuaternionBaryCentric(&gotquat,&q,&r,&t,scale,scale2);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionConjugate________________*/
- expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
- D3DXQuaternionConjugate(&gotquat,&q);
- expect_vec4(expectedquat,gotquat);
- /* Test the NULL case */
- funcpointer = D3DXQuaternionConjugate(&gotquat,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXQuaternionConjugate(NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXQuaternionDot______________________*/
- expected = 55.0f;
- got = D3DXQuaternionDot(&q,&r);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXQuaternionDot(NULL,&r);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- expected=0.0f;
- got = D3DXQuaternionDot(NULL,NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXQuaternionExp______________________________*/
- expectedquat.x = -0.216382f; expectedquat.y = -0.432764f; expectedquat.z = -0.8655270f; expectedquat.w = -0.129449f;
- D3DXQuaternionExp(&gotquat,&q);
- expect_vec4(expectedquat,gotquat);
- /* Test the null quaternion */
- expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
- D3DXQuaternionExp(&gotquat,&nul);
- expect_vec4(expectedquat,gotquat);
- /* Test the case where the norm of the quaternion is <1 */
- Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w= 0.9f;
- expectedquat.x = 0.195366; expectedquat.y = 0.097683f; expectedquat.z = 0.293049f; expectedquat.w = 0.930813f;
- D3DXQuaternionExp(&gotquat,&Nq1);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionIdentity________________*/
- expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
- D3DXQuaternionIdentity(&gotquat);
- expect_vec4(expectedquat,gotquat);
- /* Test the NULL case */
- funcpointer = D3DXQuaternionIdentity(NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXQuaternionInverse________________________*/
- expectedquat.x = -1.0f/121.0f; expectedquat.y = -2.0f/121.0f; expectedquat.z = -4.0f/121.0f; expectedquat.w = 10.0f/121.0f;
- D3DXQuaternionInverse(&gotquat,&q);
- expect_vec4(expectedquat,gotquat);
- /* test the null quaternion */
- expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
- D3DXQuaternionInverse(&gotquat,&nul);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionIsIdentity________________*/
- s.x = 0.0f; s.y = 0.0f; s.z = 0.0f; s.w = 1.0f;
- expectedbool = TRUE;
- gotbool = D3DXQuaternionIsIdentity(&s);
- ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
- s.x = 2.3f; s.y = -4.2f; s.z = 1.2f; s.w=0.2f;
- expectedbool = FALSE;
- gotbool = D3DXQuaternionIsIdentity(&q);
- ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
- /* Test the NULL case */
- gotbool = D3DXQuaternionIsIdentity(NULL);
- ok(gotbool == FALSE, "Expected boolean: %d, Got boolean: %d\n", FALSE, gotbool);
-
-/*_______________D3DXQuaternionLength__________________________*/
- expected = 11.0f;
- got = D3DXQuaternionLength(&q);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXQuaternionLength(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXQuaternionLengthSq________________________*/
- expected = 121.0f;
- got = D3DXQuaternionLengthSq(&q);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXQuaternionLengthSq(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXQuaternionLn______________________________*/
- expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 0.0f;
- D3DXQuaternionLn(&gotquat,&q);
- expect_vec4(expectedquat,gotquat);
- expectedquat.x = -3.0f; expectedquat.y = 4.0f; expectedquat.z = -5.0f; expectedquat.w = 0.0f;
- D3DXQuaternionLn(&gotquat,&r);
- expect_vec4(expectedquat,gotquat);
- Nq.x = 1.0f/11.0f; Nq.y = 2.0f/11.0f; Nq.z = 4.0f/11.0f; Nq.w=10.0f/11.0f;
- expectedquat.x = 0.093768f; expectedquat.y = 0.187536f; expectedquat.z = 0.375073f; expectedquat.w = 0.0f;
- D3DXQuaternionLn(&gotquat,&Nq);
- expect_vec4(expectedquat,gotquat);
- /* Test the cas where the norm of the quaternion is <1 */
- Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w= 0.9f;
- expectedquat.x = 0.206945f; expectedquat.y = 0.103473f; expectedquat.z = 0.310418f; expectedquat.w = 0.0f;
- D3DXQuaternionLn(&gotquat,&Nq1);
- todo_wine{ expect_vec4(expectedquat,gotquat) };
-
-/*_______________D3DXQuaternionMultiply________________________*/
- expectedquat.x = 3.0f; expectedquat.y = 61.0f; expectedquat.z = -32.0f; expectedquat.w = 85.0f;
- D3DXQuaternionMultiply(&gotquat,&q,&r);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionNormalize________________________*/
- expectedquat.x = 1.0f/11.0f; expectedquat.y = 2.0f/11.0f; expectedquat.z = 4.0f/11.0f; expectedquat.w = 10.0f/11.0f;
- D3DXQuaternionNormalize(&gotquat,&q);
- expect_vec4(expectedquat,gotquat);
- /* Test the nul quaternion */
- expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
- D3DXQuaternionNormalize(&gotquat,&nul);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionRotationAxis___________________*/
- axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f;
- angle = D3DX_PI/3.0f;
- expectedquat.x = 0.067116; expectedquat.y = 0.234905f; expectedquat.z = 0.436251f; expectedquat.w = 0.866025f;
- D3DXQuaternionRotationAxis(&gotquat,&axis,angle);
- expect_vec4(expectedquat,gotquat);
- /* Test the nul quaternion */
- axis.x = 0.0f; axis.y = 0.0; axis.z = 0.0f;
- expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.866025f;
- D3DXQuaternionRotationAxis(&gotquat,&axis,angle);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionRotationMatrix___________________*/
- /* test when the trace is >0 */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 2.368682f; expectedquat.y = 0.768221f; expectedquat.z = -0.384111f; expectedquat.w = 3.905125f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the greater element is (2,2) */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = -60.0f; U(mat).m[2][2] = 40.0f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 1.233905f; expectedquat.y = -0.237290f; expectedquat.z = 5.267827f; expectedquat.w = -0.284747f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the greater element is (1,1) */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 60.0f; U(mat).m[2][2] = -80.0f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 0.651031f; expectedquat.y = 6.144103f; expectedquat.z = -0.203447f; expectedquat.w = 0.488273f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is near 0 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.9f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 1.709495f; expectedquat.y = 2.339872f; expectedquat.z = -0.534217f; expectedquat.w = 1.282122f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 0.49 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.51f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 1.724923f; expectedquat.y = 2.318944f; expectedquat.z = -0.539039f; expectedquat.w = 1.293692f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 0.51 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.49f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 1.725726f; expectedquat.y = 2.317865f; expectedquat.z = -0.539289f; expectedquat.w = 1.294294f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 0.99 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.01f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 1.745328f; expectedquat.y = 2.291833f; expectedquat.z = -0.545415f; expectedquat.w = 1.308996f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 1.0 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.0f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 1.745743f; expectedquat.y = 2.291288f; expectedquat.z = -0.545545f; expectedquat.w = 1.309307f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 1.01 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.01f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 18.408188f; expectedquat.y = 5.970223f; expectedquat.z = -2.985111f; expectedquat.w = 0.502494f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 1.5 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.5f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 15.105186f; expectedquat.y = 4.898980f; expectedquat.z = -2.449490f; expectedquat.w = 0.612372f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 1.7 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.70f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 14.188852f; expectedquat.y = 4.601790f; expectedquat.z = -2.300895f; expectedquat.w = 0.651920f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 1.99 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.99f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 13.114303f; expectedquat.y = 4.253287f; expectedquat.z = -2.126644f; expectedquat.w = 0.705337f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
- /* test the case when the trace is 2.0 in a matrix which is not a rotation */
- U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
- U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
- U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
- U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
- U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 2.0f;
- U(mat).m[3][3] = 48.0f;
- expectedquat.x = 10.680980f; expectedquat.y = 3.464102f; expectedquat.z = -1.732051f; expectedquat.w = 0.866025f;
- D3DXQuaternionRotationMatrix(&gotquat,&mat);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionRotationYawPitchRoll__________*/
- expectedquat.x = 0.303261f; expectedquat.y = 0.262299f; expectedquat.z = 0.410073f; expectedquat.w = 0.819190f;
- D3DXQuaternionRotationYawPitchRoll(&gotquat,D3DX_PI/4.0f,D3DX_PI/11.0f,D3DX_PI/3.0f);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionSlerp________________________*/
- expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f;
- D3DXQuaternionSlerp(&gotquat,&q,&r,scale);
- expect_vec4(expectedquat,gotquat);
- expectedquat.x = 334.0f; expectedquat.y = -31.9f; expectedquat.z = 6.1f; expectedquat.w = 6.7f;
- D3DXQuaternionSlerp(&gotquat,&q,&t,scale);
- expect_vec4(expectedquat,gotquat);
- expectedquat.x = 0.239485f; expectedquat.y = 0.346580f; expectedquat.z = 0.453676f; expectedquat.w = 0.560772f;
- D3DXQuaternionSlerp(&gotquat,&smallq,&smallr,scale);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionSquad________________________*/
- expectedquat.x = -156.296f; expectedquat.y = 30.242f; expectedquat.z = -2.5022f; expectedquat.w = 7.3576f;
- D3DXQuaternionSquad(&gotquat,&q,&r,&t,&u,scale);
- expect_vec4(expectedquat,gotquat);
-
-/*_______________D3DXQuaternionToAxisAngle__________________*/
- Nq.x = 1.0f/22.0f; Nq.y = 2.0f/22.0f; Nq.z = 4.0f/22.0f; Nq.w = 10.0f/22.0f;
- expectedvec.x = 1.0f/11.0f; expectedvec.y = 2.0f/11.0f; expectedvec.z = 4.0f/11.0f;
- expected = 2.197869f;
- D3DXQuaternionToAxisAngle(&Nq,&axis,&angle);
- expect_vec3(expectedvec,axis);
- ok(fabs( angle - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, angle);
- /* Test if |w|>1.0f */
- expectedvec.x = 1.0f/11.0f; expectedvec.y = 2.0f/11.0f; expectedvec.z = 4.0f/11.0f;
- expected = 0.0f;
- D3DXQuaternionToAxisAngle(&q,&axis,&angle);
- expect_vec3(expectedvec,axis);
- ok(fabs( angle - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, angle);
- /* Test the null quaternion */
- expectedvec.x = 1.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
- expected = 0.0f;
- D3DXQuaternionToAxisAngle(&nul,&axis,&angle);
- expect_vec3(expectedvec,axis);
- ok(fabs( angle - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, angle);
-}
-
-static void D3X8Vector2Test(void)
-{
- D3DXVECTOR2 expectedvec, gotvec, nul, nulproj, u, v, w, x;
- LPD3DXVECTOR2 funcpointer;
- D3DXVECTOR4 expectedtrans, gottrans;
- D3DXMATRIX mat;
- FLOAT coeff1, coeff2, expected, got, scale;
-
- nul.x = 0.0f; nul.y = 0.0f;
- u.x = 3.0f; u.y = 4.0f;
- v.x = -7.0f; v.y = 9.0f;
- w.x = 4.0f; w.y = -3.0f;
- x.x = 2.0f; x.y = -11.0f;
-
- U(mat).m[0][0] = 1.0f; U(mat).m[0][1] = 2.0f; U(mat).m[0][2] = 3.0f; U(mat).m[0][3] = 4.0f;
- U(mat).m[1][0] = 5.0f; U(mat).m[1][1] = 6.0f; U(mat).m[1][2] = 7.0f; U(mat).m[1][3] = 8.0f;
- U(mat).m[2][0] = 9.0f; U(mat).m[2][1] = 10.0f; U(mat).m[2][2] = 11.0f; U(mat).m[2][3] = 12.0f;
- U(mat).m[3][0] = 13.0f; U(mat).m[3][1] = 14.0f; U(mat).m[3][2] = 15.0f; U(mat).m[3][3] = 16.0f;
-
- coeff1 = 2.0f; coeff2 = 5.0f;
- scale = -6.5f;
-
-/*_______________D3DXVec2Add__________________________*/
- expectedvec.x = -4.0f; expectedvec.y = 13.0f;
- D3DXVec2Add(&gotvec,&u,&v);
- expect_vec(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec2Add(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec2Add(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec2BaryCentric___________________*/
- expectedvec.x = -12.0f; expectedvec.y = -21.0f;
- D3DXVec2BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
- expect_vec(expectedvec,gotvec);
-
-/*_______________D3DXVec2CatmullRom____________________*/
- expectedvec.x = 5820.25f; expectedvec.y = -3654.5625f;
- D3DXVec2CatmullRom(&gotvec,&u,&v,&w,&x,scale);
- expect_vec(expectedvec,gotvec);
-
-/*_______________D3DXVec2CCW__________________________*/
- expected = 55.0f;
- got = D3DXVec2CCW(&u,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec2CCW(NULL,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- expected=0.0f;
- got = D3DXVec2CCW(NULL,NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec2Dot__________________________*/
- expected = 15.0f;
- got = D3DXVec2Dot(&u,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec2Dot(NULL,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- expected=0.0f;
- got = D3DXVec2Dot(NULL,NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec2Hermite__________________________*/
- expectedvec.x = 2604.625f; expectedvec.y = -4533.0f;
- D3DXVec2Hermite(&gotvec,&u,&v,&w,&x,scale);
- expect_vec(expectedvec,gotvec);
-
-/*_______________D3DXVec2Length__________________________*/
- expected = 5.0f;
- got = D3DXVec2Length(&u);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec2Length(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec2LengthSq________________________*/
- expected = 25.0f;
- got = D3DXVec2LengthSq(&u);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec2LengthSq(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec2Lerp__________________________*/
- expectedvec.x = 68.0f; expectedvec.y = -28.5f;
- D3DXVec2Lerp(&gotvec,&u,&v,scale);
- expect_vec(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec2Lerp(&gotvec,NULL,&v,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec2Lerp(NULL,NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec2Maximize__________________________*/
- expectedvec.x = 3.0f; expectedvec.y = 9.0f;
- D3DXVec2Maximize(&gotvec,&u,&v);
- expect_vec(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec2Maximize(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec2Maximize(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec2Minimize__________________________*/
- expectedvec.x = -7.0f; expectedvec.y = 4.0f;
- D3DXVec2Minimize(&gotvec,&u,&v);
- expect_vec(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec2Minimize(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec2Minimize(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec2Normalize_________________________*/
- expectedvec.x = 0.6f; expectedvec.y = 0.8f;
- D3DXVec2Normalize(&gotvec,&u);
- expect_vec(expectedvec,gotvec);
- /* Test the nul vector */
- expectedvec.x = 0.0f; expectedvec.y = 0.0f;
- D3DXVec2Normalize(&gotvec,&nul);
- expect_vec(expectedvec,gotvec);
-
-/*_______________D3DXVec2Scale____________________________*/
- expectedvec.x = -19.5f; expectedvec.y = -26.0f;
- D3DXVec2Scale(&gotvec,&u,scale);
- expect_vec(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec2Scale(&gotvec,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec2Scale(NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec2Subtract__________________________*/
- expectedvec.x = 10.0f; expectedvec.y = -5.0f;
- D3DXVec2Subtract(&gotvec,&u,&v);
- expect_vec(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec2Subtract(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec2Subtract(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec2Transform_______________________*/
- expectedtrans.x = 36.0f; expectedtrans.y = 44.0f; expectedtrans.z = 52.0f; expectedtrans.w = 60.0f;
- D3DXVec2Transform(&gottrans,&u,&mat);
- expect_vec4(expectedtrans,gottrans);
-
-/*_______________D3DXVec2TransformCoord_______________________*/
- expectedvec.x = 0.6f; expectedvec.y = 11.0f/15.0f;
- D3DXVec2TransformCoord(&gotvec,&u,&mat);
- expect_vec(expectedvec,gotvec);
- /* Test the nul projected vector */
- nulproj.x = -2.0f; nulproj.y = -1.0f;
- expectedvec.x = 0.0f; expectedvec.y = 0.0f;
- D3DXVec2TransformCoord(&gotvec,&nulproj,&mat);
- expect_vec(expectedvec,gotvec);
-
- /*_______________D3DXVec2TransformNormal______________________*/
- expectedvec.x = 23.0f; expectedvec.y = 30.0f;
- D3DXVec2TransformNormal(&gotvec,&u,&mat);
- expect_vec(expectedvec,gotvec);
-}
-
-static void D3X8Vector3Test(void)
-{
- D3DVIEWPORT8 viewport;
- D3DXVECTOR3 expectedvec, gotvec, nul, nulproj, u, v, w, x;
- LPD3DXVECTOR3 funcpointer;
- D3DXVECTOR4 expectedtrans, gottrans;
- D3DXMATRIX mat, projection, view, world;
- FLOAT coeff1, coeff2, expected, got, scale;
-
- nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f;
- u.x = 9.0f; u.y = 6.0f; u.z = 2.0f;
- v.x = 2.0f; v.y = -3.0f; v.z = -4.0;
- w.x = 3.0f; w.y = -5.0f; w.z = 7.0f;
- x.x = 4.0f; x.y = 1.0f; x.z = 11.0f;
-
- viewport.Width = 800; viewport.MinZ = 0.2f; viewport.X = 10;
- viewport.Height = 680; viewport.MaxZ = 0.9f; viewport.Y = 5;
-
- U(mat).m[0][0] = 1.0f; U(mat).m[0][1] = 2.0f; U(mat).m[0][2] = 3.0f; U(mat).m[0][3] = 4.0f;
- U(mat).m[1][0] = 5.0f; U(mat).m[1][1] = 6.0f; U(mat).m[1][2] = 7.0f; U(mat).m[1][3] = 8.0f;
- U(mat).m[2][0] = 9.0f; U(mat).m[2][1] = 10.0f; U(mat).m[2][2] = 11.0f; U(mat).m[2][3] = 12.0f;
- U(mat).m[3][0] = 13.0f; U(mat).m[3][1] = 14.0f; U(mat).m[3][2] = 15.0f; U(mat).m[3][3] = 16.0f;
-
- U(view).m[0][1] = 5.0f; U(view).m[0][2] = 7.0f; U(view).m[0][3] = 8.0f;
- U(view).m[1][0] = 11.0f; U(view).m[1][2] = 16.0f; U(view).m[1][3] = 33.0f;
- U(view).m[2][0] = 19.0f; U(view).m[2][1] = -21.0f; U(view).m[2][3] = 43.0f;
- U(view).m[3][0] = 2.0f; U(view).m[3][1] = 3.0f; U(view).m[3][2] = -4.0f;
- U(view).m[0][0] = 10.0f; U(view).m[1][1] = 20.0f; U(view).m[2][2] = 30.0f;
- U(view).m[3][3] = -40.0f;
-
- U(world).m[0][0] = 21.0f; U(world).m[0][1] = 2.0f; U(world).m[0][2] = 3.0f; U(world).m[0][3] = 4.0;
- U(world).m[1][0] = 5.0f; U(world).m[1][1] = 23.0f; U(world).m[1][2] = 7.0f; U(world).m[1][3] = 8.0f;
- U(world).m[2][0] = -8.0f; U(world).m[2][1] = -7.0f; U(world).m[2][2] = 25.0f; U(world).m[2][3] = -5.0f;
- U(world).m[3][0] = -4.0f; U(world).m[3][1] = -3.0f; U(world).m[3][2] = -2.0f; U(world).m[3][3] = 27.0f;
-
- coeff1 = 2.0f; coeff2 = 5.0f;
- scale = -6.5f;
-
-/*_______________D3DXVec3Add__________________________*/
- expectedvec.x = 11.0f; expectedvec.y = 3.0f; expectedvec.z = -2.0f;
- D3DXVec3Add(&gotvec,&u,&v);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Add(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Add(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3BaryCentric___________________*/
- expectedvec.x = -35.0f; expectedvec.y = -67.0; expectedvec.z = 15.0f;
- D3DXVec3BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
-
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3CatmullRom____________________*/
- expectedvec.x = 1458.0f; expectedvec.y = 22.1875f; expectedvec.z = 4141.375f;
- D3DXVec3CatmullRom(&gotvec,&u,&v,&w,&x,scale);
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3Cross________________________*/
- expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -39.0f;
- D3DXVec3Cross(&gotvec,&u,&v);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Cross(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Cross(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3Dot__________________________*/
- expected = -8.0f;
- got = D3DXVec3Dot(&u,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec3Dot(NULL,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- expected=0.0f;
- got = D3DXVec3Dot(NULL,NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec3Hermite__________________________*/
- expectedvec.x = -6045.75f; expectedvec.y = -6650.0f; expectedvec.z = 1358.875f;
- D3DXVec3Hermite(&gotvec,&u,&v,&w,&x,scale);
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3Length__________________________*/
- expected = 11.0f;
- got = D3DXVec3Length(&u);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec3Length(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec3LengthSq________________________*/
- expected = 121.0f;
- got = D3DXVec3LengthSq(&u);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec3LengthSq(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec3Lerp__________________________*/
- expectedvec.x = 54.5f; expectedvec.y = 64.5f, expectedvec.z = 41.0f ;
- D3DXVec3Lerp(&gotvec,&u,&v,scale);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Lerp(&gotvec,NULL,&v,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Lerp(NULL,NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3Maximize__________________________*/
- expectedvec.x = 9.0f; expectedvec.y = 6.0f; expectedvec.z = 2.0f;
- D3DXVec3Maximize(&gotvec,&u,&v);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Maximize(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Maximize(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3Minimize__________________________*/
- expectedvec.x = 2.0f; expectedvec.y = -3.0f; expectedvec.z = -4.0f;
- D3DXVec3Minimize(&gotvec,&u,&v);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Minimize(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Minimize(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3Normalize_________________________*/
- expectedvec.x = 9.0f/11.0f; expectedvec.y = 6.0f/11.0f; expectedvec.z = 2.0f/11.0f;
- D3DXVec3Normalize(&gotvec,&u);
- expect_vec3(expectedvec,gotvec);
- /* Test the nul vector */
- expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
- D3DXVec3Normalize(&gotvec,&nul);
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3Project_________________________*/
- expectedvec.x = 1135.721924f; expectedvec.y = 147.086914f; expectedvec.z = 0.153412f;
- D3DXMatrixPerspectiveFovLH(&projection,D3DX_PI/4.0f,20.0f/17.0f,1.0f,1000.0f);
- D3DXVec3Project(&gotvec,&u,&viewport,&projection,&view,&world);
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3Scale____________________________*/
- expectedvec.x = -58.5f; expectedvec.y = -39.0f; expectedvec.z = -13.0f;
- D3DXVec3Scale(&gotvec,&u,scale);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Scale(&gotvec,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Scale(NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3Subtract_______________________*/
- expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f;
- D3DXVec3Subtract(&gotvec,&u,&v);
- expect_vec3(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec3Subtract(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec3Subtract(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec3Transform_______________________*/
- expectedtrans.x = 70.0f; expectedtrans.y = 88.0f; expectedtrans.z = 106.0f; expectedtrans.w = 124.0f;
- D3DXVec3Transform(&gottrans,&u,&mat);
- expect_vec4(expectedtrans,gottrans);
-
-/*_______________D3DXVec3TransformCoord_______________________*/
- expectedvec.x = 70.0f/124.0f; expectedvec.y = 88.0f/124.0f; expectedvec.z = 106.0f/124.0f;
- D3DXVec3TransformCoord(&gotvec,&u,&mat);
- expect_vec3(expectedvec,gotvec);
- /* Test the nul projected vector */
- nulproj.x = 1.0f; nulproj.y = -1.0f, nulproj.z = -1.0f;
- expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
- D3DXVec3TransformCoord(&gotvec,&nulproj,&mat);
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3TransformNormal______________________*/
- expectedvec.x = 57.0f; expectedvec.y = 74.0f; expectedvec.z = 91.0f;
- D3DXVec3TransformNormal(&gotvec,&u,&mat);
- expect_vec3(expectedvec,gotvec);
-
-/*_______________D3DXVec3Unproject_________________________*/
- expectedvec.x = -2.913411f; expectedvec.y = 1.593215f; expectedvec.z = 0.380724f;
- D3DXMatrixPerspectiveFovLH(&projection,D3DX_PI/4.0f,20.0f/17.0f,1.0f,1000.0f);
- D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,&view,&world);
- expect_vec3(expectedvec,gotvec);
-}
-
-static void D3X8Vector4Test(void)
-{
- D3DXVECTOR4 expectedvec, gotvec, nul, u, v, w, x;
- LPD3DXVECTOR4 funcpointer;
- D3DXVECTOR4 expectedtrans, gottrans;
- D3DXMATRIX mat;
- FLOAT coeff1, coeff2, expected, got, scale;
-
- nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f; nul.w = 0.0f;
- u.x = 1.0f; u.y = 2.0f; u.z = 4.0f; u.w = 10.0;
- v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0;
- w.x = 4.0f; w.y =6.0f; w.z = -2.0f; w.w = 1.0f;
- x.x = 6.0f; x.y = -7.0f; x.z =8.0f; x.w = -9.0f;
-
- U(mat).m[0][0] = 1.0f; U(mat).m[0][1] = 2.0f; U(mat).m[0][2] = 3.0f; U(mat).m[0][3] = 4.0f;
- U(mat).m[1][0] = 5.0f; U(mat).m[1][1] = 6.0f; U(mat).m[1][2] = 7.0f; U(mat).m[1][3] = 8.0f;
- U(mat).m[2][0] = 9.0f; U(mat).m[2][1] = 10.0f; U(mat).m[2][2] = 11.0f; U(mat).m[2][3] = 12.0f;
- U(mat).m[3][0] = 13.0f; U(mat).m[3][1] = 14.0f; U(mat).m[3][2] = 15.0f; U(mat).m[3][3] = 16.0f;
-
- coeff1 = 2.0f; coeff2 = 5.0;
- scale = -6.5f;
-
-/*_______________D3DXVec4Add__________________________*/
- expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0f;
- D3DXVec4Add(&gotvec,&u,&v);
- expect_vec4(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec4Add(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec4Add(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec4BaryCentric____________________*/
- expectedvec.x = 8.0f; expectedvec.y = 26.0; expectedvec.z = -44.0f; expectedvec.w = -41.0f;
- D3DXVec4BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
- expect_vec4(expectedvec,gotvec);
-
-/*_______________D3DXVec4CatmullRom____________________*/
- expectedvec.x = 2754.625f; expectedvec.y = 2367.5625f; expectedvec.z = 1060.1875f; expectedvec.w = 131.3125f;
- D3DXVec4CatmullRom(&gotvec,&u,&v,&w,&x,scale);
- expect_vec4(expectedvec,gotvec);
-
-/*_______________D3DXVec4Cross_________________________*/
- expectedvec.x = 390.0f; expectedvec.y = -393.0f; expectedvec.z = -316.0f; expectedvec.w = 166.0f;
- D3DXVec4Cross(&gotvec,&u,&v,&w);
- expect_vec4(expectedvec,gotvec);
-
-/*_______________D3DXVec4Dot__________________________*/
- expected = 55.0f;
- got = D3DXVec4Dot(&u,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec4Dot(NULL,&v);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- expected=0.0f;
- got = D3DXVec4Dot(NULL,NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec4Hermite_________________________*/
- expectedvec.x = 1224.625f; expectedvec.y = 3461.625f; expectedvec.z = -4758.875f; expectedvec.w = -5781.5f;
- D3DXVec4Hermite(&gotvec,&u,&v,&w,&x,scale);
- expect_vec4(expectedvec,gotvec);
-
-/*_______________D3DXVec4Length__________________________*/
- expected = 11.0f;
- got = D3DXVec4Length(&u);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec4Length(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec4LengthSq________________________*/
- expected = 121.0f;
- got = D3DXVec4LengthSq(&u);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
- /* Tests the case NULL */
- expected=0.0f;
- got = D3DXVec4LengthSq(NULL);
- ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
-
-/*_______________D3DXVec4Lerp__________________________*/
- expectedvec.x = 27.0f; expectedvec.y = -11.0f; expectedvec.z = 62.5; expectedvec.w = 29.5;
- D3DXVec4Lerp(&gotvec,&u,&v,scale);
- expect_vec4(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec4Lerp(&gotvec,NULL,&v,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec4Lerp(NULL,NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec4Maximize__________________________*/
- expectedvec.x = 1.0f; expectedvec.y = 4.0f; expectedvec.z = 4.0f; expectedvec.w = 10.0;
- D3DXVec4Maximize(&gotvec,&u,&v);
- expect_vec4(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec4Maximize(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec4Maximize(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec4Minimize__________________________*/
- expectedvec.x = -3.0f; expectedvec.y = 2.0f; expectedvec.z = -5.0f; expectedvec.w = 7.0;
- D3DXVec4Minimize(&gotvec,&u,&v);
- expect_vec4(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec4Minimize(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec4Minimize(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec4Normalize_________________________*/
- expectedvec.x = 1.0f/11.0f; expectedvec.y = 2.0f/11.0f; expectedvec.z = 4.0f/11.0f; expectedvec.w = 10.0f/11.0f;
- D3DXVec4Normalize(&gotvec,&u);
- expect_vec4(expectedvec,gotvec);
- /* Test the nul vector */
- expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f; expectedvec.w = 0.0f;
- D3DXVec4Normalize(&gotvec,&nul);
- expect_vec4(expectedvec,gotvec);
-
-/*_______________D3DXVec4Scale____________________________*/
- expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f;
- D3DXVec4Scale(&gotvec,&u,scale);
- expect_vec4(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec4Scale(&gotvec,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec4Scale(NULL,NULL,scale);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec4Subtract__________________________*/
- expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f;
- D3DXVec4Subtract(&gotvec,&u,&v);
- expect_vec4(expectedvec,gotvec);
- /* Tests the case NULL */
- funcpointer = D3DXVec4Subtract(&gotvec,NULL,&v);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
- funcpointer = D3DXVec4Subtract(NULL,NULL,NULL);
- ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
-
-/*_______________D3DXVec4Transform_______________________*/
- expectedtrans.x = 177.0f; expectedtrans.y = 194.0f; expectedtrans.z = 211.0f; expectedtrans.w = 228.0f;
- D3DXVec4Transform(&gottrans,&u,&mat);
- expect_vec4(expectedtrans,gottrans);
-}
-
-static void test_matrix_stack(void)
-{
- ID3DXMatrixStack *stack;
- ULONG refcount;
- HRESULT hr;
-
- const D3DXMATRIX mat1 = {{{
- 1.0f, 2.0f, 3.0f, 4.0f,
- 5.0f, 6.0f, 7.0f, 8.0f,
- 9.0f, 10.0f, 11.0f, 12.0f,
- 13.0f, 14.0f, 15.0f, 16.0f
- }}};
-
- const D3DXMATRIX mat2 = {{{
- 17.0f, 18.0f, 19.0f, 20.0f,
- 21.0f, 22.0f, 23.0f, 24.0f,
- 25.0f, 26.0f, 27.0f, 28.0f,
- 29.0f, 30.0f, 31.0f, 32.0f
- }}};
-
- hr = D3DXCreateMatrixStack(0, &stack);
- ok(SUCCEEDED(hr), "Failed to create a matrix stack, hr %#x\n", hr);
- if (FAILED(hr)) return;
-
- ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)),
- "The top of an empty matrix stack should be an identity matrix\n");
-
- hr = ID3DXMatrixStack_Pop(stack);
- ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
-
- hr = ID3DXMatrixStack_Push(stack);
- ok(SUCCEEDED(hr), "Push failed, hr %#x\n", hr);
- ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
-
- hr = ID3DXMatrixStack_Push(stack);
- ok(SUCCEEDED(hr), "Push failed, hr %#x\n", hr);
-
- hr = ID3DXMatrixStack_LoadMatrix(stack, NULL);
- ok(hr == D3DERR_INVALIDCALL, "LoadMatrix returned %#x, expected D3DERR_INVALIDCALL\n", hr);
-
- hr = ID3DXMatrixStack_LoadMatrix(stack, &mat1);
- ok(SUCCEEDED(hr), "LoadMatrix failed, hr %#x\n", hr);
- expect_mat(&mat1, ID3DXMatrixStack_GetTop(stack));
-
- hr = ID3DXMatrixStack_Push(stack);
- ok(SUCCEEDED(hr), "Push failed, hr %#x\n", hr);
- expect_mat(&mat1, ID3DXMatrixStack_GetTop(stack));
-
- hr = ID3DXMatrixStack_LoadMatrix(stack, &mat2);
- ok(SUCCEEDED(hr), "LoadMatrix failed, hr %#x\n", hr);
- expect_mat(&mat2, ID3DXMatrixStack_GetTop(stack));
-
- hr = ID3DXMatrixStack_Push(stack);
- ok(SUCCEEDED(hr), "Push failed, hr %#x\n", hr);
- expect_mat(&mat2, ID3DXMatrixStack_GetTop(stack));
-
- hr = ID3DXMatrixStack_LoadIdentity(stack);
- ok(SUCCEEDED(hr), "LoadIdentity failed, hr %#x\n", hr);
- ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
-
- hr = ID3DXMatrixStack_Pop(stack);
- ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
- expect_mat(&mat2, ID3DXMatrixStack_GetTop(stack));
-
- hr = ID3DXMatrixStack_Pop(stack);
- ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
- expect_mat(&mat1, ID3DXMatrixStack_GetTop(stack));
-
- hr = ID3DXMatrixStack_Pop(stack);
- ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
- ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
-
- hr = ID3DXMatrixStack_Pop(stack);
- ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
- ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
-
- hr = ID3DXMatrixStack_MultMatrix(stack, NULL);
- ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
-
- hr = ID3DXMatrixStack_MultMatrixLocal(stack, NULL);
- ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
-
- hr = ID3DXMatrixStack_RotateAxis(stack, NULL, 2.0f);
- ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
-
- hr = ID3DXMatrixStack_RotateAxisLocal(stack, NULL, 2.0f);
- ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %#x\n", hr);
-
- refcount = ID3DXMatrixStack_Release(stack);
- ok(!refcount, "Matrix stack has %u references left.\n", refcount);
-}
-
-START_TEST(math)
-{
- D3DXColorTest();
- D3DXFresnelTest();
- D3DXMatrixTest();
- D3DXPlaneTest();
- D3X8QuaternionTest();
- D3X8Vector2Test();
- D3X8Vector3Test();
- D3X8Vector4Test();
- test_matrix_stack();
-}
diff --git a/dlls/d3dx8/tests/mesh.c b/dlls/d3dx8/tests/mesh.c
deleted file mode 100644
index 04e8bf2..0000000
--- a/dlls/d3dx8/tests/mesh.c
+++ /dev/null
@@ -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(¢er, 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(¢er, 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(¢er, 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(¢er, 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();
-}