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

GLRotateBallHandle Class Reference

A handle to rotate the selected object in 2 degrees of freedom. More...

#include <FnGLRotateBallHandle.h>

Inheritance diagram for GLRotateBallHandle:
Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle Foundry::Katana::ViewerUtils::GLManipulatorHandle Foundry::Katana::ViewerAPI::ManipulatorHandle Foundry::Katana::ViewerAPI::ManipulatorHandlePluginBase

List of all members.

Public Member Functions

 GLRotateBallHandle ()
 Constructor.
virtual ~GLRotateBallHandle ()
 Destructor.
void draw ()
void pickerDraw (int64_t pickerId)
void setup ()
 Initializes the mesh.
Orientation getOrientation ()
 Always returns VIEW as the orientation for this handle.
FnAttribute::Attribute getOption (Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type optionId)
 Gets the option given the option ID.

Static Public Member Functions

static
Foundry::Katana::ViewerAPI::ManipulatorHandle
create ()
 Creates a new instance of GLRotateBallHandle.
static void flush ()
 Flushes any cached data.

Protected Member Functions

virtual std::string getComponentName ()
bool getDraggingPlane (Vec3d &origin, Vec3d &normal)
void startDrag (const Vec3d &initialPointOnPlane, const Vec2i &initialMousePosition)
void drag (const Vec3d &initialPointOnPlane, const Vec3d &previousPointOnPlane, const Vec3d &currentPointOnPlane, const Vec2i &initialMousePosition, const Vec2i &previousMousePosition, const Vec2i &currentMousePosition, bool isFinal)
void applyXformToLocation (const std::string &locationPath, const IMATH_NAMESPACE::M44d &xform, bool isFinal)

Detailed Description

A handle to rotate the selected object in 2 degrees of freedom.

This class represents a central rotation handle that can be used to rotate an object in two degrees of freedom that are camera aligned. It uses a constant VIEW orientation for that. It uses a metaphor of a trackball in the center of the manipulator that can be rotated by dragging it vertically and horizontally.

The mesh used for the manipulator, although it might look like a sphere (and that is the intention), it is in reality a flat filled circle, centered at the manipulator's origin and always facing the camera. It is also slightly moved away from the camera, so that it doesn't overlap or occlude other handles placed closer to the origin. When dragging, the mouse position is transformed into a direction vector that goes from the origin of the manipulator, towards a point on the imaginary hemisphere that faces the camera where the mouse pointer is. The amount of rotation is given by the direction difference between the original direction vector at drag start and the current one. The camera up vector is used to avoid rotations along the camera direction vector (perpendicular to the screen).


Member Function Documentation

void GLRotateBallHandle::applyXformToLocation ( const std::string &  locationPath,
const IMATH_NAMESPACE::M44d &  xform,
bool  isFinal 
) [protected, virtual]

Applies the given rotation transform to the given location. This will also take the rotation order into account.

Implements Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateBallHandle::drag ( const Vec3d initialPointOnPlane,
const Vec3d previousPointOnPlane,
const Vec3d currentPointOnPlane,
const Vec2i initialMousePosition,
const Vec2i previousMousePosition,
const Vec2i currentMousePosition,
bool  isFinal 
) [protected, virtual]

Calculates the current direction vector and applies the rotation given by the difference in its orientation and the initial one calculated in startDrag().

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateBallHandle::draw ( ) [virtual]

Draws the handle.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

virtual std::string GLRotateBallHandle::getComponentName ( ) [inline, protected, virtual]

The transform component: xform.interactive.rotate?

Implements Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

bool GLRotateBallHandle::getDraggingPlane ( Vec3d origin,
Vec3d normal 
) [protected, virtual]

Gets the dragging plane's origin and normal. The origin is always the same as the whole manipulator and the the normal is given by the camera direction vector (inversed).

Reimplemented from Foundry::Katana::ViewerUtils::GLManipulatorHandle.

FnAttribute::Attribute GLRotateBallHandle::getOption ( Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type  optionId) [virtual]

Gets the option given the option ID.

It has been overridden to disable hide the mouse pointer.

Reimplemented from Foundry::Katana::ViewerUtils::GLManipulatorHandle.

void GLRotateBallHandle::pickerDraw ( int64_t  pickerId) [virtual]

Draws the manipulator with a specific selection picker ID. Typically this ID is converted to a color value, and the handle is then drawn with flat shading, so it can be identified in a look-up table.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateBallHandle::startDrag ( const Vec3d initialPointOnPlane,
const Vec2i initialMousePosition 
) [protected, virtual]

Initializes the initial direction vector.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.


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