Panda3D
trackerNode.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file trackerNode.h
10  * @author drose
11  * @date 2002-03-12
12  */
13 
14 #ifndef TRACKERNODE_H
15 #define TRACKERNODE_H
16 
17 #include "pandabase.h"
18 
19 #include "clientBase.h"
20 #include "trackerData.h"
21 #include "inputDevice.h"
22 #include "dataNode.h"
23 #include "luse.h"
24 #include "linmath_events.h"
25 #include "pointerTo.h"
26 
27 /**
28  * This class reads the position and orientation information from a tracker
29  * device and makes it available as a transformation on the data graph.
30  * It is also the primary interface to a Tracker object associated with a
31  * ClientBase.
32  */
33 class EXPCL_PANDA_DEVICE TrackerNode : public DataNode {
34 PUBLISHED:
35  explicit TrackerNode(ClientBase *client, const std::string &device_name);
36  explicit TrackerNode(InputDevice *device);
37  virtual ~TrackerNode();
38 
39  INLINE bool is_valid() const;
40 
41  INLINE const LPoint3 &get_pos() const;
42  INLINE const LOrientation &get_orient() const;
43  INLINE const LMatrix4 &get_transform() const;
44  INLINE double get_time() const;
45  INLINE bool has_time() const;
46 
47  INLINE void set_tracker_coordinate_system(CoordinateSystem cs);
48  INLINE CoordinateSystem get_tracker_coordinate_system() const;
49 
50  INLINE void set_graph_coordinate_system(CoordinateSystem cs);
51  INLINE CoordinateSystem get_graph_coordinate_system() const;
52 
53 protected:
54  // Inherited from DataNode
55  virtual void do_transmit_data(DataGraphTraverser *trav,
56  const DataNodeTransmit &input,
57  DataNodeTransmit &output);
58 
59 private:
60  // outputs
61  int _transform_output;
62 
63  CPT(TransformState) _transform;
64 
65 private:
66  PT(InputDevice) _tracker;
67  TrackerData _data;
68  LMatrix4 _mat;
69  CoordinateSystem _tracker_cs, _graph_cs;
70 
71 public:
72  static TypeHandle get_class_type() {
73  return _type_handle;
74  }
75  static void init_type() {
76  DataNode::init_type();
77  register_type(_type_handle, "TrackerNode",
78  DataNode::get_class_type());
79  }
80  virtual TypeHandle get_type() const {
81  return get_class_type();
82  }
83  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
84 
85 private:
86  static TypeHandle _type_handle;
87 };
88 
89 #include "trackerNode.I"
90 
91 #endif
The fundamental type of node for the data graph.
Definition: dataNode.h:52
Indicates a coordinate-system transform on vertices.
This class reads the position and orientation information from a tracker device and makes it availabl...
Definition: trackerNode.h:33
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a structure representing a single input device.
Definition: inputDevice.h:53
Stores the kinds of data that a tracker might output.
Definition: trackerData.h:23
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An abstract base class for a family of client device interfaces–including trackers,...
Definition: clientBase.h:43
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...