当前位置: 首页>>代码示例>>C++>>正文


C++ NodeVisitor::getVisitorType方法代码示例

本文整理汇总了C++中osg::NodeVisitor::getVisitorType方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVisitor::getVisitorType方法的具体用法?C++ NodeVisitor::getVisitorType怎么用?C++ NodeVisitor::getVisitorType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::NodeVisitor的用法示例。


在下文中一共展示了NodeVisitor::getVisitorType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
MapNode::traverse( osg::NodeVisitor& nv )
{
    if ( nv.getVisitorType() == osg::NodeVisitor::EVENT_VISITOR )
    {
        unsigned int numBlacklist = Registry::instance()->getNumBlacklistedFilenames();
        if (numBlacklist != _lastNumBlacklistedFilenames)
        {
            //Only remove the blacklisted filenames if new filenames have been added since last time.
            _lastNumBlacklistedFilenames = numBlacklist;
            RemoveBlacklistedFilenamesVisitor v;
            //accept( v );
            _terrainEngine->accept( v );
        }
    }

    osg::Group::traverse( nv );
}
开发者ID:mysticbob,项目名称:osgearth,代码行数:18,代码来源:MapNode.cpp

示例2:

void
LODScaleGroup::traverse(osg::NodeVisitor& nv)
{
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        osg::CullStack* cs = dynamic_cast<osg::CullStack*>( &nv );
        if ( cs )
        {
            float lodscale = cs->getLODScale();
            cs->setLODScale( lodscale * _scaleFactor );
            std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv));
            cs->setLODScale( lodscale );
            return;
        }
    }

    osg::Group::traverse( nv );
}
开发者ID:mathieu,项目名称:osgearth,代码行数:18,代码来源:CullingUtils.cpp

示例3: Horizon

void
HorizonNode::traverse(osg::NodeVisitor& nv)
{
    bool isStealth = (VisitorData::isSet(nv, "osgEarth.Stealth"));

    if (nv.getVisitorType() == nv.CULL_VISITOR)
    {
        if (!isStealth)
        {
            //Horizon* h = Horizon::get(nv);
            osg::ref_ptr<Horizon> h = new Horizon();

            osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);

            osg::Vec3d eye = osg::Vec3d(0,0,0) * cv->getCurrentCamera()->getInverseViewMatrix();
            h->setEye(eye);

            osg::Plane plane;
            if (h->getPlane(plane))
            {
                osg::Quat q;
                q.makeRotate(osg::Plane::Vec3_type(0,0,1), plane.getNormal());

                double dist = plane.distance(osg::Vec3d(0,0,0));

                osg::Matrix m;
                m.preMultRotate(q);
                m.preMultTranslate(osg::Vec3d(0, 0, -dist));
                m.preMultScale(osg::Vec3d(15e6, 15e6, 15e6));

                setMatrix(m);
            }
        }
        else
        {
            osg::MatrixTransform::traverse(nv);
        }
    }
       
    else
    {
        osg::MatrixTransform::traverse(nv);
    }
}
开发者ID:ldelgass,项目名称:osgearth,代码行数:44,代码来源:Horizon.cpp

示例4: traverse

