|
resonance 1.0.1
|
Animation of the colours and the texture stages of one material. More...
#include <matanim.h>


Classes | |
| class | Stage |
| Animation of one texture stage of the material. More... | |
Public Types | |
| enum | { kSerialVersion = 2 } |
| Revision Save() writes, and the highest revision Load() accepts. More... | |
| enum | { kCopyShareKeys = 0x04 } |
| Bit of the copy flags that shares the source's keyframe channels rather than copying them. 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 | |
| MatAnim (const HxStr &name) | |
| Construct an animation with five empty channels, no stages, and no material. | |
| virtual | ~MatAnim () |
| Drop every reference this animation holds and every reference held on it. | |
| virtual void | DumpText (Dbg &sink) |
| Write the animation to the engine text sink. | |
| virtual void | Save (Stream &stream) |
| Serialise the animation. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Replace one object reference with another. | |
| virtual const HxStr & | ClassName () const |
| Report the registered class name, "MatAnim". | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy another animation over this one. | |
| virtual void | Load (Stream &stream) |
| Load the animation. | |
| virtual float | FilteredFrameEnd () |
| Report the last frame this animation runs to. | |
| void | SetMat (Mat *pMat) |
| Change the material this animation drives. | |
| void | SetKeysOwner (MatAnim *pOwner) |
| Change the animation whose channels this one reads. | |
| void | SetNumStages (int nCount) |
| Resize the stage vector of the keys owner. | |
| 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(). | |
Static Public Attributes | |
| static HxStr | sClassName |
| Registered class name of Rnd::MatAnim, the string "MatAnim". | |
Protected Member Functions | |
| virtual void | SetFrameSelf (float flFrame) |
| Apply the animation at a frame. | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
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. | |
| 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 |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Animation of the colours and the texture stages of one material.
Its RTTI descriptor is at 0x008ef4b0. It has Rnd::Animatable as its one public base at offset
Two vtables belong to the class, each with the type function at 0x004dbf10 in slot 0. The Object subobject table at 0x00822d68 stores the destructor and the seven Object overrides, and the primary table at 0x00822db0 stores FilteredFrameEnd() at slot 1 and SetFrameSelf(float) at slot 3, followed by an all-zero terminator. Slot 2 still addresses the base Rnd::Animatable::StartAnim() at 0x0049a3b8, so restarting an animation does nothing of its own here.
Five channels animate the four material colours and the alpha, and the stage vector animates the texture stages one for one against the material's own stages. Two independent readings agree on which colour each channel drives. The text dump labels them " diffuseKeys:", "ambientKeys", "emissiveKeys: ", "specularKeys:", and "alphaKeys:" in offset order. And SetFrameSelf() hands each interpolated result to the material through vtable slot 10, slot 9, slot 11, slot 13, and slot 12 respectively, which are Rnd::Mat::SetDiffuse(), SetAmbient(), SetEmissive(), SetSpecular(), and SetAlpha() in the declaration order of src/rnd/mat.h.
Keys are shared rather than copied, the same arrangement Rnd::MeshAnim uses with mKeysOwner. FilteredFrameEnd() and SetFrameSelf() read the channels of mKeysOwner rather than their own.
| anonymous enum |
| anonymous enum |
Bit of the copy flags that shares the source's keyframe channels rather than copying them.
Recovered from the andi at 0x004dd404 in Copy(). Rnd::MeshAnim reads bit 0x40, Rnd::LightAnim bit 0x02, and Rnd::ParticleSysAnim bit 0x80 for the same purpose, so the bit is per class rather than shared across the hierarchy.
| Enumerator | |
|---|---|
| kCopyShareKeys | |
| Rnd::MatAnim::MatAnim | ( | const HxStr & | name | ) |
Construct an animation with five empty channels, no stages, and no material.
The animation owns its keys from the start, so mKeysOwner is this object.
| name | The object name, passed to the Rnd::Object constructor. |
|
virtual |
Drop every reference this animation holds and every reference held on it.
|
virtual |
Write the animation to the engine text sink.
Emits the Rnd::Object and Rnd::Animatable dumps, then the "[MatAnim]" block with the material, the stage vector, the keys owner, and the five channels. The block is suppressed while the dump level of the sink is not positive.
| sink | The text sink. |
Reimplemented from Rnd::Animatable.
|
virtual |
Serialise the animation.
Writes kSerialVersion, the Rnd::Animatable subobject, mMat as a name, the stage vector, mKeysOwner as a name, and finally the five channels.
| stream | The stream to write to. |
Reimplemented from Rnd::Animatable.
Replace one object reference with another.
The material, the keys owner, and every stage texture that is pFrom move to pTo. A null pTo for the keys owner copies the owner's stage vector and makes this animation its own owner, but the five colour and alpha channels are not copied. A stage texture key left null is erased.
| pFrom | The object being replaced. |
| pTo | The replacement, which may be null. |
Reimplemented from Rnd::Animatable.
|
virtual |
Report the registered class name, "MatAnim".
Implements Rnd::Object.
|
virtual |
Copy another animation over this one.
kCopyShareKeys shares the source's channels instead of copying them, and a source that is itself sharing is always shared from rather than copied. Unlike its three sibling classes this one has no mKeysOwner != this test around the clear, because ClearKeys() performs that test itself.
| pSource | The object to copy from. |
| nFlags | The set of fields to copy. |
Reimplemented from Rnd::Animatable.
|
virtual |
Load the animation.
The revision is read into Rnd::g_nRndMatLoadVersion, the material's global, and the stage records consult it there. A revision above kSerialVersion is reported to the failure sink and nothing more is read. The five channels are present from revision 2.
| stream | The stream to read from. |
Reimplemented from Rnd::Animatable.
|
virtual |
Report the last frame this animation runs to.
Rnd::Animatable vtable slot 1. Every channel of every stage of mKeysOwner and then each of the five colour and alpha channels contributes the frame of its last key, or zero while it is empty, and the result is the largest across all of them. The walk threads one running maximum through nested std::max calls, and the selected stack addresses rather than selected values prove that each pair is a call.
Reimplemented from Rnd::Animatable.
| void Rnd::MatAnim::SetMat | ( | Mat * | pMat | ) |
Change the material this animation drives.
Drops this object's reference on the previous material, records the new one, and takes a reference on it. The head-up display's FreQ icon points one shared pulse animation at its own material this way before every frame. The title is inferred.
| pMat | The new material, or null. |
| void Rnd::MatAnim::SetKeysOwner | ( | MatAnim * | pOwner | ) |
Change the animation whose channels this one reads.
Moves this object's reference from the previous owner to the new one and then empties this animation'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 keys owner, or null. |
| void Rnd::MatAnim::SetNumStages | ( | int | nCount | ) |
Resize the stage vector of the keys owner.
Every texture of a stage past the new count drops this animation's reference first. After the resize every stage records this animation as its owner. The routine has no caller in the shipped build. The name is inferred.
| nCount | The new stage count. |
|
protectedvirtual |
Apply the animation at a frame.
Rnd::Animatable vtable slot 3. Nothing happens without a material. The stage half walks the stages of mKeysOwner against mMat->mStages, bounded by both counts. Per stage, the translation writes the last transform row, the rotation rebuilds the basis through Rnd::MakeRotMatrix(), the scale folds into it through Rnd::Scale(), and the texture channel replaces the stage texture. The vector blends write three components and take the fourth word from the later key.
The colour half hands each blended colour to the material through its setters. The specular call passes an alpha of zero, which clear f12 at 0x004d54ec proves, and the alpha channel interpolates linearly rather than on VU0. Any empty channel leaves its target as it was.
| flFrame | The frame to apply. |
Reimplemented from Rnd::Animatable.
|
static |
Registered class name of Rnd::MatAnim, the string "MatAnim".
A static constructor fills the string from the literal at 0x00822e68.