osgEarth的Rex引擎原理分析(六十四)EngineContext的作用

osgEarth的Rex引擎EngineContext作用分析
EngineContext在osgEarth的Rex引擎中扮演关键角色,它用于存储RexTerrainEngineNode的各种信息,包括地形引擎的核心组件。此博客将详细探讨EngineContext在构建引擎上下文时的作用,以及它如何影响 RexTerrainEngineNode 的功能。

目标:(五十五)中的问题135

EngineContext的作用,主要是用来记录RexTerrainEngineNode方方面面的信息的。

在rex引擎构建时,创建该上下文,并将引擎的四梁八柱信息都存放在该上下文环境中。

osgEarthDrivers/engine_rex/RexTerrainEngineNode
class RexTerrainEngineNode : public TerrainEngineNode
{
    osg::ref_ptr< EngineContext > _engineContext;
}

osgEarthDrivers/engine_rex/RexTerrainEngineNode.cpp
void
RexTerrainEngineNode::setMap(const Map* map, const TerrainOptions& options)
{
    _engineContext = new EngineContext(
        getMap(),
        this, // engine
        _geometryPool.get(),
        _loader.get(),
        _unloader.get(),
        _rasterizer,
        _liveTiles.get(),
        _renderBindings,
        _terrainOptions,
        _selectionInfo,
        _modifyBBoxCallback.get());
}

 

osgEarthDrivers/engine_rex/EngineContext
class EngineContext : public osg::Referenced
    {
    public:
        EngineContext(
            const Map*                          map,
            TerrainEngineNode*                  engine,
            GeometryPool*                       geometryPool,
            Loader*                             loader,
            Unloader*                           unloader,
            TileRasterizer*                     rasterizer,
            TileNodeRegistry*                   liveTiles,
            const RenderBindings&               renderBindings,
            const RexTerrainEngineOptions&      options,
            const SelectionInfo&                selectionInfo,
            ModifyBoundingBoxCallback*          modifyBBoxCallback);
        
        Loader* getLoader() const { return _loader; }

        Unloader* getUnloader() const { return _unloader; }

        const RenderBindings& getRenderBindings() const { return _renderBindings; }

        GeometryPool* getGeometryPool() const { return _geometryPool; }

        // Raw pointer to the Map. Only call this from the MAIN thread. DO NOT access this
        // from a pager thread. Instead, create a MapFrame from it in the MAIN thread and
        // use THAT from the pager thread.
        const Map* getMap() const;

        // only call this variant when it's safe to do s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值