void ossimPlanetPointModel::traverse(osg::NodeVisitor& nv)
{
   if(!enableFlag()||!theNode.valid())
   {
      ossimPlanetAnnotationLayerNode::traverse(nv);
      return;
   }
   switch(nv.getVisitorType())
   {
      case osg::NodeVisitor::UPDATE_VISITOR:
      {
         setRedrawFlag(false); // let's reset the redraw notification
         if(!theLsrSpaceTransform->model()&&layer()) theLsrSpaceTransform->setModel(layer()->model());
         
 //        if(checkPointers())
         {
            OpenThreads::ScopedLock<OpenThreads::Mutex> lock(thePointModelPropertyMutex);
            if(theNodeChangedFlag)
            {
               if(theLsrSpaceTransform->getNumChildren() > 0)
               {
                  theLsrSpaceTransform->removeChildren(0, theLsrSpaceTransform->getNumChildren());
               }
               theLsrSpaceTransform->addChild(theNode.get());
               theNodeChangedFlag = false;
           }
         }
         break;
      }
      case osg::NodeVisitor::CULL_VISITOR:
      {
         break;
      }
      default:
      {
         break;
      }
   }
   
   theLsrSpaceTransform->accept(nv);
   ossimPlanetAnnotationLayerNode::traverse(nv);
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:42,代码来源:ossimPlanetPointModel.cpp

示例5: if

void
FadeLOD::traverse( osg::NodeVisitor& nv )
{
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
        PerViewData& data = _perViewData.get(cv);
        if ( !data._opacity.valid() )
        {
            data._opacity = new osg::Uniform(osg::Uniform::FLOAT, "oe_FadeLOD_opacity");
            data._stateSet = new osg::StateSet();
            data._stateSet->addUniform( data._opacity.get() );
        }
        
        float p = cv->clampedPixelSize(getBound()) / cv->getLODScale();
        
        float opacity;

        if ( p < _minPixelExtent )
            opacity = 0.0f;
        else if ( p < _minPixelExtent + _minFadeExtent )
            opacity = (p - _minPixelExtent) / _minFadeExtent;
        else if ( p < _maxPixelExtent - _maxFadeExtent )
            opacity = 1.0f;
        else if ( p < _maxPixelExtent )
            opacity = (_maxPixelExtent - p) / _maxFadeExtent;
        else
            opacity = 0.0f;

        data._opacity->set( opacity );

        //OE_INFO << LC << "r = " << getBound().radius() << ", p = " << p << ", o = " << opacity << std::endl;

        cv->pushStateSet( data._stateSet.get() );
        osg::Group::traverse( nv );
        cv->popStateSet();
    }
    else
    {
        osg::Group::traverse( nv );
    }
}
开发者ID:Brucezhou1979,项目名称:osgearth,代码行数:42,代码来源:FadeEffect.cpp

示例6: lock

void
MPTerrainEngineNode::traverse(osg::NodeVisitor& nv)
{
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        // since the root tiles are manually added, the pager never has a chance to 
        // register the PagedLODs in their children. So we have to do it manually here.
        if ( !_rootTilesRegistered )
        {
            Threading::ScopedMutexLock lock(_rootTilesRegisteredMutex);

            if ( !_rootTilesRegistered )
            {
                osgDB::DatabasePager* pager = dynamic_cast<osgDB::DatabasePager*>(nv.getDatabaseRequestHandler());
                if ( pager )
                {
                    //OE_WARN << "Registering plods." << std::endl;
                    pager->registerPagedLODs( _terrain );
                    _rootTilesRegistered = true;
                }
            }
        }

        // Inform the registry of the current frame so that Tiles have access
        // to the information.
        if ( _liveTiles.valid() && nv.getFrameStamp() )
        {
            _liveTiles->setTraversalFrame( nv.getFrameStamp()->getFrameNumber() );
        }
    }

#if 0
    static int c = 0;
    if ( ++c % 60 == 0 )
    {
        OE_NOTICE << LC << "Live = " << _liveTiles->size() << ", Dead = " << _deadTiles->size() << std::endl;
        _liveTiles->run( CheckForOrphans() );
    }
#endif

    TerrainEngineNode::traverse( nv );
}
开发者ID:aurelien35,项目名称:osgearth,代码行数:42,代码来源:MPTerrainEngineNode.cpp

示例7: traverse

void Dragger::traverse(osg::NodeVisitor& nv)
{
    if (_handleEvents && nv.getVisitorType()==osg::NodeVisitor::EVENT_VISITOR)
    {
        osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(&nv);
        if (ev)
        {
            for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
                itr != ev->getEvents().end();
                ++itr)
            {
                osgGA::GUIEventAdapter* ea = (*itr)->asGUIEventAdapter();
                if (ea && handle(*ea, *(ev->getActionAdapter()))) ea->setHandled(true);
            }
        }
        return;
    }

    MatrixTransform::traverse(nv);
}
开发者ID:4ker,项目名称:osg,代码行数:20,代码来源:Dragger.cpp

示例8: if

