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
eee8dd17
Commit
eee8dd17
authored
Nov 20, 2007
by
David Adam
Committed by
Alexandre Julliard
Nov 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXQuaternionRotationMatrix.
parent
345994fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
1 deletion
+86
-1
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
math.c
dlls/d3dx8/math.c
+51
-0
math.c
dlls/d3dx8/tests/math.c
+33
-0
d3dx8math.h
include/d3dx8math.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
eee8dd17
...
...
@@ -50,7 +50,7 @@
@ stdcall D3DXMatrixShadow(ptr ptr ptr)
@ stdcall D3DXMatrixReflect(ptr ptr)
@ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr)
@ st
ub D3DXQuaternionRotationMatrix
@ st
dcall D3DXQuaternionRotationMatrix(ptr ptr)
@ stdcall D3DXQuaternionRotationAxis(ptr ptr long)
@ stub D3DXQuaternionRotationYawPitchRoll
@ stdcall D3DXQuaternionMultiply(ptr ptr ptr)
...
...
dlls/d3dx8/math.c
View file @
eee8dd17
...
...
@@ -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
.
0
f
;
if
(
trace
>
0
.
0
f
)
{
pout
->
x
=
(
pm
->
u
.
m
[
1
][
2
]
-
pm
->
u
.
m
[
2
][
1
]
)
/
(
2
.
0
f
*
sqrt
(
trace
)
);
pout
->
y
=
(
pm
->
u
.
m
[
2
][
0
]
-
pm
->
u
.
m
[
0
][
2
]
)
/
(
2
.
0
f
*
sqrt
(
trace
)
);
pout
->
z
=
(
pm
->
u
.
m
[
0
][
1
]
-
pm
->
u
.
m
[
1
][
0
]
)
/
(
2
.
0
f
*
sqrt
(
trace
)
);
pout
->
w
=
sqrt
(
trace
)
/
2
.
0
f
;
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
.
0
f
*
sqrt
(
1
.
0
f
+
pm
->
u
.
m
[
0
][
0
]
-
pm
->
u
.
m
[
1
][
1
]
-
pm
->
u
.
m
[
2
][
2
]);
pout
->
x
=
0
.
25
f
*
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
.
0
f
*
sqrt
(
1
.
0
f
+
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
.
25
f
*
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
.
0
f
*
sqrt
(
1
.
0
f
+
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
.
25
f
*
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
;
...
...
dlls/d3dx8/tests/math.c
View file @
eee8dd17
...
...
@@ -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
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
20
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
30
.
0
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
2
.
368682
f
;
expectedquat
.
y
=
0
.
768221
f
;
expectedquat
.
z
=
-
0
.
384111
f
;
expectedquat
.
w
=
3
.
905125
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the greater element is (2,2) */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
-
60
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
40
.
0
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
1
.
233905
f
;
expectedquat
.
y
=
-
0
.
237290
f
;
expectedquat
.
z
=
5
.
267827
f
;
expectedquat
.
w
=
-
0
.
284747
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the greater element is (1,1) */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
60
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
-
80
.
0
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
0
.
651031
f
;
expectedquat
.
y
=
6
.
144103
f
;
expectedquat
.
z
=
-
0
.
203447
f
;
expectedquat
.
w
=
0
.
488273
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/*_______________D3DXQuaternionSlerp________________________*/
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
);
...
...
include/d3dx8math.h
View file @
eee8dd17
...
...
@@ -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
);
...
...
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