本文整理汇总了C++中osg::PagedLOD::getNumChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ PagedLOD::getNumChildren方法的具体用法?C++ PagedLOD::getNumChildren怎么用?C++ PagedLOD::getNumChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::PagedLOD
的用法示例。
在下文中一共展示了PagedLOD::getNumChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushStateSet
void
CountsVisitor::apply(osg::PagedLOD& node)
{
pushStateSet(node.getStateSet());
osg::Group* grp = node.getParent(0);
osg::Group* gPar = NULL;
if (grp)
gPar = grp->getParent(0);
apply(node.getStateSet());
_pagedLods++;
osg::ref_ptr<osg::Object> rp = (osg::Object*)&node;
_uPagedLods.insert(rp);
_totalChildren += node.getNumChildren();
if (++_depth > _maxDepth)
_maxDepth = _depth;
traverse((osg::Node&)node);
_depth--;
popStateSet();
}
示例2: apply
void IntersectionVisitor::apply(osg::PagedLOD& plod)
{
if (!enter(plod)) return;
if (plod.getNumFileNames()>0)
{
#if 1
// Identify the range value for the highest res child
float targetRangeValue;
if( plod.getRangeMode() == osg::LOD::DISTANCE_FROM_EYE_POINT )
targetRangeValue = 1e6; // Init high to find min value
else
targetRangeValue = 0; // Init low to find max value
const osg::LOD::RangeList rl = plod.getRangeList();
osg::LOD::RangeList::const_iterator rit;
for( rit = rl.begin();
rit != rl.end();
rit++ )
{
if( plod.getRangeMode() == osg::LOD::DISTANCE_FROM_EYE_POINT )
{
if( rit->first < targetRangeValue )
targetRangeValue = rit->first;
}
else
{
if( rit->first > targetRangeValue )
targetRangeValue = rit->first;
}
}
// Perform an intersection test only on children that display
// at the maximum resolution.
unsigned int childIndex;
for( rit = rl.begin(), childIndex = 0;
rit != rl.end();
rit++, childIndex++ )
{
if( rit->first != targetRangeValue )
// This is not one of the highest res children
continue;
osg::ref_ptr<osg::Node> child( NULL );
if( plod.getNumChildren() > childIndex )
child = plod.getChild( childIndex );
if( (!child.valid()) && (_readCallback.valid()) )
{
// Child is NULL; attempt to load it, if we have a readCallback...
unsigned int validIndex( childIndex );
if (plod.getNumFileNames() <= childIndex)
validIndex = plod.getNumFileNames()-1;
child = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName( validIndex ) );
}
if ( !child.valid() && plod.getNumChildren()>0)
{
// Child is still NULL, so just use the one at the end of the list.
child = plod.getChild( plod.getNumChildren()-1 );
}
if (child.valid())
{
child->accept(*this);
}
}
#else
// older code than above block, that assumes that the PagedLOD is ordered correctly
// i.e. low res children first, no duplicate ranges.
osg::ref_ptr<osg::Node> highestResChild;
if (plod.getNumFileNames() != plod.getNumChildren() && _readCallback.valid())
{
highestResChild = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName(plod.getNumFileNames()-1) );
}
if ( !highestResChild.valid() && plod.getNumChildren()>0)
{
highestResChild = plod.getChild( plod.getNumChildren()-1 );
}
if (highestResChild.valid())
{
highestResChild->accept(*this);
}
#endif
}
leave();
}