root/OpenSceneGraph/trunk/src/osg/MatrixTransform.cpp @ 13041

Revision 13041, 1.7 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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#include <osg/MatrixTransform>
14
15using namespace osg;
16
17MatrixTransform::MatrixTransform():
18    _inverseDirty(false)
19{
20}
21
22MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp& copyop):
23    Transform(transform,copyop),
24    _matrix(transform._matrix),
25    _inverse(transform._inverse),
26    _inverseDirty(transform._inverseDirty)
27{
28}
29
30MatrixTransform::MatrixTransform(const Matrix& mat )
31{
32    _referenceFrame = RELATIVE_RF;
33
34    _matrix = mat;
35    _inverseDirty = true;
36}
37
38
39MatrixTransform::~MatrixTransform()
40{
41}
42
43bool MatrixTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
44{
45    if (_referenceFrame==RELATIVE_RF)
46    {
47        matrix.preMult(_matrix);
48    }
49    else // absolute
50    {
51        matrix = _matrix;
52    }
53    return true;
54}
55
56bool MatrixTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
57{
58    const Matrix& inverse = getInverseMatrix();
59
60    if (_referenceFrame==RELATIVE_RF)
61    {
62        matrix.postMult(inverse);
63    }
64    else // absolute
65    {
66        matrix = inverse;
67    }
68    return true;
69}
Note: See TracBrowser for help on using the browser.