本文整理汇总了C++中osg::Node::accept方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::accept方法的具体用法?C++ Node::accept怎么用?C++ Node::accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Node
的用法示例。
在下文中一共展示了Node::accept方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGraphDescription
TransformerGraph::GraphDescription TransformerGraph::getGraphDescription(osg::Node& transformer)
{
GraphDescription result;
DescriptionVisitor visitor(result);
transformer.accept(visitor);
return result;
}
示例2: vc
void
OcclusionQueryVisitor::addOQN( osg::Node& node )
{
VertexCounter vc( _occluderThreshold );
node.accept( vc );
if (vc.exceeded())
{
// Insert OQN(s) above this node.
unsigned int np = node.getNumParents();
while (np--)
{
osg::Group* parent = dynamic_cast<osg::Group*>( node.getParent( np ) );
if (parent != NULL)
{
osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode();
oqn->addChild( &node );
parent->replaceChild( &node, oqn.get() );
oqn->setName( getNextOQNName() );
// Set all OQNs to use the same query StateSets (instead of multiple copies
// of the same StateSet) for efficiency.
oqn->setQueryStateSet( _state.get() );
oqn->setDebugStateSet( _debugState.get() );
}
}
}
}
示例3: computeNodePathToRoot
void osgManipulator::computeNodePathToRoot(osg::Node& node, osg::NodePath& np)
{
np.clear();
osg::ref_ptr<FindNodePathToRootVisitor> visitor = new FindNodePathToRootVisitor(np);
node.accept(*visitor);
np.pop_back();
std::reverse(np.begin(), np.end());
}
示例4: update
void AnimationPathCallback::update(osg::Node& node)
{
AnimationPath::ControlPoint cp;
if (_animationPath->getInterpolatedControlPoint(getAnimationTime(),cp))
{
AnimationPathCallbackVisitor apcv(cp,_pivotPoint,_useInverseMatrix);
node.accept(apcv);
}
}
示例5: handle
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*)
{
if ( ea.getEventType() == ea.PUSH )
{
// mouse click from [-1...1]
float nx = ea.getXnormalized();
float ny = ea.getYnormalized();
// clicked point in clip space:
osg::Vec3d pn( nx, ny, -1 ); // on near plane
osg::Vec3d pf( nx, ny, 1 ); // on far plane
OE_NOTICE << "clip: nx=" << nx << ", ny=" << ny << std::endl;
// take the view matrix as-is:
osg::Matrix view = _view->getCamera()->getViewMatrix();
// adjust projection matrix to include entire earth:
double fovy, ar, zn, zf;
_view->getCamera()->getProjectionMatrix().getPerspective(fovy, ar, zn, zf);
osg::Matrix proj;
proj.makePerspective(fovy, ar, 1.0, 1e10);
// Invert the MVP to transform points from clip to model space:
osg::Matrix MVP = view * proj;
osg::Matrix invMVP;
invMVP.invert(MVP);
pn = pn * invMVP;
pf = pf * invMVP;
OE_NOTICE << "model: near = " << pn.x() << ", " << pn.y() << ", " << pn.z() << std::endl;
OE_NOTICE << "model: far = " << pf.x() << ", " << pf.y() << ", " << pf.z() << std::endl;
// Intersect in model space.
osgUtil::LineSegmentIntersector* lsi = new osgUtil::LineSegmentIntersector(
osgUtil::Intersector::MODEL, pn, pf );
lsi->setIntersectionLimit( lsi->LIMIT_NEAREST );
osgUtil::IntersectionVisitor iv( lsi );
_node->accept( iv );
if ( lsi->containsIntersections() )
{
osg::Vec3d p = lsi->getIntersections().begin()->getWorldIntersectPoint();
OE_NOTICE << "i = " << p.x() << ", " << p.y() << ", " << p.z() << std::endl;
}
}
return false;
}
示例6: compile
void GLObjectsVisitor::compile(osg::Node& node)
{
if (_renderInfo.getState())
{
node.accept(*this);
if (_lastCompiledProgram.valid())
{
osg::State* state = _renderInfo.getState();
osg::GLExtensions* extensions = state->get<osg::GLExtensions>();
extensions->glUseProgram(0);
_renderInfo.getState()->setLastAppliedProgramObject(0);
}
}
}
示例7: compile
void GLObjectsVisitor::compile(osg::Node& node)
{
if (_renderInfo.getState())
{
node.accept(*this);
if (_lastCompiledProgram.valid())
{
osg::State* state = _renderInfo.getState();
osg::GLExtensions* extensions = state->get<osg::GLExtensions>();
extensions->glUseProgram(0);
_renderInfo.getState()->setLastAppliedProgramObject(0);
}
if (_checkGLErrors!=osg::State::NEVER_CHECK_GL_ERRORS) _renderInfo.getState()->checkGLErrors("after GLObjectsVisitor::compile(osg::Node& node)");
}
}
示例8: run
bool BaseDotVisitor::run( osg::Node& root, std::ostream* fout ) {
setTraversalMode( TRAVERSE_ALL_CHILDREN );
if ( fout && *fout ) {
root.accept( *this );
*fout << "digraph osg_scenegraph { "<<_rankdir<< std::endl;
*fout << _nodes.str() << _edges.str();
*fout << "}" << std::endl;
_nodes.clear();
_edges.clear();
_objectMap.clear();
return true;
}
return false;
}
示例9: remove
static void remove(::osg::Node &node,osg::Node *remove)
{
NodeRemover remover(remove);
node.accept(remover);
}
示例10: set
static void set(::osg::Node &node,float size)
{
TextSizeSetter setter(size);
node.accept(setter);
}
示例11: find
static std::vector<std::string> find(::osg::Node &node)
{
FindFrameNames finder;
node.accept(finder);
return finder.getNames();
}