Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends
vcg::Trackball Class Reference

The manipulator manager system. More...

#include <trackball.h>

Inheritance diagram for vcg::Trackball:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Button {
  BUTTON_NONE = 0x0000, BUTTON_LEFT = 0x0001, BUTTON_MIDDLE = 0x0002, BUTTON_RIGHT = 0x0004,
  WHEEL = 0x0008, KEY_SHIFT = 0x0010, KEY_CTRL = 0x0020, KEY_ALT = 0x0040,
  HANDLE = 0x0080, MODIFIER_MASK = 0x00FF, KEY_UP = 0x0100, KEY_DOWN = 0x0200,
  KEY_LEFT = 0x0400, KEY_RIGHT = 0x0800, KEY_PGUP = 0x1000, KEY_PGDOWN = 0x2000
}
 The componibile states of the manipulator system. More...

Public Member Functions

void Animate (unsigned int msec=0)
void Apply ()
 Application of the transformation.
void ApplyInverse ()
 Apply the inverse of current transformation on the OpenGL modelview matrix.
void Back ()
 Currently not in use.
void ButtonDown (Button button, unsigned int msec=0)
 Interface function relative to key up event in QT/SDL.
void ButtonUp (Button button)
 Interface function relative to key down event in QT/SDL.
void ClearModes ()
 clear the modes map. Taking the right care of not doubledeleting anything.
void DrawPostApply ()
 Draw the current manipulator.
void Forward ()
 Currently not in use.
void GetView ()
 Initialize the camera instance.
void HistorySize (int lenght)
 Currently not in use.
void Home ()
 Currently not in use.
Matrix44f InverseMatrix () const
bool IsAnimating (unsigned int msec=0)
bool IsSpinnable ()
 Currently not in use.
bool IsSpinning ()
 Currently not in use.
Matrix44f Matrix () const
void MouseDown (int button)
 Interface function relative to mouse down event in QT/SDL.
void MouseDown (int x, int y, int button)
 Interface function relative to mouse down event in QT/SDL.
void MouseMove (int x, int y)
 Interface function relative to mouse down event in QT/SDL.
void MouseUp (int x, int y, int button)
 Interface function relative to mouse down event in QT/SDL.
void MouseWheel (float notch)
 Old interface function relative to mouse down event in QT/SDL.
void MouseWheel (float notch, int button)
 Interface function relative to mouse down event in QT/SDL.
void Reset ()
 Reset the transformation and every mapped manipulator.
void Scale (const float f)
 Apply a scaling on the current transformation.
void SetCurrentAction ()
 Prepare Trackball and every mapped TrackMode for an user action.
void setDefaultMapping ()
 Reset modes to default mapping.
void SetFixedTimesteps (bool mode)
bool SetFromAscii (const char *st)
 Loads current status from an ascii stings.
void SetIdentity ()
 Reset the trackball.
void SetPosition (const Point3f &c, int millisec=0)
 Set the position of the trackball.
void SetScale (const float s)
 Currently not in use.
void SetSensitivity (float s)
 Currently not in use.
void SetSpinnable (bool on)
void SetSpinning (Quaternionf &spin)
 Currently not in use.
void SetTransform (const Transform &transform, int millisec=0)
 Currently not in use.
void StopSpinning ()
 Currently not in use.
void Store ()
 Currently not in use.
void ToAscii (char *st)
 Stores current status into an ascii stings.
 Trackball ()
 The constructor.
void Translate (Point3f tr)
 Apply a translation on the current transformation.
void Undo ()
 Undo function for manipulator system.
 ~Trackball ()
 The destructor.

Public Attributes

int button_mask
 Currently not in use.
View< float > camera
 The reference for point projection and unprojection from screen space to modelspace.
int current_button
 Current state composition. Note: mask with MODIFIERS to get modifier buttons only.
TrackModecurrent_mode
 The selected manipulator.
bool dragging
 Currently not in use.
std::list< Transformhistory
 Currently not in use.