void
TileNode::traverse(osg::NodeVisitor& nv)
{
    // Cull only:
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        if (_empty == false)
        {
            TerrainCuller* culler = dynamic_cast<TerrainCuller*>(&nv);
        
            if (VisitorData::isSet(culler->getParent(), "osgEarth.Stealth"))
            {
                accept_cull_stealth( culler );
            }
            else
            {
                accept_cull( culler );
            }
        }
    }

    // Everything else: update, GL compile, intersection, compute bound, etc.
    else
    {
        // If there are child nodes, traverse them:
        int numChildren = getNumChildren();
        if ( numChildren > 0 )
        {
            for(int i=0; i<numChildren; ++i)
            {
                _children[i]->accept( nv );
            }
        }

        // Otherwise traverse the surface.
        else if (_surface.valid())
        {
            _surface->accept( nv );
        }
    }
}
开发者ID:mathieu,项目名称:osgearth,代码行数:41,代码来源:TileNode.cpp

示例9:

void
TileNode::traverse( osg::NodeVisitor& nv )
{
    if ( _model.valid() && nv.getVisitorType() == nv.CULL_VISITOR )
    {
        osg::ClusterCullingCallback* ccc = dynamic_cast<osg::ClusterCullingCallback*>(getCullCallback());
        if (ccc)
        {
            if (ccc->cull(&nv,0,static_cast<osg::State *>(0))) return;
        }

        // if this tile is marked dirty, bump the marker so the engine knows it
        // needs replacing.
        if ( _dirty || _model->_revision != _maprevision )
        {
            _outOfDate = true;
        }
    }

    osg::MatrixTransform::traverse( nv );
}
开发者ID:APerennec,项目名称:osgearth,代码行数:21,代码来源:TileNode.cpp

示例10: traverse

    void traverse( osg::NodeVisitor& nv )
    {
        if ( _dragger.valid() )
        {
            if ( _active && nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR )
            {
                osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(&nv);

                float pixelSize = cv->pixelSize(_dragger->getBound().center(), 0.48f);
                if ( pixelSize!=_draggerSize )
                {
                    float pixelScale = pixelSize>0.0f ? _draggerSize/pixelSize : 1.0f;
                    osg::Vec3d scaleFactor(pixelScale, pixelScale, pixelScale);

                    osg::Vec3 trans = _dragger->getMatrix().getTrans();
                    _dragger->setMatrix( osg::Matrix::scale(scaleFactor) * osg::Matrix::translate(trans) );
                }
            }
        }
        osg::Group::traverse(nv);
    }
开发者ID:yueying,项目名称:osg,代码行数:21,代码来源:osgmanipulator.cpp

示例11: SilverLiningContextNode

void
SilverLiningNode::traverse(osg::NodeVisitor& nv)
{
	if ( nv.getVisitorType() == nv.CULL_VISITOR )
	{
		osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
		osg::Camera* camera  = cv->getCurrentCamera();
		if ( camera )
		{
			if(_cameraNodeMap.find(camera) == _cameraNodeMap.end())
			{ 
				SilverLiningContextNode *slContextNode = new SilverLiningContextNode(this, camera, _light, _map, _options);
				_cameraNodeMap[camera] = slContextNode;
//Use camera cull mask that will remove the need for context check 
//in SilverLiningContextNode, SilverLiningSkyDrawable and SilverLiningCloudsDrawable
#ifdef SL_USE_CULL_MASK 
				static int nodeMask = 0x1;
				slContextNode->getSLGeode()->setNodeMask(nodeMask);
				slContextNode->setNodeMask(nodeMask);

				int inheritanceMask = 
					(osg::CullSettings::VariablesMask::ALL_VARIABLES &
					~osg::CullSettings::VariablesMask::CULL_MASK);

				camera->setInheritanceMask(inheritanceMask);
				camera->setCullMask(nodeMask);
				nodeMask = nodeMask << 1;
#endif
				addChild(slContextNode);
			}
		}
	}

    osgEarth::Util::SkyNode::traverse( nv );

    if ( _lightSource.valid() )
    {
        _lightSource->accept(nv);
    }
}
开发者ID:Arlockff,项目名称:osgearth,代码行数:40,代码来源:SilverLiningNode.cpp

