first commit
This commit is contained in:
86
include/engine/automation/automation_source.h
Normal file
86
include/engine/automation/automation_source.h
Normal file
@ -0,0 +1,86 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NAUTOMATIONSOURCE__
|
||||
#define __NAUTOMATIONSOURCE__
|
||||
|
||||
|
||||
#include "geometry/curve.h"
|
||||
#include "math/quaternion.h"
|
||||
#include "math/vector.h"
|
||||
#include "memory/nshared_ptr.h"
|
||||
|
||||
|
||||
namespace GS {
|
||||
namespace Automation {
|
||||
class Player;
|
||||
|
||||
/*!
|
||||
@short Base automation source.
|
||||
@author Emmanuel Julien (ejulien@gsworks.fr)
|
||||
*/
|
||||
class Source : public SharedObject
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type
|
||||
{
|
||||
TypeMotion = 0
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Type type;
|
||||
|
||||
Vector4 p_pos,
|
||||
p_euler;
|
||||
Quaternion p_quat;
|
||||
|
||||
float weight,
|
||||
weight_target,
|
||||
weight_step;
|
||||
|
||||
bool dispose;
|
||||
|
||||
public:
|
||||
|
||||
NPLACEMENT_NEW(AnimationSource)
|
||||
|
||||
Time time;
|
||||
float time_scale;
|
||||
|
||||
bool relative;
|
||||
|
||||
Type GetType() const { return type; }
|
||||
|
||||
virtual void Update(const Time &dt_time);
|
||||
|
||||
virtual void Evaluate(Player &target) = 0;
|
||||
virtual bool EvaluateRotation(Quaternion &q) = 0;
|
||||
|
||||
virtual void SetLoopMode(Curve::LoopMode = Curve::Reset) {}
|
||||
virtual void SetLoop(const Time &start = Time::Inf, const Time &end = Time::Inf) {}
|
||||
|
||||
/// Is animation source done.
|
||||
virtual bool IsDone() const = 0;
|
||||
|
||||
/// Mark the source as disposable.
|
||||
void Dispose(float blend = Units::Sec(0.1));
|
||||
/// Can the source be disposed of.
|
||||
bool CanDispose() const;
|
||||
|
||||
void SetWeight(float _weight = 1, float _blend = Units::Sec(1));
|
||||
float GetWeight() const { return weight; }
|
||||
|
||||
explicit Source();
|
||||
~Source();
|
||||
};
|
||||
|
||||
} // Automation
|
||||
} // GS
|
||||
|
||||
|
||||
#endif // __NAUTOMATIONSOURCE__
|
||||
Reference in New Issue
Block a user