root/OpenSceneGraph/trunk/include/osgAnimation/Bone @ 11009

Revision 11009, 2.2 kB (checked in by robert, 4 years ago)

From Cedric Pinson, "Here a list of changes:
Bone now inherit from MatrixTransform?. It simplify a lot the update of
Bone matrix. It helps to have the bone system more generic. eg it's now
possible to have animation data with precomputed bind matrix. The other
benefit, is now the collada plugin will be able to use osgAnimation to
display skinned mesh. Michael Plating did a great work to improve this
aspect, he is working on the collada plugin and should be able to submit
a new version soon.
The RigGeometry? has been refactored so now it works when you save and
reload RigGeometry? because the source is not touched anymore. The
benefit with this update is that it should be now possible to use a
MorphGeometry? as source for a RigGeometry?.

The bad news is that the format has changed, so i have rebuild osg-data
related to osgAnimation data, updated the blender exporter to export to
the new format.
The fbx plugin could be touched about this commit, i dont compile it so
i can't give more information about it.
The bvh plugin has been updated by Wang rui so this one is fixed with
the new code of osgAnimation.
The examples has been updated to work with the new code too...

The example osg-data/example.osg should be remove, it's an old example
that does not work.

For people using blender the blender exporter up to date is here:
it will be merge to as soon as the
modification will be push in the trunk.

[9093]1/*  -*-c++-*-
[10344]2 *  Copyright (C) 2008 Cedric Pinson <>
[9093]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 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
12 * OpenSceneGraph Public License for more details.
[10527]13 *
14 * Authors:
15 *         Cedric Pinson <>
16 *         Michael Platings <>
17 */
[11009]19#ifndef OSGANIMATION_BONE
[11009]22#include <osg/MatrixTransform>
[9094]23#include <osgAnimation/Export>
25namespace osgAnimation
28    // A bone can't have more than one parent Bone, so sharing a part of Bone's hierarchy
[10558]29    // makes no sense. You can share the entire hierarchy but not only a part of it.
[11009]30    class OSGANIMATION_EXPORT Bone : public osg::MatrixTransform
[9093]31    {
32    public:
33        typedef osg::Matrix MatrixType;
35        META_Node(osgAnimation, Bone);
[9370]36        Bone(const Bone& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY);
37        Bone(const std::string& name = "");
[9370]39        void setDefaultUpdateCallback(const std::string& name = "");
41        Bone* getBoneParent();
42        const Bone* getBoneParent() const;
[11009]44        const osg::Matrix& getMatrixInBoneSpace() const { return getMatrix();}
[9093]45        const osg::Matrix& getMatrixInSkeletonSpace() const { return _boneInSkeletonSpace; }
46        const osg::Matrix& getInvBindMatrixInSkeletonSpace() const { return _invBindInSkeletonSpace;}
[9531]47        void setMatrixInSkeletonSpace(const osg::Matrix& matrix) { _boneInSkeletonSpace = matrix; }
[11009]48        void setInvBindMatrixInSkeletonSpace(const osg::Matrix& matrix) { _invBindInSkeletonSpace = matrix; }
[9370]50    protected:
52        // bind data
53        osg::Matrix _invBindInSkeletonSpace;
55        // bone updated
56        osg::Matrix _boneInSkeletonSpace;
[9093]57    };
[11009]59    typedef std::map<std::string, osg::ref_ptr<Bone> > BoneMap;
Note: See TracBrowser for help on using the browser.