|
发表于 2009-4-3 12:05:38
|
显示全部楼层
还有一个方法
还有一个方法:
取得包围球的球心和半径
然后以上述信息,用线框模式画一个圆就可以了吧
类似这样:- const osg::BoundingSphere &bs= node->getBound();
- osg::ShapeDrawable *sd = new osg::ShapeDrawable(new osg::Sphere(bs.center(), bs.radius()));
- sd->setColor(osg::Vec4(1, 0, 0, 1));
- osg::StateSet *state = sd->getOrCreateStateSet();
- osg::PolygonMode* pm = new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
- state->setAttributeAndModes(pm);
- //设置线宽
- osg::LineWidth* lw = new osg::LineWidth(1.0f);
- state->setAttribute(lw);
- osg::Geode *geode = new osg::Geode();
- geode->addDrawable(sd);
- root->addChild(geode);
复制代码 |
|