# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::TrackballManipulator Class Reference

This class lets you rotate a Camera or a Transform node using a vitual trackball. More...

`#include <TrackballManipulator.hpp>`

Inheritance diagram for vl::TrackballManipulator:

List of all members.

## Public Types

enum | ETrackballMode { NoMode, RotationMode, TranslationMode, ZoomMode }

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| TrackballManipulator ()
virtual void | mouseDownEvent (EMouseButton, int x, int y)
virtual void | mouseUpEvent (EMouseButton, int x, int y)
virtual void | mouseMoveEvent (int x, int y)
mat4 | trackballRotation (int x, int y)
vec3 | computeVector (int x, int y)
void | setCamera (Camera *camera)
Camera * | camera ()
void | prepareToReconnect ()
| Reimplement this in order to react to a setEnabled(true), see setEnabled() for more information.
void | setPivot (vec3 pivot)
| Sets the center point the camera will rotate around.
vec3 | pivot () const
void | setTransform (Transform *tr)
Transform * | transform ()
int | rotationButton () const
void | setRotationButton (int mouse_button)
int | zoomButton () const
void | setZoomButton (int mouse_button)
int | translationButton () const
void | setTranslationButton (int mouse_button)
float | rotationSpeed () const
void | setRotationSpeed (float speed)
float | zoomSpeed () const
void | setZoomSpeed (float speed)
float | translationSpeed () const
void | setTranslationSpeed (float speed)
ETrackballMode | mode () const
| Returns the current trackball manipulator state.
void | adjustView (const AABB &aabb, const vec3 &dir, const vec3 &up, Real bias=1.0f)
| Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB. See also Camera::adjustView().
void | adjustView (ActorCollection &actors, const vec3 &dir, const vec3 &up, Real bias=1.0f)
| Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB containing the Actor[s]. See also Camera::adjustView().
void | adjustView (SceneManager *scene, const vec3 &dir, const vec3 &up, Real bias=1.0f)
| Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB containing the given scene manager. See also Camera::adjustView().
void | adjustView (Rendering *rendering, const vec3 &dir, const vec3 &up, Real bias=1.0f)
| Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB containing all the scene managers part of the given rendering. See also Camera::adjustView().

## Protected Attributes

ref< Camera > | mCamera
ivec2 | mMouseStart
mat4 | mStartMatrix
vec3 | mPivot
vec3 | mStartCameraPos
vec3 | mStartPivot
ref< Transform > | mTransform
ETrackballMode | mMode
int | mRotationButton
int | mTranslationButton
int | mZoomButton
float | mRotationSpeed
float | mTranslationSpeed
float | mZoomSpeed

## Detailed Description

This class lets you rotate a Camera or a Transform node using a vitual trackball.

If you set a Transform node to manipulate, using the function setTransform(), this object will manipulate the given Transform. If no Transform is specified or a NULL one is passed to the function setTransform() then this object will manipulate the current camera.

Note:
  In any case, before using a TrackballManipulator you have to specify a Camera object using the function setCamera().

  The Transform is expected to contain only rotation and translation information. Other transformations like shearing, scaling, projection, and so on can produce unspecified results.

## Member Enumeration Documentation

enum vl::TrackballManipulator::ETrackballMode

Enumerator:

  NoMode |
  RotationMode |
  TranslationMode |
  ZoomMode |

## Constructor & Destructor Documentation

vl::TrackballManipulator::TrackballManipulator | ( |  | ) | `[inline]`

## Member Function Documentation

