00001 // Filename: trackerNode.I 00002 // Created by: drose (12Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function: TrackerNode::is_valid 00017 // Access: Public 00018 // Description: Returns true if the TrackerNode is valid and 00019 // connected to a server, false otherwise. 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE bool TrackerNode:: 00022 is_valid() const { 00023 return (_tracker != (ClientTrackerDevice *)NULL) && _tracker->is_connected(); 00024 } 00025 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: TrackerNode::get_pos 00029 // Access: Public 00030 // Description: Returns the current position of the tracker, if it is 00031 // available. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE const LPoint3 &TrackerNode:: 00034 get_pos() const { 00035 return _data.get_pos(); 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: TrackerNode::get_orient 00040 // Access: Public 00041 // Description: Returns the current orientation of the tracker, if it 00042 // is available. 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE const LOrientation &TrackerNode:: 00045 get_orient() const { 00046 return _data.get_orient(); 00047 } 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Function: TrackerNode::get_time 00051 // Access: Public 00052 // Description: Returns the time of the tracker's last update. 00053 //////////////////////////////////////////////////////////////////// 00054 INLINE double TrackerNode:: 00055 get_time() const { 00056 return _data.get_time(); 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: TrackerNode::has_time 00061 // Access: Public 00062 // Description: True if this data comes with timestamps. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE bool TrackerNode:: 00065 has_time() const { 00066 return _data.has_time(); 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function: TrackerNode::get_transform 00071 // Access: Public 00072 // Description: Returns the current position and orientation of the 00073 // tracker, as a combined matrix. 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE const LMatrix4 &TrackerNode:: 00076 get_transform() const { 00077 return _mat; 00078 } 00079 00080 00081 //////////////////////////////////////////////////////////////////// 00082 // Function: TrackerNode::set_tracker_coordinate_system 00083 // Access: Published 00084 // Description: Specifies the coordinate system that the tracker 00085 // associated with this node will operate in. Normally, 00086 // this is set from the ClientBase that's used to create 00087 // the TrackerNode, so it should not need to be set on 00088 // an individual tracker basis. 00089 //////////////////////////////////////////////////////////////////// 00090 INLINE void TrackerNode:: 00091 set_tracker_coordinate_system(CoordinateSystem cs) { 00092 _tracker_cs = cs; 00093 if (_tracker_cs == CS_default) { 00094 _tracker_cs = get_default_coordinate_system(); 00095 } 00096 } 00097 00098 //////////////////////////////////////////////////////////////////// 00099 // Function: TrackerNode::get_tracker_coordinate_system 00100 // Access: Published 00101 // Description: Returns the coordinate system that the tracker 00102 // associated with this node will operate in. 00103 //////////////////////////////////////////////////////////////////// 00104 INLINE CoordinateSystem TrackerNode:: 00105 get_tracker_coordinate_system() const { 00106 return _tracker_cs; 00107 } 00108 00109 //////////////////////////////////////////////////////////////////// 00110 // Function: TrackerNode::set_graph_coordinate_system 00111 // Access: Published 00112 // Description: Specifies the coordinate system that the TrackerNode 00113 // will convert its transform into for passing down the 00114 // data graph. Normally, this is CS_default. 00115 //////////////////////////////////////////////////////////////////// 00116 INLINE void TrackerNode:: 00117 set_graph_coordinate_system(CoordinateSystem cs) { 00118 _graph_cs = cs; 00119 if (_graph_cs == CS_default) { 00120 _graph_cs = get_default_coordinate_system(); 00121 } 00122 } 00123 00124 //////////////////////////////////////////////////////////////////// 00125 // Function: TrackerNode::get_graph_coordinate_system 00126 // Access: Published 00127 // Description: Returns the coordinate system that the TrackerNode 00128 // will convert its transform into for passing down the 00129 // data graph. Normally, this is CS_default. 00130 //////////////////////////////////////////////////////////////////// 00131 INLINE CoordinateSystem TrackerNode:: 00132 get_graph_coordinate_system() const { 00133 return _graph_cs; 00134 }