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
November 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
3 participants
757 discussions
Start a n
N
ew thread
Gerald Pfeifer : oleaut32: Simplify two conditions based on the fact that unsigned variables cannot be negative .
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 1d6206474837f6bae97637551dbc4e68483ecca1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d6206474837f6bae97637551…
Author: Gerald Pfeifer <gerald(a)pfeifer.com> Date: Thu Nov 22 01:06:32 2007 +0100 oleaut32: Simplify two conditions based on the fact that unsigned variables cannot be negative. --- dlls/oleaut32/typelib2.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 41ee8e6..7464b0c 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -3493,7 +3493,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo( TRACE("(%p,%d,%p)\n", iface, index, ppTInfo); - if ((index < 0) || (index >= This->typelib_header.nrtypeinfos)) { + if (index >= This->typelib_header.nrtypeinfos) { return TYPE_E_ELEMENTNOTFOUND; } @@ -3514,7 +3514,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType( TRACE("(%p,%d,%p)\n", iface, index, pTKind); - if ((index < 0) || (index >= This->typelib_header.nrtypeinfos)) { + if (index >= This->typelib_header.nrtypeinfos) { return TYPE_E_ELEMENTNOTFOUND; }
1
0
0
0
Gerald Pfeifer : user32: Fix variable type in SCROLL_HandleScrollEvent(). Remove useless check in SCROLL_SetScrollInfo().
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 56af18f2230c66186648ebcc6058863c4c00544d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=56af18f2230c66186648ebcc6…
Author: Gerald Pfeifer <gerald(a)pfeifer.com> Date: Wed Nov 21 11:25:09 2007 +0100 user32: Fix variable type in SCROLL_HandleScrollEvent(). Remove useless check in SCROLL_SetScrollInfo(). --- dlls/user32/scroll.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index f07bf75..78564b0 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -961,7 +961,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt) } else /* WM_MOUSEMOVE */ { - UINT pos; + INT pos; if (!SCROLL_PtInRectEx( &rect, pt, vertical )) pos = lastClickPos; else @@ -1621,7 +1621,7 @@ static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, LPCSCROLLINFO info, BOOL b if (info->fMask & SIF_PAGE) { - if( infoPtr->page != info->nPage && info->nPage >= 0) + if( infoPtr->page != info->nPage ) { infoPtr->page = info->nPage; action |= SA_SSI_REFRESH;
1
0
0
0
Patrick Moran : msiexec: Fix atou() return value mistake.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 0b79b0e58ace9bb0f0bd0735c90ef869a5d19d42 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0b79b0e58ace9bb0f0bd0735c…
Author: Patrick Moran <patrick.a.moran(a)gmail.com> Date: Sun Nov 25 02:35:27 2007 -0500 msiexec: Fix atou() return value mistake. --- programs/msiexec/msiexec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c index bdb1b90..6577c78 100644 --- a/programs/msiexec/msiexec.c +++ b/programs/msiexec/msiexec.c @@ -209,7 +209,7 @@ static DWORD msi_atou(LPCWSTR str) ret += (*str - '0'); str++; } - return 0; + return ret; } static LPWSTR msi_strdup(LPCWSTR str)
1
0
0
0
Lionel Debroux : msvcrt: Fix memory leak (found by Smatch).
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 68b1f2cde2727e381f41724d5348f9fc413b1425 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=68b1f2cde2727e381f41724d5…
Author: Lionel Debroux <lionel_debroux(a)yahoo.fr> Date: Wed Nov 21 17:34:10 2007 +0100 msvcrt: Fix memory leak (found by Smatch). --- dlls/msvcrt/tests/heap.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/dlls/msvcrt/tests/heap.c b/dlls/msvcrt/tests/heap.c index afea53f..2cd4fb2 100644 --- a/dlls/msvcrt/tests/heap.c +++ b/dlls/msvcrt/tests/heap.c @@ -342,6 +342,7 @@ START_TEST(heap) mem = malloc(0); ok(mem != NULL, "memory not allocated for size 0\n"); + free(mem); mem = realloc(NULL, 10); ok(mem != NULL, "memory not allocated\n");
1
0
0
0
David Adam : d3dx8: Implement D3DXQuaternionLn.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 41029cc88c7592adc392f94b83120682cf3906d9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=41029cc88c7592adc392f94b8…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Wed Nov 21 14:34:32 2007 +0100 d3dx8: Implement D3DXQuaternionLn. --- dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 28 ++++++++++++++++++++++++++++ dlls/d3dx8/tests/math.c | 20 ++++++++++++++++++-- include/d3dx8math.h | 1 + 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index d398791..d65dce0 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -56,7 +56,7 @@ @ stdcall D3DXQuaternionMultiply(ptr ptr ptr) @ stdcall D3DXQuaternionNormalize(ptr ptr) @ stdcall D3DXQuaternionInverse(ptr ptr) -@ stub D3DXQuaternionLn +@ stdcall D3DXQuaternionLn(ptr ptr) @ stub D3DXQuaternionExp @ stdcall D3DXQuaternionSlerp(ptr ptr ptr long) @ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr long) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index aa8664f..19d6a9f 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -612,6 +612,34 @@ D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUA return pout; } +D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) +{ + FLOAT norm, normvec, theta; + + norm = D3DXQuaternionLengthSq(pq); + if ( norm > 1.0001f ) + { + pout->x = pq->x; + pout->y = pq->y; + pout->z = pq->z; + pout->w = 0.0f; + } + else if( norm > 0.99999f) + { + normvec = sqrt( pq->x * pq->x + pq->y * pq->y + pq->z * pq->z ); + theta = atan2(normvec, pq->w) / normvec; + pout->x = theta * pq->x; + pout->y = theta * pq->y; + pout->z = theta * pq->z; + pout->w = 0.0f; + } + else + { + FIXME("The quaternion (%f, %f, %f, %f) has a norm <1. This should not happen. Windows returns a result anyway. This case is not implemented yet.\n", pq->x, pq->y, pq->z, pq->w); + } + return pout; +} + D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2) { pout->x = pq2->w * pq1->x + pq2->x * pq1->w + pq2->y * pq1->z - pq2->z * pq1->y; diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 950bc5e..6dfe49c 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -553,7 +553,7 @@ static void D3DXPlaneTest(void) static void D3X8QuaternionTest(void) { D3DXMATRIX mat; - D3DXQUATERNION expectedquat, gotquat, Nq, nul, q, r, s, t, u; + D3DXQUATERNION expectedquat, gotquat, Nq, Nq1, nul, q, r, s, t, u; LPD3DXQUATERNION funcpointer; D3DXVECTOR3 axis, expectedvec; FLOAT angle, expected, got, scale, scale2; @@ -643,6 +643,23 @@ static void D3X8QuaternionTest(void) got = D3DXQuaternionLengthSq(NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); +/*_______________D3DXQuaternionLn______________________________*/ + expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 0.0f; + D3DXQuaternionLn(&gotquat,&q); + expect_vec4(expectedquat,gotquat); + expectedquat.x = -3.0f; expectedquat.y = 4.0f; expectedquat.z = -5.0f; expectedquat.w = 0.0f; + D3DXQuaternionLn(&gotquat,&r); + expect_vec4(expectedquat,gotquat); + Nq.x = 1.0f/11.0f; Nq.y = 2.0f/11.0f; Nq.z = 4.0f/11.0f; Nq.w=10.0f/11.0f; + expectedquat.x = 0.093768f; expectedquat.y = 0.187536f; expectedquat.z = 0.375073f; expectedquat.w = 0.0f; + D3DXQuaternionLn(&gotquat,&Nq); + expect_vec4(expectedquat,gotquat); + /* Test the cas where the norm of the quaternion is <1 */ + Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w= 0.9f; + expectedquat.x = 0.206945f; expectedquat.y = 0.103473f; expectedquat.z = 0.310418f; expectedquat.w = 0.0f; + D3DXQuaternionLn(&gotquat,&Nq1); + todo_wine{ expect_vec4(expectedquat,gotquat) }; + /*_______________D3DXQuaternionMultiply________________________*/ expectedquat.x = 3.0f; expectedquat.y = 61.0f; expectedquat.z = -32.0f; expectedquat.w = 85.0f; D3DXQuaternionMultiply(&gotquat,&q,&r); @@ -706,7 +723,6 @@ static void D3X8QuaternionTest(void) D3DXQuaternionRotationYawPitchRoll(&gotquat,D3DX_PI/4.0f,D3DX_PI/11.0f,D3DX_PI/3.0f); expect_vec4(expectedquat,gotquat); - /*_______________D3DXQuaternionSlerp________________________*/ expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f; D3DXQuaternionSlerp(&gotquat,&q,&r,scale); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index 5ef85b4..6c5f18f 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -304,6 +304,7 @@ D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *pplane, C D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, FLOAT f, FLOAT g); D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); +D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2); D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle);
1
0
0
0
David Adam : d3dx8: Implement D3DXMatrixTransformation.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: cf443380ba53cf6b32277d31a95c582654ca02db URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cf443380ba53cf6b32277d31a…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Wed Nov 21 17:23:13 2007 +0100 d3dx8: Implement D3DXMatrixTransformation. --- dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/d3dx8/tests/math.c | 16 ++++++++- include/d3dx8math.h | 1 + 4 files changed, 96 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index 52fa008..28b772e 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -33,7 +33,7 @@ @ stdcall D3DXMatrixRotationAxis(ptr ptr long) @ stdcall D3DXMatrixRotationQuaternion(ptr ptr) @ stdcall D3DXMatrixRotationYawPitchRoll(ptr long long long) -@ stub D3DXMatrixTransformation +@ stdcall D3DXMatrixTransformation(ptr ptr ptr ptr ptr ptr ptr) @ stdcall D3DXMatrixAffineTransformation(ptr long ptr ptr ptr) @ stdcall D3DXMatrixLookAtRH(ptr ptr ptr ptr) @ stdcall D3DXMatrixLookAtLH(ptr ptr ptr ptr) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index 9f7522e..04072bf 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -480,6 +480,86 @@ D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, CONST D3DXVECTOR4 *plight, return pout; } +D3DXMATRIX* D3DXMatrixTransformation(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pscalingcenter, CONST D3DXQUATERNION *pscalingrotation, CONST D3DXVECTOR3 *pscaling, CONST D3DXVECTOR3 *protationcenter, CONST D3DXQUATERNION *protation, CONST D3DXVECTOR3 *ptranslation) +{ + D3DXMATRIX m1, m2, m3, m4, m5, m6, m7, p1, p2, p3, p4, p5; + D3DXQUATERNION prc; + D3DXVECTOR3 psc, pt; + + if ( !pscalingcenter ) + { + psc.x = 0.0f; + psc.y = 0.0f; + psc.z = 0.0f; + } + else + { + psc.x = pscalingcenter->x; + psc.y = pscalingcenter->y; + psc.z = pscalingcenter->z; + } + if ( !protationcenter ) + { + prc.x = 0.0f; + prc.y = 0.0f; + prc.z = 0.0f; + } + else + { + prc.x = protationcenter->x; + prc.y = protationcenter->y; + prc.z = protationcenter->z; + } + if ( !ptranslation ) + { + pt.x = 0.0f; + pt.y = 0.0f; + pt.z = 0.0f; + } + else + { + pt.x = ptranslation->x; + pt.y = ptranslation->y; + pt.z = ptranslation->z; + } + D3DXMatrixTranslation(&m1, -psc.x, -psc.y, -psc.z); + if ( !pscalingrotation ) + { + D3DXMatrixIdentity(&m2); + D3DXMatrixIdentity(&m4); + } + else + { + D3DXMatrixRotationQuaternion(&m4, pscalingrotation); + D3DXMatrixInverse(&m2, NULL, &m4); + } + if ( !pscaling ) + { + D3DXMatrixIdentity(&m3); + } + else + { + D3DXMatrixScaling(&m3, pscaling->x, pscaling->y, pscaling->z); + } + if ( !protation ) + { + D3DXMatrixIdentity(&m6); + } + else + { + D3DXMatrixRotationQuaternion(&m6, protation); + } + D3DXMatrixTranslation(&m5, psc.x - prc.x, psc.y - prc.y, psc.z - prc.z); + D3DXMatrixTranslation(&m7, prc.x + pt.x, prc.y + pt.y, prc.z + pt.z); + D3DXMatrixMultiply(&p1, &m1, &m2); + D3DXMatrixMultiply(&p2, &p1, &m3); + D3DXMatrixMultiply(&p3, &p2, &m4); + D3DXMatrixMultiply(&p4, &p3, &m5); + D3DXMatrixMultiply(&p5, &p4, &m6); + D3DXMatrixMultiply(pout, &p5, &m7); + return pout; +} + D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z) { D3DXMatrixIdentity(pout); diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index b689fb7..6fb5736 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -164,8 +164,8 @@ static void D3DXMatrixTest(void) D3DXMATRIX expectedmat, gotmat, mat, mat2, mat3; LPD3DXMATRIX funcpointer; D3DXPLANE plane; - D3DXQUATERNION q; - D3DXVECTOR3 at, axis, eye; + D3DXQUATERNION q, r; + D3DXVECTOR3 at, axis, eye, last, scaling; D3DXVECTOR4 light; BOOL expected, got; FLOAT angle, determinant, expectedfloat, gotfloat; @@ -187,10 +187,13 @@ static void D3DXMatrixTest(void) plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f; q.x = 1.0f; q.y = -4.0f; q.z =7.0f; q.w = -11.0f; + r.x = 0.87f; r.y = 0.65f; r.z =0.43f; r.w= 0.21f; at.x = -2.0f; at.y = 13.0f; at.z = -9.0f; axis.x = 1.0f; axis.y = -3.0f; axis.z = 7.0f; eye.x = 8.0f; eye.y = -5.0f; eye.z = 5.75f; + last.x = 9.7f; last.y = -8.6; last.z = 1.3f; + scaling.x = 0.03f; scaling.y =0.05f; scaling.z = 0.06f; light.x = 9.6f; light.y = 8.5f; light.z = 7.4; light.w = 6.3; @@ -364,6 +367,7 @@ static void D3DXMatrixTest(void) U(expectedmat).m[3][0] = 1.615385f; U(expectedmat).m[3][1] = 0.538462f; U(expectedmat).m[3][2] = -2.153846f; U(expectedmat).m[3][3] = 1.0f; D3DXMatrixReflect(&gotmat,&plane); expect_mat(expectedmat,gotmat); + /*____________D3DXMatrixRotationAxis_____*/ U(expectedmat).m[0][0] = 0.508475f; U(expectedmat).m[0][1] = 0.763805f; U(expectedmat).m[0][2] = 0.397563f; U(expectedmat).m[0][3] = 0.0f; U(expectedmat).m[1][0] = -0.814652f; U(expectedmat).m[1][1] = 0.576271f; U(expectedmat).m[1][2] = -0.065219f; U(expectedmat).m[1][3] = 0.0f; @@ -428,6 +432,14 @@ static void D3DXMatrixTest(void) D3DXMatrixShadow(&gotmat,&light,&plane); expect_mat(expectedmat,gotmat); +/*____________D3DXMatrixTransformation______________*/ + U(expectedmat).m[0][0] = -0.2148f; U(expectedmat).m[0][1] = 1.3116f; U(expectedmat).m[0][2] = 0.4752f; U(expectedmat).m[0][3] = 0.0f; + U(expectedmat).m[1][0] = 0.9504f; U(expectedmat).m[1][1] = -0.8836f; U(expectedmat).m[1][2] = 0.9244f; U(expectedmat).m[1][3] = 0.0f; + U(expectedmat).m[2][0] = 1.0212f; U(expectedmat).m[2][1] = 0.1936f; U(expectedmat).m[2][2] = -1.3588f; U(expectedmat).m[2][3] = 0.0f; + U(expectedmat).m[3][0] = 18.2985f; U(expectedmat).m[3][1] = -29.624001f; U(expectedmat).m[3][2] = 15.683499f; U(expectedmat).m[3][3] = 1.0f; + D3DXMatrixTransformation(&gotmat,&at,&q,NULL,&eye,&r,&last); + expect_mat(expectedmat,gotmat); + /*____________D3DXMatrixTranslation______________*/ U(expectedmat).m[0][0] = 1.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f; U(expectedmat).m[1][0] = 0.0; U(expectedmat).m[1][1] = 1.0f; U(expectedmat).m[1][2] = 0.0f; U(expectedmat).m[1][3] = 0.0f; diff --git a/include/d3dx8math.h b/include/d3dx8math.h index a799dee..4ea4d7d 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -293,6 +293,7 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *pout, FLOAT yaw, F D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle); D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz); D3DXMATRIX* WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, CONST D3DXVECTOR4 *plight, CONST D3DXPLANE *pPlane); +D3DXMATRIX* D3DXMatrixTransformation(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pscalingcenter, CONST D3DXQUATERNION *pscalingrotation, CONST D3DXVECTOR3 *pscaling, CONST D3DXVECTOR3 *protationcenter, CONST D3DXQUATERNION *protation, CONST D3DXVECTOR3 *ptranslation); D3DXMATRIX* WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z); D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *pm);
1
0
0
0
David Adam : d3dx8: Implement D3DXQuaternionExp.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: f1bc484947b45ef0e08cbf51f1b8614baf5b587d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f1bc484947b45ef0e08cbf51f…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Wed Nov 21 14:59:21 2007 +0100 d3dx8: Implement D3DXQuaternionExp. --- dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 22 ++++++++++++++++++++++ dlls/d3dx8/tests/math.c | 14 ++++++++++++++ include/d3dx8math.h | 1 + 4 files changed, 38 insertions(+), 1 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index d65dce0..52fa008 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -57,7 +57,7 @@ @ stdcall D3DXQuaternionNormalize(ptr ptr) @ stdcall D3DXQuaternionInverse(ptr ptr) @ stdcall D3DXQuaternionLn(ptr ptr) -@ stub D3DXQuaternionExp +@ stdcall D3DXQuaternionExp(ptr ptr) @ stdcall D3DXQuaternionSlerp(ptr ptr ptr long) @ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr long) @ stdcall D3DXQuaternionBaryCentric(ptr ptr ptr ptr long long) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index 19d6a9f..9f7522e 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -588,6 +588,28 @@ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONST D3D return pout; } +D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) +{ + FLOAT norm; + + norm = sqrt(pq->x * pq->x + pq->y * pq->y + pq->z * pq->z); + if (norm ) + { + pout->x = sin(norm) * pq->x / norm; + pout->y = sin(norm) * pq->y / norm; + pout->z = sin(norm) * pq->z / norm; + pout->w = cos(norm); + } + else + { + pout->x = 0.0f; + pout->y = 0.0f; + pout->z = 0.0f; + pout->w = 1.0f; + } + return pout; +} + D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) { D3DXQUATERNION temp; diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 6dfe49c..b689fb7 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -595,6 +595,20 @@ static void D3X8QuaternionTest(void) got = D3DXQuaternionDot(NULL,NULL); ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); +/*_______________D3DXQuaternionExp______________________________*/ + expectedquat.x = -0.216382f; expectedquat.y = -0.432764f; expectedquat.z = -0.8655270f; expectedquat.w = -0.129449f; + D3DXQuaternionExp(&gotquat,&q); + expect_vec4(expectedquat,gotquat); + /* Test the null quaternion */ + expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f; + D3DXQuaternionExp(&gotquat,&nul); + expect_vec4(expectedquat,gotquat); + /* Test the case where the norm of the quaternion is <1 */ + Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w= 0.9f; + expectedquat.x = 0.195366; expectedquat.y = 0.097683f; expectedquat.z = 0.293049f; expectedquat.w = 0.930813f; + D3DXQuaternionExp(&gotquat,&Nq1); + expect_vec4(expectedquat,gotquat); + /*_______________D3DXQuaternionIdentity________________*/ expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f; D3DXQuaternionIdentity(&gotquat); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index 6c5f18f..a799dee 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -303,6 +303,7 @@ D3DXPLANE* WINAPI D3DXPlaneNormalize(D3DXPLANE *pout, CONST D3DXPLANE *pp); D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *pplane, CONST D3DXMATRIX *pm); D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, FLOAT f, FLOAT g); +D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionLn(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2);
1
0
0
0
David Adam : d3dx8: Implement D3DXQuaternionRotationYawPitchRoll.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 16a8efa410859fcaadc80b931fb1949a086ece4d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=16a8efa410859fcaadc80b931…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Tue Nov 20 15:23:36 2007 +0100 d3dx8: Implement D3DXQuaternionRotationYawPitchRoll. --- dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 9 +++++++++ dlls/d3dx8/tests/math.c | 6 ++++++ include/d3dx8math.h | 1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index 4e7996a..d398791 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -52,7 +52,7 @@ @ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr) @ stdcall D3DXQuaternionRotationMatrix(ptr ptr) @ stdcall D3DXQuaternionRotationAxis(ptr ptr long) -@ stub D3DXQuaternionRotationYawPitchRoll +@ stdcall D3DXQuaternionRotationYawPitchRoll(ptr long long long) @ stdcall D3DXQuaternionMultiply(ptr ptr ptr) @ stdcall D3DXQuaternionNormalize(ptr ptr) @ stdcall D3DXQuaternionInverse(ptr ptr) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index f1cbf22..aa8664f 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -706,6 +706,15 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST return pout; } +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll) +{ + pout->x = sin( yaw / 2.0f) * cos(pitch / 2.0f) * sin(roll / 2.0f) + cos(yaw / 2.0f) * sin(pitch / 2.0f) * cos(roll / 2.0f); + pout->y = sin( yaw / 2.0f) * cos(pitch / 2.0f) * cos(roll / 2.0f) - cos(yaw / 2.0f) * sin(pitch / 2.0f) * sin(roll / 2.0f); + pout->z = cos(yaw / 2.0f) * cos(pitch / 2.0f) * sin(roll / 2.0f) - sin( yaw / 2.0f) * sin(pitch / 2.0f) * cos(roll / 2.0f); + pout->w = cos( yaw / 2.0f) * cos(pitch / 2.0f) * cos(roll / 2.0f) + sin(yaw / 2.0f) * sin(pitch / 2.0f) * sin(roll / 2.0f); + return pout; +} + D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t) { FLOAT dot, epsilon; diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 6a63fd8..950bc5e 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -701,6 +701,12 @@ static void D3X8QuaternionTest(void) D3DXQuaternionRotationMatrix(&gotquat,&mat); expect_vec4(expectedquat,gotquat); +/*_______________D3DXQuaternionRotationYawPitchRoll__________*/ + expectedquat.x = 0.303261f; expectedquat.y = 0.262299f; expectedquat.z = 0.410073f; expectedquat.w = 0.819190f; + D3DXQuaternionRotationYawPitchRoll(&gotquat,D3DX_PI/4.0f,D3DX_PI/11.0f,D3DX_PI/3.0f); + expect_vec4(expectedquat,gotquat); + + /*_______________D3DXQuaternionSlerp________________________*/ expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f; D3DXQuaternionSlerp(&gotquat,&q,&r,scale); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index f9bc777..5ef85b4 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -308,6 +308,7 @@ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQU D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle); D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXMATRIX *pm); +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll); D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t); D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST D3DXQUATERNION *pq4, FLOAT t); void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle);
1
0
0
0
David Adam : d3dx8: Implement D3DXQuaternionRotationMatrix.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: eee8dd17d8cbe1efe28d10128d3fbee68de769e6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eee8dd17d8cbe1efe28d10128…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Tue Nov 20 14:56:15 2007 +0100 d3dx8: Implement D3DXQuaternionRotationMatrix. --- dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/d3dx8/tests/math.c | 33 ++++++++++++++++++++++++++++++ include/d3dx8math.h | 1 + 4 files changed, 86 insertions(+), 1 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index d3b0ffa..4e7996a 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -50,7 +50,7 @@ @ stdcall D3DXMatrixShadow(ptr ptr ptr) @ stdcall D3DXMatrixReflect(ptr ptr) @ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr) -@ stub D3DXQuaternionRotationMatrix +@ stdcall D3DXQuaternionRotationMatrix(ptr ptr) @ stdcall D3DXQuaternionRotationAxis(ptr ptr long) @ stub D3DXQuaternionRotationYawPitchRoll @ stdcall D3DXQuaternionMultiply(ptr ptr ptr) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index adc100d..f1cbf22 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -655,6 +655,57 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3 return pout; } +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXMATRIX *pm) +{ + int i, maxi; + FLOAT maxdiag, S, trace; + + trace = pm->u.m[0][0] + pm->u.m[1][1] + pm->u.m[2][2] + 1.0f; + if ( trace > 0.0f) + { + pout->x = ( pm->u.m[1][2] - pm->u.m[2][1] ) / ( 2.0f * sqrt(trace) ); + pout->y = ( pm->u.m[2][0] - pm->u.m[0][2] ) / ( 2.0f * sqrt(trace) ); + pout->z = ( pm->u.m[0][1] - pm->u.m[1][0] ) / ( 2.0f * sqrt(trace) ); + pout->w = sqrt(trace) / 2.0f; + return pout; + } + maxi = 0; + maxdiag = pm->u.m[0][0]; + for (i=1; i<3; i++) + { + if ( pm->u.m[i][i] > maxdiag ) + { + maxi = i; + maxdiag = pm->u.m[i][i]; + } + } + switch( maxi ) + { + case 0: + S = 2.0f * sqrt(1.0f + pm->u.m[0][0] - pm->u.m[1][1] - pm->u.m[2][2]); + pout->x = 0.25f * S; + pout->y = ( pm->u.m[0][1] + pm->u.m[1][0] ) / S; + pout->z = ( pm->u.m[0][2] + pm->u.m[2][0] ) / S; + pout->w = ( pm->u.m[1][2] - pm->u.m[2][1] ) / S; + break; + case 1: + S = 2.0f * sqrt(1.0f + pm->u.m[1][1] - pm->u.m[0][0] - pm->u.m[2][2]); + pout->x = ( pm->u.m[0][1] + pm->u.m[1][0] ) / S; + pout->y = 0.25f * S; + pout->z = ( pm->u.m[1][2] + pm->u.m[2][1] ) / S; + pout->w = ( pm->u.m[2][0] - pm->u.m[0][2] ) / S; + break; + case 2: + S = 2.0f * sqrt(1.0f + pm->u.m[2][2] - pm->u.m[0][0] - pm->u.m[1][1]); + pout->x = ( pm->u.m[0][2] + pm->u.m[2][0] ) / S; + pout->y = ( pm->u.m[1][2] + pm->u.m[2][1] ) / S; + pout->z = 0.25f * S; + pout->w = ( pm->u.m[0][1] - pm->u.m[1][0] ) / S; + break; + } + return pout; +} + D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t) { FLOAT dot, epsilon; diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 589bb2a..6a63fd8 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -552,6 +552,7 @@ static void D3DXPlaneTest(void) static void D3X8QuaternionTest(void) { + D3DXMATRIX mat; D3DXQUATERNION expectedquat, gotquat, Nq, nul, q, r, s, t, u; LPD3DXQUATERNION funcpointer; D3DXVECTOR3 axis, expectedvec; @@ -668,6 +669,38 @@ static void D3X8QuaternionTest(void) D3DXQuaternionRotationAxis(&gotquat,&axis,angle); expect_vec4(expectedquat,gotquat); +/*_______________D3DXQuaternionRotationMatrix___________________*/ + /* test when the trace is >0 */ + U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f; + U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f; + U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f; + U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f; + U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f; + U(mat).m[3][3] = 48.0f; + expectedquat.x = 2.368682f; expectedquat.y = 0.768221f; expectedquat.z = -0.384111f; expectedquat.w = 3.905125f; + D3DXQuaternionRotationMatrix(&gotquat,&mat); + expect_vec4(expectedquat,gotquat); + /* test the case when the greater element is (2,2) */ + U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f; + U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f; + U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f; + U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f; + U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = -60.0f; U(mat).m[2][2] = 40.0f; + U(mat).m[3][3] = 48.0f; + expectedquat.x = 1.233905f; expectedquat.y = -0.237290f; expectedquat.z = 5.267827f; expectedquat.w = -0.284747f; + D3DXQuaternionRotationMatrix(&gotquat,&mat); + expect_vec4(expectedquat,gotquat); + /* test the case when the greater element is (1,1) */ + U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f; + U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f; + U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f; + U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f; + U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 60.0f; U(mat).m[2][2] = -80.0f; + U(mat).m[3][3] = 48.0f; + expectedquat.x = 0.651031f; expectedquat.y = 6.144103f; expectedquat.z = -0.203447f; expectedquat.w = 0.488273f; + D3DXQuaternionRotationMatrix(&gotquat,&mat); + expect_vec4(expectedquat,gotquat); + /*_______________D3DXQuaternionSlerp________________________*/ expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f; D3DXQuaternionSlerp(&gotquat,&q,&r,scale); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index c5f18a2..f9bc777 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -307,6 +307,7 @@ D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUA D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2); D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle); +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXMATRIX *pm); D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t); D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST D3DXQUATERNION *pq4, FLOAT t); void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle);
1
0
0
0
David Adam : d3dx8: Implement D3DXQuaternionRotationAxis.
by Alexandre Julliard
26 Nov '07
26 Nov '07
Module: wine Branch: master Commit: 345994fbcec4783657b7982ab3ce3f0bc3c53cae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=345994fbcec4783657b7982ab…
Author: David Adam <David.Adam(a)math.cnrs.fr> Date: Tue Nov 20 13:04:16 2007 +0100 d3dx8: Implement D3DXQuaternionRotationAxis. --- dlls/d3dx8/d3dx8.spec | 2 +- dlls/d3dx8/math.c | 12 ++++++++++++ dlls/d3dx8/tests/math.c | 12 ++++++++++++ include/d3dx8math.h | 1 + 4 files changed, 26 insertions(+), 1 deletions(-) diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index 1c57f53..d3b0ffa 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -51,7 +51,7 @@ @ stdcall D3DXMatrixReflect(ptr ptr) @ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr) @ stub D3DXQuaternionRotationMatrix -@ stub D3DXQuaternionRotationAxis +@ stdcall D3DXQuaternionRotationAxis(ptr ptr long) @ stub D3DXQuaternionRotationYawPitchRoll @ stdcall D3DXQuaternionMultiply(ptr ptr ptr) @ stdcall D3DXQuaternionNormalize(ptr ptr) diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index 52e580d..adc100d 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -643,6 +643,18 @@ D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQ return pout; } +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle) +{ + D3DXVECTOR3 temp; + + D3DXVec3Normalize(&temp, pv); + pout->x = sin( angle / 2.0f ) * temp.x; + pout->y = sin( angle / 2.0f ) * temp.y; + pout->z = sin( angle / 2.0f ) * temp.z; + pout->w = cos( angle / 2.0f ); + return pout; +} + D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t) { FLOAT dot, epsilon; diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index e3c6a28..589bb2a 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -656,6 +656,18 @@ static void D3X8QuaternionTest(void) D3DXQuaternionNormalize(&gotquat,&nul); expect_vec4(expectedquat,gotquat); +/*_______________D3DXQuaternionRotationAxis___________________*/ + axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f; + angle = D3DX_PI/3.0f; + expectedquat.x = 0.067116; expectedquat.y = 0.234905f; expectedquat.z = 0.436251f; expectedquat.w = 0.866025f; + D3DXQuaternionRotationAxis(&gotquat,&axis,angle); + expect_vec4(expectedquat,gotquat); + /* Test the nul quaternion */ + axis.x = 0.0f; axis.y = 0.0; axis.z = 0.0f; + expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.866025f; + D3DXQuaternionRotationAxis(&gotquat,&axis,angle); + expect_vec4(expectedquat,gotquat); + /*_______________D3DXQuaternionSlerp________________________*/ expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f; D3DXQuaternionSlerp(&gotquat,&q,&r,scale); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index dd85e3a..c5f18a2 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -306,6 +306,7 @@ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, CONST D3D D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); D3DXQUATERNION* WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2); D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *pout, CONST D3DXVECTOR3 *pv, FLOAT angle); D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t); D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST D3DXQUATERNION *pq4, FLOAT t); void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle);
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
76
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
Results per page:
10
25
50
100
200