virtual const char* vl::TrackballManipulator::className | ( |  | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::UIEventListener.

void TrackballManipulator::mouseDownEvent | ( | EMouseButton | btn,
|  | int | x,
|  | int | y |
| ) |  |  | `[virtual]`

Reimplemented from vl::UIEventListener.

void TrackballManipulator::mouseUpEvent | ( | EMouseButton | btn,
|  | int | x,
|  | int | y |
| ) |  |  | `[virtual]`

Reimplemented from vl::UIEventListener.

void TrackballManipulator::mouseMoveEvent | ( | int | x,
|  | int | y |
| ) |  |  | `[virtual]`

Reimplemented from vl::UIEventListener.

mat4 TrackballManipulator::trackballRotation | ( | int | x,
|  | int | y |
| ) |  |  |

vec3 TrackballManipulator::computeVector | ( | int | x,
|  | int | y |
| ) |  |  |

void vl::TrackballManipulator::setCamera | ( | Camera * | camera | ) | `[inline]`

Camera* vl::TrackballManipulator::camera | ( |  | ) | `[inline]`

void vl::TrackballManipulator::prepareToReconnect | ( |  | ) | `[inline, virtual]`

Reimplement this in order to react to a setEnabled(true), see setEnabled() for more information.

Reimplemented from vl::UIEventListener.

void vl::TrackballManipulator::setPivot | ( | vec3 | pivot | ) | `[inline]`

Sets the center point the camera will rotate around.

vec3 vl::TrackballManipulator::pivot | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setTransform | ( | Transform * | tr | ) | `[inline]`

Transform* vl::TrackballManipulator::transform | ( |  | ) | `[inline]`

int vl::TrackballManipulator::rotationButton | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setRotationButton | ( | int | mouse_button | ) | `[inline]`

int vl::TrackballManipulator::zoomButton | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setZoomButton | ( | int | mouse_button | ) | `[inline]`

int vl::TrackballManipulator::translationButton | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setTranslationButton | ( | int | mouse_button | ) | `[inline]`

float vl::TrackballManipulator::rotationSpeed | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setRotationSpeed | ( | float | speed | ) | `[inline]`

float vl::TrackballManipulator::zoomSpeed | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setZoomSpeed | ( | float | speed | ) | `[inline]`

float vl::TrackballManipulator::translationSpeed | ( |  | ) | const`[inline]`

void vl::TrackballManipulator::setTranslationSpeed | ( | float | speed | ) | `[inline]`

ETrackballMode vl::TrackballManipulator::mode | ( |  | ) | const`[inline]`

Returns the current trackball manipulator state.

void TrackballManipulator::adjustView | ( | const AABB & | aabb,
|  | const vec3 & | dir,
|  | const vec3 & | up,
|  | Real | bias = `1.0f` |
| ) |  |  |

Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB. See also Camera::adjustView().

void TrackballManipulator::adjustView | ( | ActorCollection & | actors,
|  | const vec3 & | dir,
|  | const vec3 & | up,
|  | Real | bias = `1.0f` |
| ) |  |  |

Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB containing the Actor[s]. See also Camera::adjustView().

void TrackballManipulator::adjustView | ( | SceneManager * | scene,
|  | const vec3 & | dir,
|  | const vec3 & | up,
|  | Real | bias = `1.0f` |
| ) |  |  |

Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB containing the given scene manager. See also Camera::adjustView().

void TrackballManipulator::adjustView | ( | Rendering * | rendering,
|  | const vec3 & | dir,
|  | const vec3 & | up,
|  | Real | bias = `1.0f` |
| ) |  |  |

Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to the center of the AABB containing all the scene managers part of the given rendering. See also Camera::adjustView().

## Member Data Documentation

ref<Camera> vl::TrackballManipulator::mCamera`[protected]`

ivec2 vl::TrackballManipulator::mMouseStart`[protected]`

mat4 vl::TrackballManipulator::mStartMatrix`[protected]`

vec3 vl::TrackballManipulator::mPivot`[protected]`

vec3 vl::TrackballManipulator::mStartCameraPos`[protected]`

vec3 vl::TrackballManipulator::mStartPivot`[protected]`

ref<Transform> vl::TrackballManipulator::mTransform`[protected]`

ETrackballMode vl::TrackballManipulator::mMode`[protected]`

int vl::TrackballManipulator::mRotationButton`[protected]`

int vl::TrackballManipulator::mTranslationButton`[protected]`

int vl::TrackballManipulator::mZoomButton`[protected]`

float vl::TrackballManipulator::mRotationSpeed`[protected]`

float vl::TrackballManipulator::mTranslationSpeed`[protected]`

float vl::TrackballManipulator::mZoomSpeed`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/TrackballManipulator.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/TrackballManipulator.cpp

Visualization Library v2009.07 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Mon Aug 10 21:41:44 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.