osg::Matrixd matrixd = pView->getCameraManipulator()->getMatrix();
// X Y Z
double x = matrixd.getTrans().x();
double y = matrixd.getTrans().y();
double z = matrixd.getTrans().z();
osg::Vec3d currentXYZ = osg::Vec3d(x,y,z);
double h;
double p;
double r;
double angle;
osg::Quat currentHPR = matrixd.getRotate();/*osg::Quat(h,p,r,w)*/;
currentHPR.getRotate(angle,h,p,r);
if(currentHPR != m_LastHPR || currentXYZ != m_LastXYZ)
{
CString _x;
_x.Format(_T(" %.4f"), x);
std::string _xs((LPCTSTR)_x);
pMainFrm->getCPxStatusEditX()->SetWindowTextA(_xs.c_str());
CString _y;
_y.Format(_T(" %.4f"), y);
std::string _ys((LPCTSTR)_y);
pMainFrm->getCPxStatusEditY()->SetWindowTextA(_ys.c_str());
CString _z;
_z.Format(_T(" %.4f"), z);
std::string _zs((LPCTSTR)_z);
pMainFrm->getCPxStatusEditZ()->SetWindowTextA(_zs.c_str());
m_LastXYZ = osg::Vec3d(x,y,z);
CString _h;
_h.Format(_T(" %.2f"), osg::RadiansToDegrees(h));
std::string _hs((LPCTSTR)_h);
pMainFrm->getCPxStatusEditH()->SetWindowTextA(_hs.c_str());
CString _p;
_p.Format(_T(" %.2f"), osg::RadiansToDegrees(p));
std::string _ps((LPCTSTR)_p);
pMainFrm->getCPxStatusEditP()->SetWindowTextA(_ps.c_str());
CString _r;
_r.Format(_T(" %.2f"), osg::RadiansToDegrees(r));
std::string _rs((LPCTSTR)_r);
pMainFrm->getCPxStatusEditR()->SetWindowTextA(_rs.c_str());
m_LastHPR = currentHPR;
}
Partager