Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ingameState::_setMapCamera(const TiXmlElement* root)
- {
- const TiXmlElement* nodes = root->FirstChildElement();
- while (nodes)
- {
- const std::string value = nodes->Value();
- k::camera* camera = k::renderer::getSingleton().getCamera();
- if (!camera)
- {
- K_LOG_INFO("Failed to load renderer default camera.");
- return;
- }
- if (value == "position")
- {
- k::vector3 position;
- position.x = atof(nodes->Attribute("x"));
- position.y = atof(nodes->Attribute("y"));
- position.z = atof(nodes->Attribute("z"));
- camera->setPosition(position);
- }
- else
- if (value == "quaternion")
- {
- k::quaternion rotation;
- rotation.x = atof(nodes->Attribute("x"));
- rotation.y = atof(nodes->Attribute("y"));
- rotation.z = atof(nodes->Attribute("z"));
- rotation.w = atof(nodes->Attribute("w"));
- camera->setOrientation(rotation);
- }
- nodes = nodes->NextSiblingElement();
- }
- }
Add Comment
Please, Sign In to add comment