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
bf9a690d
Commit
bf9a690d
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*LengthSq.
parent
d6377d2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
math.c
dlls/d3dx8/tests/math.c
+27
-0
d3dx8math.inl
include/d3dx8math.inl
+16
-2
No files found.
dlls/d3dx8/tests/math.c
View file @
bf9a690d
...
...
@@ -41,6 +41,15 @@ static void D3X8QuaternionTest(void)
expected
=
0
.
0
f
;
got
=
D3DXQuaternionLength
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXQuaternionLengthSq________________________*/
expected
=
121
.
0
f
;
got
=
D3DXQuaternionLengthSq
(
&
q
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/* Tests the case NULL */
expected
=
0
.
0
f
;
got
=
D3DXQuaternionLengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
}
static
void
D3X8Vector2Test
(
void
)
...
...
@@ -172,6 +181,15 @@ static void D3X8Vector3Test(void)
expected
=
0
.
0
f
;
got
=
D3DXVec3Length
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXVec3LengthSq________________________*/
expected
=
121
.
0
f
;
got
=
D3DXVec3LengthSq
(
&
u
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/* Tests the case NULL */
expected
=
0
.
0
f
;
got
=
D3DXVec3LengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
}
static
void
D3X8Vector4Test
(
void
)
...
...
@@ -189,6 +207,15 @@ static void D3X8Vector4Test(void)
expected
=
0
.
0
f
;
got
=
D3DXVec4Length
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXVec4LengthSq________________________*/
expected
=
121
.
0
f
;
got
=
D3DXVec4LengthSq
(
&
u
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/* Tests the case NULL */
expected
=
0
.
0
f
;
got
=
D3DXVec4LengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
}
START_TEST
(
math
)
...
...
include/d3dx8math.inl
View file @
bf9a690d
...
...
@@ -101,6 +101,12 @@ static inline FLOAT D3DXVec3Length(CONST D3DXVECTOR3 *pv)
return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) );
}
static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv)
{
if (!pv) return 0.0f;
return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z);
}
/*__________________D3DXVECTOR4_______________________*/
static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv)
...
...
@@ -109,6 +115,11 @@ static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv)
return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w) );
}
static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv)
{
if (!pv) return 0.0f;
return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w);
}
/*__________________D3DXQUATERNION____________________*/
...
...
@@ -118,7 +129,10 @@ static inline FLOAT D3DXQuaternionLength( CONST D3DXQUATERNION *pq)
return sqrt( (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w) );
}
static inline FLOAT D3DXQuaternionLengthSq( CONST D3DXQUATERNION *pq)
{
if (!pq) return 0.0f;
return (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w);
}
#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