int history_size
 Currently not in use.
std::vector< Point3fHits
 Currently not in use.
TrackModeidle_and_keys_mode
TrackModeinactive_mode
 The inactive manipulator. It is drawn when Trackball is inactive.
Point3f last_point
 Mouse cursor coordinates before current action.
unsigned int last_time
Similarityf last_track
 Transformation before current user action.
Similarityf last_view
 Currently not in use.
std::map< int, TrackMode * > modes
 The manipulator mapping. Needs to be explicitally managed for custom mappings.
Quaternionf spin
 Currently not in use.
bool spinnable
 Currently not in use.
bool spinning
 Currently not in use.
Similarityf undo_track
 track after an Undo() call.

Private Member Functions

Trackball operator= (const Trackball &)
void Sync (unsigned int msec)

Private Attributes

bool fixedTimestepMode

Friends

class TrackMode
 Manipulators needs full access to this class.

Detailed Description

The manipulator manager system.

Short usage note:

When you specify a translation with the trackball the trackball center remain unchanged, in other words it means that the object move out of the trackball icon. Similarly when you apply a scaling the size of the manipulator icon do not change.

Typical use:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, float(width())/float(height()), 1, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,3,   0,0,0,   0,1,0)
trackball.center=Point3f(0, 0, 0);
trackball.radius= 1;
trackball.GetView();
trackball.Apply(true); //false if you want an invisible trackball
float d=1.0f/mesh.bbox.Diag();
glScale(d);
glTranslate(-mesh.bbox.Center());
mesh->Render();

Note on the typical use:

Definition at line 167 of file gui/trackball.h.


Member Enumeration Documentation

The componibile states of the manipulator system.

Enumerator:
BUTTON_NONE 

No button or key pressed.

BUTTON_LEFT 

Left mouse button pressed.

BUTTON_MIDDLE 

Middle mouse button pressed.

BUTTON_RIGHT 

Right mouse button pressed.

WHEEL 

Mouse wheel activated.

KEY_SHIFT 

Shift key pressed.

KEY_CTRL 

Ctrl key pressed.

KEY_ALT 

Alt key pressed.

HANDLE 

Application-defined state activated.

MODIFIER_MASK 

(mask to get modifiers only)

KEY_UP 

Up directional key.

KEY_DOWN 

Down directional key.

KEY_LEFT 

Left directional key.

KEY_RIGHT 

Right directional key.

KEY_PGUP 

PageUp directional key.

KEY_PGDOWN 

PageDown directional key.

Definition at line 171 of file gui/trackball.h.


Constructor & Destructor Documentation

The constructor.

Initialize the internal state with default values and call setDefaultMapping().

Definition at line 39 of file trackball.cpp.

The destructor.

Warning:
The destructor does not deallocate the memory allocated by setDefaultMapping(), because the application can change the modes map. This can lead to small memory leaks, so please explicitally delete any manipulator in the modes map if you are going to repeatly allocate and deallocate Trackball instances.

Definition at line 45 of file trackball.cpp.


Member Function Documentation

void Trackball::Animate ( unsigned int  msec = 0)

Definition at line 318 of file trackball.cpp.

void Trackball::Apply ( )

Application of the transformation.

Warning:
This function does not draw anything. You have to call DrawPostApply() after drawing everything.

Definition at line 109 of file trackball.cpp.

Apply the inverse of current transformation on the OpenGL modelview matrix.

Definition at line 115 of file trackball.cpp.

void Trackball::Back ( )

Currently not in use.

Definition at line 421 of file trackball.cpp.

void Trackball::ButtonDown ( Trackball::Button  button,
unsigned int  msec = 0 
)

Interface function relative to key up event in QT/SDL.

Parameters:
buttonthe new state.

Definition at line 372 of file trackball.cpp.

Interface function relative to key down event in QT/SDL.

Parameters:
buttonthe new state.

Definition at line 388 of file trackball.cpp.

