Manipulator tool for translating/rotating/scaling models and links. More...
#include <gui/Gui.hh>
Inherits SingletonT< ModelManipulator >.
Public Member Functions | |
void | Clear () |
Clear the model manipulator. More... | |
void | Detach () |
Detach the manipulator from an entity. More... | |
void | Init () |
Initialize the model manipulator. More... | |
void | OnKeyPressEvent (const common::KeyEvent &_event) |
Process a key press event. More... | |
void | OnKeyReleaseEvent (const common::KeyEvent &_event) |
Process a key release event. More... | |
void | OnMouseMoveEvent (const common::MouseEvent &_event) |
Process an object translate mouse move event. More... | |
void | OnMousePressEvent (const common::MouseEvent &_event) |
Process an object translate mouse press event. More... | |
void | OnMouseReleaseEvent (const common::MouseEvent &_event) |
Process an object translate mouse release event. More... | |
void | RotateEntity (rendering::VisualPtr &_vis, const math::Vector3 &_axis, bool _local=false) |
Rotate entity. More... | |
void | ScaleEntity (rendering::VisualPtr &_vis, const math::Vector3 &_axis, bool _local=false) |
Scale entity. More... | |
void | SetAttachedVisual (rendering::VisualPtr _vis) |
Set the visual to be manipulated by the model manipulator. More... | |
void | SetManipulationMode (const std::string &_mode) |
Set the manipulation mode. More... | |
void | TranslateEntity (rendering::VisualPtr &_vis, const math::Vector3 &_axis, bool _local=false) |
Translate entity. More... | |
Static Public Member Functions | |
static math::Vector3 | GetMouseMoveDistance (rendering::CameraPtr _camera, const math::Vector2i &_start, const math::Vector2i &_end, const math::Pose &_pose, const math::Vector3 &_axis, bool _local) |
Helper function to get the distance moved by the mouse. More... | |
static math::Vector3 | GetMousePositionOnPlane (rendering::CameraPtr _camera, const common::MouseEvent &_event) |
Helper function to get the 3D position of mouse on ground plane. More... | |
static ModelManipulator * | Instance () |
Get an instance of the singleton. More... | |
static math::Vector3 | SnapPoint (const math::Vector3 &_point, double _interval=1.0, double _sensitivity=0.4) |
Snap a point at intervals of a fixed distance. More... | |
Manipulator tool for translating/rotating/scaling models and links.
void Clear | ( | ) |
Clear the model manipulator.
This explicity cleans up the internal state of the singleton and prepares it for exit.
void Detach | ( | ) |
Detach the manipulator from an entity.
|
static |
Helper function to get the distance moved by the mouse.
[in] | _camera | Pointer to user camera. |
[in] | _start | Start point. |
[in] | _end | End point. |
[in] | _pose | Pose of origin. |
[in] | _axis | Movement axis. |
[in] | _local | True to get distance in local frame. |
|
static |
Helper function to get the 3D position of mouse on ground plane.
param[in] _camera Pointer to user camera. param[in] _event Mouse event. return Point of mouse-plane intersection in world coordinates.
void Init | ( | ) |
Initialize the model manipulator.
|
inlinestaticinherited |
Get an instance of the singleton.
void OnKeyPressEvent | ( | const common::KeyEvent & | _event | ) |
Process a key press event.
[in] | _event | Key event. |
void OnKeyReleaseEvent | ( | const common::KeyEvent & | _event | ) |
Process a key release event.
[in] | _event | Key event. |
void OnMouseMoveEvent | ( | const common::MouseEvent & | _event | ) |
Process an object translate mouse move event.
[in] | _event | Mouse event. |
void OnMousePressEvent | ( | const common::MouseEvent & | _event | ) |
Process an object translate mouse press event.
[in] | _event | Mouse event. |
void OnMouseReleaseEvent | ( | const common::MouseEvent & | _event | ) |
Process an object translate mouse release event.
[in] | _event | Mouse event. |
void RotateEntity | ( | rendering::VisualPtr & | _vis, |
const math::Vector3 & | _axis, | ||
bool | _local = false |
||
) |
Rotate entity.
[in] | _vis | Visual representing the entity. |
[in] | _axis | Axis of rotation. |
[in] | _local | True to apply rotation in local frame. |
void ScaleEntity | ( | rendering::VisualPtr & | _vis, |
const math::Vector3 & | _axis, | ||
bool | _local = false |
||
) |
Scale entity.
[in] | _vis | Visual representing the entity. |
[in] | _axis | Scaling axis. |
[in] | _local | True to apply scaling in local frame. |
void SetAttachedVisual | ( | rendering::VisualPtr | _vis | ) |
Set the visual to be manipulated by the model manipulator.
void SetManipulationMode | ( | const std::string & | _mode | ) |
Set the manipulation mode.
[in] | _mode | Manipulation mode: translate, rotate, or scale. |
|
static |
Snap a point at intervals of a fixed distance.
Currently used to give a snapping behavior when moving models with a mouse.
[in] | _point | Input point. |
[in] | _interval | Fixed distance interval at which the point is snapped. |
[in] | _sensitivity | Sensitivity of point snapping, in terms of a percentage of the interval. |
void TranslateEntity | ( | rendering::VisualPtr & | _vis, |
const math::Vector3 & | _axis, | ||
bool | _local = false |
||
) |
Translate entity.
[in] | _vis | Visual representing the entity. |
[in] | _axis | Axis of translation. |
[in] | _local | True to apply translation in local frame. |