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
f13c45f4
Commit
f13c45f4
authored
Apr 19, 2007
by
David Adam
Committed by
Alexandre Julliard
Apr 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Implement D3DRMMatrixFromQuaternion.
parent
9fa78fd4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
2 deletions
+69
-2
d3drm.spec
dlls/d3drm/d3drm.spec
+1
-1
math.c
dlls/d3drm/math.c
+26
-0
vector.c
dlls/d3drm/tests/vector.c
+42
-1
No files found.
dlls/d3drm/d3drm.spec
View file @
f13c45f4
...
...
@@ -4,7 +4,7 @@
@ stub D3DRMColorGetRed
@ stub D3DRMCreateColorRGB
@ stub D3DRMCreateColorRGBA
@ st
ub D3DRMMatrixFromQuaternion
@ st
dcall D3DRMMatrixFromQuaternion(ptr ptr)
@ stub D3DRMQuaternionFromRotation
@ stdcall D3DRMQuaternionMultiply(ptr ptr ptr)
@ stub D3DRMQuaternionSlerp
...
...
dlls/d3drm/math.c
View file @
f13c45f4
...
...
@@ -44,6 +44,32 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q, LPD3DRMQUA
return
q
;
}
/* Matrix for the Rotation that a unit quaternion represents */
void
WINAPI
D3DRMMatrixFromQuaternion
(
D3DRMMATRIX4D
m
,
LPD3DRMQUATERNION
q
)
{
D3DVALUE
w
,
x
,
y
,
z
;
w
=
q
->
s
;
x
=
q
->
v
.
x
;
y
=
q
->
v
.
y
;
z
=
q
->
v
.
z
;
m
[
0
][
0
]
=
1
.
0
-
2
.
0
*
(
y
*
y
+
z
*
z
);
m
[
1
][
1
]
=
1
.
0
-
2
.
0
*
(
x
*
x
+
z
*
z
);
m
[
2
][
2
]
=
1
.
0
-
2
.
0
*
(
x
*
x
+
y
*
y
);
m
[
1
][
0
]
=
2
.
0
*
(
x
*
y
+
z
*
w
);
m
[
0
][
1
]
=
2
.
0
*
(
x
*
y
-
z
*
w
);
m
[
2
][
0
]
=
2
.
0
*
(
x
*
z
-
y
*
w
);
m
[
0
][
2
]
=
2
.
0
*
(
x
*
z
+
y
*
w
);
m
[
2
][
1
]
=
2
.
0
*
(
y
*
z
+
x
*
w
);
m
[
1
][
2
]
=
2
.
0
*
(
y
*
z
-
x
*
w
);
m
[
3
][
0
]
=
0
.
0
;
m
[
3
][
1
]
=
0
.
0
;
m
[
3
][
2
]
=
0
.
0
;
m
[
0
][
3
]
=
0
.
0
;
m
[
1
][
3
]
=
0
.
0
;
m
[
2
][
3
]
=
0
.
0
;
m
[
3
][
3
]
=
1
.
0
;
}
/* Add Two Vectors */
LPD3DVECTOR
WINAPI
D3DRMVectorAdd
(
LPD3DVECTOR
d
,
LPD3DVECTOR
s1
,
LPD3DVECTOR
s2
)
{
...
...
dlls/d3drm/tests/vector.c
View file @
f13c45f4
...
...
@@ -25,12 +25,37 @@
#define PI (4*atan(1.0))
#define admit_error 0.000001
#define expect_mat( expectedmat, gotmat)\
{ \
int i,j,equal=1; \
for (i=0; i<4; i++)\
{\
for (j=0; j<4; j++)\
{\
if (fabs(expectedmat[i][j]-gotmat[i][j])>admit_error)\
{\
equal=0;\
}\
}\
}\
ok(equal, "Expected matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n)\n\n" \
"Got matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f)\n", \
expectedmat[0][0],expectedmat[0][1],expectedmat[0][2],expectedmat[0][3], \
expectedmat[1][0],expectedmat[1][1],expectedmat[1][2],expectedmat[1][3], \
expectedmat[2][0],expectedmat[2][1],expectedmat[2][2],expectedmat[2][3], \
expectedmat[3][0],expectedmat[3][1],expectedmat[3][2],expectedmat[3][3], \
gotmat[0][0],gotmat[0][1],gotmat[0][2],gotmat[0][3], \
gotmat[1][0],gotmat[1][1],gotmat[1][2],gotmat[1][3], \
gotmat[2][0],gotmat[2][1],gotmat[2][2],gotmat[2][3], \
gotmat[3][0],gotmat[3][1],gotmat[3][2],gotmat[3][3] ); \
}
#define expect_vec(expectedvec,gotvec) \
ok( ((fabs(expectedvec.x-gotvec.x)<admit_error)&&(fabs(expectedvec.y-gotvec.y)<admit_error)&&(fabs(expectedvec.z-gotvec.z)<admit_error)), \
"Expected Vector= (%f, %f, %f)\n , Got Vector= (%f, %f, %f)\n", \
expectedvec.x,expectedvec.y,expectedvec.z, gotvec.x, gotvec.y, gotvec.z);
void
VectorTest
(
void
)
static
void
VectorTest
(
void
)
{
D3DVALUE
mod
,
par
,
theta
;
D3DVECTOR
e
,
r
,
u
,
v
,
w
,
axis
,
casnul
,
norm
,
ray
;
...
...
@@ -101,7 +126,23 @@ void VectorTest(void)
expect_vec
(
e
,
r
);
}
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
;
q
.
v
.
x
=
2
.
0
;
q
.
v
.
y
=
3
.
0
;
q
.
v
.
z
=
4
.
0
;
D3DRMMatrixFromQuaternion
(
mat
,
&
q
);
expect_mat
(
exp
,
mat
);
}
START_TEST
(
vector
)
{
VectorTest
();
MatrixTest
();
}
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