camera.cpp 804 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "camera.h"
  2. #include "core.h"
  3. namespace wp
  4. {
  5. camera::camera (json json_data)
  6. {
  7. json::const_iterator center_it = json_data.find ("center");
  8. json::const_iterator eye_it = json_data.find ("eye");
  9. json::const_iterator up_it = json_data .find ("up");
  10. if (center_it != json_data.end ())
  11. {
  12. // get center value first
  13. std::string center = *center_it;
  14. this->m_center = core::ato3vf(center.c_str());
  15. }
  16. if (eye_it != json_data.end ())
  17. {
  18. std::string eye = *eye_it;
  19. this->m_eye = core::ato3vf(eye.c_str());
  20. }
  21. if (up_it != json_data.end ())
  22. {
  23. std::string up = *up_it;
  24. this->m_up = core::ato3vf(up.c_str());
  25. }
  26. }
  27. }