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
c392a8bc
Commit
c392a8bc
authored
Oct 30, 2007
by
David Adam
Committed by
Alexandre Julliard
Oct 31, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DXMatrixMultiply.
parent
720fb79d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
7 deletions
+62
-7
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
math.c
dlls/d3dx8/math.c
+14
-0
math.c
dlls/d3dx8/tests/math.c
+46
-6
d3dx8math.h
include/d3dx8math.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
c392a8bc
...
...
@@ -21,7 +21,7 @@
@ stdcall D3DXVec4BaryCentric(ptr ptr ptr ptr long long)
@ stdcall D3DXVec4Transform(ptr ptr ptr)
@ stdcall D3DXMatrixfDeterminant(ptr)
@ st
ub D3DXMatrixMultiply
@ st
dcall D3DXMatrixMultiply(ptr ptr ptr)
@ stub D3DXMatrixTranspose
@ stub D3DXMatrixInverse
@ stub D3DXMatrixScaling
...
...
dlls/d3dx8/math.c
View file @
c392a8bc
...
...
@@ -44,6 +44,20 @@ FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm)
return
det
;
}
D3DXMATRIX
*
WINAPI
D3DXMatrixMultiply
(
D3DXMATRIX
*
pout
,
CONST
D3DXMATRIX
*
pm1
,
CONST
D3DXMATRIX
*
pm2
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
j
=
0
;
j
<
4
;
j
++
)
{
pout
->
m
[
i
][
j
]
=
pm1
->
m
[
i
][
0
]
*
pm2
->
m
[
0
][
j
]
+
pm1
->
m
[
i
][
1
]
*
pm2
->
m
[
1
][
j
]
+
pm1
->
m
[
i
][
2
]
*
pm2
->
m
[
2
][
j
]
+
pm1
->
m
[
i
][
3
]
*
pm2
->
m
[
3
][
j
];
}
}
return
pout
;
}
/*_________________D3DXQUATERNION________________*/
D3DXQUATERNION
*
WINAPI
D3DXQuaternionNormalize
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
)
...
...
dlls/d3dx8/tests/math.c
View file @
c392a8bc
...
...
@@ -25,6 +25,31 @@
#define expect_color(expectedcolor,gotcolor) ok((fabs(expectedcolor.r-gotcolor.r)<admitted_error)&&(fabs(expectedcolor.g-gotcolor.g)<admitted_error)&&(fabs(expectedcolor.b-gotcolor.b)<admitted_error)&&(fabs(expectedcolor.a-gotcolor.a)<admitted_error),"Expected Color= (%f, %f, %f, %f)\n , Got Color= (%f, %f, %f, %f)\n", expectedcolor.r, expectedcolor.g, expectedcolor.b, expectedcolor.a, gotcolor.r, gotcolor.g, gotcolor.b, gotcolor.a);
#define expect_mat(expectedmat,gotmat)\
{ \
int i,j,equal=1; \
for (i=0; i<4; i++)\
{\
for (j=0; j<4; j++)\
{\
if (fabs(expectedmat.m[i][j]-gotmat.m[i][j])>admitted_error)\
{\
equal=0;\
}\
}\
}\
ok(equal, "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", \
expectedmat.m[0][0],expectedmat.m[0][1],expectedmat.m[0][2],expectedmat.m[0][3], \
expectedmat.m[1][0],expectedmat.m[1][1],expectedmat.m[1][2],expectedmat.m[1][3], \
expectedmat.m[2][0],expectedmat.m[2][1],expectedmat.m[2][2],expectedmat.m[2][3], \
expectedmat.m[3][0],expectedmat.m[3][1],expectedmat.m[3][2],expectedmat.m[3][3], \
gotmat.m[0][0],gotmat.m[0][1],gotmat.m[0][2],gotmat.m[0][3], \
gotmat.m[1][0],gotmat.m[1][1],gotmat.m[1][2],gotmat.m[1][3], \
gotmat.m[2][0],gotmat.m[2][1],gotmat.m[2][2],gotmat.m[2][3], \
gotmat.m[3][0],gotmat.m[3][1],gotmat.m[3][2],gotmat.m[3][3]); \
}
#define expect_vec(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error),"Expected Vector= (%f, %f)\n , Got Vector= (%f, %f)\n", expectedvec.x, expectedvec.y, gotvec.x, gotvec.y);
#define expect_vec3(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error)&&(fabs(expectedvec.z-gotvec.z)<admitted_error),"Expected Vector= (%f, %f, %f)\n , Got Vector= (%f, %f, %f)\n", expectedvec.x, expectedvec.y, expectedvec.z, gotvec.x, gotvec.y, gotvec.z);
...
...
@@ -123,7 +148,7 @@ static void D3DXColorTest(void)
static
void
D3DXMatrixTest
(
void
)
{
D3DXMATRIX
mat
;
D3DXMATRIX
expectedmat
,
gotmat
,
mat
,
mat2
,
mat3
;
BOOL
expected
,
got
;
FLOAT
expectedfloat
,
gotfloat
;
...
...
@@ -134,6 +159,13 @@ static void D3DXMatrixTest(void)
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
]
=
-
40
.
0
f
;
mat2
.
m
[
0
][
0
]
=
1
.
0
f
;
mat2
.
m
[
1
][
0
]
=
2
.
0
f
;
mat2
.
m
[
2
][
0
]
=
3
.
0
f
;
mat2
.
m
[
3
][
0
]
=
4
.
0
f
;
mat2
.
m
[
0
][
1
]
=
5
.
0
f
;
mat2
.
m
[
1
][
1
]
=
6
.
0
f
;
mat2
.
m
[
2
][
1
]
=
7
.
0
f
;
mat2
.
m
[
3
][
1
]
=
8
.
0
f
;
mat2
.
m
[
0
][
2
]
=
-
8
.
0
f
;
mat2
.
m
[
1
][
2
]
=
-
7
.
0
f
;
mat2
.
m
[
2
][
2
]
=
-
6
.
0
f
;
mat2
.
m
[
3
][
2
]
=
-
5
.
0
f
;
mat2
.
m
[
0
][
3
]
=
-
4
.
0
f
;
mat2
.
m
[
1
][
3
]
=
-
3
.
0
f
;
mat2
.
m
[
2
][
3
]
=
-
2
.
0
f
;
mat2
.
m
[
3
][
3
]
=
-
1
.
0
f
;
/*____________D3DXMatrixfDeterminant_____________*/
expectedfloat
=
-
147888
.
0
f
;
gotfloat
=
D3DXMatrixfDeterminant
(
&
mat
);
...
...
@@ -141,20 +173,28 @@ static void D3DXMatrixTest(void)
/*____________D3DXMatrixIsIdentity______________*/
expected
=
FALSE
;
got
=
D3DXMatrixIsIdentity
(
&
mat
);
got
=
D3DXMatrixIsIdentity
(
&
mat
3
);
ok
(
expected
==
got
,
"Expected : %d, Got : %d
\n
"
,
expected
,
got
);
D3DXMatrixIdentity
(
&
mat
);
D3DXMatrixIdentity
(
&
mat
3
);
expected
=
TRUE
;
got
=
D3DXMatrixIsIdentity
(
&
mat
);
got
=
D3DXMatrixIsIdentity
(
&
mat
3
);
ok
(
expected
==
got
,
"Expected : %d, Got : %d
\n
"
,
expected
,
got
);
U
(
mat
).
m
[
0
][
0
]
=
0
.
00000
9
f
;
U
(
mat
3
).
m
[
0
][
0
]
=
0
.
00000
9
f
;
expected
=
FALSE
;
got
=
D3DXMatrixIsIdentity
(
&
mat
);
got
=
D3DXMatrixIsIdentity
(
&
mat
3
);
ok
(
expected
==
got
,
"Expected : %d, Got : %d
\n
"
,
expected
,
got
);
/* Test the NULL case */
expected
=
FALSE
;
got
=
D3DXMatrixIsIdentity
(
NULL
);
ok
(
expected
==
got
,
"Expected : %d, Got : %d
\n
"
,
expected
,
got
);
/*____________D3DXMatrixMultiply______________*/
expectedmat
.
m
[
0
][
0
]
=
73
.
0
f
;
expectedmat
.
m
[
0
][
1
]
=
193
.
0
f
;
expectedmat
.
m
[
0
][
2
]
=
-
197
.
0
f
;
expectedmat
.
m
[
0
][
3
]
=
-
77
.
0
f
;
expectedmat
.
m
[
1
][
0
]
=
231
.
0
f
;
expectedmat
.
m
[
1
][
1
]
=
551
.
0
f
;
expectedmat
.
m
[
1
][
2
]
=
-
489
.
0
f
;
expectedmat
.
m
[
1
][
3
]
=
-
169
.
0
;
expectedmat
.
m
[
2
][
0
]
=
239
.
0
f
;
expectedmat
.
m
[
2
][
1
]
=
523
.
0
f
;
expectedmat
.
m
[
2
][
2
]
=
-
400
.
0
f
;
expectedmat
.
m
[
2
][
3
]
=
-
116
.
0
f
;
expectedmat
.
m
[
3
][
0
]
=
-
164
.
0
f
;
expectedmat
.
m
[
3
][
1
]
=
-
320
.
0
f
;
expectedmat
.
m
[
3
][
2
]
=
187
.
0
f
;
expectedmat
.
m
[
3
][
3
]
=
31
.
0
f
;
D3DXMatrixMultiply
(
&
gotmat
,
&
mat
,
&
mat2
);
expect_mat
(
expectedmat
,
gotmat
);
}
static
void
D3DXPlaneTest
(
void
)
...
...
include/d3dx8math.h
View file @
c392a8bc
...
...
@@ -59,6 +59,7 @@ typedef struct D3DXCOLOR
}
D3DXCOLOR
,
*
LPD3DXCOLOR
;
FLOAT
WINAPI
D3DXMatrixfDeterminant
(
CONST
D3DXMATRIX
*
pm
);
D3DXMATRIX
*
WINAPI
D3DXMatrixMultiply
(
D3DXMATRIX
*
pout
,
CONST
D3DXMATRIX
*
pm1
,
CONST
D3DXMATRIX
*
pm2
);
D3DXQUATERNION
*
WINAPI
D3DXQuaternionNormalize
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
);
...
...
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