[PATCH] Implement D3DXPlaneFromPointNormal with a test
David Adam
David.Adam at math.cnrs.fr
Mon Nov 19 06:43:28 CST 2007
---
dlls/d3dx8/d3dx8.spec | 2 +-
dlls/d3dx8/math.c | 9 +++++++++
dlls/d3dx8/tests/math.c | 7 +++++++
include/d3dx8math.h | 1 +
4 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec
index 9dca39b..5b35df4 100644
--- a/dlls/d3dx8/d3dx8.spec
+++ b/dlls/d3dx8/d3dx8.spec
@@ -63,7 +63,7 @@
@ stub D3DXQuaternionBaryCentric
@ stdcall D3DXPlaneNormalize(ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)
-@ stub D3DXPlaneFromPointNormal
+@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stub D3DXPlaneFromPoints
@ stub D3DXPlaneTransform
@ stub D3DXColorAdjustSaturation
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
index cb6789a..875ca49 100644
--- a/dlls/d3dx8/math.c
+++ b/dlls/d3dx8/math.c
@@ -482,6 +482,15 @@ D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout=
, CONST D3DXMATRIX *pm)
=20
/*_________________D3DXPLANE________________*/
=20
+D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, CONST D3DXVECTO=
R3 *pvpoint, CONST D3DXVECTOR3 *pvnormal)
+{
+ pout->a =3D pvnormal->x;
+ pout->b =3D pvnormal->y;
+ pout->c =3D pvnormal->z;
+ pout->d =3D -D3DXVec3Dot(pvpoint, pvnormal);
+ return pout;
+}
+
D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, CONST D3DXPLA=
NE *pp, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
D3DXVECTOR3 direction, normal;
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 05a72e9..2811fea 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -478,6 +478,13 @@ static void D3DXPlaneTest(void)
got =3D D3DXPlaneDotNormal(NULL,NULL),
ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
=20
+/*_______________D3DXPlaneFromPointNormal_______*/
+ vec1.x =3D 11.0f; vec1.y =3D 13.0f; vec1.z =3D 15.0f;
+ vec2.x =3D 17.0f; vec2.y =3D 31.0f; vec2.z =3D 24.0f;
+ expectedplane.a =3D 17.0f; expectedplane.b =3D 31.0f; expectedplane.c =
=3D 24.0f; expectedplane.d =3D -950.0f;
+ D3DXPlaneFromPointNormal(&gotplane,&vec1,&vec2);
+ expect_plane(expectedplane, gotplane);
+
/*_______________D3DXPlaneIntersectLine___________*/
vec1.x =3D 9.0f; vec1.y =3D 6.0f; vec1.z =3D 3.0f;
vec2.x =3D 2.0f; vec2.y =3D 5.0f; vec2.z =3D 8.0f;
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index 930c417..8c2cdc3 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -293,6 +293,7 @@ D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, CO=
NST D3DXVECTOR4 *plight,
D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y=
, FLOAT z);
D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *=
pm);
=20
+D3DXPLANE* WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, CONST D3DXVECTO=
R3 *pvpoint, CONST D3DXVECTOR3 *pvnormal);
D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, CONST D3DXPLA=
NE *pp, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2);
D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, CONST D3DXPLANE *pp);
=20
--=20
1.5.3.2
--=_44aqkgpaz7s4--
More information about the wine-patches
mailing list