Panda3D
 All Classes Functions Variables Enumerations
trackerNode.h
1 // Filename: trackerNode.h
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 #ifndef TRACKERNODE_H
16 #define TRACKERNODE_H
17 
18 #include "pandabase.h"
19 
20 #include "clientBase.h"
21 #include "trackerData.h"
22 #include "clientTrackerDevice.h"
23 #include "dataNode.h"
24 #include "luse.h"
25 #include "linmath_events.h"
26 #include "pointerTo.h"
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : TrackerNode
30 // Description : This is the primary interface to a Tracker object
31 // associated with a ClientBase. It reads the position
32 // and orientation information from the tracker and
33 // makes it available as a transformation on the data
34 // graph.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_PANDA_DEVICE TrackerNode : public DataNode {
37 PUBLISHED:
38  TrackerNode(ClientBase *client, const string &device_name);
40  virtual ~TrackerNode();
41 
42  INLINE bool is_valid() const;
43 
44  INLINE const LPoint3 &get_pos() const;
45  INLINE const LOrientation &get_orient() const;
46  INLINE const LMatrix4 &get_transform() const;
47  INLINE double get_time() const;
48  INLINE bool has_time() const;
49 
50  INLINE void set_tracker_coordinate_system(CoordinateSystem cs);
51  INLINE CoordinateSystem get_tracker_coordinate_system() const;
52 
53  INLINE void set_graph_coordinate_system(CoordinateSystem cs);
54  INLINE CoordinateSystem get_graph_coordinate_system() const;
55 
56 protected:
57  // Inherited from DataNode
58  virtual void do_transmit_data(DataGraphTraverser *trav,
59  const DataNodeTransmit &input,
60  DataNodeTransmit &output);
61 
62 private:
63  // outputs
64  int _transform_output;
65 
66  CPT(TransformState) _transform;
67 
68 private:
69  PT(ClientTrackerDevice) _tracker;
70  TrackerData _data;
71  LMatrix4 _mat;
72  CoordinateSystem _tracker_cs, _graph_cs;
73 
74 public:
75  static TypeHandle get_class_type() {
76  return _type_handle;
77  }
78  static void init_type() {
79  DataNode::init_type();
80  register_type(_type_handle, "TrackerNode",
81  DataNode::get_class_type());
82  }
83  virtual TypeHandle get_type() const {
84  return get_class_type();
85  }
86  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
87 
88 private:
89  static TypeHandle _type_handle;
90 };
91 
92 #include "trackerNode.I"
93 
94 #endif
The fundamental type of node for the data graph.
Definition: dataNode.h:64
This is the primary interface to a Tracker object associated with a ClientBase.
Definition: trackerNode.h:36
This is a unit quaternion representing an orientation.
Definition: lorientation.h:92
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
A device, attached to the ClientBase by a TrackerNode, that records the data from a single tracker de...
Stores the kinds of data that a tracker might output.
Definition: trackerData.h:25
An abstract base class for a family of client device interfaces–including trackers, buttons, dials, and other analog inputs.
Definition: clientBase.h:47
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Encapsulates the data generated from (or sent into) any particular DataNode.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...