From 27ebbc5a189a1729e986205e9c01c7271f892f7e Mon Sep 17 00:00:00 2001 From: Nozomi Kodama Date: Sat, 8 Jun 2013 03:31:30 -1000 Subject: d3dx9: Avoid a useless variable in D3DXPlaneIntersectLine --- dlls/d3dx9_36/math.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 43911e9..0be794a 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -1292,7 +1292,7 @@ D3DXPLANE* WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, const D3DXVECTOR3 *pv1, c D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, const D3DXPLANE *pp, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { D3DXVECTOR3 direction, normal; - FLOAT dot, temp; + FLOAT temp; TRACE("pout %p, pp %p, pv1 %p, pv2 %p\n", pout, pp, pv1, pv2); @@ -1302,12 +1302,16 @@ D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, const D3DXPLANE *p 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; + + temp = D3DXVec3Dot(&normal, &direction); + if (!temp) + return NULL; + + temp = (pp->d + D3DXVec3Dot(&normal, pv1)) / temp; pout->x = pv1->x - temp * direction.x; pout->y = pv1->y - temp * direction.y; pout->z = pv1->z - temp * direction.z; + return pout; } -- 1.8.1.2