|
resonance 1.0.1
|
Animation that drives one transformable from three keyframe channels. More...
#include <transanim.h>


Classes | |
| class | TransKey |
| One keyframe of the translation or the scale channel. More... | |
| class | RotKey |
| One keyframe of the rotation channel. More... | |
Public Types | |
| enum | Interp { kInterpLinear = 0 , kInterpTCB = 1 } |
| Interpolation a channel applies between two keyframes. More... | |
| enum | ShapeComponent { kShapeTension = 0 , kShapeContinuity = 1 , kShapeBias = 2 } |
| Floats of a keyframe's shape triple, labelled by the dumpers at 0x004f9160. More... | |
| Public Types inherited from Rnd::Animatable | |
| 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 | |
| TransAnim (const HxStr &name) | |
| Construct an animation with no target and three empty channels that it owns. | |
| virtual | ~TransAnim () |
| Drop this object's references and every reference held on it. | |
| virtual const HxStr & | ClassName () const |
| Report the registered class name, "TransAnim". | |
| virtual float | FilteredFrameEnd () |
| Report the last frame the frames owner's three channels animate to. | |
| virtual float | StartFrame () |
| Report the first frame the frames owner's three channels animate from. | |
| virtual void | DumpText (Dbg &sink) |
| Write a description of this object to sink. | |
| virtual void | Save (Stream &stream) |
| Write the revision, both bases, both target names, the three channels, and the flags. | |
| virtual void | Load (Stream &stream) |
| Replace this object's state from stream. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Retarget mTrans and mFramesOwner when either addresses pFrom. | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy the targets, the interpolation modes, the flags, and the channels from pSource. | |
| void | EvalFrame (float flFrame, float *pXfm, int nResetEmpty) |
| Evaluate the three channels at a frame into a transform. | |
| void | Normalize () |
| Redistribute the frames owner's translation keys to an even speed. | |
| void | SetRepeatTrans (int nRepeat) |
| Set whether the translation channel repeats. | |
| void | SetTrans (Transformable *pTrans) |
| Make a transformable the target this animation drives. | |
| void | SetFramesOwner (TransAnim *pOwner) |
| Make another animation the one whose keyframes drive this one. | |
| TransAnim * | GetFramesOwner () const |
| Report the object whose keyframes drive this one. | |
| Public Member Functions inherited from Rnd::Animatable | |
| 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 void | StartAnim () |
| Restart the animation of this object and its whole subtree. | |
| 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(). | |
| Public Member Functions inherited from Rnd::Drawable | |
| Drawable () | |
| Construct a visible drawable with no children. | |
| virtual | ~Drawable () |
| Drop this object's references on its children. | |
| void | Draw () |
| Draw this object followed by each of its children. | |
| Drawable * | Parent () |
| Report the drawable that draws this one. | |
| void | AddDraw (Drawable *pDraw, Drawable *pBefore) |
| Insert pDraw into mDraws in front of pBefore. | |
| void | AddDraw (Drawable *pDraw) |
| Insert pDraw at the front of mDraws. | |
| void | RemoveDraw (Drawable *pDraw) |
| Erase pDraw from mDraws. | |
| void | RemoveAllDraws () |
| Empty mDraws, dropping this object's reference on every entry. | |
| void | MoveDraw (Drawable *pDraw, int nSteps) |
| Move pDraw nSteps places later in mDraws, or earlier for a negative count. | |
| virtual void | SetShowing (int nShowing) |
| Set whether this object draws at all. | |
| void | SetShowingRecursive (int nShowing) |
| Set whether this object and every drawable beneath it in mDraws draw at all. | |
| virtual void | SetHighlight (int nHighlight) |
| Set whether this object draws with its highlight treatment. | |
| int | GetHighlight () const |
| Report the highlight flag. | |
| int | GetShowing () const |
| Report the showing flag. | |
| std::list< Drawable * > & | GetDraws () |
| Report the child list. | |
Public Attributes | |
| std::list< RotKey > | mRotKeys |
| The rotation keyframes, kept in frame order. | |
| Public Attributes inherited from Rnd::Animatable | |
| float | mFilteredFrame |
| The frame SetFrame() last received, after the filter chain. | |
| Public Attributes inherited from Rnd::Object | |
| HxStr | mName |
| int | mInternal |
| Public Attributes inherited from Rnd::Drawable | |
| int | mShowing |
Static Public Attributes | |
| static TransAnim *(* | sNew )(const HxStr &name) |
| Creator the registered "TransAnim" class builds through. | |
Protected Member Functions | |
| virtual void | SetFrameSelf (float flFrame) |
| Write the transform this frame evaluates to into mTrans. | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
| Protected Member Functions inherited from Rnd::Drawable | |
| virtual int | DrawShowing () |
| Draw this object alone. | |
| void | ReleaseDrawsRefs () |
| Drop this object's reference on every mDraws entry without emptying the list. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Rnd::Animatable | |
| static Filter * | NewFilter (int nType) |
| Build one default-constructed filter for a type tag. | |
| Static Public Member Functions inherited from Rnd::Drawable | |
| static Drawable * | Find (const HxStr &name) |
| Resolve a registry key to a drawable. | |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Animation that drives one transformable from three keyframe channels.
Its RTTI descriptor is at 0x008ef240. It has Rnd::Animatable as a public non-virtual base at offset 0 and Rnd::Drawable as a public non-virtual base at offset 0x18. Those two offsets pin the Animatable subobject at 0x18 bytes and place this class's members from +0x2c, Drawable occupying 0x14 bytes from +0x18. Rnd::View repeats both offsets. The Animatable size is therefore fixed from outside the class rather than from a constructor's stores.
The three channels are independent. mTransKeys and mScaleKeys store vector keyframes and mRotKeys quaternion keyframes, and each channel has its own interpolation mode. The member titles come from the text DumpText() writes, "trans:", " framesOwner:", "rotKeys:", "transKeys:", "scaleKeys:", "rotInterp:", " transInterp:", " scaleInterp:", "repeatTrans:", and " followPath:".
mFramesOwner points at the object whose keyframes this one animates from, which is normally this object itself. Replace() and Copy() both use mFramesOwner == this as the mark of an object that owns its own frames, and Replace() copies the departing owner's three lists in before taking ownership.
|
explicit |
Construct an animation with no target and three empty channels that it owns.
The translation channel starts as kInterpTCB and the other two as kInterpLinear.
| name | The object name, passed to the Rnd::Object constructor. |
|
virtual |
Drop this object's references and every reference held on it.
|
virtual |
Report the registered class name, "TransAnim".
Implements Rnd::Object.
|
virtual |
Report the last frame the frames owner's three channels animate to.
Animatable vtable slot 1. Every channel is read off mFramesOwner rather than off this object, so a borrowed set of frames reports the lender's last frame. An empty channel contributes zero.
Reimplemented from Rnd::Animatable.
|
virtual |
Report the first frame the frames owner's three channels animate from.
Animatable vtable slot 4, the one virtual this class adds. Every channel is read off mFramesOwner, and an empty channel contributes zero. Rnd::Generator's path setter at 0x0045e920 calls it.
|
virtual |
Write a description of this object to sink.
| sink | The diagnostic sink to write to. |
Reimplemented from Rnd::Animatable.
|
virtual |
Write the revision, both bases, both target names, the three channels, and the flags.
The two targets are written as the names of the objects they address, so a reader has to resolve them through Rnd::TheManager. The three channels are written interleaved with the flags rather than in one block, and a reader has to expect that order.
| stream | The stream to write to. |
Reimplemented from Rnd::Animatable.
|
virtual |
Replace this object's state from stream.
A revision above the one this build writes produces the report "Can't load new TransAnim". Below revision 2 the rotation and translation keys arrive in an older form, a value and a frame each, and a channel whose interpolation reads as 0 is rebuilt from that form one key at a time, sorting the channel and rebuilding its tangents after every key. The scale channel arrives from revision 1, and the follow-path flag from revision 2. Below that the flag is derived as whether the frames owner has no rotation keys and at least two translation keys. An animation that does not own its frames then empties its own three channels.
| stream | The stream to read from. |
Reimplemented from Rnd::Animatable.
Retarget mTrans and mFramesOwner when either addresses pFrom.
A null pTo against mFramesOwner is the case worth noting. Rather than dropping the pointer, this object copies the departing owner's three keyframe lists into its own and then makes itself the owner, so the animation survives the loss of the object it borrowed its timing from.
| pFrom | The object being replaced. |
| pTo | The replacement, or null. |
Reimplemented from Rnd::Animatable.
|
virtual |
Copy the targets, the interpolation modes, the flags, and the channels from pSource.
| pSource | The object to copy from. |
| nFlags | The set of fields to copy; see kCopyShareFrames. |
Reimplemented from Rnd::Animatable.
| void Rnd::TransAnim::EvalFrame | ( | float | flFrame, |
| float * | pXfm, | ||
| int | nResetEmpty ) |
Evaluate the three channels at a frame into a transform.
The keys come from mFramesOwner and the interpolation modes and flags from this object. The translation channel writes the fourth row. Outside the key range a channel clamps to its end value. With mRepeatTrans set, the frame is wrapped by the span of the translation keys and each wrap adds the chord from the first key to the last. A negative frame on a spline translation channel instead extrapolates along the first key's outgoing tangent. The wrapped frame is relative to the first key but is compared against absolute key frames. A channel whose first key is not at frame zero therefore samples a shifted segment. A repeating spline translation channel also copies the first key's outgoing tangent over the last key's incoming tangent on every call.
The basis rows come from the rotation channel, or with mFollowPath set from the direction of the translation curve against a +z reference. A follow path of fewer than two keys writes the identity basis. The scale channel then scales each basis row by one component.
| flFrame | The frame to evaluate at. |
| pXfm | Four rows of four floats, updated in place. A channel with no keys writes nothing to its rows unless nResetEmpty is set. |
| nResetEmpty | Non-zero to reset the rows of an empty translation or rotation channel to the identity. |
| void Rnd::TransAnim::Normalize | ( | ) |
Redistribute the frames owner's translation keys to an even speed.
A channel of fewer than three keys is not changed. A linear channel retains its values, and each frame is set in proportion to the chord distance covered, between the first and last frames.
A spline channel is rebuilt. Its arc length is walked in parameter steps of 0.005, and a key is emitted each time another total length divided by one less than the key count has been covered. The emitted value is the straight-line blend of the two bracketing keys at the step's parameter rather than the curve position, and its shape comes from the earlier key. The emitted frames advance from one frame step rather than from the first key's frame. Each insertion sorts the new channel again and rebuilds its tangents. A walk one key short appends a copy of the last key, and a walk that arrives at the full count replaces its last key with the original last key. Any other count reports "Couldn't normalize" and does not change the channel. When an emission overshoots its target by more than 0.005 of the spacing, the routine runs again on the result.
No call site outside the routine itself survives in the shipped program. The name is inferred from the report text.
| void Rnd::TransAnim::SetRepeatTrans | ( | int | nRepeat | ) |
Set whether the translation channel repeats.
Turning repetition off sorts the frames owner's translation keys and rebuilds their tangents. The rebuild restores the incoming tangent of the last key. EvalFrame() overwrites that tangent while repetition is on. No call site survives in the shipped program, and the name is inferred from the member it sets.
| nRepeat | Non-zero to repeat. |
| void Rnd::TransAnim::SetTrans | ( | Transformable * | pTrans | ) |
Make a transformable the target this animation drives.
Drops this object's reference on the previous target, records the new one, and takes a reference on it. A null target clears mTrans.
| pTrans | The new target, or null. |
| void Rnd::TransAnim::SetFramesOwner | ( | TransAnim * | pOwner | ) |
Make another animation the one whose keyframes drive this one.
Moves this object's reference from the previous owner to the new one, and then empties this object's own channels unless it is its own owner. The routine has no caller in the shipped build. The name is inferred.
| pOwner | The new frames owner, or null. |
|
inline |
Report the object whose keyframes drive this one.
The out-of-line copy has no callers. TnlBumpFX::Start() inlines it.
|
protectedvirtual |
Write the transform this frame evaluates to into mTrans.
Animatable vtable slot 3. Returns at once with no target. Reads mTrans->mLocalXfm out, evaluates over it, writes it back, and marks the target dirty, so the animation drives the local transform rather than the composed one.
| flFrame | The filtered frame to animate to. |
Reimplemented from Rnd::Animatable.
Creator the registered "TransAnim" class builds through.
RegisterTransAnimClass() points it at NewTransAnim().
| std::list<RotKey> Rnd::TransAnim::mRotKeys |
The rotation keyframes, kept in frame order.
Public because TnlBumpFX::Start() at 0x0043dea8 rewrites the first key of its path's frame owner, sorts the list, and rebuilds the tangents, and the image has no accessor. +0x3c