00001 // Filename: trackerNode.I 00002 // Created by: drose (12Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: TrackerNode::is_valid 00021 // Access: Public 00022 // Description: Returns true if the TrackerNode is valid and 00023 // connected to a server, false otherwise. 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE bool TrackerNode:: 00026 is_valid() const { 00027 return (_tracker != (ClientTrackerDevice *)NULL) && _tracker->is_connected(); 00028 } 00029 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: TrackerNode::get_pos 00033 // Access: Public 00034 // Description: Returns the current position of the tracker, if it is 00035 // available. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE const LPoint3f &TrackerNode:: 00038 get_pos() const { 00039 return _data.get_pos(); 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: TrackerNode::get_orient 00044 // Access: Public 00045 // Description: Returns the current orientation of the tracker, if it 00046 // is available. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE const LOrientationf &TrackerNode:: 00049 get_orient() const { 00050 return _data.get_orient(); 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: TrackerNode::get_transform 00055 // Access: Public 00056 // Description: Returns the current position and orientation of the 00057 // tracker, as a combined matrix. 00058 //////////////////////////////////////////////////////////////////// 00059 INLINE const LMatrix4f &TrackerNode:: 00060 get_transform() const { 00061 return _mat; 00062 } 00063 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: TrackerNode::set_tracker_coordinate_system 00067 // Access: Published 00068 // Description: Specifies the coordinate system that the tracker 00069 // associated with this node will operate in. Normally, 00070 // this is set from the ClientBase that's used to create 00071 // the TrackerNode, so it should not need to be set on 00072 // an individual tracker basis. 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE void TrackerNode:: 00075 set_tracker_coordinate_system(CoordinateSystem cs) { 00076 _tracker_cs = cs; 00077 if (_tracker_cs == CS_default) { 00078 _tracker_cs = default_coordinate_system; 00079 } 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: TrackerNode::get_tracker_coordinate_system 00084 // Access: Published 00085 // Description: Returns the coordinate system that the tracker 00086 // associated with this node will operate in. 00087 //////////////////////////////////////////////////////////////////// 00088 INLINE CoordinateSystem TrackerNode:: 00089 get_tracker_coordinate_system() const { 00090 return _tracker_cs; 00091 } 00092 00093 //////////////////////////////////////////////////////////////////// 00094 // Function: TrackerNode::set_graph_coordinate_system 00095 // Access: Published 00096 // Description: Specifies the coordinate system that the TrackerNode 00097 // will convert its transform into for passing down the 00098 // data graph. Normally, this is CS_default. 00099 //////////////////////////////////////////////////////////////////// 00100 INLINE void TrackerNode:: 00101 set_graph_coordinate_system(CoordinateSystem cs) { 00102 _graph_cs = cs; 00103 if (_graph_cs == CS_default) { 00104 _graph_cs = default_coordinate_system; 00105 } 00106 } 00107 00108 //////////////////////////////////////////////////////////////////// 00109 // Function: TrackerNode::get_graph_coordinate_system 00110 // Access: Published 00111 // Description: Returns the coordinate system that the TrackerNode 00112 // will convert its transform into for passing down the 00113 // data graph. Normally, this is CS_default. 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE CoordinateSystem TrackerNode:: 00116 get_graph_coordinate_system() const { 00117 return _graph_cs; 00118 }