2 * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
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.
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.
15 * Cedric Pinson <cedric.pinson@plopbyte.net>
16 * Michael Platings <mplatings@pixelpower.com>
19#ifndef OSGANIMATION_BONE
20#define OSGANIMATION_BONE 1
22#include <osg/MatrixTransform>
23#include <osgAnimation/Export>
28 // A bone can't have more than one parent Bone, so sharing a part of Bone's hierarchy
29 // makes no sense. You can share the entire hierarchy but not only a part of it.
30 class OSGANIMATION_EXPORT Bone : public osg::MatrixTransform
33 typedef osg::Matrix MatrixType;
35 META_Node(osgAnimation, Bone);
36 Bone(const Bone& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY);
37 Bone(const std::string& name = "");
39 void setDefaultUpdateCallback(const std::string& name = "");
41 Bone* getBoneParent();
42 const Bone* getBoneParent() const;
44 const osg::Matrix& getMatrixInBoneSpace() const { return getMatrix();}
45 const osg::Matrix& getMatrixInSkeletonSpace() const { return _boneInSkeletonSpace; }
46 const osg::Matrix& getInvBindMatrixInSkeletonSpace() const { return _invBindInSkeletonSpace;}
47 void setMatrixInSkeletonSpace(const osg::Matrix& matrix) { _boneInSkeletonSpace = matrix; }
48 void setInvBindMatrixInSkeletonSpace(const osg::Matrix& matrix) { _invBindInSkeletonSpace = matrix; }
53 osg::Matrix _invBindInSkeletonSpace;
56 osg::Matrix _boneInSkeletonSpace;
59 typedef std::map<std::string, osg::ref_ptr<Bone> > BoneMap;