Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
4099eb8b
Commit
4099eb8b
authored
Jun 12, 2012
by
Nozomi Kodama
Committed by
Alexandre Julliard
Jun 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9_36: D3DXQuaternionLn computes as if the norm of the input is 1.
parent
a8139f0b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
24 deletions
+28
-24
math.c
dlls/d3dx9_36/math.c
+12
-21
math.c
dlls/d3dx9_36/tests/math.c
+16
-3
No files found.
dlls/d3dx9_36/math.c
View file @
4099eb8b
...
...
@@ -1215,29 +1215,20 @@ D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUA
D3DXQUATERNION
*
WINAPI
D3DXQuaternionLn
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
)
{
FLOAT
norm
,
normvec
,
theta
;
FLOAT
t
;
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
;
}
TRACE
(
"(%p, %p)
\n
"
,
pout
,
pq
);
if
(
(
pq
->
w
>=
1
.
0
f
)
||
(
pq
->
w
==
-
1
.
0
f
)
)
t
=
1
.
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
);
}
t
=
acos
(
pq
->
w
)
/
sqrt
(
1
.
0
f
-
pq
->
w
*
pq
->
w
);
pout
->
x
=
t
*
pq
->
x
;
pout
->
y
=
t
*
pq
->
y
;
pout
->
z
=
t
*
pq
->
z
;
pout
->
w
=
0
.
0
f
;
return
pout
;
}
...
...
dlls/d3dx9_36/tests/math.c
View file @
4099eb8b
...
...
@@ -746,11 +746,24 @@ static void D3DXQuaternionTest(void)
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
;
Nq
.
x
=
0
.
0
f
;
Nq
.
y
=
0
.
0
f
;
Nq
.
z
=
0
.
0
f
;
Nq
.
w
=
1
.
0
f
;
expectedquat
.
x
=
0
.
0
f
;
expectedquat
.
y
=
0
.
0
f
;
expectedquat
.
z
=
0
.
0
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
Nq
);
expect_vec4
(
expectedquat
,
gotquat
);
Nq
.
x
=
5
.
4
f
;
Nq
.
y
=
1
.
2
f
;
Nq
.
z
=
-
0
.
3
f
;
Nq
.
w
=
-
0
.
3
f
;
expectedquat
.
x
=
10
.
616652
f
;
expectedquat
.
y
=
2
.
359256
f
;
expectedquat
.
z
=
-
0
.
589814
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
Nq
);
expect_vec4
(
expectedquat
,
gotquat
);
/* Test the case 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
)
};
expect_vec4
(
expectedquat
,
gotquat
);
/* Test the case where the real part of the quaternion is -1.0f */
Nq1
.
x
=
0
.
2
f
;
Nq1
.
y
=
0
.
1
f
;
Nq1
.
z
=
0
.
3
;
Nq1
.
w
=
-
1
.
0
f
;
expectedquat
.
x
=
0
.
2
f
;
expectedquat
.
y
=
0
.
1
f
;
expectedquat
.
z
=
0
.
3
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionLn
(
&
gotquat
,
&
Nq1
);
expect_vec4
(
expectedquat
,
gotquat
);
/*_______________D3DXQuaternionMultiply________________________*/
expectedquat
.
x
=
3
.
0
f
;
expectedquat
.
y
=
61
.
0
f
;
expectedquat
.
z
=
-
32
.
0
f
;
expectedquat
.
w
=
85
.
0
f
;
...
...
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