root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp @ 13041

Revision 13041, 2.4 kB (checked in by robert, 3 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
16#include <osgDB/Input>
17#include <osgDB/Output>
18#include <osgDB/Registry>
19#include <osgDB/ReaderWriter>
20#include <osg/io_utils>
21#include <osgAnimation/StackedTransformElement>
22#include <osgAnimation/UpdateMatrixTransform>
23
24
25using namespace osg;
26using namespace osgDB;
27
28bool UpdateMatrixTransform_readLocalData(Object& obj, Input& fr)
29{
30    bool iteratorAdvanced = false;
31
32    osgAnimation::UpdateMatrixTransform& updateCallback = dynamic_cast<osgAnimation::UpdateMatrixTransform&>(obj);
33    osgAnimation::StackedTransform& stackedTransform = updateCallback.getStackedTransforms();
34
35    int entry = fr[0].getNoNestedBrackets();
36    while (!fr.eof() && fr[0].getNoNestedBrackets() == entry && fr.matchSequence("%w {"))
37    {
38        osgAnimation::StackedTransformElement* element = dynamic_cast<osgAnimation::StackedTransformElement*>(fr.readObject());
39        if (element)
40            stackedTransform.push_back(element);
41    }
42    return iteratorAdvanced;
43}
44
45
46
47bool UpdateMatrixTransform_writeLocalData(const Object& obj, Output& fw)
48{
49    const osgAnimation::UpdateMatrixTransform* uc = dynamic_cast<const osgAnimation::UpdateMatrixTransform*>(&obj);
50    const osgAnimation::StackedTransform& transforms = uc->getStackedTransforms();
51    for (osgAnimation::StackedTransform::const_iterator it = transforms.begin(); it != transforms.end(); ++it)
52    {
53        osgAnimation::StackedTransformElement* element = it->get();
54        if (element)
55            fw.writeObject(*element);
56    }
57    return true;
58}
59
60
61RegisterDotOsgWrapperProxy g_UpdateMatrixTransformProxy
62(
63    new osgAnimation::UpdateMatrixTransform,
64    "osgAnimation::UpdateMatrixTransform",
65    "Object NodeCallback osgAnimation::UpdateMatrixTransform",
66    &UpdateMatrixTransform_readLocalData,
67    &UpdateMatrixTransform_writeLocalData,
68    DotOsgWrapper::READ_AND_WRITE
69    );
Note: See TracBrowser for help on using the browser.