本文整理汇总了C++中TilePagedLOD::setNumChildrenThatCannotBeExpired方法的典型用法代码示例。如果您正苦于以下问题:C++ TilePagedLOD::setNumChildrenThatCannotBeExpired方法的具体用法?C++ TilePagedLOD::setNumChildrenThatCannotBeExpired怎么用?C++ TilePagedLOD::setNumChildrenThatCannotBeExpired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TilePagedLOD
的用法示例。
在下文中一共展示了TilePagedLOD::setNumChildrenThatCannotBeExpired方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TerrainNode
void
MPTerrainEngineNode::createTerrain()
{
// scrub the heightfield cache.
if (_tileModelFactory)
_tileModelFactory->getHeightFieldCache()->clear();
// New terrain
_terrain = new TerrainNode( _deadTiles.get() );
this->addChild( _terrain );
// Enable blending on the terrain node; this will result in the underlying
// "empty" globe being transparent instead of white.
if (_terrainOptions.enableBlending().value())
{
_terrain->getOrCreateStateSet()->setMode(GL_BLEND , osg::StateAttribute::ON);
}
// Factory to create the root keys:
KeyNodeFactory* factory = getKeyNodeFactory();
// Build the first level of the terrain.
// Collect the tile keys comprising the root tiles of the terrain.
std::vector< TileKey > keys;
_update_mapf->getProfile()->getAllKeysAtLOD( *_terrainOptions.firstLOD(), keys );
// create a root node for each root tile key.
OE_INFO << LC << "Creating " << keys.size() << " root keys.." << std::endl;
TilePagedLOD* root = new TilePagedLOD( _uid, _liveTiles, _deadTiles );
//osg::Group* root = new osg::Group();
_terrain->addChild( root );
osg::ref_ptr<osgDB::Options> dbOptions = Registry::instance()->cloneOrCreateOptions();
unsigned child = 0;
for( unsigned i=0; i<keys.size(); ++i )
{
osg::ref_ptr<osg::Node> node = factory->createNode( keys[i], true, 0L );
if ( node.valid() )
{
root->addChild( node.get() );
root->setRange( child++, 0.0f, FLT_MAX );
root->setCenter( node->getBound().center() );
root->setNumChildrenThatCannotBeExpired( child );
}
else
{
OE_WARN << LC << "Couldn't make tile for root key: " << keys[i].str() << std::endl;
}
}
_rootTilesRegistered = false;
updateShaders();
}
示例2: _createTerrainTilePagedLOD
//---------------------------------------------
//$$$
void MPTerrainEngineNode::_createTerrainTilePagedLOD()
{
// Factory to create the root keys:
KeyNodeFactory* factory = getKeyNodeFactory();
// Build the first level of the terrain.
// Collect the tile keys comprising the root tiles of the terrain.
std::vector< TileKey > keys;
_update_mapf->getProfile()->getAllKeysAtLOD( *_terrainOptions.firstLOD(), keys );
// create a root node for each root tile key.
OE_INFO << LC << "Creating " << keys.size() << " root keys.." << std::endl;
TilePagedLOD* root = new TilePagedLOD( _uid, _liveTiles, _deadTiles );
//osg::Group* root = new osg::Group();
osg::ref_ptr<osgDB::Options> dbOptions = Registry::instance()->cloneOrCreateOptions();
unsigned child = 0;
std::cout<<"MPTerrainEngineNode::refresh() ( @osgEarthDrivers\\..\\MPTerrainEngineNode.cpp ) : Begin create KeyNode"<<std::endl;//$$$
for( unsigned i=0; i<keys.size(); ++i )
{
osg::ref_ptr<osg::Node> node = factory->createNode( keys[i], true, true, 0L );//$$$这里消耗太多时间了!!阻塞了渲染线程。
if ( node.valid() )
{
root->addChild( node.get() );
root->setRange( child++, 0.0f, FLT_MAX );
root->setCenter( node->getBound().center() );
root->setNumChildrenThatCannotBeExpired( child );
}
else
{
OE_WARN << LC << "Couldn't make tile for root key: " << keys[i].str() << std::endl;
}
}
std::cout<<"After create KeyNode"<<std::endl;//$$$
osgX::StaticOSGViewerAssistant::dealWithUpdateOperation( new RefreshTerrainOperation( this, root ) );
}
示例3: TerrainNode
void
MPTerrainEngineNode::dirtyTerrain()
{
// scrub the heightfield cache.
if (_tileModelFactory)
{
_tileModelFactory->clearCaches();
}
// remove existing:
if ( _terrain )
{
this->removeChild( _terrain );
}
// New terrain
_terrain = new TerrainNode( _deadTiles.get() );
#ifdef USE_RENDER_BINS
_terrain->getOrCreateStateSet()->setRenderBinDetails( 0, _terrainRenderBinPrototype->getName() );
_terrain->getOrCreateStateSet()->setNestRenderBins(false);
#else
_terrain->getOrCreateStateSet()->setRenderBinDetails(0, "SORT_FRONT_TO_BACK");
#endif
this->addChild( _terrain );
// Factory to create the root keys:
KeyNodeFactory* factory = getKeyNodeFactory();
// Build the first level of the terrain.
// Collect the tile keys comprising the root tiles of the terrain.
std::vector< TileKey > keys;
_update_mapf->getProfile()->getAllKeysAtLOD( *_terrainOptions.firstLOD(), keys );
// create a root node for each root tile key.
OE_INFO << LC << "Creating " << keys.size() << " root keys.." << std::endl;
TilePagedLOD* root = new TilePagedLOD( _uid, _liveTiles, _deadTiles );
_terrain->addChild( root );
osg::ref_ptr<osgDB::Options> dbOptions = Registry::instance()->cloneOrCreateOptions();
unsigned child = 0;
for( unsigned i=0; i<keys.size(); ++i )
{
osg::ref_ptr<osg::Node> node = factory->createNode( keys[i], true, true, 0L );
if ( node.valid() )
{
root->addChild( node.get() );
root->setRange( child++, 0.0f, FLT_MAX );
root->setCenter( node->getBound().center() );
root->setNumChildrenThatCannotBeExpired( child );
}
else
{
OE_WARN << LC << "Couldn't make tile for root key: " << keys[i].str() << std::endl;
}
}
_rootTilesRegistered = false;
updateState();
// Call the base class
TerrainEngineNode::dirtyTerrain();
}