From Cedric Pinson, remove unsused files include/osgAnimation/AnimationManager and src/osgAnimation/AnimationManager.cpp

This commit is contained in:
Cedric Pinson
2009-09-09 09:54:29 +00:00
parent 9b95a78e5d
commit d28b052fb7
2 changed files with 0 additions and 200 deletions

View File

@@ -1,58 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGANIMATION_ANIMATION_MANAGER_H
#define OSGANIMATION_ANIMATION_MANAGER_H
#include <osg/Group>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/Export>
#include <osg/FrameStamp>
namespace osgAnimation
{
class OSGANIMATION_EXPORT AnimationManager : public AnimationManagerBase
{
public:
META_Object(osgAnimation, AnimationManager);
AnimationManager();
AnimationManager(const AnimationManager& b, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) :
AnimationManagerBase(b,copyop) {}
virtual ~AnimationManager();
void update (double time);
void playAnimation (Animation* pAnimation, int priority = 0, float weight = 1.0);
bool stopAnimation (Animation* pAnimation);
bool findAnimation (Animation* pAnimation);
bool isPlaying (Animation* pAnimation);
bool isPlaying (const std::string& animationName);
void stopAll();
protected:
typedef std::map<int, AnimationList > AnimationLayers;
AnimationLayers _animationsPlaying;
// clock
double _lastUpdate;
};
}
#endif

View File

@@ -1,142 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osgAnimation/AnimationManager>
#include <osgAnimation/LinkVisitor>
using namespace osgAnimation;
AnimationManager::~AnimationManager() {}
void AnimationManager::stopAll()
{
// loop over all playing animation
for( AnimationLayers::iterator iterAnim = _animationsPlaying.begin(); iterAnim != _animationsPlaying.end(); ++iterAnim )
{
AnimationList& list = iterAnim->second;
for (AnimationList::iterator it = list.begin(); it != list.end(); it++)
(*it)->resetTargets();
}
_animationsPlaying.clear();
}
AnimationManager::AnimationManager()
{
_lastUpdate = 0;
}
void AnimationManager::playAnimation(Animation* pAnimation, int priority, float weight)
{
if (!findAnimation(pAnimation))
{
return;
}
if ( isPlaying(pAnimation) )
stopAnimation(pAnimation);
_animationsPlaying[priority].push_back(pAnimation);
pAnimation->setStartTime(_lastUpdate);
pAnimation->setWeight(weight);
}
bool AnimationManager::stopAnimation(Animation* pAnimation)
{
// search though the layer and remove animation
for( AnimationLayers::iterator iterAnim = _animationsPlaying.begin(); iterAnim != _animationsPlaying.end(); ++iterAnim )
{
AnimationList& list = iterAnim->second;
for (AnimationList::iterator it = list.begin(); it != list.end(); it++)
if( (*it) == pAnimation )
{
(*it)->resetTargets();
list.erase(it);
return true;
}
}
return false;
}
void AnimationManager::update (double time)
{
if (!_lastUpdate)
_lastUpdate = time;
// could filtered with an active flag
for (TargetSet::iterator it = _targets.begin(); it != _targets.end(); it++)
(*it).get()->reset();
// update from high priority to low priority
for( AnimationLayers::reverse_iterator iterAnim = _animationsPlaying.rbegin(); iterAnim != _animationsPlaying.rend(); ++iterAnim )
{
// update all animation
std::vector<int> toremove;
AnimationList& list = iterAnim->second;
for (unsigned int i = 0; i < list.size(); i++)
{
if (! list[i]->update(time))
toremove.push_back(i);
}
// remove finished animation
while (!toremove.empty())
{
list.erase(list.begin() + toremove.back());
toremove.pop_back();
}
}
for (TargetSet::iterator it = _targets.begin(); it != _targets.end(); it++)
(*it).get()->normalize();
}
bool AnimationManager::findAnimation(Animation* pAnimation)
{
for( AnimationList::const_iterator iterAnim = _animations.begin(); iterAnim != _animations.end(); ++iterAnim )
{
if ( (*iterAnim) == pAnimation )
return true;
}
return false;
}
bool AnimationManager::isPlaying(Animation* pAnimation)
{
for( AnimationLayers::iterator iterAnim = _animationsPlaying.begin(); iterAnim != _animationsPlaying.end(); ++iterAnim )
{
AnimationList& list = iterAnim->second;
for (AnimationList::iterator it = list.begin(); it != list.end(); it++)
if ( (*it) == pAnimation )
return true;
}
return false;
}
bool AnimationManager::isPlaying(const std::string& name)
{
// loop over all playing animation
for( AnimationLayers::iterator iterAnim = _animationsPlaying.begin(); iterAnim != _animationsPlaying.end(); ++iterAnim )
{
AnimationList& list = iterAnim->second;
for (AnimationList::iterator it = list.begin(); it != list.end(); it++)
if ( (*it)->getName() == name )
return true;
}
return false;
}