root/OpenSceneGraph/trunk/src/osgAnimation/StackedMatrixElement.cpp @ 13041

Revision 13041, 1.5 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/*  -*-c++-*-
2 *  Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
3 *
4 * This library is open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version.  The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * OpenSceneGraph Public License for more details.
13 */
14
15#include <osgAnimation/StackedMatrixElement>
16
17using namespace osgAnimation;
18
19StackedMatrixElement::StackedMatrixElement() {}
20StackedMatrixElement::StackedMatrixElement(const std::string& name, const osg::Matrix& matrix) : StackedTransformElement(), _matrix(matrix) { setName(name); }
21StackedMatrixElement::StackedMatrixElement(const osg::Matrix& matrix) : _matrix(matrix) { setName("matrix"); }
22
23StackedMatrixElement::StackedMatrixElement(const StackedMatrixElement& rhs, const osg::CopyOp& c) : StackedTransformElement(rhs, c), _matrix(rhs._matrix)
24{
25    if (rhs._target.valid())
26        _target = new MatrixTarget(*rhs._target);
27}
28
29Target* StackedMatrixElement::getOrCreateTarget()
30{
31    if (!_target.valid())
32        _target = new MatrixTarget(_matrix);
33    return _target.get();
34}
35
36void StackedMatrixElement::update(float t)
37{
38    if (_target.valid())
39        _matrix = _target->getValue();
40}
Note: See TracBrowser for help on using the browser.