Computes transformation matrix for a subgraph. More...
#include <Inventor/actions/SoGetMatrixAction.h>
Public Member Functions | |
virtual SoType | getTypeId () const |
SoGetMatrixAction (const SbViewportRegion &newRegion) | |
void | setViewportRegion (const SbViewportRegion &newRegion) |
const SbViewportRegion & | getViewportRegion () const |
SbMatrix & | getMatrix () |
SbMatrix & | getInverse () |
SbMatrix & | getTextureMatrix () |
SbMatrix & | getTextureInverse () |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Computes transformation matrix for a subgraph.
This action computes transformation matrices for a given subgraph. It computes the cumulative transformation matrix and its inverse, along with a cumulative texture transformation matrix and its inverse. The cumulative transformation matrix transforms the coordinates of a shape from the local object coordinate system to the global world coordinate system.
When this action is applied to a node, it computes the matrix for just that node. This is currently the easiest way to get the transformation matrix for an SoTransform node. It's not very useful for most other types of nodes.
The most common scenario is applying this action to a path. In that case it gathers the transformation info for all nodes in the path and those that affect nodes in the path, but it stops when it hits the last node in the path; it does not traverse downwards from it as most other actions (such as rendering) do. This behavior makes the most sense for this action. To get a path to, for example, a specific geometry in the scene graph see SoSearchAction.
Sets: SoViewportRegionElement
// Get cumulative matrix using current viewport on screen SoPath* somePath = ... SoGetMatrixAction gma( viewer->getViewportRegion() ); gma.apply( somePath ); SbMatrix& matrix = gma.getMatrix();
SoGetBoundingBoxAction, SoSearchAction
SoGetMatrixAction::SoGetMatrixAction | ( | const SbViewportRegion & | newRegion | ) |
Constructor.
Even though the bounding box computation may not involve a window per se, some nodes need the size of the viewport to determine their size in 3D coordinates. For example the size of an SoText2 is a fixed value in device coordinates, but the corresponding size in 3D depends on the current camera.
Usually it is convenient to get the actual viewport region from the viewer as shown in the example above. However if the scene graph does not contain any viewport dependent nodes then any values can be used.
static SoType SoGetMatrixAction::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoAction.
SbMatrix& SoGetMatrixAction::getInverse | ( | ) | [inline] |
Returns the inverse of the cumulative transformation matrix.
Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
SbMatrix& SoGetMatrixAction::getMatrix | ( | ) | [inline] |
Returns cumulative transformation matrix.
Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
SbMatrix& SoGetMatrixAction::getTextureInverse | ( | ) | [inline] |
Returns the inverse of the cumulative texture transformation matrix.
Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
SbMatrix& SoGetMatrixAction::getTextureMatrix | ( | ) | [inline] |
Returns cumulative texture transformation matrix.
Warning: the matrix returned by this routine should not be changed (unless you are implementing your own transformation nodes).
virtual SoType SoGetMatrixAction::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
const SbViewportRegion& SoGetMatrixAction::getViewportRegion | ( | ) | const [inline] |
Returns current viewport region to use for action.
void SoGetMatrixAction::setViewportRegion | ( | const SbViewportRegion & | newRegion | ) |
Sets current viewport region to use for action.