14#ifndef DRIVEINTERFACE_H
15#define DRIVEINTERFACE_H
31class EXPCL_PANDA_TFORM DriveInterface :
public MouseInterfaceNode {
33 explicit DriveInterface(
const std::string &name =
"");
63 INLINE
const LPoint3 &
get_pos()
const;
64 INLINE PN_stdfloat get_x()
const;
65 INLINE PN_stdfloat get_y()
const;
66 INLINE PN_stdfloat get_z()
const;
67 INLINE
void set_pos(
const LVecBase3 &vec);
68 INLINE
void set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
69 INLINE
void set_x(PN_stdfloat x);
70 INLINE
void set_y(PN_stdfloat y);
71 INLINE
void set_z(PN_stdfloat z);
75 INLINE
const LVecBase3 &
get_hpr()
const;
76 INLINE PN_stdfloat get_h()
const;
77 INLINE PN_stdfloat get_p()
const;
78 INLINE PN_stdfloat get_r()
const;
79 INLINE
void set_hpr(
const LVecBase3 &hpr);
80 INLINE
void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
81 INLINE
void set_h(PN_stdfloat h);
82 INLINE
void set_p(PN_stdfloat p);
83 INLINE
void set_r(PN_stdfloat r);
96 void set_mat(
const LMatrix4 &mat);
102 void apply(
double x,
double y,
bool any_button);
104 PN_stdfloat _forward_speed;
105 PN_stdfloat _reverse_speed;
106 PN_stdfloat _rotate_speed;
107 PN_stdfloat _vertical_dead_zone;
108 PN_stdfloat _horizontal_dead_zone;
109 PN_stdfloat _vertical_center;
110 PN_stdfloat _horizontal_center;
114 PN_stdfloat _vertical_ramp_up_time;
115 PN_stdfloat _vertical_ramp_down_time;
116 PN_stdfloat _horizontal_ramp_up_time;
117 PN_stdfloat _horizontal_ramp_down_time;
120 PN_stdfloat _rot_speed;
127 bool _stop_this_frame;
137 PN_stdfloat get_effect(PN_stdfloat ramp_up_time, PN_stdfloat ramp_down_time);
138 void set_key(
bool down);
140 bool operator < (
const KeyHeld &other)
const;
144 double _changed_time;
145 PN_stdfloat _effect_at_change;
147 KeyHeld _up_arrow, _down_arrow;
148 KeyHeld _left_arrow, _right_arrow;
160 int _button_events_input;
163 int _transform_output;
164 int _velocity_output;
167 PT(EventStoreVec3) _velocity;
173 static const PN_stdfloat _hpr_quantize;
179 static void init_type() {
180 MouseInterfaceNode::init_type();
182 MouseInterfaceNode::get_class_type());
185 return get_class_type();
187 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
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.
PN_stdfloat get_rotate_speed() const
Returns the maximum rate at which the user can rotate left or right, when the mouse is at the very ed...
void set_rotate_speed(PN_stdfloat speed)
Sets the maximum rate at which the user can rotate left or right, when the mouse is at the very edge ...
PN_stdfloat get_horizontal_ramp_up_time() const
Returns the amount of time, in seconds, it takes between the time a left or right arrow key is presse...
void set_vertical_dead_zone(PN_stdfloat zone)
Sets the size of the horizontal bar in the center of the screen that represents the "dead zone" of ve...
const LMatrix4 & get_mat()
Returns the current transform.
void set_mat(const LMatrix4 &mat)
Stores the indicated transform in the DriveInterface.
void set_force_roll(PN_stdfloat force_roll)
This function is no longer used and does nothing.
PN_stdfloat get_horizontal_dead_zone() const
Returns the size of the vertical bar in the center of the screen that represents the "dead zone" of h...
PN_stdfloat get_speed() const
Returns the speed of the previous update in units/sec.
PN_stdfloat get_horizontal_ramp_down_time() const
Returns the amount of time, in seconds, it takes between the time a left or right arrow key is releas...
bool get_ignore_mouse() const
Returns the current setting of the ignore_mouse flag.
void reset()
Reinitializes the driver to the origin and resets any knowledge about buttons being held down.
PN_stdfloat get_vertical_ramp_down_time() const
Returns the amount of time, in seconds, it takes between the time an up or down arrow key is released...
void set_pos(const LVecBase3 &vec)
Directly sets the driver's position.
bool get_stop_this_frame() const
Returns the current setting of the stop_this_frame flag.
const LVecBase3 & get_hpr() const
Returns the driver's orientation.
void set_reverse_speed(PN_stdfloat speed)
Sets the speed of full reverse motion, when the mouse is at the very bottom of the window.
void set_vertical_ramp_down_time(PN_stdfloat ramp_down_time)
Sets the amount of time, in seconds, it takes between the time an up or down arrow key is released an...
void set_force_mouse(bool force_mouse)
Changes the state of the force_mouse flag.
PN_stdfloat get_forward_speed() const
Returns the speed of full forward motion, when the mouse is at the very top of the window.
void set_ignore_mouse(bool ignore_mouse)
Changes the state of the ignore_mouse flag.
void set_horizontal_dead_zone(PN_stdfloat zone)
Sets the size of the vertical bar in the center of the screen that represents the "dead zone" of hori...
void set_forward_speed(PN_stdfloat speed)
Sets the speed of full forward motion, when the mouse is at the very top of the window.
void set_horizontal_ramp_up_time(PN_stdfloat ramp_up_time)
Sets the amount of time, in seconds, it takes between the time a left or right arrow key is pressed a...
void set_vertical_ramp_up_time(PN_stdfloat ramp_up_time)
Sets the amount of time, in seconds, it takes between the time an up or down arrow key is pressed and...
PN_stdfloat get_rot_speed() const
Returns the rot_speed of the previous update in units/sec.
PN_stdfloat get_vertical_dead_zone() const
Returns the size of the horizontal bar in the center of the screen that represents the "dead zone" of...
void force_dgraph()
This is a special kludge for DriveInterface to allow us to avoid the one- frame latency after a colli...
PN_stdfloat get_reverse_speed() const
Returns the speed of full reverse motion, when the mouse is at the very bottom of the window.
void set_horizontal_ramp_down_time(PN_stdfloat ramp_down_time)
Sets the amount of time, in seconds, it takes between the time a left or right arrow key is released ...
PN_stdfloat get_vertical_ramp_up_time() const
Returns the amount of time, in seconds, it takes between the time an up or down arrow key is pressed ...
const LPoint3 & get_pos() const
Returns the driver's position.
void set_stop_this_frame(bool stop_this_frame)
If stop_this_frame is true, the next time the frame is computed no motion will be allowed,...
bool get_force_mouse() const
Returns the current setting of the force_mouse flag.
void set_hpr(const LVecBase3 &hpr)
Directly sets the driver's orientation.
TypeHandle is the identifier used to differentiate C++ class types.
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(),...