Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. void ingameState::_setMapCamera(const TiXmlElement* root)
  2. {
  3. const TiXmlElement* nodes = root->FirstChildElement();
  4. while (nodes)
  5. {
  6. const std::string value = nodes->Value();
  7. k::camera* camera = k::renderer::getSingleton().getCamera();
  8. if (!camera)
  9. {
  10. K_LOG_INFO("Failed to load renderer default camera.");
  11. return;
  12. }
  13.  
  14. if (value == "position")
  15. {
  16. k::vector3 position;
  17. position.x = atof(nodes->Attribute("x"));
  18. position.y = atof(nodes->Attribute("y"));
  19. position.z = atof(nodes->Attribute("z"));
  20.  
  21. camera->setPosition(position);
  22. }
  23. else
  24. if (value == "quaternion")
  25. {
  26. k::quaternion rotation;
  27. rotation.x = atof(nodes->Attribute("x"));
  28. rotation.y = atof(nodes->Attribute("y"));
  29. rotation.z = atof(nodes->Attribute("z"));
  30. rotation.w = atof(nodes->Attribute("w"));
  31.  
  32. camera->setOrientation(rotation);
  33. }
  34.  
  35. nodes = nodes->NextSiblingElement();
  36. }
  37. }
Add Comment
Please, Sign In to add comment