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