|
发表于 2013-11-19 16:13:35
|
显示全部楼层
您好,我也想做球面动画,按照Array老师的教程,写了下面代码:
osg::AnimationPath* CCustomOSGWnd::CreatePath()
{
typedef osg::AnimationPath::ControlPoint ControlPoint;
osg::ref_ptr<osg::AnimationPath> path = new osg::AnimationPath;
path->insert(0.0,ControlPoint(osg::Vec3d(122.20,28.59,400)));
path->insert(5.0,ControlPoint(osg::Vec3d(122.2075,28.66,300)));
path->insert(10.0,ControlPoint(osg::Vec3d(122.215,28.73,200)));
path->insert(15.0,ControlPoint(osg::Vec3d(122.225,28.80,100)));
path->insert(20.0,ControlPoint(osg::Vec3d(122.23,28.86,0)));
return path.release();
}
BOOL CCustomOSGWnd::CreateMoveModel()
{
osg::Node* model = osgDB::readNodeFile("F:\\new\\ThirdPartyLib\\Data\\Model\\F-16.ive");//cessna.osg
osg::AnimationPath* path = CreatePath();
path->setLoopMode(osg::AnimationPath:OOP);
osg::MatrixTransform* positioned = new osg::MatrixTransform;
positioned->setMatrix(osg::Matrixd::scale(0.08,0.08,0.08));
positioned->addChild(model);
positioned->setUpdateCallback(new osg::AnimationPathCallback(path));
m_pRootNode->addChild(positioned);
return TRUE;
}
但是运行后没有反应,能指点下吗,谢谢了 |
|