|
Katana Plug-in APIs 0.1
|
A base class for a GL based ManipulatorHandle. More...
#include <FnGLManipulator.h>
Public Member Functions | |
| GLManipulatorHandle () | |
| Constructor. | |
| virtual | ~GLManipulatorHandle () |
| Destructor. | |
| virtual void | cancelManipulation () |
| Cancels the manipulation. | |
| virtual void | draw () |
| Draws the handle using the standard shaders. | |
| virtual void | pickerDraw (int64_t pickerID) |
| Draws the handle for picking using the standard shaders. | |
| virtual bool | event (const FnEventWrapper &eventData) |
| Handles events once it is activated by the GLManipulatorLayer. | |
| virtual FnAttribute::Attribute | getOption (Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type) |
| Gets the option given the option ID. | |
Protected Member Functions | |
| GLManipulator * | getGLManipulator () |
| Utility that returns a pointer to the GLManipulator instance. | |
| ViewportWrapperPtr | getViewport () |
| Utility that returns the Viewport. | |
| ViewerDelegateWrapperPtr | getViewerDelegate () |
| Utility that returns the ViewerDelegate. | |
| bool | isDragging () |
| Specifies if the user is currently dragging the handle. | |
| bool | hasBeenDragged () |
| Specified if the user has been dragging the handle. | |
| virtual bool | getDraggingPlane (Vec3d &origin, Vec3d &normal) |
| Gets the dragging plane's origin and normal. | |
| virtual void | startDrag (const Vec3d &initialPointOnPlane, const Vec2i &initialMousePosition) |
| Called when a mouse dragging starts. | |
| virtual void | drag (const Vec3d &initialPointOnPlane, const Vec3d &previousPointOnPlane, const Vec3d ¤tPointOnPlane, const Vec2i &initialMousePosition, const Vec2i &previousMousePosition, const Vec2i ¤tMousePosition, bool isFinal) |
| Called when a mouse dragging occurs. | |
| virtual void | endDrag () |
| Called when a mouse dragging ends. | |
| virtual bool | canProcessKeyboardModifiers (int modifiers) const |
| Gets whether the manipulator handle can process the given keyboard modifiers. The default behavior is to ignore all events with modifiers. | |
| void | useDrawingShader (const Matrix44d &xform, const Vec4f &color, bool isFlat) |
| Activates the default manipulator handle shader for drawing. | |
| void | useLineStippleDrawingShader (const Matrix44d &xform, const Vec4f &color, int pattern, float factor) |
| Activates the manipulator handle shader for drawing line stipples. | |
| void | usePickingShader (const Matrix44d &xform, int handleId, int handlePriority) |
| Activates the default manipulator handle shader for drawing. | |
| int | getLatestKeyboardModifiers () const |
| const Vec2i & | getLatestMousePosition () const |
A base class for a GL based ManipulatorHandle.
This is a base class implementation of an OpenGL powered manipulator handle that is managed by the GLManipulatorLayer layer. It specializes the functionality of the generic ManipulatorHandle API, that is meant to be used by any renderers, including non GL ones. The ManipulatorHandles provided by Katana extend this class.
This also implements the detection of dragging using a mouse or pointer.
The manipulator class of a GLManipulatorHandle should extend GLManipulator.
| virtual void Foundry::Katana::ViewerUtils::GLManipulatorHandle::cancelManipulation | ( | ) | [virtual] |
Cancels the manipulation.
Typically called before the handle is destroyed to discard any pending transform that hasn't been made persistent while dragging the handle.
Implements Foundry::Katana::ViewerAPI::ManipulatorHandle.
Reimplemented in Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.
| virtual bool Foundry::Katana::ViewerUtils::GLManipulatorHandle::canProcessKeyboardModifiers | ( | int | modifiers | ) | const [inline, protected, virtual] |
Gets whether the manipulator handle can process the given keyboard modifiers. The default behavior is to ignore all events with modifiers.
This protected, virtual function can be overridden to allow manipulator handle implementations to process certain (or all) modifiers.
| virtual void Foundry::Katana::ViewerUtils::GLManipulatorHandle::drag | ( | const Vec3d & | initialPointOnPlane, |
| const Vec3d & | previousPointOnPlane, | ||
| const Vec3d & | currentPointOnPlane, | ||
| const Vec2i & | initialMousePosition, | ||
| const Vec2i & | previousMousePosition, | ||
| const Vec2i & | currentMousePosition, | ||
| bool | isFinal | ||
| ) | [protected, virtual] |
Called when a mouse dragging occurs.
This is the function where the Manipulator::setValue() should be called to set any node graph parameters / scene graph attributes.
| initialPointOnPlane | The initial projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane(). |
| previousPointOnPlane | The previous projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane(). |
| currentPointOnPlane | The current projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane(). |
| initialMousePosition | The initial mouse position in pixels. |
| previousMousePosition | The previous mouse position in pixels. |
| currentMousePosition | The current mouse position in pixels. |
| isFinal | True if this is a final value. |
Reimplemented in Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle, GLRotateAxisHandle, GLRotateBallHandle, GLScaleAxisHandle, GLScalePlaneHandle, GLScaleUniformHandle, and GLTranslateAxisHandle.
| virtual void Foundry::Katana::ViewerUtils::GLManipulatorHandle::draw | ( | ) | [virtual] |
Draws the handle using the standard shaders.
This should be called by the implementation on child classes in order to bind the standard shader.
The vertex shader makes use of the Manipulator's transform and also the handle local transform that can be set using setLocalXform() in order to render the handle with the correct transform.
Implements Foundry::Katana::ViewerAPI::ManipulatorHandle.
Reimplemented in GLCoiHandle, Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle, GLRotateAxisHandle, GLRotateBallHandle, GLScaleAxisHandle, GLScalePlaneHandle, GLScaleUniformHandle, GLTranslateAxisHandle, GLTranslatePlaneHandle, and GLTranslateScreenPlaneHandle.
| virtual void Foundry::Katana::ViewerUtils::GLManipulatorHandle::endDrag | ( | ) | [protected, virtual] |
Called when a mouse dragging ends.
This can be used to tear down any dragging related data.
Reimplemented in Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle, GLRotateAxisHandle, GLScaleAxisHandle, GLTranslateAxisHandle, GLTranslatePlaneHandle, and GLTranslateScreenPlaneHandle.
| virtual bool Foundry::Katana::ViewerUtils::GLManipulatorHandle::event | ( | const FnEventWrapper & | eventData | ) | [virtual] |
Handles events once it is activated by the GLManipulatorLayer.
Detects if the user is dragging the handle. It will call the dragging functions: startDrag(), drag() and endDrag()
This should be called by the implementation on child classes in order to detect the handle dragging, unless if dragging is not required.
Reimplemented from Foundry::Katana::ViewerAPI::ManipulatorHandle.
| virtual bool Foundry::Katana::ViewerUtils::GLManipulatorHandle::getDraggingPlane | ( | Vec3d & | origin, |
| Vec3d & | normal | ||
| ) | [protected, virtual] |
Gets the dragging plane's origin and normal.
When dragging a manipulator the mouse pointer position will be projected on a virtual plane in world space. This point on the plane will then be used as the dragging values during the interaction.
Reimplemented in GLRotateAxisHandle, GLRotateBallHandle, GLScaleAxisHandle, GLScalePlaneHandle, GLScaleUniformHandle, and GLTranslateAxisHandle.
| int Foundry::Katana::ViewerUtils::GLManipulatorHandle::getLatestKeyboardModifiers | ( | ) | const [inline, protected] |
| const Vec2i& Foundry::Katana::ViewerUtils::GLManipulatorHandle::getLatestMousePosition | ( | ) | const [inline, protected] |
| virtual FnAttribute::Attribute Foundry::Katana::ViewerUtils::GLManipulatorHandle::getOption | ( | Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type | ) | [virtual] |
Gets the option given the option ID.
It has been overridden to support the "NewMousePosition" option.
Reimplemented from Foundry::Katana::ViewerAPI::ManipulatorHandle.
Reimplemented in GLRotateAxisHandle, and GLRotateBallHandle.
| virtual void Foundry::Katana::ViewerUtils::GLManipulatorHandle::pickerDraw | ( | int64_t | pickerID | ) | [virtual] |
Draws the handle for picking using the standard shaders.
This should be called by the implementation on child classes in order to bind the standard picking shader, unless if a custom shader is meant to be used (not recommended).
The vertex shader makes use of the Manipulator's transform and also a local handle transform that can be set using setLocalXform() in order to render the handle with the correct transform.
The fragment shader will render the handles using the picker ID, which is then decoded by GLManipulatorLayer during picking.
Implements Foundry::Katana::ViewerAPI::ManipulatorHandle.
Reimplemented in Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle, GLRotateAxisHandle, GLRotateBallHandle, GLScaleAxisHandle, GLScalePlaneHandle, GLScaleUniformHandle, GLTranslateAxisHandle, GLTranslatePlaneHandle, and GLTranslateScreenPlaneHandle.
| virtual void Foundry::Katana::ViewerUtils::GLManipulatorHandle::startDrag | ( | const Vec3d & | initialPointOnPlane, |
| const Vec2i & | initialMousePosition | ||
| ) | [protected, virtual] |
Called when a mouse dragging starts.
This can be used to initialize any dragging related data.
| initialPointOnPlane | The initial projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane(). |
| initialMousePosition | The initial mouse position in pixels. |
Reimplemented in Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle, GLRotateAxisHandle, GLRotateBallHandle, GLScaleAxisHandle, and GLTranslateAxisHandle.
| void Foundry::Katana::ViewerUtils::GLManipulatorHandle::useLineStippleDrawingShader | ( | const Matrix44d & | xform, |
| const Vec4f & | color, | ||
| int | pattern, | ||
| float | factor | ||
| ) | [protected] |
Activates the manipulator handle shader for drawing line stipples.
The `pattern` and the `factor` parameters are equivalent to the ones in the deprecated `glLineStipple` function.
1.7.3