[PATCH v2] d3dx9: Simplify math in D3DXSphereBoundProbe
Alex Henrie
alexhenrie24 at gmail.com
Wed Jul 8 02:31:50 CDT 2020
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
v2: Calculating b isn't actually necessary at all.
---
dlls/d3dx9_36/mesh.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 5e0bb98efc..381d19a2ee 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -2413,16 +2413,13 @@ BOOL WINAPI D3DXSphereBoundProbe(const D3DXVECTOR3 *pcenter, float radius,
const D3DXVECTOR3 *prayposition, const D3DXVECTOR3 *praydirection)
{
D3DXVECTOR3 difference;
- FLOAT a, b, c, d;
+ FLOAT a, c;
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;
+ return ( a * c < 0 );
}
/*************************************************************************
--
2.27.0
More information about the wine-devel
mailing list