clear the modes map. Taking the right care of not doubledeleting anything.

Definition at line 51 of file trackball.cpp.

Draw the current manipulator.

Call the draw function of the current manipulator. If no manipulator is selected call the draw function of the manipulator associated to inactive_mode.

Warning:
This function assumes that the OpenGL modelview matrix has been initialized with Apply ().

Definition at line 101 of file trackball.cpp.

Currently not in use.

Definition at line 422 of file trackball.cpp.

Initialize the camera instance.

Definition at line 96 of file trackball.cpp.

void Trackball::HistorySize ( int  lenght)

Currently not in use.

Definition at line 424 of file trackball.cpp.

void Trackball::Home ( )

Currently not in use.

Definition at line 423 of file trackball.cpp.

Definition at line 137 of file trackball.cpp.

bool Trackball::IsAnimating ( unsigned int  msec = 0)

Definition at line 301 of file trackball.cpp.

Currently not in use.

Returns:
A meaningless boolean value.

Definition at line 411 of file trackball.cpp.

Currently not in use.

Returns:
A meaningless boolean value.

Definition at line 416 of file trackball.cpp.

Definition at line 122 of file trackball.cpp.

void Trackball::MouseDown ( int  button)

Interface function relative to mouse down event in QT/SDL.

Parameters:
buttonThe new state.

Definition at line 277 of file trackball.cpp.

void Trackball::MouseDown ( int  x,
int  y,
int  button 
)

Interface function relative to mouse down event in QT/SDL.

Parameters:
xThe horizontal coordinate of the mouse pointer.
yThe vertical coordinate of the mouse pointer.
buttonThe new state.

Definition at line 283 of file trackball.cpp.

void Trackball::MouseMove ( int  x,
int  y 
)

Interface function relative to mouse down event in QT/SDL.

Parameters:
xThe horizontal coordinate of the mouse pointer.
yThe vertical coordinate of the mouse pointer.

Definition at line 291 of file trackball.cpp.

void Trackball::MouseUp ( int  x,
int  y,
int  button 
)

Interface function relative to mouse down event in QT/SDL.

Parameters:
xThe horizontal coordinate of the mouse pointer.
yThe vertical coordinate of the mouse pointer.
buttonThe new state.

Definition at line 330 of file trackball.cpp.

void Trackball::MouseWheel ( float  notch)

Old interface function relative to mouse down event in QT/SDL.

Parameters:
notchThe mouse wheel notch (1: one forward step, -1: one backward step).

Definition at line 338 of file trackball.cpp.

void Trackball::MouseWheel ( float  notch,
int  button 
)

Interface function relative to mouse down event in QT/SDL.

Parameters:
notchThe mouse wheel notch (1: one forward step, -1: one backward step).
buttonThe new state.

Definition at line 357 of file trackball.cpp.

Trackball vcg::Trackball::operator= ( const Trackball ) [inline, private]

Definition at line 205 of file gui/trackball.h.

void Trackball::Reset ( )

Reset the transformation and every mapped manipulator.

Definition at line 264 of file trackball.cpp.

void Trackball::Scale ( const float  f)

Apply a scaling on the current transformation.

Parameters:
fThe scale factor.

Definition at line 141 of file trackball.cpp.

Prepare Trackball and every mapped TrackMode for an user action.

This function is called automatically when an user action begins.

Definition at line 426 of file trackball.cpp.

Reset modes to default mapping.

Set the default modes mapping. The default mapping is:

Warning:
The memory allocated by this function is not automatically deallocated. see ~Trackball().

Definition at line 67 of file trackball.cpp.

void vcg::Trackball::SetFixedTimesteps ( bool  mode) [inline]

Definition at line 523 of file gui/trackball.h.

bool Trackball::SetFromAscii ( const char *  st)

Loads current status from an ascii stings.

Loads current status from an ascii stings. This is useful for example to implement cut-and-paste operations of trackball status, or to embed used trackball into a comment inside a screenshot, etc.

