|
resonance 1.0.1
|
Mix-in for an object driven by a frame number. More...
#include <animatable.h>


Classes | |
| class | Filter |
| One stage of the frame-number filter chain. More... | |
| class | ScaleOffset |
| Filter stage that applies an affine map. More... | |
| class | MinMaxLoop |
| Filter stage that wraps or clamps the value into a range. More... | |
| class | ZeroOrder |
| Filter stage that limits how far the value may move in one frame. More... | |
| class | FirstOrder |
| Filter stage that moves the value a fixed fraction of the way towards its input. More... | |
| class | SecondOrder |
| Filter stage that drives the value with a spring and a damper. More... | |
Public Types | |
| enum | FilterType { kFilterScaleOffset = 0 , kFilterMinMaxLoop = 1 , kFilterZeroOrder = 2 , kFilterFirstOrder = 3 , kFilterSecondOrder = 4 } |
| Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload. More... | |
Public Member Functions | |
| Animatable () | |
| Construct an animatable with no children, no filters, and a zero frame. | |
| virtual | ~Animatable () |
| Drop this object's references on its children and delete its filters. | |
| Animatable * | Parent () |
| Report the animatable that animates this one. | |
| void | AddAnim (Animatable *pAnim) |
| Append pAnim to mAnims. | |
| void | RemoveAnim (Animatable *pAnim) |
| Erase pAnim from mAnims. | |
| 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 | AddFilter (Filter *pFilter) |
| Append an already-built filter to mFilters. | |
| void | AddScaleOffset (float flScale, float flOffset) |
| Append a new ScaleOffset stage to mFilters. | |
| void | AddMinMaxLoop (float flMin, float flMax, int nLoop) |
| Append a new MinMaxLoop stage to mFilters. | |
| void | AddZeroOrder (float flLevel, float flMaxDelta) |
| Append a new ZeroOrder stage to mFilters. | |
| void | AddFirstOrder (float flLevel, float flRatio) |
| Append a new FirstOrder stage to mFilters. | |
| void | AddSecondOrder (float flLevel, float flSpring, float flDamper) |
| Append a new SecondOrder stage to mFilters. | |
| void | RemoveFilter (int nIndex) |
| Delete and erase the filter at one position in mFilters. | |
| Filter * | FilterAt (int nIndex) |
| Return the filter at one position in mFilters. | |
| void | SetRate (float flRate) |
| Change the multiplier of the ScaleOffset stage at the front of mFilters. | |
| void | SetOffset (float flOffset) |
| Change the addend of the ScaleOffset stage at the front of mFilters. | |
| void | SetLoopRange (float flMin, float flMax) |
| Change both ends of the MinMaxLoop stage at the back of mFilters. | |
| virtual float | FilteredFrameEnd () |
| Report the last frame this object's subtree animates to. | |
| virtual void | StartAnim () |
| Restart the animation of this object and its whole subtree. | |
| virtual void | DumpText (Dbg &sink) |
| Write a description of this object to sink. | |
| virtual void | Save (Stream &stream) |
| Write the revision, mFilters, and mAnims to stream. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Retarget every mAnims entry equal to pFrom at pTo. | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Clone the filter chain of pSource, and its child list when nFlags requests it. | |
| virtual void | Load (Stream &stream) |
| Replace the filter chain and the child list from stream. | |
| void | RemoveAllAnims () |
| Drop this object's reference on every mAnims entry and then empty mAnims. | |
| Public Member Functions inherited from Rnd::Object | |
| Object () | |
| Construct an unnamed object. | |
| Object (const HxStr &name) | |
| Construct an object and register it under name. | |
| virtual | ~Object () |
| Erase the registry entry and release the name buffer. | |
| void | SetName (const HxStr &name) |
| Re-register this object under a different name. | |
| void | AddRef (Object *pReferrer) |
| Register pReferrer as a store of a pointer to this object. | |
| void | RemoveRef (Object *pReferrer) |
| Drop one registration made by AddRef(). | |
| virtual const HxStr & | ClassName () const =0 |
| Report the name of this object's most derived class. | |
Static Public Member Functions | |
| static Filter * | NewFilter (int nType) |
| Build one default-constructed filter for a type tag. | |
Public Attributes | |
| float | mFilteredFrame |
| The frame SetFrame() last received, after the filter chain. | |
| Public Attributes inherited from Rnd::Object | |
| HxStr | mName |
| int | mInternal |
Protected Member Functions | |
| virtual void | SetFrameSelf (float flFrame) |
| Animate this object alone to a frame. | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
Friends | |
| class | ::MetRenderer |
| void | CollectChildren (std::list< Object * > &objects, Animatable *pAnimatable) |
| Append every animation descendant of an animatable. | |
Additional Inherited Members | |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Mix-in for an object driven by a frame number.
Its RTTI descriptor is at 0x008eed68. It has Rnd::Object as a public virtual base at offset
The size is also pinned from outside the class, which is the stronger argument. Rnd::TransAnim and Rnd::View each derive from this class at offset 0 and place Rnd::Drawable at offset 0x18, so the next base begins exactly 0x18 bytes in. A constructor's highest store would only give a lower bound.
Two vtables belong to the class. The four-entry table at 0x0081e7f0 is addressed by the vptr at +0x14 and stores the three virtuals declared here. The nine-entry table at 0x0081e818 is addressed by the Rnd::Object subobject vptr and stores the overrides of the Rnd::Object virtuals, each with a -0x18 adjustment back to the Animatable subobject. Slot 5 of the second table still addresses the pure-virtual stub at 0x005381a8. ClassName() is therefore unimplemented here and the class remains abstract.
An animatable owns two lists. mAnims stores the animatables this one drives, and every entry registers this object as a referrer through Rnd::Object::AddRef(). mFilters stores a chain of value filters this object owns outright and deletes in its destructor. SetFrame() maps the incoming frame forward through that chain before handing it to the SetFrameSelf() hook and to the children, and UnfilterFrame() maps a child frame back the other way.
Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload.
The five names come from the type-name dumper at 0x0049a8a8, whose switch table pairs each tag with its literal. Nothing invokes that routine in the shipped build. The literals are therefore the only surviving record of the enumeration.
| Enumerator | |
|---|---|
| kFilterScaleOffset | A ScaleOffset filter. |
| kFilterMinMaxLoop | A MinMaxLoop filter. |
| kFilterZeroOrder | A ZeroOrder filter. |
| kFilterFirstOrder | A FirstOrder filter. |
| kFilterSecondOrder | A SecondOrder filter. |
| Rnd::Animatable::Animatable | ( | ) |
Construct an animatable with no children, no filters, and a zero frame.
|
virtual |
Drop this object's references on its children and delete its filters.
| Animatable * Rnd::Animatable::Parent | ( | ) |
Report the animatable that animates this one.
Walks the referrer list of the Rnd::Object subobject, casts each referrer to Animatable and returns the first whose own mAnims list includes this object. The result is therefore the parent in the animation hierarchy rather than a plain cast.
| void Rnd::Animatable::AddAnim | ( | Animatable * | pAnim | ) |
Append pAnim to mAnims.
Registers this object as a referrer of pAnim. A pAnim already in mAnims produces the report "%s already in %s" and no insertion.
| pAnim | The animatable to add. |
| void Rnd::Animatable::RemoveAnim | ( | Animatable * | pAnim | ) |
Erase pAnim from mAnims.
Drops this object's reference on pAnim first. A pAnim absent from mAnims does nothing.
| pAnim | The animatable to remove. |
| void Rnd::Animatable::SetFrame | ( | float | flFrame | ) |
Drive this object and its whole subtree to a frame.
Records the frame as given, maps it forward through mFilters, records the filtered result, hands the filtered result to the SetFrameSelf() hook, and then passes the same filtered result to every mAnims entry. A child therefore receives its parent's filtered frame and applies its own filters to it in turn.
| flFrame | The frame to move to. |
| float Rnd::Animatable::UnfilterFrame | ( | float | flValue | ) |
Map a value back through mFilters.
Walks mFilters from back to front and applies Filter::Unapply() at each stage. That undoes what SetFrame() does on the way in. FilteredFrameEnd() uses it to bring a child's end frame into this object's frame numbering.
| flValue | The value to map. |
| void Rnd::Animatable::AddFilter | ( | Filter * | pFilter | ) |
Append an already-built filter to mFilters.
The list takes ownership, and the destructor deletes the filter.
| pFilter | The filter to append. |
| void Rnd::Animatable::AddScaleOffset | ( | float | flScale, |
| float | flOffset ) |
Append a new ScaleOffset stage to mFilters.
| flScale | The multiplier. |
| flOffset | The addend. |
| void Rnd::Animatable::AddMinMaxLoop | ( | float | flMin, |
| float | flMax, | ||
| int | nLoop ) |
Append a new MinMaxLoop stage to mFilters.
| flMin | The lower end of the range. |
| flMax | The upper end of the range. |
| nLoop | Non-zero to wrap into the range instead of clamping to it. |
| void Rnd::Animatable::AddZeroOrder | ( | float | flLevel, |
| float | flMaxDelta ) |
Append a new ZeroOrder stage to mFilters.
| flLevel | The starting output. |
| flMaxDelta | The largest step one frame may take. |
| void Rnd::Animatable::AddFirstOrder | ( | float | flLevel, |
| float | flRatio ) |
Append a new FirstOrder stage to mFilters.
| flLevel | The starting output. |
| flRatio | The fraction of the remaining distance each frame covers. |
| void Rnd::Animatable::AddSecondOrder | ( | float | flLevel, |
| float | flSpring, | ||
| float | flDamper ) |
Append a new SecondOrder stage to mFilters.
| flLevel | The starting output. |
| flSpring | The acceleration per unit of distance to the input. |
| flDamper | The fraction of the velocity shed each frame. |
| void Rnd::Animatable::RemoveFilter | ( | int | nIndex | ) |
Delete and erase the filter at one position in mFilters.
An index at or past the end does nothing. No call site survives in the shipped build.
| nIndex | How far into mFilters the filter sits. |
| Filter * Rnd::Animatable::FilterAt | ( | int | nIndex | ) |
Return the filter at one position in mFilters.
The position is not tested against the list. The out-of-line copy has no caller, and the title is inferred.
| nIndex | How far into mFilters the filter sits. |
| void Rnd::Animatable::SetRate | ( | float | flRate | ) |
Change the multiplier of the ScaleOffset stage at the front of mFilters.
The addend is recomputed as well, so the stage maps the current mFrame to the same output as before and only later frames advance at the new rate. An empty chain, or a front stage of another type, produces the fatal report "%s must have scale-offset filter in slot 1". The definition sits in the unit of the tunnel object cache. The title is inferred.
| flRate | The new multiplier. |
| void Rnd::Animatable::SetOffset | ( | float | flOffset | ) |
Change the addend of the ScaleOffset stage at the front of mFilters.
An empty chain, or a front stage of another type, produces the fatal report "%s must have scale-offset filter in slot 1". The definition sits in the unit of the tunnel object cache. The title is inferred.
| flOffset | The new addend. |
| void Rnd::Animatable::SetLoopRange | ( | float | flMin, |
| float | flMax ) |
Change both ends of the MinMaxLoop stage at the back of mFilters.
An empty chain, or a back stage of another type, produces the fatal report "%s must have min-max-loop filter in last slot". The definition sits in the unit of the tunnel object cache. The title is inferred.
| flMin | The new lower end. |
| flMax | The new upper end. |
|
static |
Build one default-constructed filter for a type tag.
The reader and Copy() both use this to turn a stored tag back into an object. A tag outside the FilterType range produces the report path of Rnd::TheDbg and a null result.
| nType | One of the FilterType constants. |
|
virtual |
Report the last frame this object's subtree animates to.
Animatable vtable slot 1. The base implementation animates nothing of its own and reports the largest child end frame, each brought into this object's frame numbering through that child's own filter chain, starting from zero. Rnd::MeshAnim, Rnd::MatAnim, and Rnd::LightAnim override it with the timestamp of their last keyframe.
Reimplemented in Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::ParticleSysAnim, and Rnd::TransAnim.
|
virtual |
Restart the animation of this object and its whole subtree.
Animatable vtable slot 2. The base implementation forwards to the same slot on every mAnims entry. Rnd::ParticleSys overrides it at 0x0052c490, releases its live particles, and then chains to this implementation. The title is inferred from that one override. No string in the image identifies the slot, and no direct call site survives.
Reimplemented in Rnd::ParticleSys.
|
virtual |
Write a description of this object to sink.
Writes mFilters and mAnims, and produces nothing at all when the dump level of sink is not positive. Dbg::Print() discards its text in the shipped build. The routine therefore produces no output on this target in any case.
| sink | The diagnostic sink to write to. |
Reimplemented from Rnd::Object.
Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.
|
virtual |
Write the revision, mFilters, and mAnims to stream.
| stream | The stream to write to. |
Implements Rnd::Object.
Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.
Retarget every mAnims entry equal to pFrom at pTo.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Implements Rnd::Object.
Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.
|
virtual |
Clone the filter chain of pSource, and its child list when nFlags requests it.
| pSource | The object to copy from. |
| nFlags | The set of fields to copy; see kCopyChildLists. |
Implements Rnd::Object.
Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.
|
virtual |
Replace the filter chain and the child list from stream.
A revision above the one this build writes produces the report "Can't load new Animatable" followed by the abort handler of Rnd::TheDbg.
| stream | The stream to read from. |
Implements Rnd::Object.
Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.
| void Rnd::Animatable::RemoveAllAnims | ( | ) |
Drop this object's reference on every mAnims entry and then empty mAnims.
Every derived destructor invokes this before its own teardown. The tail at 0x0049a9c0 passes the address of mAnims to the list clear at 0x0045edc8, whose body returns every node to the pool and re-self-links the dummy node. ReleaseObjects() at 0x00494cb0 is the routine that walks mAnims without emptying it, and the two bodies are otherwise alike.
Public because Rnd::MetScreen::ResolveContainerViews() calls it at 0x0038b294 on the Rnd::View it just resolved, and MetScreen derives from MsgSink rather than from this class. A friend declaration for MetScreen fits the image equally well.
|
protectedvirtual |
Animate this object alone to a frame.
Animatable vtable slot 3. The base implementation animates nothing. Every animation subclass overrides it to interpolate its keyframes at the frame SetFrame() has already filtered. Only SetFrame() invokes it. The arrangement matches Rnd::Drawable::DrawShowing().
| flFrame | The filtered frame to animate to. |
Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, and Rnd::Tunnel.
|
friend |
|
friend |
Append every animation descendant of an animatable.
| objects | The list to append to. |
| pAnimatable | The animatable to start from, or null. |
| float Rnd::Animatable::mFilteredFrame |
The frame SetFrame() last received, after the filter chain.
This is the value handed to SetFrameSelf() and to every child. Public because TnlCrippleFX::SetFrame() at 0x0043e500 reads it through the crippler path, and the image has no accessor. +0x10