本文整理汇总了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);
//.........这里部分代码省略.........