示例12: getNumChildren

void
TileNode::traverse(osg::NodeVisitor& nv)
{
    // Cull only:
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);

        if (VisitorData::isSet(nv, "osgEarth.Stealth"))
        {
            accept_cull_stealth( cv );
        }
        else
        {
            accept_cull( cv );
        }
    }

    // Everything else: update, GL compile, intersection, compute bound, etc.
    else
    {
        // If there are child nodes, traverse them:
        int numChildren = getNumChildren();
        if ( numChildren > 0 )
        {
            for(int i=0; i<numChildren; ++i)
            {
                _children[i]->accept( nv );
            }
        }

        // Otherwise traverse the surface.
        // TODO: in what situations should we traverse the landcover as well? GL compile?
        else 
        {
            _surface->accept( nv );
        }
    }
}
开发者ID:rhabacker,项目名称:osgearth,代码行数:39,代码来源:TileNode.cpp

示例13: exclusive

void
TileGroup::traverse(osg::NodeVisitor& nv)
{
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        // only check for update if an update isn't already in progress:
        if ( !_updateAgent.valid() )
        {
            bool updateRequired = false;
            for( unsigned q=0; q<4; ++q)
            {
                if ( getTileNode(q)->isOutOfDate() )
                {
                    updateRequired = true;
                    break;
                }
            }

            if ( updateRequired )
            {
                // lock keeps multiple traversals from doing the same thing
                Threading::ScopedMutexLock exclusive( _updateMutex );

                // double check to prevent a race condition:
                if ( !_updateAgent.valid() )
                {
                    _updateAgent = new UpdateAgent(this);
                }
            }
        }

        if ( _updateAgent.valid() )
        {
            _updateAgent->accept( nv );
        }
    }

    osg::Group::traverse( nv );
}
开发者ID:RollJack,项目名称:osgearth,代码行数:39,代码来源:TileGroup.cpp

示例14: traverse

void Terrain::traverse(osg::NodeVisitor& nv)
{
    if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
    {
        // need to check if any TerrainTechniques need to have their update called on them.
        osgUtil::UpdateVisitor* uv = dynamic_cast<osgUtil::UpdateVisitor*>(&nv);
        if (uv)
        {
            OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
            for(TerrainTileSet::iterator itr = _updateTerrainTileSet.begin();
                itr != _updateTerrainTileSet.end();
                ++itr)
            {
                TerrainTile* tile = *itr;
                tile->traverse(nv);
            }
            _updateTerrainTileSet.clear();
        }
    }

    Group::traverse(nv);
}
开发者ID:dev2dev,项目名称:OpenSceneGraph-port-to-IOS,代码行数:22,代码来源:Terrain.cpp

示例15:

void
TileNode::traverse( osg::NodeVisitor& nv )
{
    if ( nv.getVisitorType() == nv.CULL_VISITOR )
    {
        osg::ClusterCullingCallback* ccc = dynamic_cast<osg::ClusterCullingCallback*>(getCullCallback());
        if (ccc)
        {
            if (ccc->cull(&nv,0,static_cast<osg::State *>(0))) return;
        }

        // if this tile is marked dirty, bump the marker so the engine knows it
        // needs replacing.
        if ( _dirty || _model->_revision != _maprevision )
        {
            _outOfDate = true;
        }

        // reset the "birth" time if necessary - this is the time at which the 
        // node passes cull (not multi-view compatible)
        const osg::FrameStamp* fs = nv.getFrameStamp();
        if ( fs )
        {
            unsigned frame = fs->getFrameNumber();

            if ( (frame - _lastTraversalFrame > 1) || (_bornTime == 0.0) )
            {
                _bornTime = fs->getReferenceTime();
                _bornUniform->set( (float)_bornTime );
            }

            _lastTraversalFrame = frame;
        }
    }

    osg::MatrixTransform::traverse( nv );
}
开发者ID:flybpc,项目名称:osgearth,代码行数:37,代码来源:TileNode.cpp


注:本文中的osg::NodeVisitor::getVisitorType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。