osgEarth的Rex引擎原理分析(一一零)state中_defineMap构建过程

本文深入探讨osgEarth的Rex引擎,在绘制过程中如何构建_state中的_defineMap。详细分析了从状态集StateSet到_state的不同部分,包括模式、属性、一致变量和定义的整合过程,并列出了一系列相关问题进行逐步解答。
摘要由CSDN通过智能技术生成

目标:(一零九)中的问题195

是在绘制过程中,每经过一个状态集StateSet就会将该状态集中的模式、属性、一致变量、定义都放入State的相应变量中。定义都放入_defineMap.

 

osg/State.cpp
void State::pushStateSet(const StateSet* dstate)
{
        pushModeList(_modeMap,dstate->getModeList());
        pushAttributeList(_attributeMap,dstate->getAttributeList());
        pushUniformList(_uniformMap,dstate->getUniformList());
        pushDefineList(_defineMap,dstate->getDefineList());
}

_defineMap的构建过程如下:

osg/State.cpp
inline void State::pushDefineList(DefineMap& defineMap,const StateSet::DefineList& defineList)
{
    for(StateSet::DefineList::const_iterator aitr=defineList.begin();
        aitr!=defineList.end();
        ++aitr)
    {
        // get the attribute stack for incoming type {aitr->first}.
        DefineStack& ds = defineMap.map[aitr->first];
        DefineStack::DefineVec& dv = ds.defineVec;
        if (dv.empty())
        {
            // first pair so simply push incoming pair to back.
            dv.push_back(StateSet::DefinePair(aitr->second.first,aitr->second.second));

            ds.changed = true;
            defineMap.changed = true;
        }
        else if ((ds.defineVec.back().second & StateAttribute::OVERRIDE) && !(aitr->second.second & StateAttribute::PROTECTED)) // check the existing override flag
        {
            // push existing back since override keeps the previous value.
            ds.defineVec.push_back(ds.defineVec.back());
        }
        else
        {
            // no override on so simply push incoming pair to back.
            dv.push_back(StateSet::DefinePair(aitr->second.first,aitr->second.second));

            // if the back of the stack has changed since the last then mark it as changed.
            bool changed = (dv[dv.size()-2] != dv.back());
            if (changed)
            {
                ds.changed = true;
                defineMap.changed = true;
            }
        }
    }
}

 

 

待继续分析列表:

9、earth文件中都有哪些options((九)中问题)

10、如何根据earth文件options创建不同的地理信息引擎节点((九)中问题)

11、rex地理信息引擎的四梁八柱((九)中问题)

12、osgEarth::TerrainEngineNode中setMap方法作用((十二)中问题)

13、RexTerrainEngineNode中_mapFrame的作用((十二)中问题)

14、地形变形(Terrain morphing)((十二)中问题)

15、地球瓦片过期门限的含义((十二)中问题)

16、高分辨率优先的含义((十二)中问题)

17、OSGEARTH_DEBUG_NORMALS环境变量的作用((十二)中问题)

18、活跃瓦片寄存器的作用((十二)中问题)

19、资源释放器子节点的作用((十二)中问题)

20、共享几何图形池子节点的作用((十二)中问题)

21、分页瓦片加载器子节点的作用((十二)中问题)

22、分页瓦片卸载器子节点的作用((十二)中问题)

23、栅格化器子节点的作用((十二)中问题)

24、地形子节点的作用((十二)中问题)

25、绑定渲染器的作用((十二)中问题)

26、地图回调函数的作用((十二)中问题)

27、如何将地图图层添

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值