|
resonance 1.0.1
|
Per-vertex animation of one mesh. More...
#include <meshanim.h>


Classes | |
| struct | PointsKey |
| One keyframe of the vertex position channel. More... | |
| struct | TexsKey |
| One keyframe of the first texture coordinate channel. More... | |
| struct | ColorsKey |
| One keyframe of the vertex colour channel. More... | |
Public Types | |
| enum | { kSerialVersion = 0 } |
| Serial version this build writes, and the highest version it loads. More... | |
| enum | { kCopyShareKeys = 0x40 } |
| 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 | |
| MeshAnim (const HxStr &name) | |
| Construct an animation with no keyframes that owns its own channels. | |
| virtual | ~MeshAnim () |
| virtual float | FilteredFrameEnd () |
| Report the frame of the last keyframe across the three channels. | |
| 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 |
| Return the registered class name, "MeshAnim". | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy another animation over this one. | |
| virtual void | Load (Stream &stream) |
| Load the animation. | |
| void | CopyVertKeys (int nFromVert, int nToVert) |
| Copy one vertex slot over another in every keyframe of all three channels. | |
| void | AppendVertKeys (int nVert) |
| Append a copy of one vertex slot to every keyframe of all three channels. | |
| void | SetMesh (Mesh *pMesh) |
| Change the mesh this animation deforms. | |
| void | SetKeysOwner (MeshAnim *pOwner) |
| Make another animation the one whose channels 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 Attributes | |
| std::list< PointsKey > | mVertPointsKeys |
| Position keyframes. | |
| std::list< TexsKey > | mVertTexsKeys |
| Texture coordinate keyframes. | |
| std::list< ColorsKey > | mVertColorsKeys |
| Colour keyframes. | |
| MeshAnim * | mKeysOwner |
| 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 Member Functions | |
| virtual void | SetFrameSelf (float flFrame) |
| Interpolate the three channels at a frame and write the result into the mesh. | |
| 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. | |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
Per-vertex animation of one mesh.
Its RTTI descriptor is at 0x008ef4a0. It has Rnd::Animatable as its one public base at offset
Three channels animate the mesh, one for the vertex positions, one for the first texture coordinate, and one for the vertex colours. The text dump labels them "vertPointsKeys:", "vertTexsKeys:", and "vertColorsKeys:", which is where the member names come from. Each channel is a std::list of keyframes, and one keyframe stores a whole vector of per-vertex values plus the frame it applies at. A mesh anim whose keys belong to another mesh anim reads that object's channels instead of its own, the same sharing arrangement Rnd::Mesh uses for its geometry.
The dump labels the two object references "light:" and " keysOwner:". The first label is wrong in the shipped program: Replace() at 0x00486ae8 and Copy() at 0x00487288 both narrow the incoming object with the Rnd::Mesh type descriptor at 0x00492528 before storing it, and SetFrameSelf() reads mVertsOwner at +0x130 and the vertex vector at +0xe8 through it, so the field is the animated mesh. The label is a copy-paste remnant from a sibling class.
| anonymous enum |
| anonymous enum |
| Rnd::MeshAnim::MeshAnim | ( | const HxStr & | name | ) |
Construct an animation with no keyframes that owns its own channels.
| name | The object name, passed to the Rnd::Object constructor. |
|
virtual |
|
virtual |
Report the frame of the last keyframe across the three channels.
Rnd::Animatable vtable slot 1. An empty channel reports zero, and the channels read belong to mKeysOwner rather than to this object.
Reimplemented from Rnd::Animatable.
|
virtual |
Write the animation to the engine text sink.
Emits the Rnd::Object and Rnd::Animatable dumps, then the "[MeshAnim]" block. The block is suppressed while the dump level of the sink is zero or negative.
| sink | The text sink. |
Reimplemented from Rnd::Animatable.
|
virtual |
Serialise the animation.
Writes kSerialVersion, the Rnd::Animatable subobject, the mesh reference as a name, the three channels, and finally the keys owner as a name.
| stream | The stream to write to. |
Reimplemented from Rnd::Animatable.
Replace one object reference with another.
Forwards to Rnd::Animatable, then swaps the mesh and the keys owner whose current value is the old object. Losing the keys owner makes this object copy the channels it was sharing and become its own owner rather than lose them.
| pFrom | The object being replaced. |
| pTo | The object to point at, which may be null. |
Reimplemented from Rnd::Animatable.
|
virtual |
Return the registered class name, "MeshAnim".
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.
| pSource | The source object, which has to be a mesh anim for the copy to have any effect. |
| nFlags | The copy flags. |
Reimplemented from Rnd::Animatable.
|
virtual |
Load the animation.
Reports "Can't load new MeshAnim" through the failure sink when the file version exceeds kSerialVersion. Object references arrive as names and resolve through Rnd::TheManager with a checked cast.
| stream | The stream to read from. |
Reimplemented from Rnd::Animatable.
| void Rnd::MeshAnim::CopyVertKeys | ( | int | nFromVert, |
| int | nToVert ) |
Copy one vertex slot over another in every keyframe of all three channels.
The channels read and written belong to mKeysOwner. Rnd::Mesh::WeldVerts() is the only caller, which is why the method is public.
| nFromVert | The vertex slot to copy from. |
| nToVert | The vertex slot to copy over. |
| void Rnd::MeshAnim::AppendVertKeys | ( | int | nVert | ) |
Append a copy of one vertex slot to every keyframe of all three channels.
The channels written belong to mKeysOwner. Rnd::Mesh::AssignFlatVerts() calls it on each animation of a mesh after it splits a vertex. The title is inferred.
| nVert | The vertex slot to copy. |
| void Rnd::MeshAnim::SetMesh | ( | Mesh * | pMesh | ) |
Change the mesh this animation deforms.
Drops this object's reference on the previous mesh, records the new one, and takes a reference on it. HudPosition's constructor points the shared position animation at each section mesh this way. The title is inferred.
| pMesh | The new mesh, or null. |
| void Rnd::MeshAnim::SetKeysOwner | ( | MeshAnim * | pOwner | ) |
Make another animation the one whose channels 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 out-of-line copy has no caller, and the title follows Rnd::LightAnim::SetKeysOwner().
| pOwner | The new keys owner, or null. |
|
protectedvirtual |
Interpolate the three channels at a frame and write the result into the mesh.
Rnd::Animatable vtable slot 3. Does nothing while mMesh is null. Each channel selects the keyframe pair bracketing the frame, clamping to the first and the last key outside the recorded range, and blends into the vertices of mMesh->mVertsOwner. Each channel then reports its own bit to Rnd::Mesh::SyncChanged().
| flFrame | The filtered frame to animate to. |
Reimplemented from Rnd::Animatable.
| std::list<PointsKey> Rnd::MeshAnim::mVertPointsKeys |
Position keyframes.
The three channels are public because Rnd::Mesh::WeldVerts() resizes the vector of each key and empties a channel whose keys all match, and the image has no accessor for either.
| std::list<TexsKey> Rnd::MeshAnim::mVertTexsKeys |
Texture coordinate keyframes.
| std::list<ColorsKey> Rnd::MeshAnim::mVertColorsKeys |
Colour keyframes.
Animation whose channels this one reads, itself for an animation that owns its keys. Public because Rnd::Mesh::WeldVerts() reads it at 0x00483f88 to decide whether an animation may be rebuilt, and the image has no accessor for it. +0x28
| MeshAnim* Rnd::MeshAnim::mKeysOwner |