|
本帖最后由 smengq 于 2012-11-25 14:00 编辑
class MyShape : public osg:rawable
{
public:
MyShape()
{
}
MyShape( const MyShape& shape , const osg::CopyOp& copyop =
osg::CopyOp::SHALLOW_COPY ) : osg::Drawable( shape , copyop )
{
}
META_Object( test , MyShape )
virtual void drawImplementation( osg::RenderInfo& ) const
{
glColor3f(1,1,1);
glutSolidSphere(0.05,20, 20);
}
protected :
virtual ~MyShape()
{
}
};
以上是派生自osg::Drawable对象用opengl绘制的球体,将它加入到viewer里,用osg教程上class PickHandler那个拾取对象的类拾取,对象能显示但是拾取不到,网上说自定义Drawable需要实现Drawable::accept(PrimitiveFunctor&)等接口,才能支持OSG内部的求交、拣选等算法,怎样实现Drawable::accept(PrimitiveFunctor&)接口啊?里面该做些什么工作?大家能不能帮帮忙提供些指导,最好能写出相应的代码,急急急!
|
|