本文整理汇总了C++中osg::NodeVisitor::getTraversalMask方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVisitor::getTraversalMask方法的具体用法?C++ NodeVisitor::getTraversalMask怎么用?C++ NodeVisitor::getTraversalMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodeVisitor
的用法示例。
在下文中一共展示了NodeVisitor::getTraversalMask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPerViewData
void
OverlayDecorator::traverse( osg::NodeVisitor& nv )
{
bool defaultTraversal = true;
// in the CULL traversal, find the per-view data associated with the
// cull visitor's current camera view and work with that:
if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
osg::Camera* camera = cv->getCurrentCamera();
if ( camera != 0L && (_rttTraversalMask & nv.getTraversalMask()) != 0 )
{
// access per-camera data to support multi-threading:
PerViewData& pvd = getPerViewData( camera );
// technique-specific setup prior to traversing:
bool hasOverlayData = false;
for(unsigned i=0; i<_techniques.size(); ++i)
{
if ( _techniques[i]->hasData(pvd._techParams[i]) )
{
hasOverlayData = true;
_techniques[i]->preCullTerrain( pvd._techParams[i], cv );
}
}
if ( hasOverlayData )
{
defaultTraversal = false;
// shared terrain culling pass:
cullTerrainAndCalculateRTTParams( cv, pvd );
// prep and traverse the RTT camera(s):
for(unsigned i=0; i<_techniques.size(); ++i)
{
TechRTTParams& params = pvd._techParams[i];
_techniques[i]->cullOverlayGroup( params, cv );
}
}
}
}
else
{
// Some other type of visitor (like update or intersection). Skip the technique
// and traverse the geometry directly.
for(unsigned i=0; i<_overlayGroups.size(); ++i)
{
_overlayGroups[i]->accept( nv );
}
}
if ( defaultTraversal )
{
osg::Group::traverse( nv );
}
}
示例2: getPerViewData
void
OverlayDecorator::traverse( osg::NodeVisitor& nv )
{
if ( _overlayGraph.valid() && _textureUnit.isSet() )
{
// in the CULL traversal, find the per-view data associated with the
// cull visitor's current camera view and work with that:
if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>( &nv );
osg::Camera* camera = cv->getCurrentCamera();
if ( camera != 0L && (_rttTraversalMask & nv.getTraversalMask()) != 0 )
{
PerViewData& pvd = getPerViewData( camera );
if (checkNeedsUpdate(pvd))
{
updateRTTCamera(pvd);
}
if ( pvd._texGen.valid() )
{
// FFP path only
cv->getCurrentRenderBin()->getStage()->addPositionedTextureAttribute(
*_textureUnit, cv->getModelViewMatrix(), pvd._texGen.get() );
}
cull( cv, pvd );
pvd._rttCamera->accept( nv );
}
else
{
osg::Group::traverse(nv);
}
// debug-- (draws the overlay at its native location as well)
//_overlayGraph->accept(nv);
}
else
{
// Some other type of visitor (like update or intersection). Skip the RTT camera
// and traverse the overlay graph directly.
if ( _overlayGraph.valid() )
{
_overlayGraph->accept( nv );
}
osg::Group::traverse( nv );
}
}
else
{
osg::Group::traverse( nv );
}
}
示例3: getPerViewData
void
OverlayDecorator::traverse( osg::NodeVisitor& nv )
{
if ( true ) //if (_totalOverlayChildren > 0 )
{
// in the CULL traversal, find the per-view data associated with the
// cull visitor's current camera view and work with that:
if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>( &nv );
osg::Camera* camera = cv->getCurrentCamera();
if ( camera != 0L && (_rttTraversalMask & nv.getTraversalMask()) != 0 )
{
PerViewData& pvd = getPerViewData( camera );
//TODO:
// check whether we need to recalculate the RTT camera params.
// don't do it if the main camera hasn't moved;
// also, tell the ClampingTech not to re-snap the depth texture
// unless something has changed (e.g. camera params, terrain bounds..?
// what about paging..?)
// technique-specific setup prior to traversing:
for(unsigned i=0; i<_techniques.size(); ++i)
{
_techniques[i]->preCullTerrain( pvd._techParams[i], cv );
}
// shared terrain culling pass:
cullTerrainAndCalculateRTTParams( cv, pvd );
// prep and traverse the RTT camera(s):
for(unsigned i=0; i<_techniques.size(); ++i)
{
TechRTTParams& params = pvd._techParams[i];
_techniques[i]->cullOverlayGroup( params, cv );
}
}
else
{
osg::Group::traverse(nv);
}
}
else
{
// Some other type of visitor (like update or intersection). Skip the technique
// and traverse the geometry directly.
for(unsigned i=0; i<_overlayGroups.size(); ++i)
{
_overlayGroups[i]->accept( nv );
}
osg::Group::traverse( nv );
}
}
else
{
osg::Group::traverse( nv );
}
}