코드: D3DXMATRIX * pMatrix = [- Source -];
float sx = pMatrix->_32;
float cx = sqrtf(1.0f - sx * sx);
float x, y, z;
if (cx < 0.00001f)
{
if (sx > 0)
x = D3DX_PI / 2;
else
x = -D3DX_PI / 2;
y = atan2f(pMatrix->_31, pMatrix->_11);
z = 0.0f;
}
else
{
x = atan2f(sx, cx);
y = atan2f(-pMatrix->_31, pMatrix->_33);
z = atan2f(-pMatrix->_12, pMatrix->_22);
}
pRotation->x = x;
pRotation->y = y;
pRotation->z = z; |
Posted by chungki


