Panda3D
|
This is a TFormer, similar to Trackball, that moves around a transform matrix in response to mouse input. More...
#include "driveInterface.h"
Classes | |
class | KeyHeld |
Public Member Functions | |
DriveInterface (const string &name="") | |
void | force_dgraph () |
This is a special kludge for DriveInterface to allow us to avoid the one-frame latency after a collision. | |
virtual TypeHandle | force_init_type () |
bool | get_force_mouse () const |
Returns the current setting 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. | |
PN_stdfloat | get_h () const |
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 horizontal motion: the region in which the mouse does not report horizontal motion. | |
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 released and the time it registers no motion. | |
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 pressed and the time it registers full rotation. | |
const LVecBase3 & | get_hpr () const |
**** Rotation **** | |
bool | get_ignore_mouse () const |
Returns the current setting of the ignore_mouse flag. | |
const LMatrix4 & | get_mat () |
Returns the current transform. | |
PN_stdfloat | get_p () const |
const LPoint3 & | get_pos () const |
**** Translation **** | |
PN_stdfloat | get_r () const |
PN_stdfloat | get_reverse_speed () const |
Returns the speed of full reverse motion, when the mouse is at the very bottom of the window. | |
PN_stdfloat | get_rot_speed () const |
Returns the rot_speed of the previous update in units/sec. | |
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 edge of the window. | |
PN_stdfloat | get_speed () const |
Returns the speed of the previous update in units/sec. | |
bool | get_stop_this_frame () const |
Returns the current setting of the stop_this_frame flag. | |
virtual TypeHandle | get_type () const |
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 vertical motion: the region in which the mouse does not report vertical motion. | |
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 and the time it registers no motion. | |
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 and the time it registers full forward or backward motion. | |
PN_stdfloat | get_x () const |
PN_stdfloat | get_y () const |
PN_stdfloat | get_z () const |
void | reset () |
Reinitializes the driver to the origin and resets any knowledge about buttons being held down. | |
void | set_force_mouse (bool force_mouse) |
Changes the state of the force_mouse flag. | |
void | set_force_roll (PN_stdfloat force_roll) |
This function is no longer used and does nothing. | |
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_h (PN_stdfloat h) |
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 horizontal motion: the region in which the mouse does not report horizontal motion. | |
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 and the time it registers no motion. | |
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 and the time it registers full rotation. | |
void | set_hpr (const LVecBase3 &hpr) |
Directly sets the driver's orientation. | |
void | set_hpr (PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) |
void | set_ignore_mouse (bool ignore_mouse) |
Changes the state of the ignore_mouse flag. | |
void | set_mat (const LMatrix4 &mat) |
Stores the indicated transform in the DriveInterface. | |
void | set_p (PN_stdfloat p) |
void | set_pos (const LVecBase3 &vec) |
Directly sets the driver's position. | |
void | set_pos (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) |
void | set_r (PN_stdfloat r) |
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_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 of the window. | |
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, and then the flag is reset to false. | |
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 vertical motion: the region in which the mouse does not report vertical motion. | |
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 and the time it registers no motion. | |
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 the time it registers full forward or backward motion. | |
void | set_x (PN_stdfloat x) |
void | set_y (PN_stdfloat y) |
void | set_z (PN_stdfloat z) |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
virtual void | do_transmit_data (DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output) |
The virtual implementation of transmit_data(). |
This is a TFormer, similar to Trackball, that moves around a transform matrix in response to mouse input.
The basic motion is on a horizontal plane, as if driving a vehicle.
Definition at line 34 of file driveInterface.h.
void DriveInterface::do_transmit_data | ( | DataGraphTraverser * | trav, |
const DataNodeTransmit & | input, | ||
DataNodeTransmit & | output | ||
) | [protected, virtual] |
The virtual implementation of transmit_data().
This function receives an array of input parameters and should generate an array of output parameters. The input parameters may be accessed with the index numbers returned by the define_input() calls that were made earlier (presumably in the constructor); likewise, the output parameters should be set with the index numbers returned by the define_output() calls.
Reimplemented from DataNode.
Definition at line 392 of file driveInterface.cxx.
References MouseInterfaceNode::check_button_events(), DataNodeTransmit::get_data(), ButtonEventList::get_event(), ButtonEventList::get_num_events(), EventParameter::get_ptr(), EventStoreValue< Type >::get_value(), DataNodeTransmit::has_data(), MouseInterfaceNode::is_down(), MouseButton::one(), and DataNodeTransmit::set_data().
void DriveInterface::force_dgraph | ( | ) |
This is a special kludge for DriveInterface to allow us to avoid the one-frame latency after a collision.
It forces an immediate partial data flow for all data graph nodes below this node, causing all data nodes that depend on this matrix to be updated immediately.
Definition at line 213 of file driveInterface.cxx.
References DataGraphTraverser::collect_leftovers(), Thread::get_current_thread(), DataNode::get_num_outputs(), PandaNode::output(), DataNodeTransmit::reserve(), DataNodeTransmit::set_data(), and DataGraphTraverser::traverse_below().
bool DriveInterface::get_force_mouse | ( | ) | const [inline] |
Returns the current setting of the force_mouse flag.
See set_force_mouse().
Definition at line 427 of file driveInterface.I.
PN_stdfloat DriveInterface::get_forward_speed | ( | ) | const [inline] |
Returns the speed of full forward motion, when the mouse is at the very top of the window.
This is in units (e.g. feet) per second.
Definition at line 36 of file driveInterface.I.
PN_stdfloat DriveInterface::get_horizontal_dead_zone | ( | ) | const [inline] |
Returns the size of the vertical bar in the center of the screen that represents the "dead zone" of horizontal motion: the region in which the mouse does not report horizontal motion.
This is in a fraction of the window width, so 0.5 will set a dead zone as large as half the screen.
Definition at line 144 of file driveInterface.I.
PN_stdfloat DriveInterface::get_horizontal_ramp_down_time | ( | ) | const [inline] |
Returns the amount of time, in seconds, it takes between the time a left or right arrow key is released and the time it registers no motion.
Definition at line 241 of file driveInterface.I.
PN_stdfloat DriveInterface::get_horizontal_ramp_up_time | ( | ) | const [inline] |
Returns the amount of time, in seconds, it takes between the time a left or right arrow key is pressed and the time it registers full rotation.
Definition at line 217 of file driveInterface.I.
const LVecBase3 & DriveInterface::get_hpr | ( | ) | const [inline] |
**** Rotation ****
Returns the driver's orientation.
Definition at line 328 of file driveInterface.I.
bool DriveInterface::get_ignore_mouse | ( | ) | const [inline] |
Returns the current setting of the ignore_mouse flag.
See set_ignore_mouse().
Definition at line 404 of file driveInterface.I.
const LMatrix4 & DriveInterface::get_mat | ( | ) |
Returns the current transform.
Definition at line 195 of file driveInterface.cxx.
const LPoint3 & DriveInterface::get_pos | ( | ) | const [inline] |
**** Translation ****
Returns the driver's position.
Definition at line 271 of file driveInterface.I.
PN_stdfloat DriveInterface::get_reverse_speed | ( | ) | const [inline] |
Returns the speed of full reverse motion, when the mouse is at the very bottom of the window.
This is in units (e.g. feet) per second.
Definition at line 60 of file driveInterface.I.
PN_stdfloat DriveInterface::get_rot_speed | ( | ) | const [inline] |
Returns the rot_speed of the previous update in units/sec.
Definition at line 261 of file driveInterface.I.
PN_stdfloat DriveInterface::get_rotate_speed | ( | ) | const [inline] |
Returns the maximum rate at which the user can rotate left or right, when the mouse is at the very edge of the window.
This is in degrees per second.
Definition at line 84 of file driveInterface.I.
PN_stdfloat DriveInterface::get_speed | ( | ) | const [inline] |
Returns the speed of the previous update in units/sec.
Definition at line 251 of file driveInterface.I.
bool DriveInterface::get_stop_this_frame | ( | ) | const [inline] |
Returns the current setting of the stop_this_frame flag.
Definition at line 454 of file driveInterface.I.
PN_stdfloat DriveInterface::get_vertical_dead_zone | ( | ) | const [inline] |
Returns the size of the horizontal bar in the center of the screen that represents the "dead zone" of vertical motion: the region in which the mouse does not report vertical motion.
This is in a fraction of the window height, so 0.5 will set a dead zone as large as half the screen.
Definition at line 114 of file driveInterface.I.
PN_stdfloat DriveInterface::get_vertical_ramp_down_time | ( | ) | const [inline] |
Returns the amount of time, in seconds, it takes between the time an up or down arrow key is released and the time it registers no motion.
Definition at line 193 of file driveInterface.I.
PN_stdfloat DriveInterface::get_vertical_ramp_up_time | ( | ) | const [inline] |
Returns the amount of time, in seconds, it takes between the time an up or down arrow key is pressed and the time it registers full forward or backward motion.
Definition at line 169 of file driveInterface.I.
void DriveInterface::reset | ( | ) |
Reinitializes the driver to the origin and resets any knowledge about buttons being held down.
Definition at line 158 of file driveInterface.cxx.
void DriveInterface::set_force_mouse | ( | bool | force_mouse | ) | [inline] |
Changes the state of the force_mouse flag.
If this flag is true, the mouse button need not be held down in order to drive the avatar around.
Definition at line 416 of file driveInterface.I.
void DriveInterface::set_force_roll | ( | PN_stdfloat | force_roll | ) |
This function is no longer used and does nothing.
It will be removed soon.
Definition at line 175 of file driveInterface.cxx.
void DriveInterface::set_forward_speed | ( | PN_stdfloat | speed | ) | [inline] |
Sets the speed of full forward motion, when the mouse is at the very top of the window.
This is in units (e.g. feet) per second.
Definition at line 24 of file driveInterface.I.
void DriveInterface::set_horizontal_dead_zone | ( | PN_stdfloat | speed | ) | [inline] |
Sets the size of the vertical bar in the center of the screen that represents the "dead zone" of horizontal motion: the region in which the mouse does not report horizontal motion.
This is in a fraction of the window width, so 0.5 will set a dead zone as large as half the screen.
Definition at line 129 of file driveInterface.I.
void DriveInterface::set_horizontal_ramp_down_time | ( | PN_stdfloat | ramp_down_time | ) | [inline] |
Sets the amount of time, in seconds, it takes between the time a left or right arrow key is released and the time it registers no motion.
Definition at line 229 of file driveInterface.I.
void DriveInterface::set_horizontal_ramp_up_time | ( | PN_stdfloat | ramp_up_time | ) | [inline] |
Sets the amount of time, in seconds, it takes between the time a left or right arrow key is pressed and the time it registers full rotation.
Definition at line 205 of file driveInterface.I.
void DriveInterface::set_hpr | ( | const LVecBase3 & | hpr | ) | [inline] |
Directly sets the driver's orientation.
Definition at line 354 of file driveInterface.I.
void DriveInterface::set_ignore_mouse | ( | bool | ignore_mouse | ) | [inline] |
Changes the state of the ignore_mouse flag.
If this flag is true, the DriveInterface will ignore mouse down button events (but still recognize mouse up button events); the user will not be able to start the DriveInterface going again if it is stopped, but if the user is currently holding down a mouse button it will not stop immediately until the user eventually releases the button.
Definition at line 393 of file driveInterface.I.
void DriveInterface::set_mat | ( | const LMatrix4 & | mat | ) |
Stores the indicated transform in the DriveInterface.
Definition at line 184 of file driveInterface.cxx.
void DriveInterface::set_pos | ( | const LVecBase3 & | vec | ) | [inline] |
Directly sets the driver's position.
Definition at line 297 of file driveInterface.I.
void DriveInterface::set_reverse_speed | ( | PN_stdfloat | speed | ) | [inline] |
Sets the speed of full reverse motion, when the mouse is at the very bottom of the window.
This is in units (e.g. feet) per second.
Definition at line 48 of file driveInterface.I.
void DriveInterface::set_rotate_speed | ( | PN_stdfloat | speed | ) | [inline] |
Sets the maximum rate at which the user can rotate left or right, when the mouse is at the very edge of the window.
This is in degrees per second.
Definition at line 72 of file driveInterface.I.
void DriveInterface::set_stop_this_frame | ( | bool | stop_this_frame | ) | [inline] |
If stop_this_frame is true, the next time the frame is computed no motion will be allowed, and then the flag is reset to false.
This can be used to prevent too much movement when we know a long time has artificially elapsed, for instance when we take a screenshot, without munging the clock for everything else.
Definition at line 443 of file driveInterface.I.
void DriveInterface::set_vertical_dead_zone | ( | PN_stdfloat | speed | ) | [inline] |
Sets the size of the horizontal bar in the center of the screen that represents the "dead zone" of vertical motion: the region in which the mouse does not report vertical motion.
This is in a fraction of the window height, so 0.5 will set a dead zone as large as half the screen.
Definition at line 99 of file driveInterface.I.
void DriveInterface::set_vertical_ramp_down_time | ( | PN_stdfloat | ramp_down_time | ) | [inline] |
Sets the amount of time, in seconds, it takes between the time an up or down arrow key is released and the time it registers no motion.
Definition at line 181 of file driveInterface.I.
void DriveInterface::set_vertical_ramp_up_time | ( | PN_stdfloat | ramp_up_time | ) | [inline] |
Sets the amount of time, in seconds, it takes between the time an up or down arrow key is pressed and the time it registers full forward or backward motion.
Definition at line 156 of file driveInterface.I.