Panda3D
|
Trackball acts like Performer in trackball mode. More...
#include "trackball.h"
Public Types | |
enum | ControlMode { CM_default, CM_truck, CM_pan, CM_dolly, CM_roll } |
**** Misc **** More... | |
Public Member Functions | |
Trackball (const string &name) | |
virtual TypeHandle | force_init_type () |
ControlMode | get_control_mode () const |
Returns the control mode. | |
CoordinateSystem | get_coordinate_system () const |
Returns the coordinate system of the Trackball. | |
PN_stdfloat | get_forward_scale () const |
Returns the scale factor applied to forward and backward motion. | |
PN_stdfloat | get_h () const |
LVecBase3 | get_hpr () const |
**** Rotation **** | |
bool | get_invert () const |
Returns the invert flag. | |
const LMatrix4 & | get_mat () const |
Returns the matrix represented by the trackball rotation. | |
LPoint3 | get_origin () const |
Returns the current center of rotation. | |
PN_stdfloat | get_p () const |
const LPoint3 & | get_pos () const |
**** Translation **** | |
PN_stdfloat | get_r () const |
const NodePath & | get_rel_to () const |
Returns the NodePath that all trackball manipulations are relative to, or the empty path. | |
const LMatrix4 & | get_trans_mat () const |
Returns the actual transform that will be applied to the scene graph. | |
virtual TypeHandle | get_type () const |
PN_stdfloat | get_x () const |
PN_stdfloat | get_y () const |
PN_stdfloat | get_z () const |
void | move_origin (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) |
Moves the center of rotation by the given amount. | |
void | reset () |
Reinitializes all transforms to identity. | |
void | reset_origin_here () |
**** Origin of Rotation **** | |
void | set_control_mode (ControlMode control_mode) |
Sets the control mode. | |
void | set_coordinate_system (CoordinateSystem cs) |
Sets the coordinate system of the Trackball. | |
void | set_forward_scale (PN_stdfloat fwdscale) |
Changes the scale factor applied to forward and backward motion. | |
void | set_h (PN_stdfloat h) |
void | set_hpr (PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) |
void | set_hpr (const LVecBase3 &hpr) |
Directly set the mover's orientation. | |
void | set_invert (bool flag) |
Sets the invert flag. | |
void | set_mat (const LMatrix4 &mat) |
Stores the indicated transform in the trackball. | |
void | set_origin (const LVecBase3 &origin) |
Directly sets the center of rotation. | |
void | set_p (PN_stdfloat p) |
void | set_pos (PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) |
void | set_pos (const LVecBase3 &vec) |
Directly set the offset from the rotational origin. | |
void | set_r (PN_stdfloat r) |
void | set_rel_to (const NodePath &rel_to) |
Sets the NodePath that all trackball manipulations are to be assumed to be relative to. | |
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(). |
Trackball acts like Performer in trackball mode.
It can either spin around a piece of geometry directly, or it can spin around a camera with the inverse transform to make it appear that the whole world is spinning.
The Trackball object actually just places a transform in the data graph; parent a Transform2SG node under it to actually transform objects (or cameras) in the world.
Definition at line 40 of file trackball.h.
**** Misc ****
Definition at line 84 of file trackball.h.
void Trackball::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 597 of file trackball.cxx.
References MouseInterfaceNode::check_button_events(), DataNodeTransmit::get_data(), EventParameter::get_ptr(), EventStoreValue< Type >::get_value(), DataNodeTransmit::has_data(), MouseInterfaceNode::is_down(), MouseButton::one(), DataNodeTransmit::set_data(), MouseButton::three(), and MouseButton::two().
Trackball::ControlMode Trackball::get_control_mode | ( | ) | const |
CoordinateSystem Trackball::get_coordinate_system | ( | ) | const |
Returns the coordinate system of the Trackball.
Definition at line 414 of file trackball.cxx.
PN_stdfloat Trackball::get_forward_scale | ( | ) | const |
Returns the scale factor applied to forward and backward motion.
See set_forward_scale().
Definition at line 105 of file trackball.cxx.
LVecBase3 Trackball::get_hpr | ( | ) | const |
**** Rotation ****
Return the trackball's orientation.
Definition at line 191 of file trackball.cxx.
bool Trackball::get_invert | ( | ) | const |
Returns the invert flag.
When this is set, the inverse matrix is generated, suitable for joining to a camera, instead of parenting the scene under it.
Definition at line 336 of file trackball.cxx.
const LMatrix4 & Trackball::get_mat | ( | ) | const |
Returns the matrix represented by the trackball rotation.
Definition at line 445 of file trackball.cxx.
LPoint3 Trackball::get_origin | ( | ) | const |
Returns the current center of rotation.
Definition at line 300 of file trackball.cxx.
References LMatrix4f::get_row3().
const LPoint3 & Trackball::get_pos | ( | ) | const |
**** Translation ****
Return the offset from the center of rotation.
Definition at line 129 of file trackball.cxx.
const NodePath & Trackball::get_rel_to | ( | ) | const |
Returns the NodePath that all trackball manipulations are relative to, or the empty path.
Definition at line 388 of file trackball.cxx.
const LMatrix4 & Trackball::get_trans_mat | ( | ) | const |
Returns the actual transform that will be applied to the scene graph.
This is the same as get_mat(), unless invert is in effect.
Definition at line 457 of file trackball.cxx.
void Trackball::move_origin | ( | PN_stdfloat | x, |
PN_stdfloat | y, | ||
PN_stdfloat | z | ||
) |
Moves the center of rotation by the given amount.
Definition at line 290 of file trackball.cxx.
References LMatrix4f::translate_mat().
void Trackball::reset | ( | ) |
Reinitializes all transforms to identity.
Definition at line 91 of file trackball.cxx.
References LMatrix4f::ident_mat().
void Trackball::reset_origin_here | ( | ) |
**** Origin of Rotation ****
Reposition the center of rotation to coincide with the current translation offset.
Future rotations will be about the current origin.
Definition at line 277 of file trackball.cxx.
void Trackball::set_control_mode | ( | ControlMode | control_mode | ) |
Sets the control mode.
Normally this is CM_default, which means each mouse button serves its normal function. When it is CM_truck, CM_pan, CM_dolly, or CM_roll, all of the mouse buttons serve the indicated function instead of their normal function. This can be used in conjunction with some external way of changing modes.
Definition at line 352 of file trackball.cxx.
void Trackball::set_coordinate_system | ( | CoordinateSystem | cs | ) |
Sets the coordinate system of the Trackball.
Normally, this is the default coordinate system. This changes the axes the Trackball manipulates so that the user interface remains consistent across different coordinate systems.
Definition at line 403 of file trackball.cxx.
void Trackball::set_forward_scale | ( | PN_stdfloat | fwdscale | ) |
Changes the scale factor applied to forward and backward motion.
The larger this number, the faster the model will move in response to dollying in and out.
Definition at line 118 of file trackball.cxx.
void Trackball::set_hpr | ( | const LVecBase3 & | hpr | ) |
Directly set the mover's orientation.
Definition at line 225 of file trackball.cxx.
void Trackball::set_invert | ( | bool | flag | ) |
Sets the invert flag.
When this is set, the inverse matrix is generated, suitable for joining to a camera, instead of parenting the scene under it.
Definition at line 324 of file trackball.cxx.
void Trackball::set_mat | ( | const LMatrix4 & | mat | ) |
Stores the indicated transform in the trackball.
This is a transform in global space, regardless of the rel_to node.
Definition at line 426 of file trackball.cxx.
void Trackball::set_origin | ( | const LVecBase3 & | origin | ) |
Directly sets the center of rotation.
Definition at line 310 of file trackball.cxx.
References LMatrix4f::set_row(), and LMatrix4f::translate_mat().
void Trackball::set_pos | ( | const LVecBase3 & | vec | ) |
Directly set the offset from the rotational origin.
Definition at line 155 of file trackball.cxx.
void Trackball::set_rel_to | ( | const NodePath & | rel_to | ) |
Sets the NodePath that all trackball manipulations are to be assumed to be relative to.
For instance, set your camera node here to make the trackball motion camera relative. The default is the empty path, which means trackball motion is in global space.
Definition at line 377 of file trackball.cxx.