Parameters:
stThe string where to read from (must be allocated). Use ToAscii() method to set it.
Returns:
True iff the trackball was successfully recovered.

Definition at line 191 of file trackball.cpp.

Reset the trackball.

Equivalent to Reset().

Definition at line 88 of file trackball.cpp.

void Trackball::SetPosition ( const Point3f c,
int  millisec = 0 
)

Set the position of the trackball.

Parameters:
cThe new position of the trackball.
millisecCurrently not in use.

Definition at line 92 of file trackball.cpp.

void vcg::Trackball::SetScale ( const float  s) [inline]

Currently not in use.

Parameters:
sCurrently not in use.

Definition at line 225 of file gui/trackball.h.

void vcg::Trackball::SetSensitivity ( float  s)

Currently not in use.

Parameters:
sCurrently not in use.
void Trackball::SetSpinnable ( bool  on)

Definition at line 410 of file trackball.cpp.

Currently not in use.

Parameters:
spinCurrently not in use.

Definition at line 414 of file trackball.cpp.

void vcg::Trackball::SetTransform ( const Transform transform,
int  millisec = 0 
)

Currently not in use.

Parameters:
transformCurrently not in use.
millisecCurrently not in use.

Currently not in use.

Definition at line 415 of file trackball.cpp.

Currently not in use.

void Trackball::Sync ( unsigned int  msec) [private]

Definition at line 314 of file trackball.cpp.

void Trackball::ToAscii ( char *  st)

Stores current status into an ascii stings.

Stores current status into an ascii stings. This is useful for example to implement cut-and-paste operations of trackball status, or to embed used trackball into a comment inside a screenshot, etc.

Parameters:
stThe string where to export (must be allocated 256bytes should be enough).

Definition at line 185 of file trackball.cpp.

Apply a translation on the current transformation.

Parameters:
trThe translation vector.

Definition at line 146 of file trackball.cpp.

void Trackball::Undo ( )

Undo function for manipulator system.

A call of this function restores the state before last user action. This function calls Undo() on every mapped manipulator.

Definition at line 402 of file trackball.cpp.


Friends And Related Function Documentation

friend class TrackMode [friend]

Manipulators needs full access to this class.

Definition at line 528 of file gui/trackball.h.


Member Data Documentation

Currently not in use.

Definition at line 506 of file gui/trackball.h.

The reference for point projection and unprojection from screen space to modelspace.

Definition at line 458 of file gui/trackball.h.

Current state composition. Note: mask with MODIFIERS to get modifier buttons only.

Definition at line 466 of file gui/trackball.h.

The selected manipulator.

Definition at line 468 of file gui/trackball.h.

Currently not in use.

Definition at line 504 of file gui/trackball.h.

Definition at line 531 of file gui/trackball.h.

Currently not in use.

Definition at line 518 of file gui/trackball.h.

Currently not in use.

Definition at line 520 of file gui/trackball.h.

Currently not in use.

Definition at line 502 of file gui/trackball.h.

Definition at line 474 of file gui/trackball.h.

The inactive manipulator. It is drawn when Trackball is inactive.

Definition at line 471 of file gui/trackball.h.

Mouse cursor coordinates before current action.

Definition at line 500 of file gui/trackball.h.

Definition at line 508 of file gui/trackball.h.

Transformation before current user action.

Definition at line 494 of file gui/trackball.h.

Currently not in use.

Definition at line 498 of file gui/trackball.h.

std::map<int, TrackMode *> vcg::Trackball::modes

The manipulator mapping. Needs to be explicitally managed for custom mappings.

Definition at line 490 of file gui/trackball.h.

Currently not in use.

Definition at line 511 of file gui/trackball.h.

Currently not in use.

Definition at line 513 of file gui/trackball.h.

Currently not in use.

Definition at line 515 of file gui/trackball.h.

track after an Undo() call.

Definition at line 496 of file gui/trackball.h.


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


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:41:23