EntityPoint.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #include "core/EntityPoint.h"
  2. #include "core/ConfigVar.h"
  3. #include "core/DebugDraw.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. m_Name( name ),
  8. m_Position( Ogre::Vector3::ZERO ),
  9. m_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 = m_Position;
  22. point1.z += 0.5f;
  23. Ogre::Vector3 point2 = m_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( m_Position, 0, 0, m_Name );
  29. }
  30. }
  31. const Ogre::String&
  32. EntityPoint::GetName() const
  33. {
  34. return m_Name;
  35. }
  36. void
  37. EntityPoint::SetPosition( const Ogre::Vector3& point )
  38. {
  39. m_Position = point;
  40. }
  41. const Ogre::Vector3&
  42. EntityPoint::GetPosition() const
  43. {
  44. return m_Position;
  45. }
  46. void
  47. EntityPoint::ScriptGetPosition() const
  48. {
  49. ScriptManager::getSingleton().AddValueToStack( m_Position.x );
  50. ScriptManager::getSingleton().AddValueToStack( m_Position.y );
  51. ScriptManager::getSingleton().AddValueToStack( m_Position.z );
  52. }
  53. void
  54. EntityPoint::SetRotation( const float rotation )
  55. {
  56. m_Rotation = rotation;
  57. }
  58. float
  59. EntityPoint::GetRotation() const
  60. {
  61. return m_Rotation;
  62. }
  63. float
  64. EntityPoint::ScriptGetRotation() const
  65. {
  66. return m_Rotation;
  67. }