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
44e74969
Commit
44e74969
authored
Feb 14, 2009
by
David Adam
Committed by
Alexandre Julliard
Feb 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3drm: Implement the spherical interpolation part of D3DRMQuaternionSlerp.
parent
a737dcf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
math.c
dlls/d3drm/math.c
+19
-5
vector.c
dlls/d3drm/tests/vector.c
+9
-3
No files found.
dlls/d3drm/math.c
View file @
44e74969
...
...
@@ -123,12 +123,26 @@ LPD3DRMQUATERNION WINAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION q, LPD3DV
/* Interpolation between two quaternions */
LPD3DRMQUATERNION
WINAPI
D3DRMQuaternionSlerp
(
LPD3DRMQUATERNION
q
,
LPD3DRMQUATERNION
a
,
LPD3DRMQUATERNION
b
,
D3DVALUE
alpha
)
{
D3DVALUE
epsilon
=
1
.
0
;
D3DVALUE
dot
,
epsilon
,
temp
,
theta
,
u
;
D3DVECTOR
sca1
,
sca2
;
if
(
a
->
s
*
b
->
s
+
D3DRMVectorDotProduct
(
&
a
->
v
,
&
b
->
v
)
<
0
.
0
)
epsilon
=
-
1
.
0
;
q
->
s
=
(
1
.
0
-
alpha
)
*
a
->
s
+
epsilon
*
alpha
*
b
->
s
;
D3DRMVectorAdd
(
&
q
->
v
,
D3DRMVectorScale
(
&
sca1
,
&
a
->
v
,
1
.
0
-
alpha
),
D3DRMVectorScale
(
&
sca2
,
&
b
->
v
,
epsilon
*
alpha
));
dot
=
a
->
s
*
b
->
s
+
D3DRMVectorDotProduct
(
&
a
->
v
,
&
b
->
v
);
epsilon
=
1
.
0
f
;
temp
=
1
.
0
f
-
alpha
;
u
=
alpha
;
if
(
dot
<
0
.
0
)
{
epsilon
=
-
1
.
0
;
dot
=
-
dot
;
}
if
(
1
.
0
f
-
dot
>
0
.
001
f
)
{
theta
=
acos
(
dot
);
temp
=
sin
(
theta
*
temp
)
/
sin
(
theta
);
u
=
sin
(
theta
*
alpha
)
/
sin
(
theta
);
}
q
->
s
=
temp
*
a
->
s
+
epsilon
*
u
*
b
->
s
;
D3DRMVectorAdd
(
&
q
->
v
,
D3DRMVectorScale
(
&
sca1
,
&
a
->
v
,
temp
),
D3DRMVectorScale
(
&
sca2
,
&
b
->
v
,
epsilon
*
u
));
return
q
;
}
...
...
dlls/d3drm/tests/vector.c
View file @
44e74969
...
...
@@ -227,10 +227,9 @@ static void QuaternionTest(void)
expect_quat
(
q
,
r
);
/*_________________QuaternionSlerp_________________________*/
/* Interpolation slerp is in fact a linear interpolation, not a spherical linear
* interpolation. Moreover, if the angle of the two quaternions is in ]PI/2;3PI/2[, QuaternionSlerp
/* 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
* th
ese two facts
. */
* th
is fact
. */
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
;
...
...
@@ -256,6 +255,13 @@ static void QuaternionTest(void)
U3
(
q
.
v
).
z
=
g
*
U3
(
q1
.
v
).
z
+
h
*
U3
(
q2
.
v
).
z
;
pD3DRMQuaternionSlerp
(
&
r
,
&
q1
,
&
q2
,
par
);
expect_quat
(
q
,
r
);
/* Test the spherical interpolation part */
q1
.
s
=
0
.
1
f
;
U1
(
q1
.
v
).
x
=
0
.
2
f
;
U2
(
q1
.
v
).
y
=
0
.
3
f
;
U3
(
q1
.
v
).
z
=
0
.
4
f
;
q2
.
s
=
0
.
5
f
;
U1
(
q2
.
v
).
x
=
0
.
6
f
;
U2
(
q2
.
v
).
y
=
0
.
7
f
;
U3
(
q2
.
v
).
z
=
0
.
8
f
;
q
.
s
=
0
.
243943
f
;
U1
(
q
.
v
).
x
=
0
.
351172
f
;
U2
(
q
.
v
).
y
=
0
.
458401
f
;
U3
(
q
.
v
).
z
=
0
.
565629
f
;
pD3DRMQuaternionSlerp
(
&
r
,
&
q1
,
&
q2
,
par
);
expect_quat
(
q
,
r
);
}
static
void
ColorTest
(
void
)
...
...
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