OpenSceneGraph 3.6.5
MatrixTransform
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_MATRIXTRANSFORM
15#define OSG_MATRIXTRANSFORM 1
16
17#include <osg/Transform>
18
19namespace osg {
20
26{
27 public :
28
29
31
34
35 MatrixTransform(const Matrix& matix);
36
38
39 virtual MatrixTransform* asMatrixTransform() { return this; }
40 virtual const MatrixTransform* asMatrixTransform() const { return this; }
41
42
44 void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); }
45
47 inline const Matrix& getMatrix() const { return _matrix; }
48
50 void preMult(const Matrix& mat) { _matrix.preMult(mat); _inverseDirty=true; dirtyBound(); }
51
53 void postMult(const Matrix& mat) { _matrix.postMult(mat); _inverseDirty=true; dirtyBound(); }
54
56 inline const Matrix& getInverseMatrix() const
57 {
58 if (_inverseDirty)
59 {
60 _inverse.invert(_matrix);
61 _inverseDirty = false;
62 }
63 return _inverse;
64 }
65
66 virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const;
67
68 virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const;
69
70
71 protected :
72
74
77 mutable bool _inverseDirty;
78
79
80};
81
82}
83
84#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Matrixd Matrix
Definition Matrix:27
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
MatrixTransform(const Matrix &matix)
META_Node(osg, MatrixTransform)
const Matrix & getInverseMatrix() const
Get the inverse matrix.
Definition MatrixTransform:56
Matrix _matrix
Definition MatrixTransform:75
virtual bool computeLocalToWorldMatrix(Matrix &matrix, NodeVisitor *) const
void setMatrix(const Matrix &mat)
Set the transform's matrix.
Definition MatrixTransform:44
bool _inverseDirty
Definition MatrixTransform:77
virtual const MatrixTransform * asMatrixTransform() const
Definition MatrixTransform:40
virtual MatrixTransform * asMatrixTransform()
Definition MatrixTransform:39
Matrix _inverse
Definition MatrixTransform:76
virtual bool computeWorldToLocalMatrix(Matrix &matrix, NodeVisitor *) const
MatrixTransform(const MatrixTransform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
const Matrix & getMatrix() const
Get the matrix.
Definition MatrixTransform:47
void postMult(const Matrix &mat)
post multiply the transform's matrix.
Definition MatrixTransform:53
void preMult(const Matrix &mat)
pre multiply the transform's matrix.
Definition MatrixTransform:50
virtual ~MatrixTransform()
void dirtyBound()
Mark this node's bounding sphere dirty.
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.