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
d6377d2f
Commit
d6377d2f
authored
Oct 18, 2007
by
David Adam
Committed by
Alexandre Julliard
Oct 22, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement D3DX*Length with a test.
parent
8f3accc7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
0 deletions
+84
-0
math.c
dlls/d3dx8/tests/math.c
+54
-0
d3dx8math.inl
include/d3dx8math.inl
+30
-0
No files found.
dlls/d3dx8/tests/math.c
View file @
d6377d2f
...
@@ -26,6 +26,23 @@
...
@@ -26,6 +26,23 @@
#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_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);
static
void
D3X8QuaternionTest
(
void
)
{
D3DXQUATERNION
q
;
FLOAT
expected
,
got
;
q
.
x
=
1
.
0
f
,
q
.
y
=
2
.
0
f
;
q
.
z
=
4
.
0
f
;
q
.
w
=
10
.
0
f
;
/*_______________D3DXQuaternionLength__________________________*/
expected
=
11
.
0
f
;
got
=
D3DXQuaternionLength
(
&
q
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/* Tests the case NULL */
expected
=
0
.
0
f
;
got
=
D3DXQuaternionLength
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
}
static
void
D3X8Vector2Test
(
void
)
static
void
D3X8Vector2Test
(
void
)
{
{
D3DXVECTOR2
expectedvec
,
gotvec
,
u
,
v
;
D3DXVECTOR2
expectedvec
,
gotvec
,
u
,
v
;
...
@@ -140,7 +157,44 @@ static void D3X8Vector2Test(void)
...
@@ -140,7 +157,44 @@ static void D3X8Vector2Test(void)
}
}
static
void
D3X8Vector3Test
(
void
)
{
D3DXVECTOR3
u
;
FLOAT
expected
,
got
;
u
.
x
=
9
.
0
f
;
u
.
y
=
6
.
0
f
;
u
.
z
=
2
.
0
f
;
/*_______________D3DXVec3Length__________________________*/
expected
=
11
.
0
f
;
got
=
D3DXVec3Length
(
&
u
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/* Tests the case NULL */
expected
=
0
.
0
f
;
got
=
D3DXVec3Length
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
}
static
void
D3X8Vector4Test
(
void
)
{
D3DXVECTOR4
u
;
FLOAT
expected
,
got
;
u
.
x
=
1
.
0
f
;
u
.
y
=
2
.
0
f
;
u
.
z
=
4
.
0
f
;
u
.
w
=
10
.
0
;
/*_______________D3DXVec4Length__________________________*/
expected
=
11
.
0
f
;
got
=
D3DXVec4Length
(
&
u
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/* Tests the case NULL */
expected
=
0
.
0
f
;
got
=
D3DXVec4Length
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
}
START_TEST
(
math
)
START_TEST
(
math
)
{
{
D3X8QuaternionTest
();
D3X8Vector2Test
();
D3X8Vector2Test
();
D3X8Vector3Test
();
D3X8Vector4Test
();
}
}
include/d3dx8math.inl
View file @
d6377d2f
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
#ifndef __D3DX8MATH_INL__
#ifndef __D3DX8MATH_INL__
#define __D3DX8MATH_INL__
#define __D3DX8MATH_INL__
/*_______________D3DXVECTOR2________________________*/
static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
{
if ( !pout || !pv1 || !pv2) return NULL;
if ( !pout || !pv1 || !pv2) return NULL;
...
@@ -91,4 +93,32 @@ static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2
...
@@ -91,4 +93,32 @@ static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2
return pout;
return pout;
}
}
/*__________________D3DXVECTOR3_______________________*/
static inline FLOAT D3DXVec3Length(CONST D3DXVECTOR3 *pv)
{
if (!pv) return 0.0f;
return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) );
}
/*__________________D3DXVECTOR4_______________________*/
static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv)
{
if (!pv) return 0.0f;
return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w) );
}
/*__________________D3DXQUATERNION____________________*/
static inline FLOAT D3DXQuaternionLength( CONST D3DXQUATERNION *pq)
{
if (!pq) return 0.0f;
return sqrt( (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w) );
}
#endif
#endif
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