00001 // Filename: trackerNode.h 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 #ifndef TRACKERNODE_H 00020 #define TRACKERNODE_H 00021 00022 #include "pandabase.h" 00023 00024 #include "clientBase.h" 00025 #include "trackerData.h" 00026 #include "clientTrackerDevice.h" 00027 #include "dataNode.h" 00028 #include "luse.h" 00029 #include "linmath_events.h" 00030 #include "pointerTo.h" 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Class : TrackerNode 00034 // Description : This is the primary interface to a Tracker object 00035 // associated with a ClientBase. It reads the position 00036 // and orientation information from the tracker and 00037 // makes it available as a transformation on the data 00038 // graph. 00039 //////////////////////////////////////////////////////////////////// 00040 class EXPCL_PANDA TrackerNode : public DataNode { 00041 PUBLISHED: 00042 TrackerNode(ClientBase *client, const string &device_name); 00043 virtual ~TrackerNode(); 00044 00045 INLINE bool is_valid() const; 00046 00047 INLINE const LPoint3f &get_pos() const; 00048 INLINE const LOrientationf &get_orient() const; 00049 INLINE const LMatrix4f &get_transform() const; 00050 00051 INLINE void set_tracker_coordinate_system(CoordinateSystem cs); 00052 INLINE CoordinateSystem get_tracker_coordinate_system() const; 00053 00054 INLINE void set_graph_coordinate_system(CoordinateSystem cs); 00055 INLINE CoordinateSystem get_graph_coordinate_system() const; 00056 00057 protected: 00058 // Inherited from DataNode 00059 virtual void do_transmit_data(const DataNodeTransmit &input, 00060 DataNodeTransmit &output); 00061 00062 private: 00063 // outputs 00064 int _transform_output; 00065 00066 PT(EventStoreTransform) _transform; 00067 00068 private: 00069 PT(ClientTrackerDevice) _tracker; 00070 TrackerData _data; 00071 LMatrix4f _mat; 00072 CoordinateSystem _tracker_cs, _graph_cs; 00073 00074 public: 00075 static TypeHandle get_class_type() { 00076 return _type_handle; 00077 } 00078 static void init_type() { 00079 DataNode::init_type(); 00080 register_type(_type_handle, "TrackerNode", 00081 DataNode::get_class_type()); 00082 } 00083 virtual TypeHandle get_type() const { 00084 return get_class_type(); 00085 } 00086 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00087 00088 private: 00089 static TypeHandle _type_handle; 00090 }; 00091 00092 #include "trackerNode.I" 00093 00094 #endif