winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2007
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
996 discussions
Start a n
N
ew thread
David Adam : d3dx8: Implement D3DXQuaternionConjugate.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: 77f5d4c88c02287f852c961962e3e9c12570c91d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=77f5d4c88c02287f852c96196…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 20:28:36 2007 +0200 d3dx8: Implement D3DXQuaternionConjugate. --- dlls/d3dx8/tests/math.c | 14 +++++++++++++- include/d3dx8math.inl | 10 ++++++++++ 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index b7302b1..8c5baa3 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -32,12 +32,24 @@ static void D3X8QuaternionTest(void) { - D3DXQUATERNION q, r; + D3DXQUATERNION expectedquat, gotquat, q, r; + LPD3DXQUATERNION funcpointer; FLOAT expected, got; q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f; r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0; +/*_______________D3DXQuaternionConjugate________________*/ + expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f; + D3DXQuaternionConjugate(&gotquat,&q); + expect_vec4(expectedquat,gotquat); + /* Test the NULL case */ + funcpointer = D3DXQuaternionConjugate(&gotquat,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXQuaternionConjugate(NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + + /*_______________D3DXQuaternionDot______________________*/ expected = 55.0f; got = D3DXQuaternionDot(&q,&r); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 87e1289..a2fd8bf 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -258,6 +258,16 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 /*__________________D3DXQUATERNION____________________*/ +static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) +{ + if ( !pout || !pq) return NULL; + pout->x = -pq->x; + pout->y = -pq->y; + pout->z = -pq->z; + pout->w = pq->w; + return pout; +} + static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2) { if ( !pq1 || !pq2 ) return 0.0f;
1
0
0
0
David Adam : d3dx8: Implement D3DXVec3Cross.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: a394fef4b75f6a1024644d1ac8d4302811e16722 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a394fef4b75f6a1024644d1ac…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 20:12:29 2007 +0200 d3dx8: Implement D3DXVec3Cross. --- dlls/d3dx8/tests/math.c | 9 +++++++++ include/d3dx8math.inl | 9 +++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 9197ba1..b7302b1 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -203,6 +203,15 @@ static void D3X8Vector3Test(void) funcpointer = D3DXVec3Add(NULL,NULL,NULL); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec3Cross________________________*/ + expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -30.0f; + D3DXVec3Cross(&gotvec,&u,&v); + /* Tests the case NULL */ + funcpointer = D3DXVec3Cross(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Cross(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec3Dot__________________________*/ expected = -8.0f; got = D3DXVec3Dot(&u,&v); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index b9cf875..87e1289 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -104,6 +104,15 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1 return pout; } +static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y); + pout->y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z); + pout->z = (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x); + return pout; +} + static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) { if ( !pv1 || !pv2 ) return 0.0f;
1
0
0
0
David Adam : d3dx8: Implement D3DX*Scale.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: 96576118788f0f32d7cb3cf2b48b4fa295ef0691 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=96576118788f0f32d7cb3cf2b…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 19:53:30 2007 +0200 d3dx8: Implement D3DX*Scale. --- dlls/d3dx8/tests/math.c | 20 ++++++++++++++++++++ include/d3dx8math.inl | 19 +++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index dd7e26b..9197ba1 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -263,6 +263,16 @@ static void D3X8Vector3Test(void) funcpointer = D3DXVec3Minimize(NULL,NULL,NULL); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec3Scale____________________________*/ + expectedvec.x = -58.5f; expectedvec.y = -39.0f; expectedvec.z = -13.0f; + D3DXVec3Scale(&gotvec,&u,scale); + expect_vec3(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec3Scale(&gotvec,NULL,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Scale(NULL,NULL,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec3Subtract_______________________*/ expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f; D3DXVec3Subtract(&gotvec,&u,&v); @@ -355,6 +365,16 @@ static void D3X8Vector4Test(void) funcpointer = D3DXVec4Minimize(NULL,NULL,NULL); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec4Scale____________________________*/ + expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f; + D3DXVec4Scale(&gotvec,&u,scale); + expect_vec4(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec4Scale(&gotvec,NULL,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec4Scale(NULL,NULL,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec4Subtract__________________________*/ expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f; D3DXVec4Subtract(&gotvec,&u,&v); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index ee628d3..b9cf875 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -149,6 +149,15 @@ static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 return pout; } +static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, FLOAT s) +{ + if ( !pout || !pv) return NULL; + pout->x = s * (pv->x); + pout->y = s * (pv->y); + pout->z = s * (pv->z); + return pout; +} + static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; @@ -218,6 +227,16 @@ static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 return pout; } +static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, FLOAT s) +{ + if ( !pout || !pv) return NULL; + pout->x = s * (pv->x); + pout->y = s * (pv->y); + pout->z = s * (pv->z); + pout->w = s * (pv->w); + return pout; +} + static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL;
1
0
0
0
David Adam : d3dx8: Implement D3DX*Maximize.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: c7f0eca4e3b9985fd66ac53c418861a621080688 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c7f0eca4e3b9985fd66ac53c4…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 19:29:21 2007 +0200 d3dx8: Implement D3DX*Maximize. --- dlls/d3dx8/tests/math.c | 20 ++++++++++++++++++++ include/d3dx8math.inl | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 7d1a84e..1490a66 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -243,6 +243,16 @@ static void D3X8Vector3Test(void) funcpointer = D3DXVec3Lerp(NULL,NULL,NULL,scale); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec3Maximize__________________________*/ + expectedvec.x = 9.0f; expectedvec.y = 6.0f; expectedvec.z = 2.0f; + D3DXVec3Maximize(&gotvec,&u,&v); + expect_vec3(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec3Maximize(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Maximize(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec3Subtract_______________________*/ expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f; D3DXVec3Subtract(&gotvec,&u,&v); @@ -315,6 +325,16 @@ static void D3X8Vector4Test(void) funcpointer = D3DXVec4Lerp(NULL,NULL,NULL,scale); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec4Maximize__________________________*/ + expectedvec.x = 1.0f; expectedvec.y = 4.0f; expectedvec.z = 4.0f; expectedvec.w = 10.0; + D3DXVec4Maximize(&gotvec,&u,&v); + expect_vec4(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec4Maximize(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec4Maximize(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec4Subtract__________________________*/ expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f; D3DXVec4Subtract(&gotvec,&u,&v); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index ab1b9be..1da846d 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -131,6 +131,15 @@ static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv return pout; } +static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = max(pv1->x , pv2->x); + pout->y = max(pv1->y , pv2->y); + pout->z = max(pv1->z , pv2->z); + return pout; +} + static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; @@ -179,6 +188,17 @@ static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv return pout; } + +static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = max(pv1->x , pv2->x); + pout->y = max(pv1->y , pv2->y); + pout->z = max(pv1->z , pv2->z); + pout->w = max(pv1->w , pv2->w); + return pout; +} + static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL;
1
0
0
0
David Adam : d3dx8: Implement D3DX*Lerp.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: ab4e829757b3b6c9dee4be10afb5d9a3c406b66c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ab4e829757b3b6c9dee4be10a…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 19:01:57 2007 +0200 d3dx8: Implement D3DX*Lerp. --- dlls/d3dx8/tests/math.c | 30 ++++++++++++++++++++++++++---- include/d3dx8math.inl | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index dcee021..7d1a84e 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -187,10 +187,11 @@ static void D3X8Vector3Test(void) { D3DXVECTOR3 expectedvec, gotvec, u, v; LPD3DXVECTOR3 funcpointer; - FLOAT expected, got; + FLOAT expected, got, scale; u.x = 9.0f; u.y = 6.0f; u.z = 2.0f; v.x = 2.0f; v.y = -3.0f; v.z = -4.0; + scale = -6.5f; /*_______________D3DXVec3Add__________________________*/ expectedvec.x = 11.0f; expectedvec.y = 3.0f; expectedvec.z = -2.0f; @@ -232,6 +233,16 @@ static void D3X8Vector3Test(void) got = D3DXVec3LengthSq(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); +/*_______________D3DXVec3Lerp__________________________*/ + expectedvec.x = 54.5f; expectedvec.y = 64.5f, expectedvec.z = 41.0f ; + D3DXVec3Lerp(&gotvec,&u,&v,scale); + expect_vec3(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec3Lerp(&gotvec,NULL,&v,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Lerp(NULL,NULL,NULL,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec3Subtract_______________________*/ expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f; D3DXVec3Subtract(&gotvec,&u,&v); @@ -248,12 +259,13 @@ static void D3X8Vector4Test(void) { D3DXVECTOR4 expectedvec, gotvec, u, v; LPD3DXVECTOR4 funcpointer; - FLOAT expected, got; + FLOAT expected, got, scale; + scale = -6.5f; u.x = 1.0f; u.y = 2.0f; u.z = 4.0f; u.w = 10.0; v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0; -/*_______________D3DXVec3Add__________________________*/ +/*_______________D3DXVec4Add__________________________*/ expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0f; D3DXVec4Add(&gotvec,&u,&v); expect_vec4(expectedvec,gotvec); @@ -293,7 +305,17 @@ static void D3X8Vector4Test(void) got = D3DXVec4LengthSq(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); -/*_______________D3DXVec3Add__________________________*/ +/*_______________D3DXVec4Lerp__________________________*/ + expectedvec.x = 27.0f; expectedvec.y = -11.0f; expectedvec.z = 62.5; expectedvec.w = 29.5; + D3DXVec4Lerp(&gotvec,&u,&v,scale); + expect_vec4(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec4Lerp(&gotvec,NULL,&v,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec4Lerp(NULL,NULL,NULL,scale); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + +/*_______________D3DXVec4Subtract__________________________*/ expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f; D3DXVec4Subtract(&gotvec,&u,&v); expect_vec4(expectedvec,gotvec); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index e25c3e6..ab1b9be 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -122,6 +122,15 @@ static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv) return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z); } +static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, FLOAT s) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = (1-s) * (pv1->x) + s * (pv2->x); + pout->y = (1-s) * (pv1->y) + s * (pv2->y); + pout->z = (1-s) * (pv1->z) + s * (pv2->z); + return pout; +} + static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; @@ -160,6 +169,16 @@ static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv) return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w); } +static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, FLOAT s) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = (1-s) * (pv1->x) + s * (pv2->x); + pout->y = (1-s) * (pv1->y) + s * (pv2->y); + pout->z = (1-s) * (pv1->z) + s * (pv2->z); + pout->w = (1-s) * (pv1->w) + s * (pv2->w); + return pout; +} + static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; @@ -169,6 +188,7 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 pout->w = pv1->w - pv2->w; return pout; } + /*__________________D3DXQUATERNION____________________*/ static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2)
1
0
0
0
David Adam : d3dx8: Implement D3DX*Minimize.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: c1892f258ffb012bbdeb4f635427947cebacb5a2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c1892f258ffb012bbdeb4f635…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 19:35:52 2007 +0200 d3dx8: Implement D3DX*Minimize. --- dlls/d3dx8/tests/math.c | 20 ++++++++++++++++++++ include/d3dx8math.inl | 19 +++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 1490a66..dd7e26b 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -253,6 +253,16 @@ static void D3X8Vector3Test(void) funcpointer = D3DXVec3Maximize(NULL,NULL,NULL); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec3Minimize__________________________*/ + expectedvec.x = 2.0f; expectedvec.y = -3.0f; expectedvec.z = -4.0f; + D3DXVec3Minimize(&gotvec,&u,&v); + expect_vec3(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec3Minimize(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Minimize(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec3Subtract_______________________*/ expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f; D3DXVec3Subtract(&gotvec,&u,&v); @@ -335,6 +345,16 @@ static void D3X8Vector4Test(void) funcpointer = D3DXVec4Maximize(NULL,NULL,NULL); ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); +/*_______________D3DXVec4Minimize__________________________*/ + expectedvec.x = -3.0f; expectedvec.y = 2.0f; expectedvec.z = -5.0f; expectedvec.w = 7.0; + D3DXVec4Minimize(&gotvec,&u,&v); + expect_vec4(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec4Minimize(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec4Minimize(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec4Subtract__________________________*/ expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f; D3DXVec4Subtract(&gotvec,&u,&v); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 1da846d..ee628d3 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -140,6 +140,15 @@ static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 return pout; } +static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = min(pv1->x , pv2->x); + pout->y = min(pv1->y , pv2->y); + pout->z = min(pv1->z , pv2->z); + return pout; +} + static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; @@ -199,6 +208,16 @@ static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 return pout; } +static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = min(pv1->x , pv2->x); + pout->y = min(pv1->y , pv2->y); + pout->z = min(pv1->z , pv2->z); + pout->w = min(pv1->w , pv2->w); + return pout; +} + static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL;
1
0
0
0
David Adam : d3dx8: Implement D3DX*Subtract.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: 4ef92a23e56cfff7013d7ad1af7927e3cded6574 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4ef92a23e56cfff7013d7ad1a…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 18:38:32 2007 +0200 d3dx8: Implement D3DX*Subtract. --- dlls/d3dx8/tests/math.c | 23 ++++++++++++++++++++++- include/d3dx8math.inl | 17 +++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 631c8ee..dcee021 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -231,6 +231,17 @@ static void D3X8Vector3Test(void) expected=0.0f; got = D3DXVec3LengthSq(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + +/*_______________D3DXVec3Subtract_______________________*/ + expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f; + D3DXVec3Subtract(&gotvec,&u,&v); + expect_vec3(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec3Subtract(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Subtract(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + } static void D3X8Vector4Test(void) @@ -243,7 +254,7 @@ static void D3X8Vector4Test(void) v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0; /*_______________D3DXVec3Add__________________________*/ - expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0; + expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0f; D3DXVec4Add(&gotvec,&u,&v); expect_vec4(expectedvec,gotvec); /* Tests the case NULL */ @@ -281,6 +292,16 @@ static void D3X8Vector4Test(void) expected=0.0f; got = D3DXVec4LengthSq(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + +/*_______________D3DXVec3Add__________________________*/ + expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f; + D3DXVec4Subtract(&gotvec,&u,&v); + expect_vec4(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec4Subtract(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec4Subtract(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); } START_TEST(math) diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 5f8544e..e25c3e6 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -122,6 +122,14 @@ static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv) return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z); } +static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = pv1->x - pv2->x; + pout->y = pv1->y - pv2->y; + pout->z = pv1->z - pv2->z; + return pout; +} /*__________________D3DXVECTOR4_______________________*/ static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) @@ -152,6 +160,15 @@ static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv) return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w); } +static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = pv1->x - pv2->x; + pout->y = pv1->y - pv2->y; + pout->z = pv1->z - pv2->z; + pout->w = pv1->w - pv2->w; + return pout; +} /*__________________D3DXQUATERNION____________________*/ static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2)
1
0
0
0
David Adam : d3dx8: Implement D3DX*Add with a test.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: e205a210d262d8a4259a854d822492d814f5d10b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e205a210d262d8a4259a854d8…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 18:32:17 2007 +0200 d3dx8: Implement D3DX*Add with a test. --- dlls/d3dx8/tests/math.c | 30 ++++++++++++++++++++++++++++-- include/d3dx8math.inl | 19 +++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index a222362..631c8ee 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -26,6 +26,10 @@ #define expect_vec(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error),"Expected Vector= (%f, %f)\n , Got Vector= (%f, %f)\n", expectedvec.x, expectedvec.y, gotvec.x, gotvec.y); +#define expect_vec3(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error)&&(fabs(expectedvec.z-gotvec.z)<admitted_error),"Expected Vector= (%f, %f,%f)\n , Got Vector= (%f, %f, %f)\n", expectedvec.x, expectedvec.y, expectedvec.z, gotvec.x, gotvec.y, gotvec.z); + +#define expect_vec4(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error)&&(fabs(expectedvec.z-gotvec.z)<admitted_error)&&(fabs(expectedvec.w-gotvec.w)<admitted_error),"Expected Vector= (%f, %f, %f, %f)\n , Got Vector= (%f, %f, %f, %f)\n", expectedvec.x, expectedvec.y, expectedvec.z, expectedvec.w, gotvec.x, gotvec.y, gotvec.z, gotvec.w); + static void D3X8QuaternionTest(void) { D3DXQUATERNION q, r; @@ -181,12 +185,23 @@ static void D3X8Vector2Test(void) static void D3X8Vector3Test(void) { - D3DXVECTOR3 u, v; + D3DXVECTOR3 expectedvec, gotvec, u, v; + LPD3DXVECTOR3 funcpointer; FLOAT expected, got; u.x = 9.0f; u.y = 6.0f; u.z = 2.0f; v.x = 2.0f; v.y = -3.0f; v.z = -4.0; +/*_______________D3DXVec3Add__________________________*/ + expectedvec.x = 11.0f; expectedvec.y = 3.0f; expectedvec.z = -2.0f; + D3DXVec3Add(&gotvec,&u,&v); + expect_vec3(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec3Add(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec3Add(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec3Dot__________________________*/ expected = -8.0f; got = D3DXVec3Dot(&u,&v); @@ -220,12 +235,23 @@ static void D3X8Vector3Test(void) static void D3X8Vector4Test(void) { - D3DXVECTOR4 u, v; + D3DXVECTOR4 expectedvec, gotvec, u, v; + LPD3DXVECTOR4 funcpointer; FLOAT expected, got; u.x = 1.0f; u.y = 2.0f; u.z = 4.0f; u.w = 10.0; v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0; +/*_______________D3DXVec3Add__________________________*/ + expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0; + D3DXVec4Add(&gotvec,&u,&v); + expect_vec4(expectedvec,gotvec); + /* Tests the case NULL */ + funcpointer = D3DXVec4Add(&gotvec,NULL,&v); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + funcpointer = D3DXVec4Add(NULL,NULL,NULL); + ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer); + /*_______________D3DXVec4Dot__________________________*/ expected = 55.0f; got = D3DXVec4Dot(&u,&v); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index cbe01ec..5f8544e 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -95,6 +95,15 @@ static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 /*__________________D3DXVECTOR3_______________________*/ +static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = pv1->x + pv2->x; + pout->y = pv1->y + pv2->y; + pout->z = pv1->z + pv2->z; + return pout; +} + static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) { if ( !pv1 || !pv2 ) return 0.0f; @@ -115,6 +124,16 @@ static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv) /*__________________D3DXVECTOR4_______________________*/ +static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +{ + if ( !pout || !pv1 || !pv2) return NULL; + pout->x = pv1->x + pv2->x; + pout->y = pv1->y + pv2->y; + pout->z = pv1->z + pv2->z; + pout->w = pv1->w + pv2->w; + return pout; +} + static inline FLOAT D3DXVec4Dot(CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) { if (!pv1 || !pv2 ) return 0.0f;
1
0
0
0
David Adam : d3dx8: Implement D3DX*Dot with a test.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: 643bcd3e46d49ec9bb865dd5c53278790f7fd23d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=643bcd3e46d49ec9bb865dd5c…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 18:06:37 2007 +0200 d3dx8: Implement D3DX*Dot with a test. --- dlls/d3dx8/tests/math.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- include/d3dx8math.inl | 22 ++++++++++++++++++++-- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index a598020..a222362 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -28,10 +28,23 @@ static void D3X8QuaternionTest(void) { - D3DXQUATERNION q; + D3DXQUATERNION q, r; FLOAT expected, got; q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f; + r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0; + +/*_______________D3DXQuaternionDot______________________*/ + expected = 55.0f; + got = D3DXQuaternionDot(&q,&r); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got = D3DXQuaternionDot(NULL,&r); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + expected=0.0f; + got = D3DXQuaternionDot(NULL,NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); /*_______________D3DXQuaternionLength__________________________*/ expected = 11.0f; @@ -168,10 +181,23 @@ static void D3X8Vector2Test(void) static void D3X8Vector3Test(void) { - D3DXVECTOR3 u; + D3DXVECTOR3 u, v; FLOAT expected, got; u.x = 9.0f; u.y = 6.0f; u.z = 2.0f; + v.x = 2.0f; v.y = -3.0f; v.z = -4.0; + +/*_______________D3DXVec3Dot__________________________*/ + expected = -8.0f; + got = D3DXVec3Dot(&u,&v); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got = D3DXVec3Dot(NULL,&v); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + expected=0.0f; + got = D3DXVec3Dot(NULL,NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); /*_______________D3DXVec3Length__________________________*/ expected = 11.0f; @@ -194,10 +220,23 @@ static void D3X8Vector3Test(void) static void D3X8Vector4Test(void) { - D3DXVECTOR4 u; + D3DXVECTOR4 u, v; FLOAT expected, got; u.x = 1.0f; u.y = 2.0f; u.z = 4.0f; u.w = 10.0; + v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0; + +/*_______________D3DXVec4Dot__________________________*/ + expected = 55.0f; + got = D3DXVec4Dot(&u,&v); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got = D3DXVec4Dot(NULL,&v); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + expected=0.0f; + got = D3DXVec4Dot(NULL,NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); /*_______________D3DXVec4Length__________________________*/ expected = 11.0f; diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index c8de09b..cbe01ec 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -95,6 +95,12 @@ static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 /*__________________D3DXVECTOR3_______________________*/ +static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +{ + if ( !pv1 || !pv2 ) return 0.0f; + return (pv1->x) * (pv2->x) + (pv1->y) * (pv2->y) + (pv1->z) * (pv2->z); +} + static inline FLOAT D3DXVec3Length(CONST D3DXVECTOR3 *pv) { if (!pv) return 0.0f; @@ -109,6 +115,12 @@ static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv) /*__________________D3DXVECTOR4_______________________*/ +static inline FLOAT D3DXVec4Dot(CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +{ + if (!pv1 || !pv2 ) return 0.0f; + return (pv1->x) * (pv2->x) + (pv1->y) * (pv2->y) + (pv1->z) * (pv2->z) + (pv1->w) * (pv2->w); +} + static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv) { if (!pv) return 0.0f; @@ -123,13 +135,19 @@ static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv) /*__________________D3DXQUATERNION____________________*/ -static inline FLOAT D3DXQuaternionLength( CONST D3DXQUATERNION *pq) +static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2) +{ + if ( !pq1 || !pq2 ) return 0.0f; + return (pq1->x) * (pq2->x) + (pq1->y) * (pq2->y) + (pq1->z) * (pq2->z) + (pq1->w) * (pq2->w); +} + +static inline FLOAT D3DXQuaternionLength(CONST D3DXQUATERNION *pq) { if (!pq) return 0.0f; return sqrt( (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w) ); } -static inline FLOAT D3DXQuaternionLengthSq( CONST D3DXQUATERNION *pq) +static inline FLOAT D3DXQuaternionLengthSq(CONST D3DXQUATERNION *pq) { if (!pq) return 0.0f; return (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w);
1
0
0
0
David Adam : d3dx8: Implement D3DX*LengthSq.
by Alexandre Julliard
22 Oct '07
22 Oct '07
Module: wine Branch: master Commit: bf9a690dbc43727e2e4207f13197f3baf92fdc80 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bf9a690dbc43727e2e4207f13…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Thu Oct 18 17:47:50 2007 +0200 d3dx8: Implement D3DX*LengthSq. --- dlls/d3dx8/tests/math.c | 27 +++++++++++++++++++++++++++ include/d3dx8math.inl | 18 ++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index d0d0b03..a598020 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -41,6 +41,15 @@ static void D3X8QuaternionTest(void) expected=0.0f; got = D3DXQuaternionLength(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + +/*_______________D3DXQuaternionLengthSq________________________*/ + expected = 121.0f; + got = D3DXQuaternionLengthSq(&q); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got = D3DXQuaternionLengthSq(NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); } static void D3X8Vector2Test(void) @@ -172,6 +181,15 @@ static void D3X8Vector3Test(void) expected=0.0f; got = D3DXVec3Length(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + +/*_______________D3DXVec3LengthSq________________________*/ + expected = 121.0f; + got = D3DXVec3LengthSq(&u); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got = D3DXVec3LengthSq(NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); } static void D3X8Vector4Test(void) @@ -189,6 +207,15 @@ static void D3X8Vector4Test(void) expected=0.0f; got = D3DXVec4Length(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + +/*_______________D3DXVec4LengthSq________________________*/ + expected = 121.0f; + got = D3DXVec4LengthSq(&u); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got = D3DXVec4LengthSq(NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); } START_TEST(math) diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 94e0019..c8de09b 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -101,6 +101,12 @@ static inline FLOAT D3DXVec3Length(CONST D3DXVECTOR3 *pv) return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) ); } +static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv) +{ + if (!pv) return 0.0f; + return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z); +} + /*__________________D3DXVECTOR4_______________________*/ static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv) @@ -109,6 +115,11 @@ static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv) return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w) ); } +static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv) +{ + if (!pv) return 0.0f; + return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w); +} /*__________________D3DXQUATERNION____________________*/ @@ -118,7 +129,10 @@ static inline FLOAT D3DXQuaternionLength( CONST D3DXQUATERNION *pq) return sqrt( (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w) ); } - - +static inline FLOAT D3DXQuaternionLengthSq( CONST D3DXQUATERNION *pq) +{ + if (!pq) return 0.0f; + return (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w); +} #endif
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
100
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Results per page:
10
25
50
100
200