Commit 9fdd2f13 authored by Jan Möbius's avatar Jan Möbius

Separated Skeleton Object Type

parents
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef ANIMATIONHANDLE_HH
#define ANIMATIONHANDLE_HH
/**
* @brief A handle used to refer to an animation or to a specific frame in an animation
*/
class AnimationHandle
{
public:
/// Constructs an invalid animation handle (interpreted as handle of the reference pose)
AnimationHandle() : idAnimation(0), iFrame(0) {};
/// Constructs a valid handle for the given animation and frame
AnimationHandle(size_t idAnimation, size_t iFrame = 0) : idAnimation(idAnimation + 1), iFrame(iFrame) {};
/// Returns true if the handle is valid
inline bool isValid() const { return idAnimation > 0; }
/// Returns the animation index (zero based)
inline size_t animationIndex() const { return idAnimation - 1; }
/// Returns the selected frame (zero based)
inline size_t frame() const { return iFrame; }
/// Sets the current animation frame (not failsafe)
inline void setFrame(size_t _iFrame) { iFrame = _iFrame; }
/// Returns to the first frame
inline void firstFrame() { iFrame = 0; }
/// Increases the handle to the next frame (not failsafe)
inline void operator++() { ++iFrame; }
/// Decreases the handle to the previous frame (not failsafe)
inline void operator--() { --iFrame; }
inline bool operator==(const AnimationHandle &rhs) { return (idAnimation == rhs.idAnimation) && (iFrame == rhs.iFrame); }
inline bool operator!=(const AnimationHandle &rhs) { return (idAnimation != rhs.idAnimation) || (iFrame != rhs.iFrame); }
private:
/// The one based index of the animation, set to 0 for invalid (or reference pose)
size_t idAnimation;
/// The frame number
size_t iFrame;
};
#endif // ANIMATIONHANDLE_HH
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#define ANIMATIONHELPER_CC
#include "AnimationHelper.hh"
#include <cmath>
#include <cassert>
#define APPROXIMATION_EPSILON 1.0e-09
#define VERYSMALL 1.0e-20
#define MAXIMUM_ITERATIONS 1000
template<typename Scalar>
Scalar AnimationHelper::clampTo01Interval(Scalar _value) {
if (_value < 0.0)
return 0.0;
else if (_value > 1.0)
return 1.0;
else
return _value;
}
template<typename Scalar>
Scalar AnimationHelper::abs(Scalar _value) {
if (_value < 0.0)
return _value * -1.0;
else
return _value;
}
template<typename Scalar>
float AnimationHelper::approximateCubicBezierParameter(Scalar _atX, Scalar _P0X, Scalar _P1X, Scalar _C0X, Scalar _C1X) {
if (_atX - _P0X < VERYSMALL)
return 0.0;
if (_P1X - _atX < VERYSMALL)
return 1.0;
long iterationStep = 0;
float u = 0.0f; float v = 1.0f;
//iteratively apply subdivision to approach value atX
while (iterationStep < MAXIMUM_ITERATIONS) {
// de Casteljau Subdivision.
Scalar a = (_P0X + _C0X)*0.5;
Scalar b = (_C0X + _C1X)*0.5;
Scalar c = (_C1X + _P1X)*0.5;
Scalar d = (a + b)*0.5;
Scalar e = (b + c)*0.5;
Scalar f = (d + e)*0.5; //this one is on the curve!
//The curve point is close enough to our wanted atX
if (abs<Scalar>(f - _atX) < APPROXIMATION_EPSILON)
return clampTo01Interval<Scalar>((u + v)*0.5f);
//dichotomy
if (f < _atX) {
_P0X = f;
_C0X = e;
_C1X = c;
u = (u + v)*0.5f;
} else {
_C0X = a; _C1X = d; _P1X = f; v = (u + v)*0.5f;
}
iterationStep++;
}
return clampTo01Interval<Scalar>((u + v)*0.5f);
}
template<typename Scalar>
std::vector<Scalar> AnimationHelper::evaluateBezier(float at, std::vector<Scalar> _P0, std::vector<Scalar> _P1, std::vector<Scalar> _C0, std::vector<Scalar> _C1) {
unsigned int size = _P0.size();
assert(size == _P1.size() && size == _C0.size() && size == _C1.size());
float s = at;
float sinv = (1-s);
std::vector<Scalar> result;
for (unsigned int i=0;i<size;++i) {
result.push_back( _P0[i]*sinv*sinv*sinv + 3*_C0[i]*s*sinv*sinv + 3*_C1[i]*s*s*sinv + _P1[i]*s*s*s );
}
return result;
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef SKELETON_ANIMATIONHELPER_HH
#define SKELETON_ANIMATIONHELPER_HH
#include <vector>
class AnimationHelper
{
public:
/** \brief Approximates the parameter value for a Bezier curve to get a certain x value
* Does an iterative DeCasteljau search for the correct value.
*
* ^
* | C0----------------------------C1
* | / \
* | / \
* | / \
* | P0 P1
* |
* +------------------atX------------------------------------>
*
* @param _atX The X value that the parameter value should be found for
* @param _P0X The X value of the first key point
* @param _P1X The X value of the second key point
* @param _C0X The X value of the first control point
* @param _C1X The X value of the second control point
* @return The parameter value that has to be used to get the specified X value
*/
template<typename Scalar>
static float approximateCubicBezierParameter(Scalar _atX, Scalar _P0X, Scalar _P1X, Scalar _C0X, Scalar _C1X);
/**
* \brief Evaluates the cubic Bezier curve parameterized by P0, P1, C0 and C1 at the parameter value "at"
*/
template<typename Scalar>
static std::vector<Scalar> evaluateBezier(float at, std::vector<Scalar> _P0, std::vector<Scalar> _P1, std::vector<Scalar> _C0, std::vector<Scalar> _C1);
private:
template<typename Scalar>
static Scalar clampTo01Interval(Scalar _value);
template<typename Scalar>
static Scalar abs(Scalar _value);
};
//=============================================================================
#if defined(INCLUDE_TEMPLATES) && !defined(ANIMATIONHELPER_CC)
#define ANIMATIONHELPER_TEMPLATES
#include "AnimationHelper.cc"
#endif
//=============================================================================
#endif //SKELETON_ANIMATIONHELPER_HH
\ No newline at end of file
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef ANIMATIONT_HH
#define ANIMATIONT_HH
#include <vector>
#include <map>
#include "../PoseT.hh"
#include "AnimationHandle.hh"
/**
* @brief Stores a single animation
*
* This class is used by a skeleton to store a single animation. An animation is an array of different Poses.
* Both the reference pose and the skeleton hierarchy are not used by the animation class itself, but are
* passed to the poses.
*/
template<class PointT>
class AnimationT
{
template<typename>
friend class SkeletonT;
public:
typedef PointT Point;
typedef typename Point::value_type Scalar;
typedef PoseT<PointT> Pose;
public:
AnimationT(std::string _name = "") : name_(_name), fps_(60) {}
virtual AnimationT* copy() = 0;
virtual ~AnimationT() {}
public:
/**
* @name Frame access
* There is one pose per frame.
*/
//@{
virtual Pose *pose(unsigned int _iFrame) = 0;
virtual unsigned int frameCount() = 0;
//@}
/**
* @name Synchronization
* Use these methods to keep the poses in sync with the number (and indices) of the joints.
*/
//@{
virtual void insertJointAt(unsigned int _index) = 0;
virtual void removeJointAt(unsigned int _index) = 0;
//@}
virtual void updateFromGlobal(unsigned int _index) = 0;
virtual void clearPoseCache() {}
inline std::string name() {
return name_;
}
inline void setName(std::string _name) {
name_ = _name;
}
inline int fps() {
return fps_;
}
inline void setFps(int _fps) {
fps_ = _fps;
}
protected:
std::string name_;
int fps_;
};
#endif
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#include "AnimationHelper.hh"
#include <utility>
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
std::vector<Scalar> BezierInterpolationT<Scalar>::getValue(Scalar _atX) {
float bezierParam = AnimationHelper::approximateCubicBezierParameter<Scalar>(_atX, P0_.first, P1_.first, C0_.first, C1_.first);
return AnimationHelper::evaluateBezier<Scalar>(bezierParam, P0_.second, P1_.second, C0_.second, C1_.second);
}
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
Scalar BezierInterpolationT<Scalar>::getMaxInput() {
typedef std::vector<Scalar> Scalars;
Scalars p0_x; p0_x.push_back(P0_.first);
Scalars p1_x; p1_x.push_back(P1_.first);
Scalars c0_x; c0_x.push_back(C0_.first);
Scalars c1_x; c1_x.push_back(C1_.first);
return AnimationHelper::evaluateBezier<Scalar>(1.0f, p0_x, p1_x, c0_x, c1_x)[0];
}
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
Scalar BezierInterpolationT<Scalar>::getMinInput() {
typedef std::vector<Scalar> Scalars;
Scalars p0_x; p0_x.push_back(P0_.first);
Scalars p1_x; p1_x.push_back(P1_.first);
Scalars c0_x; c0_x.push_back(C0_.first);
Scalars c1_x; c1_x.push_back(C1_.first);
return AnimationHelper::evaluateBezier<Scalar>(0.0f, p0_x, p1_x, c0_x, c1_x)[0];
}
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
typename BezierInterpolationT<Scalar>::Point&
BezierInterpolationT<Scalar>::P0(){
return P0_;
}
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
typename BezierInterpolationT<Scalar>::Point&
BezierInterpolationT<Scalar>::C0(){
return C0_;
}
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
typename BezierInterpolationT<Scalar>::Point&
BezierInterpolationT<Scalar>::C1(){
return C1_;
}
//-----------------------------------------------------------------------------------------------------
template<typename Scalar>
typename BezierInterpolationT<Scalar>::Point&
BezierInterpolationT<Scalar>::P1(){
return P1_;
}
//-----------------------------------------------------------------------------------------------------
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#define FRAMEANIMATIONT_C
#include <vector>
#include <cassert>
//-----------------------------------------------------------------------------
/**
* @brief Constructor - Creates a new animation consisting of a single pose
*
* The animation will hold a single frame, made up by a copy of the given pose. After this call returns the
* pose given by \e _pose is no longer needed and independent from this instance.
*
* You can use this operation to clone the reference pose as new instance, then modify the pose.
*
* @param _pose This pose will make up the only frame in this new animation
*/
template<class PointT>
FrameAnimationT<PointT>::FrameAnimationT(const PoseT<PointT> &_pose) :
skeleton_(_pose.skeleton_)
{
poses_.push_back(new Pose(_pose));
}
//-----------------------------------------------------------------------------
/** \brief Constructor - Creates a new empty animation
*
* @param _skeleton The skeleton that will hold this animation
*/
template<class PointT>
FrameAnimationT<PointT>::FrameAnimationT(Skeleton* _skeleton) :
skeleton_(_skeleton)
{
}
//-----------------------------------------------------------------------------
/**
* @brief Constructor - Creates a new animation with the given number of frames
*
* The poses in the given number of frames will all hold identity matrices for all joints. Make sure you write
* data to the poses before you use it.
*
* @param _skeleton The skeleton that will hold this animation
* @param _iNumFrames The number of frames for this animation
*/
template<class PointT>
FrameAnimationT<PointT>::FrameAnimationT(Skeleton* _skeleton, unsigned int _iNumFrames) :
skeleton_(_skeleton)
{
for(unsigned int i = 0; i < _iNumFrames; ++i)
poses_.push_back(new Pose(_skeleton));
}
//-----------------------------------------------------------------------------
/**
* @brief Copy constructor
*
* This animation will copy all frames from the given animation. After the call returns they are completely
* independent.