本文整理汇总了C++中TileNode::getLocator方法的典型用法代码示例。如果您正苦于以下问题:C++ TileNode::getLocator方法的具体用法?C++ TileNode::getLocator怎么用?C++ TileNode::getLocator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileNode
的用法示例。
在下文中一共展示了TileNode::getLocator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lowerLeft
//.........这里部分代码省略.........
tileNode->setTileModel( model );
tileNode->compile( _modelCompiler.get() );
// assemble a URI for this tile's child group:
std::string uri = Stringify() << model->_tileKey.str() << "." << _engineUID << ".osgearth_engine_mp_tile";
osg::Node* result = 0L;
// Only add the next tile if all the following are true:
// 1. Either there's real tile data, or a minLOD is explicity set in the options;
// 2. The tile isn't blacklisted; and
// 3. We are still below the maximim LOD.
bool wrapInPagedLOD =
(tileHasRealData || (_options.minLOD().isSet() && model->_tileKey.getLOD() < *_options.minLOD())) &&
!osgEarth::Registry::instance()->isBlacklisted( uri ) &&
model->_tileKey.getLOD() < *_options.maxLOD();
if ( wrapInPagedLOD )
{
osg::BoundingSphere bs = tileNode->getBound();
float maxRange = FLT_MAX;
//Compute the min range based on the 2D size of the tile
GeoExtent extent = model->_tileKey.getExtent();
GeoPoint lowerLeft(extent.getSRS(), extent.xMin(), extent.yMin(), 0.0, ALTMODE_ABSOLUTE);
GeoPoint upperRight(extent.getSRS(), extent.xMax(), extent.yMax(), 0.0, ALTMODE_ABSOLUTE);
osg::Vec3d ll, ur;
lowerLeft.toWorld( ll );
upperRight.toWorld( ur );
double radius = (ur - ll).length() / 2.0;
float minRange = (float)(radius * _options.minTileRangeFactor().value());
// create a PLOD so we can keep subdividing:
osg::PagedLOD* plod = new CustomPagedLOD( _liveTiles.get(), _deadTiles.get() );
plod->setCenter( bs.center() );
plod->addChild( tileNode );
plod->setRangeMode( *_options.rangeMode() );
plod->setFileName( 1, uri );
if (plod->getRangeMode() == osg::LOD::PIXEL_SIZE_ON_SCREEN)
{
static const float sqrt2 = sqrt(2.0f);
minRange = 0;
maxRange = (*_options.tilePixelSize()) * sqrt2;
plod->setRange( 0, minRange, maxRange );
plod->setRange( 1, maxRange, FLT_MAX );
}
else
{
plod->setRange( 0, minRange, maxRange );
plod->setRange( 1, 0, minRange );
}
plod->setUserData( new MapNode::TileRangeData(minRange, maxRange) );
#if USE_FILELOCATIONCALLBACK
osgDB::Options* options = Registry::instance()->cloneOrCreateOptions();
options->setFileLocationCallback( new FileLocationCallback() );
plod->setDatabaseOptions( options );
#endif
result = plod;
if ( tileHasLodBlending )
{
// Make the LOD transition distance, and a measure of how
// close the tile is to an LOD change, to shaders.
result->addCullCallback(new LODFactorCallback);
}
}
else
{
result = tileNode;
}
// this cull callback dynamically adjusts the LOD scale based on distance-to-camera:
if ( _options.lodFallOff().isSet() && *_options.lodFallOff() > 0.0 )
{
result->addCullCallback( new DynamicLODScaleCallback(*_options.lodFallOff()) );
}
// this one rejects back-facing tiles:
if ( _mapInfo.isGeocentric() && _options.clusterCulling() == true )
{
osg::HeightField* hf =
model->_elevationData.getHFLayer()->getHeightField();
result->addCullCallback( HeightFieldUtils::createClusterCullingCallback(
hf,
tileNode->getLocator()->getEllipsoidModel(),
*_options.verticalScale() ) );
}
parent->addChild( result );
}