d3dx9_36: Implement D3DXComputeBoundingSphere.
This commit is contained in:
parent
00d14355db
commit
e5425fc17b
|
@ -17,7 +17,7 @@
|
||||||
@ stub D3DXCompileShaderFromResourceA
|
@ stub D3DXCompileShaderFromResourceA
|
||||||
@ stub D3DXCompileShaderFromResourceW
|
@ stub D3DXCompileShaderFromResourceW
|
||||||
@ stdcall D3DXComputeBoundingBox(ptr long long ptr ptr)
|
@ stdcall D3DXComputeBoundingBox(ptr long long ptr ptr)
|
||||||
@ stub D3DXComputeBoundingSphere
|
@ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
|
||||||
@ stub D3DXComputeIMTFromPerTexelSignal
|
@ stub D3DXComputeIMTFromPerTexelSignal
|
||||||
@ stub D3DXComputeIMTFromPerVertexSignal
|
@ stub D3DXComputeIMTFromPerVertexSignal
|
||||||
@ stub D3DXComputeIMTFromSignal
|
@ stub D3DXComputeIMTFromSignal
|
||||||
|
|
|
@ -54,6 +54,40 @@ HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *pfirstposition, DWORD n
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* D3DXComputeBoundingSphere
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3* pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pcenter, FLOAT *pradius)
|
||||||
|
{
|
||||||
|
D3DXVECTOR3 temp, temp1;
|
||||||
|
FLOAT d;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if( !pfirstposition || !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*)pfirstposition + dwstride * i));
|
||||||
|
temp = temp1;
|
||||||
|
}
|
||||||
|
|
||||||
|
D3DXVec3Scale(pcenter, &temp, 1.0f/((FLOAT)numvertices));
|
||||||
|
|
||||||
|
for(i=0; i<numvertices; i++)
|
||||||
|
{
|
||||||
|
d = D3DXVec3Length(D3DXVec3Subtract(&temp, (D3DXVECTOR3*)((char*)pfirstposition + dwstride * i), pcenter));
|
||||||
|
if ( d > *pradius ) *pradius = d;
|
||||||
|
}
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* D3DXIntersectTri
|
* D3DXIntersectTri
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,6 +30,7 @@ UINT WINAPI D3DXGetFVFVertexSize(DWORD);
|
||||||
BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *);
|
BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *);
|
||||||
BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *,FLOAT,CONST D3DXVECTOR3 *,CONST D3DXVECTOR3 *);
|
BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *,FLOAT,CONST D3DXVECTOR3 *,CONST D3DXVECTOR3 *);
|
||||||
HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, D3DXVECTOR3 *);
|
HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, D3DXVECTOR3 *);
|
||||||
|
HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, FLOAT *);
|
||||||
BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3*, FLOAT *, FLOAT *, FLOAT *);
|
BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3*, FLOAT *, FLOAT *, FLOAT *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue