本文整理汇总了C++中osg::LOD::getChild方法的典型用法代码示例。如果您正苦于以下问题:C++ LOD::getChild方法的具体用法?C++ LOD::getChild怎么用?C++ LOD::getChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::LOD
的用法示例。
在下文中一共展示了LOD::getChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guard
void
FltExportVisitor::apply( osg::LOD& lodNode )
{
_firstNode = false;
ScopedStatePushPop guard( this, lodNode.getStateSet() );
// LOD center - same for all children
osg::Vec3d center = lodNode.getCenter();
// Iterate children of the LOD and write a separate LOD record for each,
// with that child's individual switchIn and switchOut properties
for ( size_t i = 0; i < lodNode.getNumChildren(); ++i )
{
osg::Node* lodChild = lodNode.getChild(i);
// Switch-in/switch-out distances may vary per child
double switchInDist = lodNode.getMaxRange(i);
double switchOutDist = lodNode.getMinRange(i);
writeLevelOfDetail( lodNode, center, switchInDist, switchOutDist);
writeMatrix( lodNode.getUserData() );
writeComment( lodNode );
// Traverse each child of the LOD
writePushTraverseWritePop( *lodChild );
}
}
示例2: apply
void apply(osg::LOD& lod)
{
// find the highest LOD:
int minIndex = 0;
float minRange = FLT_MAX;
for(unsigned i=0; i<lod.getNumRanges(); ++i)
{
if ( lod.getRangeList()[i].first < minRange )
{
minRange = lod.getRangeList()[i].first;
minIndex = i;
}
}
//remove all but the highest:
osg::ref_ptr<osg::Node> highestLOD = lod.getChild( minIndex );
lod.removeChildren( 0, lod.getNumChildren() );
//add it back with a full range.
lod.addChild( highestLOD.get(), 0.0f, FLT_MAX );
traverse(lod);
}