Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtTrackball Class Reference

#include <NavEngines.h>

Inheritance diagram for vtTrackball:
vtLastMouse vtEngine vtEnabledBase

Public Member Functions

 vtTrackball (float fRadius)
 
void SetRadius (float fRadius)
 
float GetRadius () const
 
void SetPivotPoint (const FPoint3 &pos)
 
FPoint3 GetPivotPoint () 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 SetTrans (const FPoint3 &trans)
 
void Translate (const FPoint3 &trans)
 
FPoint3 GetTrans () const
 
void GetState (FPoint3 *state)
 
void SetState (const FPoint3 *state)
 
void OnMouse (vtMouseEvent &event)
 Virtual handler, to catch mouse events, can be overridden by your engine class.
 
void Eval ()
 
void LimitPos (const FPoint3 &min, const FPoint3 &max)
 
void LimitTrans (const FPoint3 &min, const FPoint3 &max)
 
- 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 SetTarget (osg::Referenced *ptr)
 
void RemoveTarget (osg::Referenced *ptr)
 
uint NumTargets ()
 Return the number of targets for this engine.
 
void setName (const char *str)
 
const char * getName ()
 
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.
 
void SetWindow (vtWindow *pWin)
 
vtWindowGetWindow ()
 
void AddChild (vtEngine *pEngine)
 
void RemoveChild (vtEngine *pEngine)
 
vtEngineGetChild (uint i)
 
uint NumChildren ()
 
void AddChildrenToList (vtArray< vtEngine * > &list, bool bEnabledOnly)
 
- Public Member Functions inherited from vtEnabledBase
virtual void SetEnabled (bool bOn)
 
bool GetEnabled ()
 

Protected Member Functions

bool _IsRotate ()
 
bool _IsZoom ()
 
bool _IsTranslate ()
 
void _ApplyLimits ()
 

Protected Attributes

FPoint3 m_Pos
 
FPoint3 m_Start
 
FPoint3 m_Trans
 
FPoint3 m_Pivot
 
bool m_bRotate
 
bool m_bZoom
 
bool m_bTrans
 
IPoint2 m_MouseStart
 
float m_fZoomScale
 
float m_fRotScale
 
float m_fTransScale
 
int m_rotate_button
 
int m_rotate_modifier
 
bool m_rotate_exact
 
int m_zoom_button
 
int m_zoom_modifier
 
bool m_zoom_exact
 
int m_trans_button
 
int m_trans_modifier
 
bool m_trans_exact
 
FPoint3 m_pos_min
 
FPoint3 m_pos_max
 
FPoint3 m_trans_min
 
FPoint3 m_trans_max
 

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.


The documentation for this class was generated from the following files: