49 friend class ::MetRenderer;
94 virtual float Apply(
float flValue) = 0;
378 ZeroOrder(
float flLevel,
float flMaxDelta) : mLevel(flLevel), mMaxDelta(flMaxDelta) {
474 FirstOrder(
float flLevel,
float flRatio) : mLevel(flLevel), mRatio(flRatio) {
577 : mLevel(flLevel), mSpring(flSpring), mDamper(flDamper), mVel(0.0f) {
1005 void ReleaseObjects();
1012 float FilterFrame(
float flValue);
1019 void AcquireAnimsRefs();
1023 std::list<Animatable *> mAnims;
1025 std::list<Filter *> mFilters;
Front-end renderer that owns the screen stack and drives every MetScreen.
Definition metrenderer.h:68
One stage of the frame-number filter chain.
Definition animatable.h:84
virtual float Unapply(float flValue)
Map a value back through this stage.
virtual void Copy(const Filter *pSource)=0
Replace this stage's parameters with those of pSource.
virtual void Print(Dbg &sink) const =0
Write this stage's parameters to sink.
virtual void Load(Stream &stream)=0
Read this stage's parameters from stream.
virtual float Apply(float flValue)=0
Map a value forward through this stage.
virtual void Save(Stream &stream)=0
Write this stage's parameters to stream.
virtual int Type()=0
Report the type tag of this stage.
virtual void Copy(const Filter *pSource)
Copy both parameters from pSource.
virtual void Load(Stream &stream)
Read both parameters from stream.
virtual void Save(Stream &stream)
Write both parameters to stream.
virtual int Type()
Report kFilterFirstOrder.
FirstOrder(float flLevel, float flRatio)
Construct a stage with both parameters set.
Definition animatable.h:474
FirstOrder()
Construct a stage with indeterminate parameters.
Definition animatable.h:465
virtual float Apply(float flValue)
Move mLevel a fraction mRatio of the way towards the value.
virtual float Unapply(float flValue)
Report the mLevel that preceded an Apply() of the value.
virtual void Print(Dbg &sink) const
Write "(level:%.2f ratio:%.2f)" to sink.
virtual void Copy(const Filter *pSource)
Copy all three parameters from pSource.
virtual void Print(Dbg &sink) const
Write "(min:%.2f max:%.2f loop:true)" to sink, with mLoop as a word rather than a number.
virtual void Load(Stream &stream)
Read the two ends as floats and mLoop as a single byte.
virtual float Apply(float flValue)
Bring the value into the range.
MinMaxLoop()
Construct a stage with indeterminate parameters.
Definition animatable.h:274
MinMaxLoop(float flMin, float flMax, int nLoop)
Construct a stage with all three parameters set.
Definition animatable.h:286
virtual void Save(Stream &stream)
Write the two ends as floats and mLoop as a single byte.
float mMax
Definition animatable.h:351
virtual int Type()
Report kFilterMinMaxLoop.
float mMin
Definition animatable.h:350
virtual float Apply(float flValue)
Scale and then offset the value.
virtual int Type()
Report kFilterScaleOffset.
virtual void Load(Stream &stream)
Read both parameters from stream.
virtual void Copy(const Filter *pSource)
Copy both parameters from pSource.
float mOffset
Definition animatable.h:257
virtual void Save(Stream &stream)
Write both parameters to stream.
float mScale
Definition animatable.h:256
virtual void Print(Dbg &sink) const
Write "(scale:%.2f offset:%.2f)" to sink.
ScaleOffset(float flScale, float flOffset)
Construct a stage with both parameters set.
Definition animatable.h:183
ScaleOffset()
Construct a stage with indeterminate parameters.
Definition animatable.h:174
virtual float Unapply(float flValue)
Undo the affine map.
SecondOrder()
Construct a stage at rest with indeterminate spring parameters.
Definition animatable.h:566
virtual void Save(Stream &stream)
Write the three spring parameters to stream, the velocity excluded.
virtual void Copy(const Filter *pSource)
Copy all four members from pSource.
virtual int Type()
Report kFilterSecondOrder.
virtual float Unapply(float flValue)
Report the mLevel that preceded the last Apply().
SecondOrder(float flLevel, float flSpring, float flDamper)
Construct a stage at rest with all three parameters set.
Definition animatable.h:576
virtual void Load(Stream &stream)
Read the three spring parameters from stream, the velocity excluded.
virtual void Print(Dbg &sink) const
Write "(level:%.2f spring:%.2f damper:)%.2f vel%.2f" to sink.
virtual float Apply(float flValue)
Integrate the spring and the damper by one step.
ZeroOrder(float flLevel, float flMaxDelta)
Construct a stage with both parameters set.
Definition animatable.h:378
virtual void Load(Stream &stream)
Read both parameters from stream.
virtual void Print(Dbg &sink) const
Write "(level:%.2f maxDelta:%.2f)" to sink.
virtual float Unapply(float flValue)
Report the mLevel that preceded an Apply() of the value.
virtual void Save(Stream &stream)
Write both parameters to stream.
virtual float Apply(float flValue)
Advance mLevel towards the value by at most mMaxDelta.
virtual void Copy(const Filter *pSource)
Copy both parameters from pSource.
ZeroOrder()
Construct a stage with indeterminate parameters.
Definition animatable.h:369
virtual int Type()
Report kFilterZeroOrder.
virtual float FilteredFrameEnd()
Report the last frame this object's subtree animates to.
Animatable * Parent()
Report the animatable that animates this one.
void SetFrame(float flFrame)
Drive this object and its whole subtree to a frame.
float UnfilterFrame(float flValue)
Map a value back through mFilters.
void AddSecondOrder(float flLevel, float flSpring, float flDamper)
Append a new SecondOrder stage to mFilters.
friend void CollectChildren(std::list< Object * > &objects, Animatable *pAnimatable)
Append every animation descendant of an animatable.
Definition collectchildren.h:27
void RemoveAnim(Animatable *pAnim)
Erase pAnim from mAnims.
virtual void Load(Stream &stream)
Replace the filter chain and the child list from stream.
virtual void Replace(Object *pFrom, Object *pTo)
Retarget every mAnims entry equal to pFrom at pTo.
float mFilteredFrame
The frame SetFrame() last received, after the filter chain.
Definition animatable.h:1037
void AddMinMaxLoop(float flMin, float flMax, int nLoop)
Append a new MinMaxLoop stage to mFilters.
void AddScaleOffset(float flScale, float flOffset)
Append a new ScaleOffset stage to mFilters.
virtual void DumpText(Dbg &sink)
Write a description of this object to sink.
void AddZeroOrder(float flLevel, float flMaxDelta)
Append a new ZeroOrder stage to mFilters.
Animatable()
Construct an animatable with no children, no filters, and a zero frame.
FilterType
Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload.
Definition animatable.h:59
@ kFilterScaleOffset
Definition animatable.h:60
@ kFilterFirstOrder
Definition animatable.h:63
@ kFilterSecondOrder
Definition animatable.h:64
@ kFilterZeroOrder
Definition animatable.h:62
@ kFilterMinMaxLoop
Definition animatable.h:61
void AddAnim(Animatable *pAnim)
Append pAnim to mAnims.
void SetRate(float flRate)
Change the multiplier of the ScaleOffset stage at the front of mFilters.
void RemoveFilter(int nIndex)
Delete and erase the filter at one position in mFilters.
void AddFirstOrder(float flLevel, float flRatio)
Append a new FirstOrder stage to mFilters.
virtual void Copy(const Object *pSource, unsigned nFlags)
Clone the filter chain of pSource, and its child list when nFlags requests it.
void SetOffset(float flOffset)
Change the addend of the ScaleOffset stage at the front of mFilters.
virtual ~Animatable()
Drop this object's references on its children and delete its filters.
static Filter * NewFilter(int nType)
Build one default-constructed filter for a type tag.
virtual void SetFrameSelf(float flFrame)
Animate this object alone to a frame.
void SetLoopRange(float flMin, float flMax)
Change both ends of the MinMaxLoop stage at the back of mFilters.
void AddFilter(Filter *pFilter)
Append an already-built filter to mFilters.
void RemoveAllAnims()
Drop this object's reference on every mAnims entry and then empty mAnims.
Filter * FilterAt(int nIndex)
Return the filter at one position in mFilters.
virtual void StartAnim()
Restart the animation of this object and its whole subtree.
virtual void Save(Stream &stream)
Write the revision, mFilters, and mAnims to stream.
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
Object()
Construct an unnamed object.
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
The rendering engine.
Definition animhelper.h:3