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


C++ PNode::name方法代码示例

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


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

示例1: unpack

pbool PScene::unpack(const PXmlElement* xmlElement)
{
    // Sanity check
    if (pstrcmp(xmlElement->name(), "scene") != 0)
    {
        PLOG_ERROR("It is not a scene element");
        return false;
    }

    // Delete all scene nodes
    PDELETE(m_root);

    PResourceManager *resourceManager = context()->module<PResourceManager>("resource-manager");

    // Delete all effects
    PList<PAbstractEffect *>::iterator it = m_effects.begin();
    PList<PAbstractEffect *>::iterator ie = m_effects.end();
    while (it != ie)
    {
        PAbstractEffect *effect = *it;
        effect->m_scene = P_NULL;
        PDELETE(effect);
        ++it;
    }

    // Recursively unpack its children
    PXmlElement childElement = xmlElement->firstChild();
    while (childElement.isValid())
    {
        if (pstrcmp(childElement.name(), "root") == 0)
        {
            const pchar *rootNameValue = childElement.attribute("name");
            PASSERT(rootNameValue != P_NULL);
            m_root = PNEW(PRootNode(rootNameValue, this));
            if (!m_root->unpack(&childElement))
            {
                return false;
            }
        }
        else if (pstrcmp(childElement.name(), "effect") == 0)
        {
            PAbstractEffect *effect = s_effectFactory.unpack(&childElement, this);
            if (effect == P_NULL)
            {
                return false;
            }
        }
        else if (pstrcmp(childElement.name(), "texture") == 0)
        {
            const pchar *textureId = childElement.attribute("id");
            if (textureId != P_NULL)
            {
                PTexture *texture = resourceManager->getTexture(textureId);
                if (texture == P_NULL)
                {
                    PLOG_ERROR("Failed to find texture %s.", textureId);
                }
                else
                {
                    const pchar *wrapValue = childElement.attribute("wrap");
                    if (wrapValue != P_NULL)
                    {
                        if (pstrcmp(wrapValue, "repeat") == 0)
                        {
                            texture->setRepeatWrappingEnabled(true, true);
                        }
                    }
                    
                    const pchar *mipmapValue = childElement.attribute("mipmap");
                    if (mipmapValue != P_NULL)
                    {
                        if (pstrcmp(mipmapValue, "true") == 0)
                        {
                            // TODO:
                            PASSERT_NOTIMPLEMENTED();
                        }
                    }
                }
            }
            else
            {
                PLOG_ERROR("Failed to find the id of the texture is missing.");
            }
        }
        else
        {
            PLOG_WARNING("Unknown element node (%s) in scene.", childElement.name());
        }

        childElement = childElement.nextSibling();
    } 

    // Find the main camera.
    const pchar *mainCameraValue = xmlElement->attribute("maincamera");
    m_mainCamera = P_NULL;
    if (mainCameraValue == P_NULL)
    {
        // When the main camera is not specified, use the first camera in the 
        // scene nodes as the main camera.
        PNode::iterator ni(m_root);
//.........这里部分代码省略.........
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:101,代码来源:pscene.cpp


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