|
楼主 |
发表于 2010-7-15 10:33:11
|
显示全部楼层
bool KeySwitchManipulatorExt::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
{
bool resu=false;
if (!ea.getHandled()&&ea.getEventType()==GUIEventAdapter:EFT_MOUSE_BUTTON||ea.getEventType()==GUIEventAdapter::MOVE)
{
std::string str=getCurrentMatrixManipulator()->className();
if ("Trackball"==str)
{
mm=getCurrentMatrixManipulator()->getMatrix();
}
}
resu=KeySwitchMatrixManipulator::handle(ea,us);
if (ea.getEventType()==GUIEventAdapter::KEYDOWN)
{
std::string str1=getCurrentMatrixManipulator()->className();
if ("Terrain"==str1)
{
osg::Vec3f eye,center,up;
mm.getLookAt(eye,center,up);
getCurrentMatrixManipulator()->setHomePosition(eye,center,up);
}
}
return resu;
}
这个是重写keyswitchmatrixmanipulator的handle函数,不知道哪里有问题,在trackball切换到Terrain后设置控制器位置好像没有反应 |
|