MCPcopy Create free account
hub / github.com/OGRECave/ogre / processLookTarget

Method processLookTarget

PlugIns/DotScene/src/DotSceneLoader.cpp:541–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541void DotSceneLoader::processLookTarget(pugi::xml_node& XMLNode, SceneNode* pParent)
542{
543 //! @todo Is this correct? Cause I don't have a clue actually
544
545 // Process attributes
546 String nodeName = getAttrib(XMLNode, "nodeName");
547
548 LogManager::getSingleton().logMessage("[DotSceneLoader] Processing Look Target, nodeName: " + nodeName, LML_TRIVIAL);
549
550 Node::TransformSpace relativeTo = Node::TS_PARENT;
551 String sValue = getAttrib(XMLNode, "relativeTo");
552 if (sValue == "local")
553 relativeTo = Node::TS_LOCAL;
554 else if (sValue == "parent")
555 relativeTo = Node::TS_PARENT;
556 else if (sValue == "world")
557 relativeTo = Node::TS_WORLD;
558
559 // Process position (?)
560 Vector3 position;
561 if (auto pElement = XMLNode.child("position"))
562 position = parseVector3(pElement);
563
564 // Process localDirection (?)
565 Vector3 localDirection = Vector3::NEGATIVE_UNIT_Z;
566 if (auto pElement = XMLNode.child("localDirection"))
567 localDirection = parseVector3(pElement);
568
569 // Setup the look target
570 try
571 {
572 if (!nodeName.empty())
573 {
574 SceneNode* pLookNode = mSceneMgr->getSceneNode(nodeName);
575 position = pLookNode->_getDerivedPosition();
576 }
577
578 pParent->lookAt(position, relativeTo, localDirection);
579 }
580 catch (const Exception& e)
581 {
582 LogManager::getSingleton().logError("DotSceneLoader - " + e.getDescription());
583 }
584}
585
586void DotSceneLoader::processTrackTarget(pugi::xml_node& XMLNode, SceneNode* pParent)
587{

Callers

nothing calls this directly

Calls 8

getAttribFunction · 0.85
getSceneNodeMethod · 0.80
logErrorMethod · 0.80
parseVector3Function · 0.70
logMessageMethod · 0.45
emptyMethod · 0.45
lookAtMethod · 0.45
getDescriptionMethod · 0.45

Tested by

no test coverage detected