|
楼主 |
发表于 2013-12-14 08:58:27
|
显示全部楼层
osg::MatrixTransform* createNeedlePart( const std::string& image, float radius, float height,float deltaX,float deltaY )
{
osg::Vec3 center(-radius, -radius, height);
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(
createTexturedQuadGeometry(center, osg::Vec3(radius*2.0+deltaX,0.0f,0.0f), osg::Vec3(0.0f,radius*2.0+deltaY,0.0f)) );
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage( osgDB::readImageFile(image) );
osg::ref_ptr<osg::MatrixTransform> part = new osg::MatrixTransform;
part->setUpdateCallback(new NeedleRotationCallback());
part->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() );
part->getOrCreateStateSet()->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
part->addChild( geode.get() );
return part.release();
}
就这样设置了一个回调函数,然后在回调里让他旋转。但是没有反应啊,是哪里搞错了吗? |
|