Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions

Trackball Class Reference

Trackball acts like Performer in trackball mode. More...

#include "trackball.h"

Inheritance diagram for Trackball:
MouseInterfaceNode DataNode PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

 Trackball (const string &name)
virtual TypeHandle force_init_type ()
CoordinateSystem get_coordinate_system () const
 Returns the coordinate system of the Trackball.
float get_forward_scale () const
 Returns the scale factor applied to forward and backward motion.
float get_h () const
LVecBase3f get_hpr () const
 **** Rotation ****
bool get_invert () const
 Returns the invert flag.
const LMatrix4fget_mat () const
 Returns the matrix represented by the trackball rotation.
LPoint3f get_origin () const
 Returns the current center of rotation.
float get_p () const
const LPoint3fget_pos () const
 **** Translation ****
float get_r () const
const NodePathget_rel_to () const
 Returns the NodePath that all trackball manipulations are relative to, or the empty path.
const LMatrix4fget_trans_mat () const
 Returns the actual transform that will be applied to the scene graph.
virtual TypeHandle get_type () const
float get_x () const
float get_y () const
float get_z () const
void move_origin (float x, float y, float 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_coordinate_system (CoordinateSystem cs)
 Sets the coordinate system of the Trackball.
void set_forward_scale (float fwdscale)
 Changes the scale factor applied to forward and backward motion.
void set_h (float h)
void set_hpr (const LVecBase3f &hpr)
 Directly set the mover's orientation.
void set_hpr (float h, float p, float r)
void set_invert (bool flag)
 **** Misc ****
void set_mat (const LMatrix4f &mat)
 Stores the indicated transform in the trackball.
void set_origin (const LVecBase3f &origin)
 Directly sets the center of rotation.
void set_p (float p)
void set_pos (const LVecBase3f &vec)
 Directly set the offset from the rotational origin.
void set_pos (float x, float y, float z)
void set_r (float 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 (float x)
void set_y (float y)
void set_z (float 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().

Detailed Description

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.


Member Function Documentation

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 541 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().

CoordinateSystem Trackball::get_coordinate_system ( ) const

Returns the coordinate system of the Trackball.

See set_coordinate_system().

Definition at line 386 of file trackball.cxx.

float Trackball::get_forward_scale ( ) const

Returns the scale factor applied to forward and backward motion.

See set_forward_scale().

Definition at line 103 of file trackball.cxx.

LVecBase3f Trackball::get_hpr ( ) const

**** Rotation ****

Return the trackball's orientation.

Definition at line 189 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 334 of file trackball.cxx.

const LMatrix4f & Trackball::get_mat ( ) const

Returns the matrix represented by the trackball rotation.

Definition at line 417 of file trackball.cxx.

LPoint3f Trackball::get_origin ( ) const

Returns the current center of rotation.

Definition at line 298 of file trackball.cxx.

References LMatrix4f::get_row3().

const LPoint3f & Trackball::get_pos ( ) const

**** Translation ****

Return the offset from the center of rotation.

Definition at line 127 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 360 of file trackball.cxx.

const LMatrix4f & 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 429 of file trackball.cxx.

void Trackball::move_origin ( float  x,
float  y,
float  z 
)

Moves the center of rotation by the given amount.

Definition at line 288 of file trackball.cxx.

References LMatrix4f::translate_mat().

void Trackball::reset ( )

Reinitializes all transforms to identity.

Definition at line 89 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 275 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 375 of file trackball.cxx.

void Trackball::set_forward_scale ( float  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 116 of file trackball.cxx.

void Trackball::set_hpr ( const LVecBase3f hpr)

Directly set the mover's orientation.

Definition at line 223 of file trackball.cxx.

void Trackball::set_invert ( bool  flag)

**** Misc ****

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 322 of file trackball.cxx.

void Trackball::set_mat ( const LMatrix4f mat)

Stores the indicated transform in the trackball.

This is a transform in global space, regardless of the rel_to node.

Definition at line 398 of file trackball.cxx.

void Trackball::set_origin ( const LVecBase3f origin)

Directly sets the center of rotation.

Definition at line 308 of file trackball.cxx.

References LMatrix4f::set_row(), and LMatrix4f::translate_mat().

void Trackball::set_pos ( const LVecBase3f vec)

Directly set the offset from the rotational origin.

Definition at line 153 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 349 of file trackball.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations