Files
bluflame/demo09/src/demo09/AnimationManager/AnimationManager.h
2026-04-18 22:31:51 +02:00

64 lines
1.6 KiB
C++

#pragma once
#include "IAnimationManager.h"
class AnimationManager
: public IAnimationManager
{
public:
AnimationManager(IEngine* engine);
virtual ~AnimationManager();
virtual void AddDemoTimeAnimation(double beginTime, double endTime, IAnimateable* value, unsigned int userData = 0);
virtual void AddRealTimeAnimation(double beginTime, double endTime, IAnimateable* value, unsigned int userData = 0);
virtual void AddDemoTimeEvent(double time, IEvent* value, unsigned int userData = 0);
virtual void AddRealTimeEvent(double time, IEvent* value, unsigned int userData = 0);
virtual void Animate();
private:
struct AnimationInterval
{
AnimationInterval(double begin, double end)
: begin(begin)
, end(end)
{
};
double begin;
double end;
};
struct ForwardSort
{
bool operator ()(const AnimationInterval& a, const AnimationInterval& b) const
{
return a.begin < b.begin;
}
};
struct BackwardSort
{
bool operator ()(const AnimationInterval& a, const AnimationInterval& b) const
{
return a.end > b.end;
}
};
typedef std::map<AnimationInterval, std::vector<std::pair<IAnimateable*, unsigned int> >, ForwardSort> forwardAnims;
typedef std::map<AnimationInterval, std::vector<std::pair<IAnimateable*, unsigned int> >, BackwardSort> backwardAnims;
typedef std::map<double, std::vector<std::pair<IEvent*, unsigned int> > > events;
IEngine* engine;
forwardAnims forwardSortedAnimations;
backwardAnims backwardSortedAnimations;
forwardAnims realTimeAnimations;
events demoTimeEvents;
events realTimeEvents;
double previousDemoTime;
double previousRealTime;
};