|
楼主 |
发表于 2011-5-10 17:09:04
|
显示全部楼层
回复 8# array
做了两个widget的按钮实现添加和移除车辆
mousePush(double,double,osgWidget::WindowManager*wm)
{
if(按1)
osg::ref_ptr<osg::MatrixTransform>matrixCallback1=new osg::MatrixTransform;
osg::ref_ptr<osg::AnimationPath>path1=new osg::AnimationPath;
std::string filename("1.path");
std::ifstream s(filename.c_str());
path1->read(s);
s.close();
matrixCallback1->setUpdateCallback (new osg::AnimationPathCallback(path1));
group->addChild(matrixCallback1);
if(按2)
matrixCallback1->setUpdateCallback(NULL);
}
其中matrixCallback1定义成widget的成员变量 |
|