15#include <vsg/core/Allocator.h>
16#include <vsg/core/Inherit.h>
17#include <vsg/core/Visitor.h>
31 virtual void update(
double time) = 0;
32 virtual double maxTime()
const = 0;
37 void read(
Input& input)
override;
38 void write(
Output& output)
const override;
68 using Samplers = std::vector<ref_ptr<AnimationSampler>>;
72 virtual bool start(
double simulationTime,
double startTime = 0.0);
75 virtual bool update(
double simulationTime);
78 virtual bool stop(
double simulationTime);
81 bool active()
const {
return _active; }
90 template<
class N,
class V>
91 static void t_traverse(N& node, V& visitor)
93 for (
auto& sampler : node.samplers) sampler->accept(visitor);
95 void traverse(
Visitor& visitor)
override { t_traverse(*
this, visitor); }
96 void traverse(ConstVisitor& visitor)
const override { t_traverse(*
this, visitor); }
98 void read(Input& input)
override;
99 void write(Output& output)
const override;
103 bool _active =
false;
104 double _previousSimulationTime = 0.0;
105 double _maxTime = 0.0;
109 using Animations = std::vector<ref_ptr<Animation>, allocator_affinity_nodes<ref_ptr<Animation>>>;
Animation class that controls a single animation made up of one more samplers.
Definition Animation.h:44
virtual double maxTime() const
compute the max time from the highest time keyframes in the available samplers
ref_ptr< Object > clone(const CopyOp ©op={}) const override
Definition Animation.h:87
bool active() const
return true if this animation is being actively updated.
Definition Animation.h:81
std::vector< ref_ptr< AnimationSampler > > Samplers
Animation samplers provide the means for mapping the local animation time.
Definition Animation.h:68
virtual bool update(double simulationTime)
update the samplers
virtual bool stop(double simulationTime)
signal that this animation is to stop
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
virtual bool start(double simulationTime, double startTime=0.0)
initialize this animation start time
Base class for animation samplers that sample animation data and set associated scene graph objects.
Definition Animation.h:24
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...