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
50ae1e36
Commit
50ae1e36
authored
Oct 26, 2007
by
David Adam
Committed by
Alexandre Julliard
Oct 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DX*Normalize.
parent
9a04b754
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
184 additions
and
19 deletions
+184
-19
Makefile.in
dlls/d3dx8/Makefile.in
+2
-1
d3dx8.spec
dlls/d3dx8/d3dx8.spec
+4
-4
math.c
dlls/d3dx8/math.c
+119
-0
Makefile.in
dlls/d3dx8/tests/Makefile.in
+1
-1
math.c
dlls/d3dx8/tests/math.c
+50
-13
d3dx8math.h
include/d3dx8math.h
+8
-0
No files found.
dlls/d3dx8/Makefile.in
View file @
50ae1e36
...
...
@@ -9,7 +9,8 @@ EXTRALIBS = -ldxguid -luuid
C_SRCS
=
\
d3dx8_main.c
\
d3dxbuffer.c
d3dxbuffer.c
\
math.c
@MAKE_DLL_RULES@
...
...
dlls/d3dx8/d3dx8.spec
View file @
50ae1e36
@ st
ub D3DXVec2Normalize
@ st
dcall D3DXVec2Normalize(ptr ptr)
@ stub D3DXVec2Hermite
@ stub D3DXVec2CatmullRom
@ stub D3DXVec2BaryCentric
@ stub D3DXVec2Transform
@ stub D3DXVec2TransformCoord
@ stub D3DXVec2TransformNormal
@ st
ub D3DXVec3Normalize
@ st
dcall D3DXVec3Normalize(ptr ptr)
@ stub D3DXVec3Hermite
@ stub D3DXVec3CatmullRom
@ stub D3DXVec3BaryCentric
...
...
@@ -15,7 +15,7 @@
@ stub D3DXVec3Project
@ stub D3DXVec3Unproject
@ stub D3DXVec4Cross
@ st
ub D3DXVec4Normalize
@ st
dcall D3DXVec4Normalize(ptr ptr)
@ stub D3DXVec4Hermite
@ stub D3DXVec4CatmullRom
@ stub D3DXVec4BaryCentric
...
...
@@ -53,7 +53,7 @@
@ stub D3DXQuaternionRotationAxis
@ stub D3DXQuaternionRotationYawPitchRoll
@ stub D3DXQuaternionMultiply
@ st
ub D3DXQuaternionNormalize
@ st
dcall D3DXQuaternionNormalize(ptr ptr)
@ stub D3DXQuaternionInverse
@ stub D3DXQuaternionLn
@ stub D3DXQuaternionExp
...
...
dlls/d3dx8/math.c
0 → 100644
View file @
50ae1e36
/*
* Copyright 2007 David Adam
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "d3dx8.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx8
);
/*_________________D3DXQUATERNION________________*/
D3DXQUATERNION
*
WINAPI
D3DXQuaternionNormalize
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
)
{
FLOAT
norm
;
norm
=
D3DXQuaternionLength
(
pq
);
if
(
!
norm
)
{
pout
->
x
=
0
.
0
f
;
pout
->
y
=
0
.
0
f
;
pout
->
z
=
0
.
0
f
;
pout
->
w
=
0
.
0
f
;
}
else
{
pout
->
x
=
pq
->
x
/
norm
;
pout
->
y
=
pq
->
y
/
norm
;
pout
->
z
=
pq
->
z
/
norm
;
pout
->
w
=
pq
->
w
/
norm
;
}
return
pout
;
}
/*_________________D3DXVec2_____________________*/
D3DXVECTOR2
*
WINAPI
D3DXVec2Normalize
(
D3DXVECTOR2
*
pout
,
CONST
D3DXVECTOR2
*
pv
)
{
FLOAT
norm
;
norm
=
D3DXVec2Length
(
pv
);
if
(
!
norm
)
{
pout
->
x
=
0
.
0
f
;
pout
->
y
=
0
.
0
f
;
}
else
{
pout
->
x
=
pv
->
x
/
norm
;
pout
->
y
=
pv
->
y
/
norm
;
}
return
pout
;
}
/*_________________D3DXVec3_____________________*/
D3DXVECTOR3
*
WINAPI
D3DXVec3Normalize
(
D3DXVECTOR3
*
pout
,
CONST
D3DXVECTOR3
*
pv
)
{
FLOAT
norm
;
norm
=
D3DXVec3Length
(
pv
);
if
(
!
norm
)
{
pout
->
x
=
0
.
0
f
;
pout
->
y
=
0
.
0
f
;
pout
->
z
=
0
.
0
f
;
}
else
{
pout
->
x
=
pv
->
x
/
norm
;
pout
->
y
=
pv
->
y
/
norm
;
pout
->
z
=
pv
->
z
/
norm
;
}
return
pout
;
}
/*_________________D3DXVec4_____________________*/
D3DXVECTOR4
*
WINAPI
D3DXVec4Normalize
(
D3DXVECTOR4
*
pout
,
CONST
D3DXVECTOR4
*
pv
)
{
FLOAT
norm
;
norm
=
D3DXVec4Length
(
pv
);
if
(
!
norm
)
{
pout
->
x
=
0
.
0
f
;
pout
->
y
=
0
.
0
f
;
pout
->
z
=
0
.
0
f
;
pout
->
w
=
0
.
0
f
;
}
else
{
pout
->
x
=
pv
->
x
/
norm
;
pout
->
y
=
pv
->
y
/
norm
;
pout
->
z
=
pv
->
z
/
norm
;
pout
->
w
=
pv
->
w
/
norm
;
}
return
pout
;
}
dlls/d3dx8/tests/Makefile.in
View file @
50ae1e36
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
d3dx8.dll
IMPORTS
=
kernel32
IMPORTS
=
d3dx8
kernel32
EXTRALIBS
=
-ldxguid
CTESTS
=
math.c
...
...
dlls/d3dx8/tests/math.c
View file @
50ae1e36
...
...
@@ -17,8 +17,7 @@
*/
#include <assert.h>
#include "d3dx8math.h"
#include "d3dx8math.inl"
#include "d3dx8.h"
#include "wine/test.h"
...
...
@@ -147,8 +146,6 @@ static void D3DXMatrixTest(void)
ok
(
expected
==
got
,
"Expected : %d, Got : %d
\n
"
,
expected
,
got
);
}
static
void
D3DXPlaneTest
(
void
)
{
D3DXPLANE
plane
;
...
...
@@ -194,11 +191,12 @@ static void D3DXPlaneTest(void)
static
void
D3X8QuaternionTest
(
void
)
{
D3DXQUATERNION
expectedquat
,
gotquat
,
q
,
r
,
s
;
D3DXQUATERNION
expectedquat
,
gotquat
,
nul
,
q
,
r
,
s
;
LPD3DXQUATERNION
funcpointer
;
FLOAT
expected
,
got
;
BOOL
expectedbool
,
gotbool
;
nul
.
x
=
0
.
0
f
;
nul
.
y
=
0
.
0
f
;
nul
.
z
=
0
.
0
f
;
nul
.
w
=
0
.
0
f
;
q
.
x
=
1
.
0
f
,
q
.
y
=
2
.
0
f
;
q
.
z
=
4
.
0
f
;
q
.
w
=
10
.
0
f
;
r
.
x
=
-
3
.
0
f
;
r
.
y
=
4
.
0
f
;
r
.
z
=
-
5
.
0
f
;
r
.
w
=
7
.
0
;
...
...
@@ -262,14 +260,24 @@ static void D3X8QuaternionTest(void)
expected
=
0
.
0
f
;
got
=
D3DXQuaternionLengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXQuaternionNormalize________________________*/
expectedquat
.
x
=
1
.
0
f
/
11
.
0
f
;
expectedquat
.
y
=
2
.
0
f
/
11
.
0
f
;
expectedquat
.
z
=
4
.
0
f
/
11
.
0
f
;
expectedquat
.
w
=
10
.
0
f
/
11
.
0
f
;
D3DXQuaternionNormalize
(
&
gotquat
,
&
q
);
expect_vec4
(
expectedquat
,
gotquat
);
/* Test the nul quaternion */
expectedquat
.
x
=
0
.
0
f
;
expectedquat
.
y
=
0
.
0
f
;
expectedquat
.
z
=
0
.
0
f
;
expectedquat
.
w
=
0
.
0
f
;
D3DXQuaternionNormalize
(
&
gotquat
,
&
nul
);
expect_vec4
(
expectedquat
,
gotquat
);
}
static
void
D3X8Vector2Test
(
void
)
{
D3DXVECTOR2
expectedvec
,
gotvec
,
u
,
v
;
D3DXVECTOR2
expectedvec
,
gotvec
,
nul
,
u
,
v
;
LPD3DXVECTOR2
funcpointer
;
FLOAT
expected
,
got
,
scale
;
nul
.
x
=
0
.
0
f
;
nul
.
y
=
0
.
0
f
;
u
.
x
=
3
.
0
f
;
u
.
y
=
4
.
0
f
;
v
.
x
=-
7
.
0
f
;
v
.
y
=
9
.
0
f
;
scale
=
-
6
.
5
f
;
...
...
@@ -347,15 +355,24 @@ static void D3X8Vector2Test(void)
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*_______________D3DXVec2Minimize__________________________*/
expectedvec
.
x
=
-
7
.
0
f
;
expectedvec
.
y
=
4
.
0
f
;
D3DXVec2Minimize
(
&
gotvec
,
&
u
,
&
v
);
expect_vec
(
expectedvec
,
gotvec
);
/* Tests the case NULL */
expectedvec
.
x
=
-
7
.
0
f
;
expectedvec
.
y
=
4
.
0
f
;
D3DXVec2Minimize
(
&
gotvec
,
&
u
,
&
v
);
expect_vec
(
expectedvec
,
gotvec
);
/* Tests the case NULL */
funcpointer
=
D3DXVec2Minimize
(
&
gotvec
,
NULL
,
&
v
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
funcpointer
=
D3DXVec2Minimize
(
NULL
,
NULL
,
NULL
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*_______________D3DXVec2Normalize_________________________*/
expectedvec
.
x
=
0
.
6
f
;
expectedvec
.
y
=
0
.
8
f
;
D3DXVec2Normalize
(
&
gotvec
,
&
u
);
expect_vec
(
expectedvec
,
gotvec
);
/* Test the nul vector */
expectedvec
.
x
=
0
.
0
f
;
expectedvec
.
y
=
0
.
0
f
;
D3DXVec2Normalize
(
&
gotvec
,
&
nul
);
expect_vec
(
expectedvec
,
gotvec
);
/*_______________D3DXVec2Scale____________________________*/
expectedvec
.
x
=
-
19
.
5
f
;
expectedvec
.
y
=
-
26
.
0
f
;
D3DXVec2Scale
(
&
gotvec
,
&
u
,
scale
);
...
...
@@ -380,10 +397,11 @@ static void D3X8Vector2Test(void)
static
void
D3X8Vector3Test
(
void
)
{
D3DXVECTOR3
expectedvec
,
gotvec
,
u
,
v
;
D3DXVECTOR3
expectedvec
,
gotvec
,
nul
,
u
,
v
;
LPD3DXVECTOR3
funcpointer
;
FLOAT
expected
,
got
,
scale
;
nul
.
x
=
0
.
0
f
;
nul
.
y
=
0
.
0
f
;
nul
.
z
=
0
.
0
f
;
u
.
x
=
9
.
0
f
;
u
.
y
=
6
.
0
f
;
u
.
z
=
2
.
0
f
;
v
.
x
=
2
.
0
f
;
v
.
y
=
-
3
.
0
f
;
v
.
z
=
-
4
.
0
;
scale
=
-
6
.
5
f
;
...
...
@@ -467,6 +485,15 @@ static void D3X8Vector3Test(void)
funcpointer
=
D3DXVec3Minimize
(
NULL
,
NULL
,
NULL
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*_______________D3DXVec3Normalize_________________________*/
expectedvec
.
x
=
9
.
0
f
/
11
.
0
f
;
expectedvec
.
y
=
6
.
0
f
/
11
.
0
f
;
expectedvec
.
z
=
2
.
0
f
/
11
.
0
f
;
D3DXVec3Normalize
(
&
gotvec
,
&
u
);
expect_vec3
(
expectedvec
,
gotvec
);
/* Test the nul vector */
expectedvec
.
x
=
0
.
0
f
;
expectedvec
.
y
=
0
.
0
f
;
expectedvec
.
z
=
0
.
0
f
;
D3DXVec3Normalize
(
&
gotvec
,
&
nul
);
expect_vec3
(
expectedvec
,
gotvec
);
/*_______________D3DXVec3Scale____________________________*/
expectedvec
.
x
=
-
58
.
5
f
;
expectedvec
.
y
=
-
39
.
0
f
;
expectedvec
.
z
=
-
13
.
0
f
;
D3DXVec3Scale
(
&
gotvec
,
&
u
,
scale
);
...
...
@@ -491,13 +518,14 @@ static void D3X8Vector3Test(void)
static
void
D3X8Vector4Test
(
void
)
{
D3DXVECTOR4
expectedvec
,
gotvec
,
u
,
v
;
D3DXVECTOR4
expectedvec
,
gotvec
,
nul
,
u
,
v
;
LPD3DXVECTOR4
funcpointer
;
FLOAT
expected
,
got
,
scale
;
scale
=
-
6
.
5
f
;
nul
.
x
=
0
.
0
f
;
nul
.
y
=
0
.
0
f
;
nul
.
z
=
0
.
0
f
;
nul
.
w
=
0
.
0
f
;
u
.
x
=
1
.
0
f
;
u
.
y
=
2
.
0
f
;
u
.
z
=
4
.
0
f
;
u
.
w
=
10
.
0
;
v
.
x
=
-
3
.
0
f
;
v
.
y
=
4
.
0
f
;
v
.
z
=
-
5
.
0
f
;
v
.
w
=
7
.
0
;
scale
=
-
6
.
5
f
;
/*_______________D3DXVec4Add__________________________*/
expectedvec
.
x
=
-
2
.
0
f
;
expectedvec
.
y
=
6
.
0
f
;
expectedvec
.
z
=
-
1
.
0
f
;
expectedvec
.
w
=
17
.
0
f
;
...
...
@@ -569,6 +597,15 @@ static void D3X8Vector4Test(void)
funcpointer
=
D3DXVec4Minimize
(
NULL
,
NULL
,
NULL
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*_______________D3DXVec4Normalize_________________________*/
expectedvec
.
x
=
1
.
0
f
/
11
.
0
f
;
expectedvec
.
y
=
2
.
0
f
/
11
.
0
f
;
expectedvec
.
z
=
4
.
0
f
/
11
.
0
f
;
expectedvec
.
w
=
10
.
0
f
/
11
.
0
f
;
D3DXVec4Normalize
(
&
gotvec
,
&
u
);
expect_vec4
(
expectedvec
,
gotvec
);
/* Test the nul vector */
expectedvec
.
x
=
0
.
0
f
;
expectedvec
.
y
=
0
.
0
f
;
expectedvec
.
z
=
0
.
0
f
;
expectedvec
.
w
=
0
.
0
f
;
D3DXVec4Normalize
(
&
gotvec
,
&
nul
);
expect_vec4
(
expectedvec
,
gotvec
);
/*_______________D3DXVec4Scale____________________________*/
expectedvec
.
x
=
-
6
.
5
f
;
expectedvec
.
y
=
-
13
.
0
f
;
expectedvec
.
z
=
-
26
.
0
f
;
expectedvec
.
w
=
-
65
.
0
f
;
D3DXVec4Scale
(
&
gotvec
,
&
u
,
scale
);
...
...
include/d3dx8math.h
View file @
50ae1e36
...
...
@@ -58,6 +58,14 @@ typedef struct D3DXCOLOR
FLOAT
r
,
g
,
b
,
a
;
}
D3DXCOLOR
,
*
LPD3DXCOLOR
;
D3DXQUATERNION
*
WINAPI
D3DXQuaternionNormalize
(
D3DXQUATERNION
*
pout
,
CONST
D3DXQUATERNION
*
pq
);
D3DXVECTOR2
*
WINAPI
D3DXVec2Normalize
(
D3DXVECTOR2
*
pout
,
CONST
D3DXVECTOR2
*
pv
);
D3DXVECTOR3
*
WINAPI
D3DXVec3Normalize
(
D3DXVECTOR3
*
pout
,
CONST
D3DXVECTOR3
*
pv
);
D3DXVECTOR4
*
WINAPI
D3DXVec4Normalize
(
D3DXVECTOR4
*
pout
,
CONST
D3DXVECTOR4
*
pv
);
#include <d3dx8math.inl>
#endif
/* __D3DX8MATH_H__ */
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