EntityPoint.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #include "core/ConfigVar.h"
  2. #include "core/DebugDraw.h"
  3. #include "core/EntityPoint.h"
  4. #include "core/ScriptManager.h"
  5. ConfigVar cv_debug_point("debug_point", "Draw point debug info", "false");
  6. EntityPoint::EntityPoint(const Ogre::String& name):
  7. name_(name),
  8. position_(Ogre::Vector3::ZERO),
  9. rotation_(0)
  10. {
  11. }
  12. EntityPoint::~EntityPoint()
  13. {
  14. }
  15. void
  16. EntityPoint::UpdateDebug()
  17. {
  18. if(cv_debug_point.GetB() == true)
  19. {
  20. DEBUG_DRAW.SetColour(Ogre::ColourValue::White);
  21. Ogre::Vector3 point1 = position_;
  22. point1.z += 0.5f;
  23. Ogre::Vector3 point2 = position_;
  24. point2.z -= 0.5f;
  25. DEBUG_DRAW.Line3d(point1, point2);
  26. DEBUG_DRAW.SetTextAlignment(DEBUG_DRAW.CENTER);
  27. DEBUG_DRAW.SetFadeDistance(30, 40);
  28. DEBUG_DRAW.Text(position_, 0, 0, name_);
  29. }
  30. }
  31. const Ogre::String&
  32. EntityPoint::GetName() const
  33. {
  34. return name_;
  35. }
  36. void
  37. EntityPoint::SetPosition(const Ogre::Vector3& point)
  38. {
  39. position_ = point;
  40. }
  41. const Ogre::Vector3&
  42. EntityPoint::GetPosition() const
  43. {
  44. return position_;
  45. }
  46. std::tuple<float, float, float>
  47. EntityPoint::ScriptGetPosition() const
  48. {
  49. return std::make_tuple(position_.x, position_.y, position_.z);
  50. }
  51. void
  52. EntityPoint::SetRotation(const float rotation)
  53. {
  54. rotation_ = rotation;
  55. }
  56. float
  57. EntityPoint::GetRotation() const
  58. {
  59. return rotation_;
  60. }
  61. float
  62. EntityPoint::ScriptGetRotation() const
  63. {
  64. return rotation_;
  65. }