Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
41029cc8
Commit
41029cc8
authored
Nov 21, 2007
by
David Adam
Committed by
Alexandre Julliard
Nov 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXQuaternionLn.
parent
16a8efa4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+48
-3
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
math.c
dlls/d3dx8/math.c
+28
-0
math.c
dlls/d3dx8/tests/math.c
+18
-2
d3dx8math.h
include/d3dx8math.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
41029cc8
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
@ stdcall D3DXQuaternionMultiply(ptr ptr ptr)
@ stdcall D3DXQuaternionMultiply(ptr ptr ptr)
@ stdcall D3DXQuaternionNormalize(ptr ptr)
@ stdcall D3DXQuaternionNormalize(ptr ptr)
@ stdcall D3DXQuaternionInverse(ptr ptr)
@ stdcall D3DXQuaternionInverse(ptr ptr)
@ st
ub D3DXQuaternionLn
@ st
dcall D3DXQuaternionLn(ptr ptr)
@ stub D3DXQuaternionExp
@ stub D3DXQuaternionExp
@ stdcall D3DXQuaternionSlerp(ptr ptr ptr long)
@ stdcall D3DXQuaternionSlerp(ptr ptr ptr long)
@ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr long)
@ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr long)
...
...
dlls/d3dx8/math.c
View file @
41029cc8
...
@@ -612,6 +612,34 @@ D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUA
...
@@ -612,6 +612,34 @@ D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUA
return
pout
;
return
pout
;
}
}
D3DXQUATERNION
*
WINAPI
D3DXQuaternionLn
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
)
{
FLOAT
norm
,
normvec
,
theta
;
norm
=
D3DXQuaternionLengthSq
(
pq
);
if
(
norm
>
1
.
0001
f
)
{
pout
->
x
=
pq
->
x
;
pout
->
y
=
pq
->
y
;
pout
->
z
=
pq
->
z
;
pout
->
w
=
0
.
0
f
;
}
else
if
(
norm
>
0
.
99999
f
)
{
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
.
0
f
;
}
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
)
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
;
pout
->
x
=
pq2
->
w
*
pq1
->
x
+
pq2
->
x
*
pq1
->
w
+
pq2
->
y
*
pq1
->
z
-
pq2
->
z
*
pq1
->
y
;
...
...
dlls/d3dx8/tests/math.c
View file @
41029cc8
...
@@ -553,7 +553,7 @@ static void D3DXPlaneTest(void)
...
@@ -553,7 +553,7 @@ static void D3DXPlaneTest(void)
static
void
D3X8QuaternionTest
(
void
)
static
void
D3X8QuaternionTest
(
void
)
{
{
D3DXMATRIX
mat
;
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
;
LPD3DXQUATERNION
funcpointer
;
D3DXVECTOR3
axis
,
expectedvec
;
D3DXVECTOR3
axis
,
expectedvec
;
FLOAT
angle
,
expected
,
got
,
scale
,
scale2
;
FLOAT
angle
,
expected
,
got
,
scale
,
scale2
;
...
@@ -643,6 +643,23 @@ static void D3X8QuaternionTest(void)
...
@@ -643,6 +643,23 @@ static void D3X8QuaternionTest(void)
got
=
D3DXQuaternionLengthSq
(
NULL
);
got
=
D3DXQuaternionLengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXQuaternionLn______________________________*/
expectedquat
.
x
=
1
.
0
f
;
expectedquat
.
y
=
2
.
0
f
;
expectedquat
.
z
=
4
.
0
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
q
);
expect_vec4
(
expectedquat
,
gotquat
);
expectedquat
.
x
=
-
3
.
0
f
;
expectedquat
.
y
=
4
.
0
f
;
expectedquat
.
z
=
-
5
.
0
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
r
);
expect_vec4
(
expectedquat
,
gotquat
);
Nq
.
x
=
1
.
0
f
/
11
.
0
f
;
Nq
.
y
=
2
.
0
f
/
11
.
0
f
;
Nq
.
z
=
4
.
0
f
/
11
.
0
f
;
Nq
.
w
=
10
.
0
f
/
11
.
0
f
;
expectedquat
.
x
=
0
.
093768
f
;
expectedquat
.
y
=
0
.
187536
f
;
expectedquat
.
z
=
0
.
375073
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
Nq
);
expect_vec4
(
expectedquat
,
gotquat
);
/* Test the cas where the norm of the quaternion is <1 */
Nq1
.
x
=
0
.
2
f
;
Nq1
.
y
=
0
.
1
f
;
Nq1
.
z
=
0
.
3
;
Nq1
.
w
=
0
.
9
f
;
expectedquat
.
x
=
0
.
206945
f
;
expectedquat
.
y
=
0
.
103473
f
;
expectedquat
.
z
=
0
.
310418
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
Nq1
);
todo_wine
{
expect_vec4
(
expectedquat
,
gotquat
)
};
/*_______________D3DXQuaternionMultiply________________________*/
/*_______________D3DXQuaternionMultiply________________________*/
expectedquat
.
x
=
3
.
0
f
;
expectedquat
.
y
=
61
.
0
f
;
expectedquat
.
z
=
-
32
.
0
f
;
expectedquat
.
w
=
85
.
0
f
;
expectedquat
.
x
=
3
.
0
f
;
expectedquat
.
y
=
61
.
0
f
;
expectedquat
.
z
=
-
32
.
0
f
;
expectedquat
.
w
=
85
.
0
f
;
D3DXQuaternionMultiply
(
&
gotquat
,
&
q
,
&
r
);
D3DXQuaternionMultiply
(
&
gotquat
,
&
q
,
&
r
);
...
@@ -706,7 +723,6 @@ static void D3X8QuaternionTest(void)
...
@@ -706,7 +723,6 @@ static void D3X8QuaternionTest(void)
D3DXQuaternionRotationYawPitchRoll
(
&
gotquat
,
D3DX_PI
/
4
.
0
f
,
D3DX_PI
/
11
.
0
f
,
D3DX_PI
/
3
.
0
f
);
D3DXQuaternionRotationYawPitchRoll
(
&
gotquat
,
D3DX_PI
/
4
.
0
f
,
D3DX_PI
/
11
.
0
f
,
D3DX_PI
/
3
.
0
f
);
expect_vec4
(
expectedquat
,
gotquat
);
expect_vec4
(
expectedquat
,
gotquat
);
/*_______________D3DXQuaternionSlerp________________________*/
/*_______________D3DXQuaternionSlerp________________________*/
expectedquat
.
x
=
-
0
.
2
f
;
expectedquat
.
y
=
2
.
6
f
;
expectedquat
.
z
=
1
.
3
f
;
expectedquat
.
w
=
9
.
1
f
;
expectedquat
.
x
=
-
0
.
2
f
;
expectedquat
.
y
=
2
.
6
f
;
expectedquat
.
z
=
1
.
3
f
;
expectedquat
.
w
=
9
.
1
f
;
D3DXQuaternionSlerp
(
&
gotquat
,
&
q
,
&
r
,
scale
);
D3DXQuaternionSlerp
(
&
gotquat
,
&
q
,
&
r
,
scale
);
...
...
include/d3dx8math.h
View file @
41029cc8
...
@@ -304,6 +304,7 @@ D3DXPLANE* WINAPI D3DXPlaneTransform(D3DXPLANE *pout, CONST D3DXPLANE *pplane, C
...
@@ -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
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
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
D3DXQuaternionMultiply
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq1
,
CONST
D3DXQUATERNION
*
pq2
);
D3DXQUATERNION
*
WINAPI
D3DXQuaternionNormalize
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
);
D3DXQUATERNION
*
WINAPI
D3DXQuaternionNormalize
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
);
D3DXQUATERNION
*
WINAPI
D3DXQuaternionRotationAxis
(
D3DXQUATERNION
*
pout
,
CONST
D3DXVECTOR3
*
pv
,
FLOAT
angle
);
D3DXQUATERNION
*
WINAPI
D3DXQuaternionRotationAxis
(
D3DXQUATERNION
*
pout
,
CONST
D3DXVECTOR3
*
pv
,
FLOAT
angle
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment