|
楼主 |
发表于 2011-4-25 13:04:59
|
显示全部楼层
回复 2# array
我在主函数上加入
osg::ref_ptr<TravelManipulator>tm=new TravelManipulator;//自定义操作器
osgGA::KeySwitchMatrixManipulator *k = new osgGA::KeySwitchMatrixManipulator();
k->addMatrixManipulator('m',"change",tm);
viewer->setCameraManipulator(k);
可一运行直接就是自定义操作器,似乎这几句都没起作用
附上main函数,自定义漫游器就是很普通的设置正逆矩阵,加上一个handle函数。
int main()
{
osg::ref_ptr<osgViewer::Viewer>viewer=new osgViewer::Viewer;
osg::ref_ptr<osg::Group>group=new osg::Group;
osg::ref_ptr<osg::Node>node=osgDB::readNodeFile("station.ive");
osg::ref_ptr<TravelManipulator>tm=new TravelManipulator;
osgGA::KeySwitchMatrixManipulator *k = new osgGA::KeySwitchMatrixManipulator();
k->addMatrixManipulator('m',"change",tm);
viewer->setCameraManipulator(k);
viewer->setSceneData(group);
viewer->run();
} |
|