trackerNode.I 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Filename: trackerNode.I
  2. // Created by: drose (12Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. ////////////////////////////////////////////////////////////////////
  15. // Function: TrackerNode::is_valid
  16. // Access: Public
  17. // Description: Returns true if the TrackerNode is valid and
  18. // connected to a server, false otherwise.
  19. ////////////////////////////////////////////////////////////////////
  20. INLINE bool TrackerNode::
  21. is_valid() const {
  22. return (_tracker != (ClientTrackerDevice *)NULL) && _tracker->is_connected();
  23. }
  24. ////////////////////////////////////////////////////////////////////
  25. // Function: TrackerNode::get_pos
  26. // Access: Public
  27. // Description: Returns the current position of the tracker, if it is
  28. // available.
  29. ////////////////////////////////////////////////////////////////////
  30. INLINE const LPoint3f &TrackerNode::
  31. get_pos() const {
  32. return _data.get_pos();
  33. }
  34. ////////////////////////////////////////////////////////////////////
  35. // Function: TrackerNode::get_orient
  36. // Access: Public
  37. // Description: Returns the current orientation of the tracker, if it
  38. // is available.
  39. ////////////////////////////////////////////////////////////////////
  40. INLINE const LOrientationf &TrackerNode::
  41. get_orient() const {
  42. return _data.get_orient();
  43. }
  44. ////////////////////////////////////////////////////////////////////
  45. // Function: TrackerNode::get_time
  46. // Access: Public
  47. // Description: Returns the time of the tracker's last update.
  48. ////////////////////////////////////////////////////////////////////
  49. INLINE double TrackerNode::
  50. get_time() const {
  51. return _data.get_time();
  52. }
  53. ////////////////////////////////////////////////////////////////////
  54. // Function: TrackerNode::has_time
  55. // Access: Public
  56. // Description: True if this data comes with timestamps.
  57. ////////////////////////////////////////////////////////////////////
  58. INLINE bool TrackerNode::
  59. has_time() const {
  60. return _data.has_time();
  61. }
  62. ////////////////////////////////////////////////////////////////////
  63. // Function: TrackerNode::get_transform
  64. // Access: Public
  65. // Description: Returns the current position and orientation of the
  66. // tracker, as a combined matrix.
  67. ////////////////////////////////////////////////////////////////////
  68. INLINE const LMatrix4f &TrackerNode::
  69. get_transform() const {
  70. return _mat;
  71. }
  72. ////////////////////////////////////////////////////////////////////
  73. // Function: TrackerNode::set_tracker_coordinate_system
  74. // Access: Published
  75. // Description: Specifies the coordinate system that the tracker
  76. // associated with this node will operate in. Normally,
  77. // this is set from the ClientBase that's used to create
  78. // the TrackerNode, so it should not need to be set on
  79. // an individual tracker basis.
  80. ////////////////////////////////////////////////////////////////////
  81. INLINE void TrackerNode::
  82. set_tracker_coordinate_system(CoordinateSystem cs) {
  83. _tracker_cs = cs;
  84. if (_tracker_cs == CS_default) {
  85. _tracker_cs = get_default_coordinate_system();
  86. }
  87. }
  88. ////////////////////////////////////////////////////////////////////
  89. // Function: TrackerNode::get_tracker_coordinate_system
  90. // Access: Published
  91. // Description: Returns the coordinate system that the tracker
  92. // associated with this node will operate in.
  93. ////////////////////////////////////////////////////////////////////
  94. INLINE CoordinateSystem TrackerNode::
  95. get_tracker_coordinate_system() const {
  96. return _tracker_cs;
  97. }
  98. ////////////////////////////////////////////////////////////////////
  99. // Function: TrackerNode::set_graph_coordinate_system
  100. // Access: Published
  101. // Description: Specifies the coordinate system that the TrackerNode
  102. // will convert its transform into for passing down the
  103. // data graph. Normally, this is CS_default.
  104. ////////////////////////////////////////////////////////////////////
  105. INLINE void TrackerNode::
  106. set_graph_coordinate_system(CoordinateSystem cs) {
  107. _graph_cs = cs;
  108. if (_graph_cs == CS_default) {
  109. _graph_cs = get_default_coordinate_system();
  110. }
  111. }
  112. ////////////////////////////////////////////////////////////////////
  113. // Function: TrackerNode::get_graph_coordinate_system
  114. // Access: Published
  115. // Description: Returns the coordinate system that the TrackerNode
  116. // will convert its transform into for passing down the
  117. // data graph. Normally, this is CS_default.
  118. ////////////////////////////////////////////////////////////////////
  119. INLINE CoordinateSystem TrackerNode::
  120. get_graph_coordinate_system() const {
  121. return _graph_cs;
  122. }