vtlib library
Public Member Functions | List of all members
vtTrackball Class Reference
Inheritance diagram for vtTrackball:
Inheritance graph
[legend]

Public Member Functions

void SetRadius (float fRadius)
 
float GetRadius () const
 
void SetRotateButton (int button, int modifier=0, bool bExact=true)
 
void SetZoomButton (int button, int modifier=0, bool bExact=true)
 
void SetTranslateButton (int button, int modifier=0, bool bExact=true)
 
void SetZoomScale (float s)
 
void SetRotScale (float s)
 
void SetTransScale (float s)
 
void SetDirection (float fTheta, float fPhi)
 
void MoveDirection (float fTheta, float fPhi)
 
void OnMouse (vtMouseEvent &event)
 Virtual handler, to catch mouse events, can be overridden by your engine class.
 
void Eval ()
 
- Public Member Functions inherited from vtLastMouse
void GetNormalizedMouseCoords (float &mx, float &my)
 
- Public Member Functions inherited from vtEngine
osg::Referenced * GetTarget (uint which=0)
 
void AddTarget (osg::Referenced *ptr)
 
void RemoveTarget (osg::Referenced *ptr)
 
uint NumTargets ()
 Return the number of targets for this engine.
 
virtual void OnKey (int key, int flags)
 Virtual handler, to catch keyboard events, can be overridden by your engine class.
 
virtual void OnWindowSize (int width, int height)
 Virtual handler, to catch resize events, can be overridden by your engine class.
 

Additional Inherited Members

- Public Attributes inherited from vtLastMouse
int m_buttons
 
IPoint2 m_pos
 
int m_flags
 

Detailed Description

A Trackball is a navigation engine which can move a Camera (or any other Transform target) and move it around a center point based on mouse input.

You can set which combinations of mouse buttons and modifier keys will rotate, zoom and translate the target. The default is:

Member Function Documentation

void vtTrackball::Eval ( )
virtual

Virtual handler, will be called every frame to do the work of the engine. You must override this if you want your engine to be useful.

Reimplemented from vtEngine.

float vtTrackball::GetRadius ( ) const

Get the radius, the distance from the pivot point that the Trackball rotates around.

void vtTrackball::MoveDirection ( float  fTheta,
float  fPhi 
)

Shift the direction the trackball is facing, by a given offset.

Parameters
fTheta,fPhiPolar coordinates for the target relative to the pivot point.
void vtTrackball::SetDirection ( float  fTheta,
float  fPhi 
)

Set the direction the trackball is facing.

Parameters
fTheta,fPhiPolar coordinates for the target relative to the pivot point.
void vtTrackball::SetRadius ( float  fRadius)

Set the radius, the distance from the pivot point that the Trackball rotates around.

void vtTrackball::SetRotateButton ( int  button,
int  modifier = 0,
bool  bExact = true 
)

Set the buttons and modifier keys that will cause the Trackball to rotate.

Parameters
buttonThe button state (VT_LEFT, VT_RIGHT, and/or VT_MIDDLE)
modifierThe modifier state (VT_SHIFT, VT_CONTROL, and/or VT_ALT)
bExactIf true, then exactly this button must occur. Otherwise, any button state that includes this state will suffice.
void vtTrackball::SetRotScale ( float  s)

Set the scale factor for rotation, which controls how fast the Trackball will spin its target.

void vtTrackball::SetTranslateButton ( int  button,
int  modifier = 0,
bool  bExact = true 
)

Set the buttons and modifier keys that will cause the Trackball to translate.

Parameters
buttonThe button state (VT_LEFT, VT_RIGHT, and/or VT_MIDDLE)
modifierThe modifier state (VT_SHIFT, VT_CONTROL, and/or VT_ALT)
bExactIf true, then exactly this button must occur. Otherwise, any button state that includes this state will suffice.
void vtTrackball::SetTransScale ( float  s)

Set the scale factor for translation, which controls how fast the Trackball will translate its target.

void vtTrackball::SetZoomButton ( int  button,
int  modifier = 0,
bool  bExact = true 
)

Set the buttons and modifier keys that will cause the Trackball to zoom.

Parameters
buttonThe button state (VT_LEFT, VT_RIGHT, and/or VT_MIDDLE)
modifierThe modifier state (VT_SHIFT, VT_CONTROL, and/or VT_ALT)
bExactIf true, then exactly this button must occur. Otherwise, any button state that includes this state will suffice.
void vtTrackball::SetZoomScale ( float  s)

Set the scale factor for zoom, which controls how fast the Trackball will zoom in/out.