diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index 64ebd58fa3a..2534acfab05 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -16,7 +16,7 @@ @ stub D3DXCompileShaderFromFileW @ stub D3DXCompileShaderFromResourceA @ stub D3DXCompileShaderFromResourceW -@ stub D3DXComputeBoundingBox +@ stdcall D3DXComputeBoundingBox(ptr long long ptr ptr) @ stub D3DXComputeBoundingSphere @ stub D3DXComputeIMTFromPerTexelSignal @ stub D3DXComputeIMTFromPerVertexSignal diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c index c8637d89f87..08d6e2f7d47 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c @@ -24,6 +24,36 @@ #include "d3dx9.h" +/************************************************************************* + * D3DXComputeBoundingBox + */ +HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pmin, D3DXVECTOR3 *pmax) +{ + D3DXVECTOR3 vec; + unsigned int i; + + if( !pfirstposition || !pmin || !pmax ) return D3DERR_INVALIDCALL; + + *pmin = *pfirstposition; + *pmax = *pmin; + + for(i=0; ix ) 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; +} + /************************************************************************* * D3DXIntersectTri */ diff --git a/include/d3dx9.h b/include/d3dx9.h index b551eba4f2c..6b3bdf6c19d 100644 --- a/include/d3dx9.h +++ b/include/d3dx9.h @@ -24,6 +24,7 @@ #include "d3d9.h" #include "d3dx9math.h" #include "d3dx9core.h" +#include "d3dx9mesh.h" #include "d3dx9shader.h" #include "d3dx9tex.h" diff --git a/include/d3dx9mesh.h b/include/d3dx9mesh.h index c337ad249c5..5cfc25ee0e3 100644 --- a/include/d3dx9mesh.h +++ b/include/d3dx9mesh.h @@ -29,6 +29,7 @@ HRESULT WINAPI D3DXCreateBuffer(DWORD, LPD3DXBUFFER*); UINT WINAPI D3DXGetFVFVertexSize(DWORD); BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *); BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *,FLOAT,CONST D3DXVECTOR3 *,CONST D3DXVECTOR3 *); +HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, D3DXVECTOR3 *); BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3*, FLOAT *, FLOAT *, FLOAT *); #ifdef __cplusplus