d3dx9: Simplify D3DXComputeBoundingSphere.

This commit is contained in:
Nozomi Kodama 2012-09-21 23:19:29 +08:00 committed by Alexandre Julliard
parent 0ef523e2bf
commit 10d1253971

View file

@ -1991,7 +1991,7 @@ HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *pfirstposition, DWORD n
*/
HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3* pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pcenter, FLOAT *pradius)
{
D3DXVECTOR3 temp, temp1;
D3DXVECTOR3 temp;
FLOAT d;
unsigned int i;
@ -2000,16 +2000,12 @@ HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3* pfirstposition, DWOR
temp.x = 0.0f;
temp.y = 0.0f;
temp.z = 0.0f;
temp1 = temp;
*pradius = 0.0f;
for(i=0; i<numvertices; i++)
{
D3DXVec3Add(&temp1, &temp, (const D3DXVECTOR3*)((const char*)pfirstposition + dwstride * i));
temp = temp1;
}
D3DXVec3Add(&temp, &temp, (const D3DXVECTOR3*)((const char*)pfirstposition + dwstride * i));
D3DXVec3Scale(pcenter, &temp, 1.0f/((FLOAT)numvertices));
D3DXVec3Scale(pcenter, &temp, 1.0f / numvertices);
for(i=0; i<numvertices; i++)
{