osgEarth的Rex引擎原理分析(十三)选择信息的作用

目标:(十二)中的问题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
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值