d3dx9: Use float functions in D3DXQuaternionRotationYawPitchRoll().

This commit is contained in:
Rico Schüller 2012-09-26 13:57:05 +02:00 committed by Alexandre Julliard
parent ce319e9d53
commit 7d75ad8230
1 changed files with 17 additions and 7 deletions

View File

@ -1424,15 +1424,25 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST
return pout; 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); TRACE("out %p, yaw %f, pitch %f, roll %f\n", out, yaw, pitch, roll);
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); syaw = sinf(yaw / 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); cyaw = cosf(yaw / 2.0f);
return pout; 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, D3DXQUATERNION * WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1,