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
cacf37f0
Commit
cacf37f0
authored
May 31, 2007
by
Francois Gouget
Committed by
Alexandre Julliard
May 31, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm/tests: Fix the Visual C++ double to float conversion warnings.
parent
ab91c216
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
60 deletions
+60
-60
vector.c
dlls/d3drm/tests/vector.c
+60
-60
No files found.
dlls/d3drm/tests/vector.c
View file @
cacf37f0
...
...
@@ -23,8 +23,8 @@
#include "wine/test.h"
#define PI (4
*atan(1.0
))
#define admit_error 0.000001
#define PI (4
.0f*atanf(1.0f
))
#define admit_error 0.000001
f
#define expect_mat( expectedmat, gotmat)\
{ \
...
...
@@ -132,69 +132,69 @@ static void VectorTest(void)
D3DVALUE
mod
,
par
,
theta
;
D3DVECTOR
e
,
r
,
u
,
v
,
w
,
axis
,
casnul
,
norm
,
ray
;
U1
(
u
).
x
=
2
.
0
;
U2
(
u
).
y
=
2
.
0
;
U3
(
u
).
z
=
1
.
0
;
U1
(
v
).
x
=
4
.
0
;
U2
(
v
).
y
=
4
.
0
;
U3
(
v
).
z
=
0
.
0
;
U1
(
u
).
x
=
2
.
0
f
;
U2
(
u
).
y
=
2
.
0
f
;
U3
(
u
).
z
=
1
.
0
f
;
U1
(
v
).
x
=
4
.
0
f
;
U2
(
v
).
y
=
4
.
0
f
;
U3
(
v
).
z
=
0
.
0
f
;
/*______________________VectorAdd_________________________________*/
pD3DRMVectorAdd
(
&
r
,
&
u
,
&
v
);
U1
(
e
).
x
=
6
.
0
;
U2
(
e
).
y
=
6
.
0
;
U3
(
e
).
z
=
1
.
0
;
U1
(
e
).
x
=
6
.
0
f
;
U2
(
e
).
y
=
6
.
0
f
;
U3
(
e
).
z
=
1
.
0
f
;
expect_vec
(
e
,
r
);
/*_______________________VectorSubtract__________________________*/
pD3DRMVectorSubtract
(
&
r
,
&
u
,
&
v
);
U1
(
e
).
x
=-
2
.
0
;
U2
(
e
).
y
=-
2
.
0
;
U3
(
e
).
z
=
1
.
0
;
U1
(
e
).
x
=-
2
.
0
f
;
U2
(
e
).
y
=-
2
.
0
f
;
U3
(
e
).
z
=
1
.
0
f
;
expect_vec
(
e
,
r
);
/*_______________________VectorCrossProduct_______________________*/
pD3DRMVectorCrossProduct
(
&
r
,
&
u
,
&
v
);
U1
(
e
).
x
=-
4
.
0
;
U2
(
e
).
y
=
4
.
0
;
U3
(
e
).
z
=
0
.
0
;
U1
(
e
).
x
=-
4
.
0
f
;
U2
(
e
).
y
=
4
.
0
f
;
U3
(
e
).
z
=
0
.
0
f
;
expect_vec
(
e
,
r
);
/*_______________________VectorDotProduct__________________________*/
mod
=
pD3DRMVectorDotProduct
(
&
u
,
&
v
);
ok
((
mod
==
16
.
0
),
"Expected 16.0, Got %f
\n
"
,
mod
);
ok
((
mod
==
16
.
0
f
),
"Expected 16.0f, Got %f
\n
"
,
mod
);
/*_______________________VectorModulus_____________________________*/
mod
=
pD3DRMVectorModulus
(
&
u
);
ok
((
mod
==
3
.
0
),
"Expected 3.0, Got %f
\n
"
,
mod
);
ok
((
mod
==
3
.
0
f
),
"Expected 3.0f, Got %f
\n
"
,
mod
);
/*_______________________VectorNormalize___________________________*/
pD3DRMVectorNormalize
(
&
u
);
U1
(
e
).
x
=
2
.
0
/
3
.
0
;
U2
(
e
).
y
=
2
.
0
/
3
.
0
;
U3
(
e
).
z
=
1
.
0
/
3
.
0
;
U1
(
e
).
x
=
2
.
0
f
/
3
.
0
f
;
U2
(
e
).
y
=
2
.
0
f
/
3
.
0
f
;
U3
(
e
).
z
=
1
.
0
f
/
3
.
0
f
;
expect_vec
(
e
,
u
);
/* If u is the NULL vector, MSDN says that the return vector is NULL. In fact, the returned vector is (1,0,0). The following test case prove it. */
U1
(
casnul
).
x
=
0
.
0
;
U2
(
casnul
).
y
=
0
.
0
;
U3
(
casnul
).
z
=
0
.
0
;
U1
(
casnul
).
x
=
0
.
0
f
;
U2
(
casnul
).
y
=
0
.
0
f
;
U3
(
casnul
).
z
=
0
.
0
f
;
pD3DRMVectorNormalize
(
&
casnul
);
U1
(
e
).
x
=
1
.
0
;
U2
(
e
).
y
=
0
.
0
;
U3
(
e
).
z
=
0
.
0
;
U1
(
e
).
x
=
1
.
0
f
;
U2
(
e
).
y
=
0
.
0
f
;
U3
(
e
).
z
=
0
.
0
f
;
expect_vec
(
e
,
casnul
);
/*____________________VectorReflect_________________________________*/
U1
(
ray
).
x
=
3
.
0
;
U2
(
ray
).
y
=-
4
.
0
;
U3
(
ray
).
z
=
5
.
0
;
U1
(
norm
).
x
=
1
.
0
;
U2
(
norm
).
y
=-
2
.
0
;
U3
(
norm
).
z
=
6
.
0
;
U1
(
e
).
x
=
79
.
0
;
U2
(
e
).
y
=-
160
.
0
;
U3
(
e
).
z
=
487
.
0
;
U1
(
ray
).
x
=
3
.
0
f
;
U2
(
ray
).
y
=-
4
.
0
f
;
U3
(
ray
).
z
=
5
.
0
f
;
U1
(
norm
).
x
=
1
.
0
f
;
U2
(
norm
).
y
=-
2
.
0
f
;
U3
(
norm
).
z
=
6
.
0
f
;
U1
(
e
).
x
=
79
.
0
f
;
U2
(
e
).
y
=-
160
.
0
f
;
U3
(
e
).
z
=
487
.
0
f
;
pD3DRMVectorReflect
(
&
r
,
&
ray
,
&
norm
);
expect_vec
(
e
,
r
);
/*_______________________VectorRotate_______________________________*/
U1
(
w
).
x
=
3
.
0
;
U2
(
w
).
y
=
4
.
0
;
U3
(
w
).
z
=
0
.
0
;
U1
(
axis
).
x
=
0
.
0
;
U2
(
axis
).
y
=
0
.
0
;
U3
(
axis
).
z
=
1
.
0
;
theta
=
2
.
0
*
PI
/
3
.
0
;
U1
(
w
).
x
=
3
.
0
f
;
U2
(
w
).
y
=
4
.
0
f
;
U3
(
w
).
z
=
0
.
0
f
;
U1
(
axis
).
x
=
0
.
0
f
;
U2
(
axis
).
y
=
0
.
0
f
;
U3
(
axis
).
z
=
1
.
0
f
;
theta
=
2
.
0
f
*
PI
/
3
.
0
f
;
pD3DRMVectorRotate
(
&
r
,
&
w
,
&
axis
,
theta
);
U1
(
e
).
x
=-
0
.
3
-
0
.
4
*
sqrt
(
3
.
0
);
U2
(
e
).
y
=
0
.
3
*
sqrt
(
3
.
0
)
-
0
.
4
;
U3
(
e
).
z
=
0
.
0
;
U1
(
e
).
x
=-
0
.
3
f
-
0
.
4
f
*
sqrtf
(
3
.
0
f
);
U2
(
e
).
y
=
0
.
3
f
*
sqrtf
(
3
.
0
f
)
-
0
.
4
f
;
U3
(
e
).
z
=
0
.
0
f
;
expect_vec
(
e
,
r
);
/* The same formula gives D3DRMVectorRotate, for theta in [-PI/2;+PI/2] or not. The following test proves this fact.*/
theta
=-
PI
/
4
.
0
;
pD3DRMVectorRotate
(
&
r
,
&
w
,
&
axis
,
-
PI
/
4
);
U1
(
e
).
x
=
1
.
4
/
sqrt
(
2
.
0
);
U2
(
e
).
y
=
0
.
2
/
sqrt
(
2
.
0
);
U3
(
e
).
z
=
0
.
0
;
theta
=-
PI
/
4
.
0
f
;
pD3DRMVectorRotate
(
&
r
,
&
w
,
&
axis
,
theta
);
U1
(
e
).
x
=
1
.
4
f
/
sqrtf
(
2
.
0
f
);
U2
(
e
).
y
=
0
.
2
f
/
sqrtf
(
2
.
0
f
);
U3
(
e
).
z
=
0
.
0
f
;
expect_vec
(
e
,
r
);
/*_______________________VectorScale__________________________*/
par
=
2
.
5
;
par
=
2
.
5
f
;
pD3DRMVectorScale
(
&
r
,
&
v
,
par
);
U1
(
e
).
x
=
10
.
0
;
U2
(
e
).
y
=
10
.
0
;
U3
(
e
).
z
=
0
.
0
;
U1
(
e
).
x
=
10
.
0
f
;
U2
(
e
).
y
=
10
.
0
f
;
U3
(
e
).
z
=
0
.
0
f
;
expect_vec
(
e
,
r
);
}
...
...
@@ -203,11 +203,11 @@ static void MatrixTest(void)
D3DRMQUATERNION
q
;
D3DRMMATRIX4D
exp
,
mat
;
exp
[
0
][
0
]
=-
49
.
0
;
exp
[
0
][
1
]
=
4
.
0
;
exp
[
0
][
2
]
=
22
.
0
;
exp
[
0
][
3
]
=
0
.
0
;
exp
[
1
][
0
]
=
20
.
0
;
exp
[
1
][
1
]
=-
39
.
0
;
exp
[
1
][
2
]
=
20
.
0
;
exp
[
1
][
3
]
=
0
.
0
;
exp
[
2
][
0
]
=
10
.
0
;
exp
[
2
][
1
]
=
28
.
0
;
exp
[
2
][
2
]
=-
25
.
0
;
exp
[
2
][
3
]
=
0
.
0
;
exp
[
3
][
0
]
=
0
.
0
;
exp
[
3
][
1
]
=
0
.
0
;
exp
[
3
][
2
]
=
0
.
0
;
exp
[
3
][
3
]
=
1
.
0
;
q
.
s
=
1
.
0
;
U1
(
q
.
v
).
x
=
2
.
0
;
U2
(
q
.
v
).
y
=
3
.
0
;
U3
(
q
.
v
).
z
=
4
.
0
;
exp
[
0
][
0
]
=-
49
.
0
f
;
exp
[
0
][
1
]
=
4
.
0
f
;
exp
[
0
][
2
]
=
22
.
0
f
;
exp
[
0
][
3
]
=
0
.
0
f
;
exp
[
1
][
0
]
=
20
.
0
f
;
exp
[
1
][
1
]
=-
39
.
0
f
;
exp
[
1
][
2
]
=
20
.
0
f
;
exp
[
1
][
3
]
=
0
.
0
f
;
exp
[
2
][
0
]
=
10
.
0
f
;
exp
[
2
][
1
]
=
28
.
0
f
;
exp
[
2
][
2
]
=-
25
.
0
f
;
exp
[
2
][
3
]
=
0
.
0
f
;
exp
[
3
][
0
]
=
0
.
0
f
;
exp
[
3
][
1
]
=
0
.
0
f
;
exp
[
3
][
2
]
=
0
.
0
f
;
exp
[
3
][
3
]
=
1
.
0
f
;
q
.
s
=
1
.
0
f
;
U1
(
q
.
v
).
x
=
2
.
0
f
;
U2
(
q
.
v
).
y
=
3
.
0
f
;
U3
(
q
.
v
).
z
=
4
.
0
f
;
pD3DRMMatrixFromQuaternion
(
mat
,
&
q
);
expect_mat
(
exp
,
mat
);
...
...
@@ -220,10 +220,10 @@ static void QuaternionTest(void)
D3DRMQUATERNION
q
,
q1
,
q2
,
r
;
/*_________________QuaternionFromRotation___________________*/
U1
(
axis
).
x
=
1
.
0
;
U2
(
axis
).
y
=
1
.
0
;
U3
(
axis
).
z
=
1
.
0
;
theta
=
2
.
0
*
PI
/
3
.
0
;
U1
(
axis
).
x
=
1
.
0
f
;
U2
(
axis
).
y
=
1
.
0
f
;
U3
(
axis
).
z
=
1
.
0
f
;
theta
=
2
.
0
f
*
PI
/
3
.
0
f
;
pD3DRMQuaternionFromRotation
(
&
r
,
&
axis
,
theta
);
q
.
s
=
0
.
5
;
U1
(
q
.
v
).
x
=
0
.
5
;
U2
(
q
.
v
).
y
=
0
.
5
;
U3
(
q
.
v
).
z
=
0
.
5
;
q
.
s
=
0
.
5
f
;
U1
(
q
.
v
).
x
=
0
.
5
f
;
U2
(
q
.
v
).
y
=
0
.
5
f
;
U3
(
q
.
v
).
z
=
0
.
5
f
;
expect_quat
(
q
,
r
);
/*_________________QuaternionSlerp_________________________*/
...
...
@@ -231,12 +231,12 @@ static void QuaternionTest(void)
* interpolation. Moreover, if the angle of the two quaternions is in ]PI/2;3PI/2[, QuaternionSlerp
* interpolates between the first quaternion and the opposite of the second one. The test proves
* these two facts. */
par
=
0
.
31
;
q1
.
s
=
1
.
0
;
U1
(
q1
.
v
).
x
=
2
.
0
;
U2
(
q1
.
v
).
y
=
3
.
0
;
U3
(
q1
.
v
).
z
=
50
.
0
;
q2
.
s
=-
4
.
0
;
U1
(
q2
.
v
).
x
=
6
.
0
;
U2
(
q2
.
v
).
y
=
7
.
0
;
U3
(
q2
.
v
).
z
=
8
.
0
;
par
=
0
.
31
f
;
q1
.
s
=
1
.
0
f
;
U1
(
q1
.
v
).
x
=
2
.
0
f
;
U2
(
q1
.
v
).
y
=
3
.
0
f
;
U3
(
q1
.
v
).
z
=
50
.
0
f
;
q2
.
s
=-
4
.
0
f
;
U1
(
q2
.
v
).
x
=
6
.
0
f
;
U2
(
q2
.
v
).
y
=
7
.
0
f
;
U3
(
q2
.
v
).
z
=
8
.
0
f
;
/* The angle between q1 and q2 is in [-PI/2,PI/2]. So, one interpolates between q1 and q2. */
epsilon
=
1
.
0
;
g
=
1
.
0
-
par
;
h
=
epsilon
*
par
;
epsilon
=
1
.
0
f
;
g
=
1
.
0
f
-
par
;
h
=
epsilon
*
par
;
/* Part of the test proving that the interpolation is linear. */
q
.
s
=
g
*
q1
.
s
+
h
*
q2
.
s
;
U1
(
q
.
v
).
x
=
g
*
U1
(
q1
.
v
).
x
+
h
*
U1
(
q2
.
v
).
x
;
...
...
@@ -245,11 +245,11 @@ static void QuaternionTest(void)
pD3DRMQuaternionSlerp
(
&
r
,
&
q1
,
&
q2
,
par
);
expect_quat
(
q
,
r
);
q1
.
s
=
1
.
0
;
U1
(
q1
.
v
).
x
=
2
.
0
;
U2
(
q1
.
v
).
y
=
3
.
0
;
U3
(
q1
.
v
).
z
=
50
.
0
;
q2
.
s
=-
94
.
0
;
U1
(
q2
.
v
).
x
=
6
.
0
;
U2
(
q2
.
v
).
y
=
7
.
0
;
U3
(
q2
.
v
).
z
=-
8
.
0
;
q1
.
s
=
1
.
0
f
;
U1
(
q1
.
v
).
x
=
2
.
0
f
;
U2
(
q1
.
v
).
y
=
3
.
0
f
;
U3
(
q1
.
v
).
z
=
50
.
0
f
;
q2
.
s
=-
94
.
0
f
;
U1
(
q2
.
v
).
x
=
6
.
0
f
;
U2
(
q2
.
v
).
y
=
7
.
0
f
;
U3
(
q2
.
v
).
z
=-
8
.
0
f
;
/* The angle between q1 and q2 is not in [-PI/2,PI/2]. So, one interpolates between q1 and -q2. */
epsilon
=-
1
.
0
;
g
=
1
.
0
-
par
;
h
=
epsilon
*
par
;
epsilon
=-
1
.
0
f
;
g
=
1
.
0
f
-
par
;
h
=
epsilon
*
par
;
q
.
s
=
g
*
q1
.
s
+
h
*
q2
.
s
;
U1
(
q
.
v
).
x
=
g
*
U1
(
q1
.
v
).
x
+
h
*
U1
(
q2
.
v
).
x
;
U2
(
q
.
v
).
y
=
g
*
U2
(
q1
.
v
).
y
+
h
*
U2
(
q2
.
v
).
y
;
...
...
@@ -264,61 +264,61 @@ static void ColorTest(void)
D3DVALUE
expected
,
got
,
red
,
green
,
blue
,
alpha
;
/*___________D3DRMCreateColorRGB_________________________*/
red
=
0
.
8
;
green
=
0
.
3
;
blue
=
0
.
55
;
red
=
0
.
8
f
;
green
=
0
.
3
f
;
blue
=
0
.
55
f
;
expected_color
=
0xffcc4c8c
;
got_color
=
pD3DRMCreateColorRGB
(
red
,
green
,
blue
);
ok
((
expected_color
==
got_color
),
"Expected color=%x, Got color=%x
\n
"
,
expected_color
,
got_color
);
/*___________D3DRMCreateColorRGBA________________________*/
red
=
0
.
1
;
green
=
0
.
4
;
blue
=
0
.
7
;
alpha
=
0
.
58
;
red
=
0
.
1
f
;
green
=
0
.
4
f
;
blue
=
0
.
7
f
;
alpha
=
0
.
58
f
;
expected_color
=
0x931966b2
;
got_color
=
pD3DRMCreateColorRGBA
(
red
,
green
,
blue
,
alpha
);
ok
((
expected_color
==
got_color
),
"Expected color=%x, Got color=%x
\n
"
,
expected_color
,
got_color
);
/* if a component is <0 then, then one considers this compenent as 0. The following test proves this fact (test only with the red component). */
red
=-
0
.
88
;
green
=
0
.
4
;
blue
=
0
.
6
;
alpha
=
0
.
41
;
red
=-
0
.
88
f
;
green
=
0
.
4
f
;
blue
=
0
.
6
f
;
alpha
=
0
.
41
f
;
expected_color
=
0x68006699
;
got_color
=
pD3DRMCreateColorRGBA
(
red
,
green
,
blue
,
alpha
);
ok
((
expected_color
==
got_color
),
"Expected color=%x, Got color=%x
\n
"
,
expected_color
,
got_color
);
/* if a component is >1 then, then one considers this compenent as 1. The following test proves this fact (test only with the red component). */
red
=
2
.
37
;
green
=
0
.
4
;
blue
=
0
.
6
;
alpha
=
0
.
41
;
red
=
2
.
37
f
;
green
=
0
.
4
f
;
blue
=
0
.
6
f
;
alpha
=
0
.
41
f
;
expected_color
=
0x68ff6699
;
got_color
=
pD3DRMCreateColorRGBA
(
red
,
green
,
blue
,
alpha
);
ok
((
expected_color
==
got_color
),
"Expected color=%x, Got color=%x
\n
"
,
expected_color
,
got_color
);
/*___________D3DRMColorGetAlpha_________________________*/
color
=
0x0e4921bf
;
expected
=
14
.
0
/
255
.
0
;
expected
=
14
.
0
f
/
255
.
0
f
;
got
=
pD3DRMColorGetAlpha
(
color
);
ok
((
fabs
(
expected
-
got
)
<
admit_error
),
"Expected=%f, Got=%f
\n
"
,
expected
,
got
);
/*___________D3DRMColorGetBlue__________________________*/
color
=
0xc82a1455
;
expected
=
1
.
0
/
3
.
0
;
expected
=
1
.
0
f
/
3
.
0
f
;
got
=
pD3DRMColorGetBlue
(
color
);
ok
((
fabs
(
expected
-
got
)
<
admit_error
),
"Expected=%f, Got=%f
\n
"
,
expected
,
got
);
/*___________D3DRMColorGetGreen_________________________*/
color
=
0xad971203
;
expected
=
6
.
0
/
85
.
0
;
expected
=
6
.
0
f
/
85
.
0
f
;
got
=
pD3DRMColorGetGreen
(
color
);
ok
((
fabs
(
expected
-
got
)
<
admit_error
),
"Expected=%f, Got=%f
\n
"
,
expected
,
got
);
/*___________D3DRMColorGetRed__________________________*/
color
=
0xb62d7a1c
;
expected
=
3
.
0
/
17
.
0
;
expected
=
3
.
0
f
/
17
.
0
f
;
got
=
pD3DRMColorGetRed
(
color
);
ok
((
fabs
(
expected
-
got
)
<
admit_error
),
"Expected=%f, Got=%f
\n
"
,
expected
,
got
);
}
...
...
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