本文整理汇总了C++中ogre::SceneNode::setInitialState方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::setInitialState方法的具体用法?C++ SceneNode::setInitialState怎么用?C++ SceneNode::setInitialState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::setInitialState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSceneNodes
bool VehicleRenderable::loadSceneNodes(TinyXml::TiXmlElement* ele)
{
TinyXml::TiXmlElement* nodeEle = ele->FirstChildElement("node");
while (nodeEle)
{
Ogre::String name = getAttrib(nodeEle, "name");
Ogre::SceneNode* node = NULL;
if (name.empty())
node = mAttachNode->createChildSceneNode();
else
node = mAttachNode->createChildSceneNode(name);
mSceneNodes.push_back(node);
Ogre::LogManager::getSingleton().
logMessage("VehicleRenderable : parsing <" + name + "> node...");
//process position
TinyXml::TiXmlElement* pos = nodeEle->FirstChildElement("position");
node->setPosition(parseVector3(pos));
node->setInitialState();
//process scale
TinyXml::TiXmlElement* scale = nodeEle->FirstChildElement("scale");
node->setScale(parseVector3(scale));
node->setInitialState();
//process rotate
TinyXml::TiXmlElement* rotate = nodeEle->FirstChildElement("rotation");
node->setOrientation(parseQuaternion(rotate));
node->setInitialState();
//process entities
TinyXml::TiXmlElement* entity = nodeEle->FirstChildElement("entity");
while (entity)
{
if (!loadEntity(entity, node))
return false;
entity = entity->NextSiblingElement("entity");
}
nodeEle = nodeEle->NextSiblingElement("node");
}
return true;
}
示例2: processNode
void DotSceneLoader::processNode(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
// Construct the node's name
Ogre::String name = m_sPrependNode + getAttrib(XMLNode, "name");
// Create the scene node
Ogre::SceneNode *pNode;
if (name.empty())
{
// Let Ogre choose the name
if (pParent)
pNode = pParent->createChildSceneNode();
else
pNode = mAttachNode->createChildSceneNode();
}
else
{
// Provide the name
if (pParent)
pNode = pParent->createChildSceneNode(name);
else
pNode = mAttachNode->createChildSceneNode(name);
}
// Process other attributes
Ogre::String id = getAttrib(XMLNode, "id");
bool isTarget = getAttribBool(XMLNode, "isTarget");
rapidxml::xml_node<>* pElement;
// Process position (?)
pElement = XMLNode->first_node("position");
if (pElement)
{
pNode->setPosition(parseVector3(pElement));
pNode->setInitialState();
}
// Process rotation (?)
pElement = XMLNode->first_node("rotation");
if (pElement)
{
pNode->setOrientation(parseQuaternion(pElement));
pNode->setInitialState();
}
// Process scale (?)
pElement = XMLNode->first_node("scale");
if (pElement)
{
pNode->setScale(parseVector3(pElement));
pNode->setInitialState();
}
// Process lookTarget (?)
pElement = XMLNode->first_node("lookTarget");
if (pElement)
processLookTarget(pElement, pNode);
// Process trackTarget (?)
pElement = XMLNode->first_node("trackTarget");
if (pElement)
processTrackTarget(pElement, pNode);
// Process node (*)
pElement = XMLNode->first_node("node");
while (pElement)
{
processNode(pElement, pNode);
pElement = pElement->next_sibling("node");
}
// Process entity (*)
pElement = XMLNode->first_node("entity");
while (pElement)
{
processEntity(pElement, pNode);
pElement = pElement->next_sibling("entity");
}
// Process light (*)
//pElement = XMLNode->first_node("light");
//while(pElement)
//{
// processLight(pElement, pNode);
// pElement = pElement->next_sibling("light");
//}
// Process camera (*)
pElement = XMLNode->first_node("camera");
while (pElement)
{
processCamera(pElement, pNode);
pElement = pElement->next_sibling("camera");
}
// Process particleSystem (*)
pElement = XMLNode->first_node("particleSystem");
while (pElement)
{
//.........这里部分代码省略.........
示例3: parseLevelObject
void Level::parseLevelObject(TiXmlElement *XMLNode, Ogre::SceneNode *parent)
{
Ogre::Vector3 spawnPosition;
Ogre::Quaternion spawnRotation;
Ogre::SceneNode* node;
Ogre::String name = getAttribute(XMLNode, "name");
Ogre::String mesh = name;
if(name.empty())
{
// Let Ogre choose the name
if(parent)
node = parent->createChildSceneNode();
else
node = mAttachNode->createChildSceneNode();
}
else
{
// Provide the name
if(parent)
node = parent->createChildSceneNode(name);
else
node = mAttachNode->createChildSceneNode(name);
}
Ogre::String id = getAttribute(XMLNode, "id");
TiXmlElement *element;
element = XMLNode->FirstChildElement("position");
if(element)
{
spawnPosition = parseVector3(element);
node->setPosition(spawnPosition);
node->setInitialState();
}
element = XMLNode->FirstChildElement("rotation");
if(element)
{
node->setOrientation(parseQuaternion(element));
spawnRotation = parseQuaternion(element);
}
element = XMLNode->FirstChildElement("scale");
if(element)
{
node->setScale(parseVector3(element));
node->setInitialState();
}
element = XMLNode->FirstChildElement("node");
while(element)
{
parseLevelObject(element, node);
element = element->NextSiblingElement("node");
}
element = XMLNode->FirstChildElement("entity");
while(element)
{
processEntity(element, node);
element = element->NextSiblingElement("entity");
}
}