Katana Plug-in APIs 0.1
Public Member Functions | Protected Member Functions

Foundry::Katana::ViewerUtils::GLManipulatorHandle Class Reference

A base class for a GL based ManipulatorHandle. More...

#include <FnGLManipulator.h>

Inheritance diagram for Foundry::Katana::ViewerUtils::GLManipulatorHandle:
Foundry::Katana::ViewerAPI::ManipulatorHandle Foundry::Katana::ViewerAPI::ManipulatorHandlePluginBase Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle GLCoiHandle GLRotateAxisHandle GLRotateBallHandle GLScaleAxisHandle GLScalePlaneHandle GLScaleUniformHandle GLTranslateAxisHandle GLTranslatePlaneHandle GLTranslateScreenPlaneHandle

List of all members.

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

GLManipulatorgetGLManipulator ()
 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 &currentPointOnPlane, const Vec2i &initialMousePosition, const Vec2i &previousMousePosition, const Vec2i &currentMousePosition, 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 Vec2igetLatestMousePosition () const

Detailed Description

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.


Member Function Documentation

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.

Parameters:
initialPointOnPlaneThe initial projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane().
previousPointOnPlaneThe previous projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane().
currentPointOnPlaneThe current projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane().
initialMousePositionThe initial mouse position in pixels.
previousMousePositionThe previous mouse position in pixels.
currentMousePositionThe current mouse position in pixels.
isFinalTrue 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]
Returns:
The latest keyboard modifiers mask (i.e. the modifiers received in the last handled event() call).
const Vec2i& Foundry::Katana::ViewerUtils::GLManipulatorHandle::getLatestMousePosition ( ) const [inline, protected]
Returns:
The latest mouse position (i.e. the mouse position received in the last handled event() call).
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.

Parameters:
initialPointOnPlaneThe initial projection of the mouse pointer on the virtual manipulation plane defined by getDraggingPlane().
initialMousePositionThe 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.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator