MatrixTransform
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_MATRIXTRANSFORM
#define OSG_MATRIXTRANSFORM 1
#include <osg/Transform>
namespace osg {
class OSG_EXPORT MatrixTransform : public Transform
{
public :
MatrixTransform();
MatrixTransform(const MatrixTransform&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
MatrixTransform(const Matrix& matix);
META_Node(osg, MatrixTransform);
virtual MatrixTransform* asMatrixTransform() { return this; }
virtual const MatrixTransform* asMatrixTransform() const { return this; }
void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); }
inline const Matrix& getMatrix() const { return _matrix; }
void preMult(const Matrix& mat) { _matrix.preMult(mat); _inverseDirty=true; dirtyBound(); }
void postMult(const Matrix& mat) { _matrix.postMult(mat); _inverseDirty=true; dirtyBound(); }
inline const Matrix& getInverseMatrix() const
{
if (_inverseDirty)
{
_inverse.invert(_matrix);
_inverseDirty = false;
}
return _inverse;
}
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const;
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const;
protected :
virtual ~MatrixTransform();
Matrix _matrix;
mutable Matrix _inverse;
mutable bool _inverseDirty;
};
}
#endif
Transform
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::MatrixTransform::MatrixTransform
MatrixTransform(const Matrix &matix)
osg::MatrixTransform::META_Node
META_Node(osg, MatrixTransform)
osg::MatrixTransform::getInverseMatrix
const Matrix & getInverseMatrix() const
Definition MatrixTransform:56
osg::MatrixTransform::_matrix
Matrix _matrix
Definition MatrixTransform:75
osg::MatrixTransform::computeLocalToWorldMatrix
virtual bool computeLocalToWorldMatrix(Matrix &matrix, NodeVisitor *) const
osg::MatrixTransform::setMatrix
void setMatrix(const Matrix &mat)
Definition MatrixTransform:44
osg::MatrixTransform::_inverseDirty
bool _inverseDirty
Definition MatrixTransform:77
osg::MatrixTransform::asMatrixTransform
virtual const MatrixTransform * asMatrixTransform() const
Definition MatrixTransform:40
osg::MatrixTransform::asMatrixTransform
virtual MatrixTransform * asMatrixTransform()
Definition MatrixTransform:39
osg::MatrixTransform::_inverse
Matrix _inverse
Definition MatrixTransform:76
osg::MatrixTransform::MatrixTransform
MatrixTransform()
osg::MatrixTransform::computeWorldToLocalMatrix
virtual bool computeWorldToLocalMatrix(Matrix &matrix, NodeVisitor *) const
osg::MatrixTransform::MatrixTransform
MatrixTransform(const MatrixTransform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::MatrixTransform::getMatrix
const Matrix & getMatrix() const
Definition MatrixTransform:47
osg::MatrixTransform::postMult
void postMult(const Matrix &mat)
Definition MatrixTransform:53
osg::MatrixTransform::preMult
void preMult(const Matrix &mat)
Definition MatrixTransform:50
osg::MatrixTransform::~MatrixTransform
virtual ~MatrixTransform()
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node::dirtyBound
void dirtyBound()
osg::Transform::Transform
Transform()
osg
Definition AlphaFunc:19
osg::Matrix
Matrixd Matrix
Definition Matrix:27
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39