=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3dx9: Use float functions in D3DXQuaternionRotationYawPitchRoll().
Alexandre Julliard
julliard at winehq.org
Wed Sep 26 14:06:50 CDT 2012
Module: wine
Branch: master
Commit: 7d75ad8230e182fe4c6724aed20b6a9302d7fa54
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7d75ad8230e182fe4c6724aed20b6a9302d7fa54
Author: Rico Schüller <kgbricola at web.de>
Date: Wed Sep 26 13:57:05 2012 +0200
d3dx9: Use float functions in D3DXQuaternionRotationYawPitchRoll().
---
dlls/d3dx9_36/math.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index 7599a0a..3f0e8e4 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -1424,15 +1424,25 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST
return pout;
}
-D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll)
+D3DXQUATERNION * WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *out, FLOAT yaw, FLOAT pitch, FLOAT roll)
{
- TRACE("(%p, %f, %f, %f)\n", pout, yaw, pitch, roll);
+ FLOAT syaw, cyaw, spitch, cpitch, sroll, croll;
- pout->x = sin( yaw / 2.0f) * cos(pitch / 2.0f) * sin(roll / 2.0f) + cos(yaw / 2.0f) * sin(pitch / 2.0f) * cos(roll / 2.0f);
- pout->y = sin( yaw / 2.0f) * cos(pitch / 2.0f) * cos(roll / 2.0f) - cos(yaw / 2.0f) * sin(pitch / 2.0f) * sin(roll / 2.0f);
- pout->z = cos(yaw / 2.0f) * cos(pitch / 2.0f) * sin(roll / 2.0f) - sin( yaw / 2.0f) * sin(pitch / 2.0f) * cos(roll / 2.0f);
- pout->w = cos( yaw / 2.0f) * cos(pitch / 2.0f) * cos(roll / 2.0f) + sin(yaw / 2.0f) * sin(pitch / 2.0f) * sin(roll / 2.0f);
- return pout;
+ TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
+
+ syaw = sinf(yaw / 2.0f);
+ cyaw = cosf(yaw / 2.0f);
+ spitch = sinf(pitch / 2.0f);
+ cpitch = cosf(pitch / 2.0f);
+ sroll = sinf(roll / 2.0f);
+ croll = cosf(roll / 2.0f);
+
+ out->x = syaw * cpitch * sroll + cyaw * spitch * croll;
+ out->y = syaw * cpitch * croll - cyaw * spitch * sroll;
+ out->z = cyaw * cpitch * sroll - syaw * spitch * croll;
+ out->w = cyaw * cpitch * croll + syaw * spitch * sroll;
+
+ return out;
}
D3DXQUATERNION * WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1,
More information about the wine-cvs
mailing list