目标:(十二)中的问题28
在rex引擎setMap时初始化该变量,主要用于记录一些信息。
osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp
void
RexTerrainEngineNode::setMap(const Map* map, const TerrainOptions& options)
{
_selectionInfo.initialize(
0u, // always zero, not the terrain options firstLOD
std::min( _terrainOptions.maxLOD().get(), maxLOD ),
_mapFrame.getMapInfo().getProfile(),
_terrainOptions.minTileRangeFactor().get() );
}
1、记录每一级瓦片的可视化距离
2、记录每一级瓦片颜色渐变(morph)的起始距离和终止距离
osgEarthDrivers/engine_rex/SelectionInfo
/**
* SelectionInfo is a data structure that holds the LOD distance switching
* information for the terrain, to support paging and LOD morphing.
* This is calculated once when the terrain is first created.
*/
class SelectionInfo
{
unsigned _numLods;//记录LOD层级数,默认是20
std::pair<unsigned, unsigned> _uiGridDimensions;//没有实际意义
std::vector<VisParameters> _vecVisParams;//最重要,记录各级的可视距离和渐变距离
unsigned _uiFirstLOD;//第一级lod从哪开始,默认是0
static const double _fMorphStartRatio; //用于确定渐变起始距离的参数
// This is the lod at which morphing should start (used by shader)
// 这个变量没有实际意义
static const unsigned _uiLODForMorphingRoundEarth;
// This is used to determine _numLods given a fLodFar during initialize
// initialize. This is the distance beyond which further lods (and
// hence VisParameters) are not generated
// 这个变量没有实际意义
static const double _fLodLowerBound;
}
在rex引擎创建时,会创建选择信息结构体SelectionInfo _selectionInfo;该结构体包含了lod切换的距离设置的参数信息,在判断TileNode瓦片是否还能细分时会用到该变量。
osgEarthDrivers/engine_rex/TileNode.cpp
bool
TileNode::shouldSubDivide(TerrainCuller* culler, const SelectionInfo& selectionInfo)
{
}
在创建时也会用到,主要设设置瓦片的渐变参数
osgEarthDrivers/engine_rex/TileNode.cpp
void
TileNode::create(const TileKey& key, TileNode* parent, EngineCo