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
43643072
Commit
43643072
authored
Nov 11, 2007
by
David Adam
Committed by
Alexandre Julliard
Nov 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3XMatrixInverse.
parent
f6833c4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
2 deletions
+55
-2
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+1
-1
math.c
dlls/d3dx8/math.c
+39
-0
math.c
dlls/d3dx8/tests/math.c
+14
-1
d3dx8math.h
include/d3dx8math.h
+1
-0
No files found.
dlls/d3dx8/d3dx8.spec
View file @
43643072
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
@ stdcall D3DXMatrixfDeterminant(ptr)
@ stdcall D3DXMatrixfDeterminant(ptr)
@ stdcall D3DXMatrixMultiply(ptr ptr ptr)
@ stdcall D3DXMatrixMultiply(ptr ptr ptr)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ st
ub D3DXMatrixInverse
@ st
dcall D3DXMatrixInverse(ptr ptr ptr)
@ stdcall D3DXMatrixScaling(ptr long long long)
@ stdcall D3DXMatrixScaling(ptr long long long)
@ stdcall D3DXMatrixTranslation(ptr long long long)
@ stdcall D3DXMatrixTranslation(ptr long long long)
@ stdcall D3DXMatrixRotationX(ptr long)
@ stdcall D3DXMatrixRotationX(ptr long)
...
...
dlls/d3dx8/math.c
View file @
43643072
...
@@ -47,6 +47,45 @@ FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm)
...
@@ -47,6 +47,45 @@ FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm)
return
det
;
return
det
;
}
}
D3DXMATRIX
*
WINAPI
D3DXMatrixInverse
(
D3DXMATRIX
*
pout
,
FLOAT
*
pdeterminant
,
CONST
D3DXMATRIX
*
pm
)
{
int
a
,
i
,
j
;
D3DXVECTOR4
v
,
vec
[
3
];
FLOAT
cofactor
,
det
;
det
=
D3DXMatrixfDeterminant
(
pm
);
if
(
!
det
)
return
NULL
;
if
(
pdeterminant
)
*
pdeterminant
=
det
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
j
=
0
;
j
<
4
;
j
++
)
{
if
(
j
!=
i
)
{
a
=
j
;
if
(
j
>
i
)
a
=
a
-
1
;
vec
[
a
].
x
=
pm
->
u
.
m
[
j
][
0
];
vec
[
a
].
y
=
pm
->
u
.
m
[
j
][
1
];
vec
[
a
].
z
=
pm
->
u
.
m
[
j
][
2
];
vec
[
a
].
w
=
pm
->
u
.
m
[
j
][
3
];
}
}
D3DXVec4Cross
(
&
v
,
&
vec
[
0
],
&
vec
[
1
],
&
vec
[
2
]);
for
(
j
=
0
;
j
<
4
;
j
++
)
{
switch
(
j
)
{
case
0
:
cofactor
=
v
.
x
;
break
;
case
1
:
cofactor
=
v
.
y
;
break
;
case
2
:
cofactor
=
v
.
z
;
break
;
case
3
:
cofactor
=
v
.
w
;
break
;
}
pout
->
u
.
m
[
j
][
i
]
=
pow
(
-
1
.
0
f
,
i
)
*
cofactor
/
det
;
}
}
return
pout
;
}
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtLH
(
D3DXMATRIX
*
pout
,
CONST
D3DXVECTOR3
*
peye
,
CONST
D3DXVECTOR3
*
pat
,
CONST
D3DXVECTOR3
*
pup
)
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtLH
(
D3DXMATRIX
*
pout
,
CONST
D3DXVECTOR3
*
peye
,
CONST
D3DXVECTOR3
*
pat
,
CONST
D3DXVECTOR3
*
pup
)
{
{
D3DXVECTOR3
right
,
rightn
,
up
,
upn
,
vec
,
vec2
;
D3DXVECTOR3
right
,
rightn
,
up
,
upn
,
vec
,
vec2
;
...
...
dlls/d3dx8/tests/math.c
View file @
43643072
...
@@ -149,10 +149,11 @@ static void D3DXColorTest(void)
...
@@ -149,10 +149,11 @@ static void D3DXColorTest(void)
static
void
D3DXMatrixTest
(
void
)
static
void
D3DXMatrixTest
(
void
)
{
{
D3DXMATRIX
expectedmat
,
gotmat
,
mat
,
mat2
,
mat3
;
D3DXMATRIX
expectedmat
,
gotmat
,
mat
,
mat2
,
mat3
;
LPD3DXMATRIX
funcpointer
;
D3DXQUATERNION
q
;
D3DXQUATERNION
q
;
D3DXVECTOR3
at
,
axis
,
eye
;
D3DXVECTOR3
at
,
axis
,
eye
;
BOOL
expected
,
got
;
BOOL
expected
,
got
;
FLOAT
angle
,
expectedfloat
,
gotfloat
;
FLOAT
angle
,
determinant
,
expectedfloat
,
gotfloat
;
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
[
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
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
...
@@ -181,6 +182,18 @@ static void D3DXMatrixTest(void)
...
@@ -181,6 +182,18 @@ static void D3DXMatrixTest(void)
gotfloat
=
D3DXMatrixfDeterminant
(
&
mat
);
gotfloat
=
D3DXMatrixfDeterminant
(
&
mat
);
ok
(
fabs
(
gotfloat
-
expectedfloat
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expectedfloat
,
gotfloat
);
ok
(
fabs
(
gotfloat
-
expectedfloat
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expectedfloat
,
gotfloat
);
/*____________D3DXMatrixInverse______________*/
expectedmat
.
m
[
0
][
0
]
=
16067
.
0
f
/
73944
.
0
f
;
expectedmat
.
m
[
0
][
1
]
=
-
10165
.
0
f
/
147888
.
0
f
;
expectedmat
.
m
[
0
][
2
]
=
-
2729
.
0
f
/
147888
.
0
f
;
expectedmat
.
m
[
0
][
3
]
=
-
1631
.
0
f
/
49296
.
0
f
;
expectedmat
.
m
[
1
][
0
]
=
-
565
.
0
f
/
36972
.
0
f
;
expectedmat
.
m
[
1
][
1
]
=
2723
.
0
f
/
73944
.
0
f
;
expectedmat
.
m
[
1
][
2
]
=
-
1073
.
0
f
/
73944
.
0
f
;
expectedmat
.
m
[
1
][
3
]
=
289
.
0
f
/
24648
.
0
f
;
expectedmat
.
m
[
2
][
0
]
=
-
389
.
0
f
/
2054
.
0
f
;
expectedmat
.
m
[
2
][
1
]
=
337
.
0
f
/
4108
.
0
f
;
expectedmat
.
m
[
2
][
2
]
=
181
.
0
f
/
4108
.
0
f
;
expectedmat
.
m
[
2
][
3
]
=
317
.
0
f
/
4108
.
0
f
;
expectedmat
.
m
[
3
][
0
]
=
163
.
0
f
/
5688
.
0
f
;
expectedmat
.
m
[
3
][
1
]
=
-
101
.
0
f
/
11376
.
0
f
;
expectedmat
.
m
[
3
][
2
]
=
-
73
.
0
f
/
11376
.
0
f
;
expectedmat
.
m
[
3
][
3
]
=
-
127
.
0
f
/
3792
.
0
f
;
expectedfloat
=
-
147888
.
0
f
;
D3DXMatrixInverse
(
&
gotmat
,
&
determinant
,
&
mat
);
expect_mat
(
expectedmat
,
gotmat
);
ok
(
fabs
(
determinant
-
expectedfloat
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expectedfloat
,
determinant
);
funcpointer
=
D3DXMatrixInverse
(
&
gotmat
,
NULL
,
&
mat2
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*____________D3DXMatrixIsIdentity______________*/
/*____________D3DXMatrixIsIdentity______________*/
expected
=
FALSE
;
expected
=
FALSE
;
got
=
D3DXMatrixIsIdentity
(
&
mat3
);
got
=
D3DXMatrixIsIdentity
(
&
mat3
);
...
...
include/d3dx8math.h
View file @
43643072
...
@@ -260,6 +260,7 @@ typedef struct D3DXCOLOR
...
@@ -260,6 +260,7 @@ typedef struct D3DXCOLOR
}
D3DXCOLOR
,
*
LPD3DXCOLOR
;
}
D3DXCOLOR
,
*
LPD3DXCOLOR
;
FLOAT
WINAPI
D3DXMatrixfDeterminant
(
CONST
D3DXMATRIX
*
pm
);
FLOAT
WINAPI
D3DXMatrixfDeterminant
(
CONST
D3DXMATRIX
*
pm
);
D3DXMATRIX
*
WINAPI
D3DXMatrixInverse
(
D3DXMATRIX
*
pout
,
FLOAT
*
pdeterminant
,
CONST
D3DXMATRIX
*
pm
);
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtLH
(
D3DXMATRIX
*
pout
,
CONST
D3DXVECTOR3
*
peye
,
CONST
D3DXVECTOR3
*
pat
,
CONST
D3DXVECTOR3
*
pup
);
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtLH
(
D3DXMATRIX
*
pout
,
CONST
D3DXVECTOR3
*
peye
,
CONST
D3DXVECTOR3
*
pat
,
CONST
D3DXVECTOR3
*
pup
);
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtRH
(
D3DXMATRIX
*
pout
,
CONST
D3DXVECTOR3
*
peye
,
CONST
D3DXVECTOR3
*
pat
,
CONST
D3DXVECTOR3
*
pup
);
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtRH
(
D3DXMATRIX
*
pout
,
CONST
D3DXVECTOR3
*
peye
,
CONST
D3DXVECTOR3
*
pat
,
CONST
D3DXVECTOR3
*
pup
);
D3DXMATRIX
*
WINAPI
D3DXMatrixMultiply
(
D3DXMATRIX
*
pout
,
CONST
D3DXMATRIX
*
pm1
,
CONST
D3DXMATRIX
*
pm2
);
D3DXMATRIX
*
WINAPI
D3DXMatrixMultiply
(
D3DXMATRIX
*
pout
,
CONST
D3DXMATRIX
*
pm1
,
CONST
D3DXMATRIX
*
pm2
);
...
...
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