Workspace 6.21.5
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
TransformManipulator Class Referenceabstract

Base class for manipulators in a renderer. A manipulator is an object that can be interacted with (e.g. with the mouse, or keyboard) to modify a SceneItem.

#include <Rendering/SceneInteraction/transformmanipulator.h>

Inheritance diagram for TransformManipulator:
[legend]

Public Types

enum  AxisFlags { XAxis , YAxis , ZAxis , AllAxes }
 

Public Member Functions

 TransformManipulator (const TransformManipulator &other)
 
 TransformManipulator (unsigned freeAxes=AllAxes)
 
 ~TransformManipulator () override
 
bool activate (Scene &scene, Camera &camera) override=0
 
QString getCacheKey () const override=0
 
const Mesh::LinegetDragEnd () const
 
const Mesh::LinegetDragStart () const
 
const Mesh::TransformMatrixgetFinalTransform () const
 
unsigned getFreeAxesOfMotion () const
 
TransformManipulatoroperator= (const TransformManipulator &rhs)
 
void setDragEnd (const Mesh::Line &dragEnd)
 
void setDragStart (const Mesh::Line &dragStart)
 
void setFinalTransformToIdentity ()
 
void setFreeAxesOfMotion (unsigned axisFlags)
 
- Public Member Functions inherited from Manipulator
 Manipulator ()
 
 Manipulator (const Manipulator &other)
 
virtual ~Manipulator ()
 
virtual bool activate (Scene &scene, Camera &camera)=0
 
virtual QString getCacheKey () const =0
 
const QString & getOpIdPath () const
 
Manipulatoroperator= (const Manipulator &rhs)
 
void setOpIdPath (const QString &opIdPath)
 
virtual bool visit (ManipulatorProcessor &processor)=0
 

Protected Member Functions

void combineWithFinalTransform (const Mesh::TransformMatrix &t)
 

Static Protected Member Functions

static Mesh::Vector3d calcDragVectorAlongAxis (const Mesh::Line &dragStart, const Mesh::Line &dragEnd, const Mesh::BoundingPlane &plane, const Mesh::Vector3d &axis)
 
static Mesh::Vector3d calcPlanarMotion (const Mesh::Line &dragStart, const Mesh::Line &dragEnd, const Mesh::BoundingPlane &plane)
 
static bool getWorldMatrices (const SceneItem &manipItem, Mesh::TransformMatrix &world, Mesh::TransformMatrix &worldNoTranslate, Mesh::TransformMatrix &worldInv)
 

Member Enumeration Documentation

◆ AxisFlags

enum AxisFlags
Enumerator
XAxis 
YAxis 
ZAxis 
AllAxes 

Constructor & Destructor Documentation

◆ TransformManipulator() [1/2]

TransformManipulator ( unsigned  freeAxes = AllAxes)

◆ TransformManipulator() [2/2]

◆ ~TransformManipulator()

~TransformManipulator ( )
override

Member Function Documentation

◆ activate()

bool activate ( Scene scene,
Camera camera 
)
overridepure virtual

◆ calcDragVectorAlongAxis()

Vector3d calcDragVectorAlongAxis ( const Mesh::Line dragStart,
const Mesh::Line dragEnd,
const Mesh::BoundingPlane plane,
const Mesh::Vector3d axis 
)
staticprotected
Parameters
dragStartLine representing the start point of a drag (world coordinates)
dragEndLine representing the end point of a drag (world coordinates)
planePlane which our lines are intersecting (world coordinates)
axisAxis along which we are projecting motion (world coordinates)
Note
The axis vector and plane normal are assumed to be unit vectors in order to save on calculations.
Returns
a vector representing the distance dragged along the axis, on the plane, in world coords.

◆ calcPlanarMotion()

Vector3d calcPlanarMotion ( const Mesh::Line dragStart,
const Mesh::Line dragEnd,
const Mesh::BoundingPlane plane 
)
staticprotected
Parameters
dragStartLine representing the start point of a drag (world coordinates)
dragEndLine representing the end point of a drag (world coordinates)
planePlane on which to intersect our lines (world coordinates)
Returns
a vector representing the motion dragged on the specified plane, in world coordinates.
Note
the plane normal is assumed to be a unit vector in order to save on calculations.

Computes planar motion from the input start and end rays by projecting those points onto a plane defined by pointOnPlane and planeNormal.

◆ combineWithFinalTransform()

void combineWithFinalTransform ( const Mesh::TransformMatrix t)
protected
Parameters
tThe transform to combine with the current "final" transform.

Combines a transform with the recorded final transform of this manipulator; i.e. applies this transform to the overall transform, which indicates the final position of the object that this manipulator has been repeatedly applied to.

See also
getFinalTransform

◆ getCacheKey()

QString getCacheKey ( ) const
overridepure virtual

◆ getDragEnd()

const Line & getDragEnd ( ) const
Returns
dragStart A line (in world coordinates) representing the end point of a user's mouse drag. The line cuts through the view frustum.

Get the end of the drag for the manipulator. A single drag is made of a start (where the user pressed), and an end (where the user released).

◆ getDragStart()

const Line & getDragStart ( ) const
Returns
dragStart A line (in world coordinates) representing the start point of a user's mouse drag. The line cuts through the view frustum.

Get the start of the drag for the manipulator. A single drag is made of a start (where the user pressed), and an end (where the user released).

◆ getFinalTransform()

const Mesh::TransformMatrix & getFinalTransform ( ) const
Returns
The final transform that has been applied by this manipulator, taking into account each individual application (call to apply()).

Manipulators always notify the scene of their changes instantly during the activate() function. This function returns a transform that represents the final state that the manipulator would apply to the object if all of these accumulated changes were applied together. This is useful for undoing/redoing a whole set of individual manipulations.

◆ getFreeAxesOfMotion()

unsigned getFreeAxesOfMotion ( ) const

◆ getWorldMatrices()

bool getWorldMatrices ( const SceneItem manipItem,
Mesh::TransformMatrix world,
Mesh::TransformMatrix worldNoTranslate,
Mesh::TransformMatrix worldInv 
)
staticprotected
Parameters
manipItemThe scene item being manipulated. We are retrieving its matrices.
world(out) The world matrix of the scene item
worldNoTranslate(out) The world matrix without a translation component
worldInv(out) The world matrix (without translation) inverted
Returns
true if the matrices were successfully obtained from the scene item, false if an error occurred (e.g. the world matrix was not invertible).

◆ operator=()

TransformManipulator & operator= ( const TransformManipulator rhs)
Parameters
rhs

◆ setDragEnd()

void setDragEnd ( const Mesh::Line dragEnd)
Parameters
dragEndA line (in world coordinates) representing the end point of a user's mouse drag. The line cuts through the view frustum.

Set the end of the drag for the manipulator. A single drag is made of a start (where the user pressed), and an end (where the user released).

◆ setDragStart()

void setDragStart ( const Mesh::Line dragStart)
Parameters
dragStartA line (in world coordinates) representing the start point of a user's mouse drag. The line cuts through the view frustum.

Set the start of the drag for the manipulator. A single drag is made of a start (where the user pressed), and an end (where the user released).

◆ setFinalTransformToIdentity()

void setFinalTransformToIdentity ( )

Resets the final transform to the identity matrix.

◆ setFreeAxesOfMotion()

void setFreeAxesOfMotion ( unsigned  axisFlags)