当前位置: 首页>>代码示例>>C++>>正文


C++ CNode::getNodeType方法代码示例

本文整理汇总了C++中CNode::getNodeType方法的典型用法代码示例。如果您正苦于以下问题:C++ CNode::getNodeType方法的具体用法?C++ CNode::getNodeType怎么用?C++ CNode::getNodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CNode的用法示例。


在下文中一共展示了CNode::getNodeType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: refresh

void CRenderList::refresh()
{
    m_draw.clear();

    m_drawAlpha.clear();
    m_drawStatic.clear();
    m_drawTransparency.clear();

    u32 size = (u32)m_list.size();
    m_drawAlpha.reserve(size);
    m_drawStatic.reserve(size);
    m_drawTransparency.reserve(size);

    for (std::vector<SNodeList>::iterator iter = m_list.begin(); iter < m_list.end(); ++iter)
    {
        CNode* node = (*iter)._node;
        switch (node->getNodeType())
        {
            case ENodeType::eShape:
            case ENodeType::eMesh:
            case ENodeType::eBillboard:
            case ENodeType::eParticleSystem:
            {
                f32 priority = 0.0f;
                CMesh* mesh = static_cast<CMesh*>(node);
                const MaterialPtr& material = mesh->getMaterial();
                if (material->getTransparency() < 1.0f)
                {
                    if (m_camera)
                    {
                        priority = (node->getAbsPosition() - m_camera->getAbsPosition()).length();
                    }
                    else
                    {
                        priority = node->getAbsPosition().z;
                    }
                    node->setPriority(priority);

                    if (checkDistance(node, priority))
                    {
                        m_drawTransparency.push_back((*iter));
                    }
                }
                else if (mesh->getRenderTechique()->getRenderPass((*iter)._passIndex)->getRenderState()->isBlend())
                {
                    if (m_camera)
                    {
                        priority = (node->getAbsPosition() - m_camera->getAbsPosition()).length();
                    }
                    else
                    {
                        priority = node->getAbsPosition().z;
                    }
                    node->setPriority(priority);

                    if (checkDistance(node, priority))
                    {
                        m_drawAlpha.push_back((*iter));
                    }
                }
                else
                {
                    if (checkDistance(node, priority))
                    {
                        m_drawStatic.push_back((*iter));
                    }
                }
            }
                break;

            case ENodeType::eCamera:
            {
                /*node->setPriority(k_maxPriority);
                if (static_cast<CCamera*>(node)->isActive())
                {
                    m_update.push_back(node);
                }*/
            }
                break;

            case ENodeType::eSkyBox:
            {
                node->setPriority(k_maxPriority);
                m_drawStatic.push_back((*iter));
            }
                break;

            case ENodeType::eLight:
            case ENodeType::eFog:
            {
                node->setPriority(-k_maxPriority);
            }
                break;

            case ENodeType::eText:
            {
                node->setPriority(0.0f);

                CText* text = static_cast<CText*>(node);
                const MaterialPtr& material = text->getMaterial();
//.........这里部分代码省略.........
开发者ID:fedoriusv,项目名称:V3DEngine,代码行数:101,代码来源:RenderList.cpp


注:本文中的CNode::getNodeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。