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
4f1d5c26
Commit
4f1d5c26
authored
Nov 12, 2008
by
David Adam
Committed by
Alexandre Julliard
Nov 13, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXMatrixAffineTransformation2D.
parent
63e82945
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
208 additions
and
2 deletions
+208
-2
d3dx9_36.spec
dlls/d3dx9_36/d3dx9_36.spec
+1
-1
math.c
dlls/d3dx9_36/math.c
+47
-0
math.c
dlls/d3dx9_36/tests/math.c
+159
-1
d3dx9math.h
include/d3dx9math.h
+1
-0
No files found.
dlls/d3dx9_36/d3dx9_36.spec
View file @
4f1d5c26
...
...
@@ -197,7 +197,7 @@
@ stub D3DXLoadVolumeFromResourceW
@ stub D3DXLoadVolumeFromVolume
@ stdcall D3DXMatrixAffineTransformation(ptr long ptr ptr ptr) d3dx8.D3DXMatrixAffineTransformation
@ st
ub D3DXMatrixAffineTransformation2D
@ st
dcall D3DXMatrixAffineTransformation2D(ptr long ptr long ptr)
@ stdcall D3DXMatrixDecompose(ptr ptr ptr ptr)
@ stdcall D3DXMatrixDeterminant(ptr) d3dx8.D3DXMatrixfDeterminant
@ stdcall D3DXMatrixInverse(ptr ptr ptr) d3dx8.D3DXMatrixInverse
...
...
dlls/d3dx9_36/math.c
View file @
4f1d5c26
...
...
@@ -29,6 +29,53 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
/*************************************************************************
* D3DXMatrixAffineTransformation2D
*/
D3DXMATRIX
*
WINAPI
D3DXMatrixAffineTransformation2D
(
D3DXMATRIX
*
pout
,
FLOAT
scaling
,
CONST
D3DXVECTOR2
*
protationcenter
,
FLOAT
rotation
,
CONST
D3DXVECTOR2
*
ptranslation
)
{
D3DXQUATERNION
rot
;
D3DXVECTOR3
rot_center
,
trans
;
rot
.
w
=
cos
(
rotation
/
2
.
0
f
);
rot
.
x
=
0
.
0
f
;
rot
.
y
=
0
.
0
f
;
rot
.
z
=
sin
(
rotation
/
2
.
0
f
);
if
(
protationcenter
)
{
rot_center
.
x
=
protationcenter
->
x
;
rot_center
.
y
=
protationcenter
->
y
;
rot_center
.
z
=
0
.
0
f
;
}
else
{
rot_center
.
x
=
0
.
0
f
;
rot_center
.
y
=
0
.
0
f
;
rot_center
.
z
=
0
.
0
f
;
}
if
(
ptranslation
)
{
trans
.
x
=
ptranslation
->
x
;
trans
.
y
=
ptranslation
->
y
;
trans
.
z
=
0
.
0
f
;
}
else
{
trans
.
x
=
0
.
0
f
;
trans
.
y
=
0
.
0
f
;
trans
.
z
=
0
.
0
f
;
}
D3DXMatrixAffineTransformation
(
pout
,
scaling
,
&
rot_center
,
&
rot
,
&
trans
);
return
pout
;
}
/*************************************************************************
* D3DXMatrixDecompose
*/
HRESULT
WINAPI
D3DXMatrixDecompose
(
D3DXVECTOR3
*
poutscale
,
D3DXQUATERNION
*
poutrotation
,
D3DXVECTOR3
*
pouttranslation
,
D3DXMATRIX
*
pm
)
...
...
dlls/d3dx9_36/tests/math.c
View file @
4f1d5c26
...
...
@@ -17,7 +17,7 @@
*/
#include "wine/test.h"
#include "d3dx9
math
.h"
#include "d3dx9.h"
#define ARRAY_SIZE 5
...
...
@@ -25,6 +25,38 @@
#define relative_error(exp, out) ((exp == out) ? 0.0f : (fabs(out - exp) / fabs(exp)))
static
inline
BOOL
compare_matrix
(
const
D3DXMATRIX
*
m1
,
const
D3DXMATRIX
*
m2
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
j
=
0
;
j
<
4
;
++
j
)
{
if
(
fabs
(
U
(
*
m1
).
m
[
i
][
j
]
-
U
(
*
m2
).
m
[
i
][
j
])
>
admitted_error
)
return
FALSE
;
}
}
return
TRUE
;
}
#define expect_mat(expectedmat, gotmat) \
do { \
const D3DXMATRIX *__m1 = (expectedmat); \
const D3DXMATRIX *__m2 = (gotmat); \
ok(compare_matrix(__m1, __m2), "Expected matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n)\n\n" \
"Got matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f)\n", \
U(*__m1).m[0][0], U(*__m1).m[0][1], U(*__m1).m[0][2], U(*__m1).m[0][3], \
U(*__m1).m[1][0], U(*__m1).m[1][1], U(*__m1).m[1][2], U(*__m1).m[1][3], \
U(*__m1).m[2][0], U(*__m1).m[2][1], U(*__m1).m[2][2], U(*__m1).m[2][3], \
U(*__m1).m[3][0], U(*__m1).m[3][1], U(*__m1).m[3][2], U(*__m1).m[3][3], \
U(*__m2).m[0][0], U(*__m2).m[0][1], U(*__m2).m[0][2], U(*__m2).m[0][3], \
U(*__m2).m[1][0], U(*__m2).m[1][1], U(*__m2).m[1][2], U(*__m2).m[1][3], \
U(*__m2).m[2][0], U(*__m2).m[2][1], U(*__m2).m[2][2], U(*__m2).m[2][3], \
U(*__m2).m[3][0], U(*__m2).m[3][1], U(*__m2).m[3][2], U(*__m2).m[3][3]); \
} while(0)
#define compare_rotation(exp, got) \
ok(fabs(exp.w - got.w) < admitted_error && \
fabs(exp.x - got.x) < admitted_error && \
...
...
@@ -88,6 +120,131 @@
* says so too).
*/
static
void
test_Matrix_AffineTransformation2D
(
void
)
{
D3DXMATRIX
exp_mat
,
got_mat
;
D3DXVECTOR2
center
,
position
;
FLOAT
angle
,
scale
;
center
.
x
=
3
.
0
f
;
center
.
y
=
4
.
0
f
;
position
.
x
=
-
6
.
0
f
;
position
.
y
=
7
.
0
f
;
angle
=
D3DX_PI
/
3
.
0
f
;
scale
=
20
.
0
f
;
exp_mat
.
m
[
0
][
0
]
=
10
.
0
f
;
exp_mat
.
m
[
1
][
0
]
=
-
17
.
320507
f
;
exp_mat
.
m
[
2
][
0
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
0
]
=
-
1
.
035
898
f
;
exp_mat
.
m
[
0
][
1
]
=
17
.
320507
f
;
exp_mat
.
m
[
1
][
1
]
=
10
.
0
f
;
exp_mat
.
m
[
2
][
1
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
1
]
=
6
.
401924
f
;
exp_mat
.
m
[
0
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
2
]
=
20
.
0
f
;
exp_mat
.
m
[
3
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
0
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
3
]
=
1
.
0
f
;
D3DXMatrixAffineTransformation2D
(
&
got_mat
,
scale
,
&
center
,
angle
,
&
position
);
expect_mat
(
&
exp_mat
,
&
got_mat
);
/*______________*/
center
.
x
=
3
.
0
f
;
center
.
y
=
4
.
0
f
;
angle
=
D3DX_PI
/
3
.
0
f
;
scale
=
20
.
0
f
;
exp_mat
.
m
[
0
][
0
]
=
10
.
0
f
;
exp_mat
.
m
[
1
][
0
]
=
-
17
.
320507
f
;
exp_mat
.
m
[
2
][
0
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
0
]
=
4
.
964102
f
;
exp_mat
.
m
[
0
][
1
]
=
17
.
320507
f
;
exp_mat
.
m
[
1
][
1
]
=
10
.
0
f
;
exp_mat
.
m
[
2
][
1
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
1
]
=
-
0
.
598076
f
;
exp_mat
.
m
[
0
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
2
]
=
20
.
0
f
;
exp_mat
.
m
[
3
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
0
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
3
]
=
1
.
0
f
;
D3DXMatrixAffineTransformation2D
(
&
got_mat
,
scale
,
&
center
,
angle
,
NULL
);
expect_mat
(
&
exp_mat
,
&
got_mat
);
/*______________*/
position
.
x
=
-
6
.
0
f
;
position
.
y
=
7
.
0
f
;
angle
=
D3DX_PI
/
3
.
0
f
;
scale
=
20
.
0
f
;
exp_mat
.
m
[
0
][
0
]
=
10
.
0
f
;
exp_mat
.
m
[
1
][
0
]
=
-
17
.
320507
f
;
exp_mat
.
m
[
2
][
0
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
0
]
=
-
6
.
0
f
;
exp_mat
.
m
[
0
][
1
]
=
17
.
320507
f
;
exp_mat
.
m
[
1
][
1
]
=
10
.
0
f
;
exp_mat
.
m
[
2
][
1
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
1
]
=
7
.
0
f
;
exp_mat
.
m
[
0
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
2
]
=
20
.
0
f
;
exp_mat
.
m
[
3
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
0
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
3
]
=
1
.
0
f
;
D3DXMatrixAffineTransformation2D
(
&
got_mat
,
scale
,
NULL
,
angle
,
&
position
);
expect_mat
(
&
exp_mat
,
&
got_mat
);
/*______________*/
angle
=
5
.
0
f
*
D3DX_PI
/
4
.
0
f
;
scale
=
-
20
.
0
f
;
exp_mat
.
m
[
0
][
0
]
=
14
.
142133
f
;
exp_mat
.
m
[
1
][
0
]
=
-
14
.
142133
f
;
exp_mat
.
m
[
2
][
0
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
0
]
=
0
.
0
f
;
exp_mat
.
m
[
0
][
1
]
=
14
.
142133
;
exp_mat
.
m
[
1
][
1
]
=
14
.
142133
f
;
exp_mat
.
m
[
2
][
1
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
1
]
=
0
.
0
f
;
exp_mat
.
m
[
0
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
2
]
=
-
20
.
0
f
;
exp_mat
.
m
[
3
][
2
]
=
0
.
0
f
;
exp_mat
.
m
[
0
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
1
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
2
][
3
]
=
0
.
0
f
;
exp_mat
.
m
[
3
][
3
]
=
1
.
0
f
;
D3DXMatrixAffineTransformation2D
(
&
got_mat
,
scale
,
NULL
,
angle
,
NULL
);
expect_mat
(
&
exp_mat
,
&
got_mat
);
}
static
void
test_Matrix_Decompose
(
void
)
{
D3DXMATRIX
pm
;
...
...
@@ -566,6 +723,7 @@ static void test_D3DXVec_Array(void)
START_TEST
(
math
)
{
test_Matrix_AffineTransformation2D
();
test_Matrix_Decompose
();
test_D3DXVec_Array
();
}
include/d3dx9math.h
View file @
4f1d5c26
...
...
@@ -267,6 +267,7 @@ D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR *pc,
D3DXCOLOR
*
WINAPI
D3DXColorAdjustSaturation
(
D3DXCOLOR
*
pout
,
CONST
D3DXCOLOR
*
pc
,
FLOAT
s
);
D3DXMATRIX
*
WINAPI
D3DXMatrixAffineTransformation
(
D3DXMATRIX
*
pout
,
float
scaling
,
D3DXVECTOR3
*
rotationcenter
,
D3DXQUATERNION
*
rotation
,
D3DXVECTOR3
*
translation
);
D3DXMATRIX
*
WINAPI
D3DXMatrixAffineTransformation2D
(
D3DXMATRIX
*
pout
,
FLOAT
scaling
,
CONST
D3DXVECTOR2
*
protationcenter
,
FLOAT
rotation
,
CONST
D3DXVECTOR2
*
ptranslation
);
HRESULT
WINAPI
D3DXMatrixDecompose
(
D3DXVECTOR3
*
poutscale
,
D3DXQUATERNION
*
poutrotation
,
D3DXVECTOR3
*
pouttranslation
,
D3DXMATRIX
*
pm
);
FLOAT
WINAPI
D3DXMatrixDeterminant
(
CONST
D3DXMATRIX
*
pm
);
D3DXMATRIX
*
WINAPI
D3DXMatrixInverse
(
D3DXMATRIX
*
pout
,
FLOAT
*
pdeterminant
,
CONST
D3DXMATRIX
*
pm
);
...
...
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