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
ab4e8297
Commit
ab4e8297
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*Lerp.
parent
4ef92a23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
+46
-4
math.c
dlls/d3dx8/tests/math.c
+26
-4
d3dx8math.inl
include/d3dx8math.inl
+20
-0
No files found.
dlls/d3dx8/tests/math.c
View file @
ab4e8297
...
...
@@ -187,10 +187,11 @@ static void D3X8Vector3Test(void)
{
D3DXVECTOR3
expectedvec
,
gotvec
,
u
,
v
;
LPD3DXVECTOR3
funcpointer
;
FLOAT
expected
,
got
;
FLOAT
expected
,
got
,
scale
;
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
;
/*_______________D3DXVec3Add__________________________*/
expectedvec
.
x
=
11
.
0
f
;
expectedvec
.
y
=
3
.
0
f
;
expectedvec
.
z
=
-
2
.
0
f
;
...
...
@@ -232,6 +233,16 @@ static void D3X8Vector3Test(void)
got
=
D3DXVec3LengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXVec3Lerp__________________________*/
expectedvec
.
x
=
54
.
5
f
;
expectedvec
.
y
=
64
.
5
f
,
expectedvec
.
z
=
41
.
0
f
;
D3DXVec3Lerp
(
&
gotvec
,
&
u
,
&
v
,
scale
);
expect_vec3
(
expectedvec
,
gotvec
);
/* Tests the case NULL */
funcpointer
=
D3DXVec3Lerp
(
&
gotvec
,
NULL
,
&
v
,
scale
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
funcpointer
=
D3DXVec3Lerp
(
NULL
,
NULL
,
NULL
,
scale
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*_______________D3DXVec3Subtract_______________________*/
expectedvec
.
x
=
7
.
0
f
;
expectedvec
.
y
=
9
.
0
f
;
expectedvec
.
z
=
6
.
0
f
;
D3DXVec3Subtract
(
&
gotvec
,
&
u
,
&
v
);
...
...
@@ -248,12 +259,13 @@ static void D3X8Vector4Test(void)
{
D3DXVECTOR4
expectedvec
,
gotvec
,
u
,
v
;
LPD3DXVECTOR4
funcpointer
;
FLOAT
expected
,
got
;
FLOAT
expected
,
got
,
scale
;
scale
=
-
6
.
5
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
;
/*_______________D3DXVec
3
Add__________________________*/
/*_______________D3DXVec
4
Add__________________________*/
expectedvec
.
x
=
-
2
.
0
f
;
expectedvec
.
y
=
6
.
0
f
;
expectedvec
.
z
=
-
1
.
0
f
;
expectedvec
.
w
=
17
.
0
f
;
D3DXVec4Add
(
&
gotvec
,
&
u
,
&
v
);
expect_vec4
(
expectedvec
,
gotvec
);
...
...
@@ -293,7 +305,17 @@ static void D3X8Vector4Test(void)
got
=
D3DXVec4LengthSq
(
NULL
);
ok
(
fabs
(
got
-
expected
)
<
admitted_error
,
"Expected: %f, Got: %f
\n
"
,
expected
,
got
);
/*_______________D3DXVec3Add__________________________*/
/*_______________D3DXVec4Lerp__________________________*/
expectedvec
.
x
=
27
.
0
f
;
expectedvec
.
y
=
-
11
.
0
f
;
expectedvec
.
z
=
62
.
5
;
expectedvec
.
w
=
29
.
5
;
D3DXVec4Lerp
(
&
gotvec
,
&
u
,
&
v
,
scale
);
expect_vec4
(
expectedvec
,
gotvec
);
/* Tests the case NULL */
funcpointer
=
D3DXVec4Lerp
(
&
gotvec
,
NULL
,
&
v
,
scale
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
funcpointer
=
D3DXVec4Lerp
(
NULL
,
NULL
,
NULL
,
scale
);
ok
(
funcpointer
==
NULL
,
"Expected: %p, Got: %p
\n
"
,
NULL
,
funcpointer
);
/*_______________D3DXVec4Subtract__________________________*/
expectedvec
.
x
=
4
.
0
f
;
expectedvec
.
y
=
-
2
.
0
f
;
expectedvec
.
z
=
9
.
0
f
;
expectedvec
.
w
=
3
.
0
f
;
D3DXVec4Subtract
(
&
gotvec
,
&
u
,
&
v
);
expect_vec4
(
expectedvec
,
gotvec
);
...
...
include/d3dx8math.inl
View file @
ab4e8297
...
...
@@ -122,6 +122,15 @@ static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv)
return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z);
}
static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (1-s) * (pv1->x) + s * (pv2->x);
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
pout->z = (1-s) * (pv1->z) + s * (pv2->z);
return pout;
}
static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
...
...
@@ -160,6 +169,16 @@ static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv)
return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w);
}
static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
pout->x = (1-s) * (pv1->x) + s * (pv2->x);
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
pout->z = (1-s) * (pv1->z) + s * (pv2->z);
pout->w = (1-s) * (pv1->w) + s * (pv2->w);
return pout;
}
static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
...
...
@@ -169,6 +188,7 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
pout->w = pv1->w - pv2->w;
return pout;
}
/*__________________D3DXQUATERNION____________________*/
static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2)
...
...
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