Panda3D
Loading...
Searching...
No Matches
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 */
33class EXPCL_PANDA_DEVICE TrackerNode : public DataNode {
34PUBLISHED:
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
53protected:
54 // Inherited from DataNode
55 virtual void do_transmit_data(DataGraphTraverser *trav,
56 const DataNodeTransmit &input,
57 DataNodeTransmit &output);
58
59private:
60 // outputs
61 int _transform_output;
62
63 CPT(TransformState) _transform;
64
65private:
66 PT(InputDevice) _tracker;
67 TrackerData _data;
68 LMatrix4 _mat;
69 CoordinateSystem _tracker_cs, _graph_cs;
70
71public:
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
85private:
86 static TypeHandle _type_handle;
87};
88
89#include "trackerNode.I"
90
91#endif
An abstract base class for a family of client device interfaces–including trackers,...
Definition clientBase.h:43
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
Encapsulates the data generated from (or sent into) any particular DataNode.
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
CoordinateSystem get_graph_coordinate_system() const
Returns the coordinate system that the TrackerNode will convert its transform into for passing down t...
CoordinateSystem get_tracker_coordinate_system() const
Returns the coordinate system that the tracker associated with this node will operate in.
Definition trackerNode.I:84
bool has_time() const
True if this data comes with timestamps.
Definition trackerNode.I:51
bool is_valid() const
Returns true if the TrackerNode is valid and connected to a server, false otherwise.
Definition trackerNode.I:19
void set_graph_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system that the TrackerNode will convert its transform into for passing down...
Definition trackerNode.I:94
const LMatrix4 & get_transform() const
Returns the current position and orientation of the tracker, as a combined matrix.
Definition trackerNode.I:60
const LOrientation & get_orient() const
Returns the current orientation of the tracker, if it is available.
Definition trackerNode.I:35
double get_time() const
Returns the time of the tracker's last update.
Definition trackerNode.I:43
const LPoint3 & get_pos() const
Returns the current position of the tracker, if it is available.
Definition trackerNode.I:27
void set_tracker_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system that the tracker associated with this node will operate in.
Definition trackerNode.I:72
Indicates a coordinate-system transform on vertices.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.