|
resonance 1.0.1
|
Emitter that spawns copies of one drawable along an animated path. More...
#include <generator.h>


Classes | |
| struct | Instance |
| One live instance. More... | |
Public Member Functions | |
| Generator (const HxStr &name) | |
| Construct an emitter with no instances and no subject. | |
| virtual | ~Generator () |
| virtual void | DumpText (Dbg &sink) |
| Write the emitter to the engine text sink. | |
| virtual void | Save (Stream &stream) |
| Write revision 7 of the emitter to stream. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Replace one object reference with another. | |
| virtual const HxStr & | ClassName () const |
| Return the registered class name, "Generator". | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy another emitter over this one. | |
| virtual void | Load (Stream &stream) |
| Read the emitter from stream. | |
| void | Regenerate () |
| Give every live instance a fresh particle from mParticleSys. | |
| std::list< Instance > & | Instances () |
| Report the live instance list. | |
| int | NumInstances () |
| Count the live instances. | |
| void | SetMesh (Mesh *pMesh) |
| Make a mesh the drawn subject. | |
| void | SetView (View *pView) |
| Make a view the drawn subject, clearing mMesh, mMultiMesh, and mParticleSys. | |
| void | SetMultiMesh (MultiMesh *pMultiMesh) |
| Make a multi-mesh the drawn subject, clearing mMesh, mView, and mParticleSys. | |
| void | SetParticleSys (ParticleSys *pParticleSys) |
| Make a particle system the drawn subject, clearing mMesh, mView, and mMultiMesh. | |
| void | SetBirthCamera (Cam *pCam) |
| Set the camera the birth culling measures against. | |
| void | SetPath (TransAnim *pPath, float flStartFrame, float flEndFrame) |
| Replace the path and set the frame span the instances travel. | |
| TransAnim * | GetPath () const |
| Report the path. | |
| float | GetPathStartFrame () const |
| Report the path frame an instance starts at. | |
| float | GetPathEndFrame () const |
| Report the path frame an instance ends at. | |
| Mesh * | GetMesh () const |
| Report the mesh subject. | |
| View * | GetView () const |
| Report the view subject. | |
| MultiMesh * | GetMultiMesh () const |
| Report the multi-mesh subject. | |
| ParticleSys * | GetParticleSys () const |
| Report the particle system subject. | |
| void | SetAnimateFromStart (int nAnimateFromStart) |
| Set mAnimateFromStart. | |
| int | GetAnimateFromStart () const |
| Report mAnimateFromStart. | |
| void | SetBirthFrontOnly (int nBirthFrontOnly) |
| Set mBirthFrontOnly. | |
| int | GetBirthFrontOnly () const |
| Report mBirthFrontOnly. | |
| void | SetBirthSquareDistCull (int nCull) |
| Set mBirthSquareDistCull. | |
| int | GetBirthSquareDistCull () const |
| Report mBirthSquareDistCull. | |
| void | SetBirthSquareDist (float flSquareDist) |
| Set mBirthSquareDist. | |
| float | GetBirthSquareDist () const |
| Report mBirthSquareDist. | |
| Cam * | GetBirthCam () const |
| Report the birth camera. | |
| void | SetNextSpawnFrame (float flFrame) |
| Set mNextSpawnFrame. | |
| void | SetRateGen (float flLow, float flHigh) |
| Set the bounds of the random spawn interval. | |
| void | GetRateGen (float &flLow, float &flHigh) const |
| Report the bounds of the random spawn interval. | |
| void | SetScaleGen (float flLow, float flHigh) |
| Set the bounds of the random instance scale. | |
| void | GetScaleGen (float &flLow, float &flHigh) const |
| Report the bounds of the random instance scale. | |
| void | SetPathVarMax (float flX, float flY, float flZ) |
| Set the largest random rotation about each axis, in degrees. | |
| void | GetGenPathVarMax (float &flX, float &flY, float &flZ) const |
| Report the largest random rotation about each axis, in degrees. | |
| 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 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. | |
| 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::Transformable | |
| Transformable () | |
| Construct a dirty transformable with identity transforms and no children. | |
| virtual | ~Transformable () |
| Drop this object's references on its children. | |
| void | AddTrans (Transformable *pTrans) |
| Append pTrans to mTransList and mark it dirty. | |
| void | RemoveTrans (Transformable *pTrans) |
| Erase pTrans from mTransList. | |
| void | RemoveAllTranses () |
| Drop this object's reference on every mTransList entry and empty the list. | |
| Transformable * | Parent () |
| Report the transformable that positions this one. | |
| virtual void | SetBillboard (int nBillboard) |
| Set the billboard mode and mark the transform dirty. | |
| virtual int | UpdateWorldXfm (Transformable *pParent, int nForce) |
| Compose mWorldXfm from mLocalXfm and the parent's world transform. | |
| void | SetOrigin (const float *pOrigin) |
| Set the origin row and mark the transform dirty. | |
| float * | GetDrawXfm () |
| Build the transform this object draws with and return it. | |
| 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. | |
Static Public Member Functions | |
| static void | Init () |
| Register the class with Rnd::TheManager under the key "Generator". | |
| static void * | operator new (size_t nSize) |
| Allocate an emitter under the tag "Rnd::Generator". | |
| static void | operator delete (void *pBlock) |
| Release an emitter under the tag "Rnd::Generator". | |
| 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. | |
Public Attributes | |
| float | mNextSpawnFrame |
| Frame the next instance is spawned on. | |
| 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::Transformable | |
| float | mLocalXfm [kXfmRowCount][kXfmRowFloatCount] |
| Transform this object is positioned by, before the parent transform is applied. | |
| float | mWorldXfm [kXfmRowCount][kXfmRowFloatCount] |
| Composed world transform. | |
| int | mDirty |
| Set by every writer of a transform field and cleared once UpdateWorldXfm has recomposed. | |
| Public Attributes inherited from Rnd::Drawable | |
| int | mShowing |
Protected Member Functions | |
| virtual int | DrawShowing () |
| Draw every live instance. | |
| virtual void | SetFrameSelf (float flFrame) |
| Expire and spawn instances for a frame. | |
| 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::Transformable | |
| void | AdoptXfmFrom (const Transformable &owner) |
| Adopt the transform of an owner this object is being detached from. | |
| void | ReleaseTransRefs () |
| Drop this object's reference on every mTransList entry without emptying the list. | |
| Protected Member Functions inherited from Rnd::Drawable | |
| void | ReleaseDrawsRefs () |
| Drop this object's reference on every mDraws entry without emptying the list. | |
Additional Inherited Members | |
| 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 Types inherited from Rnd::Transformable | |
| enum | Billboard { kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 , kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 , kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160 } |
| Mode mBillboard selects, recovered from the name dumper at 0x004f26f0. More... | |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
| Protected Attributes inherited from Rnd::Transformable | |
| float | mOrigin [kXfmRowFloatCount] |
| int | mBillboard |
Emitter that spawns copies of one drawable along an animated path.
Its RTTI descriptor is at 0x008ef5e0, its name string at 0x0081c640, and its three base entries record Rnd::Animatable at +0x00, Rnd::Transformable at +0x20, and Rnd::Drawable at +0xd0, each non-virtual and public. All three derive virtually from Rnd::Object, so one shared Object subobject sits at +0x140, which the constructor proves by writing this + 0x140 into the virtual-base pointer of each of the three subobjects. The class is therefore 0x15c bytes, and the creator allocates 0x160, which is that size rounded up to the quadword the vector unit reads a transform from. The members of the class itself occupy +0xe4 through +0x13f.
The base offsets also pin the three base subobjects. Animatable uses 0x18 bytes, and the eight bytes after it are the padding that puts the 16-byte-aligned Transformable subobject on +0x20. Transformable uses 0xac and its size rounds to 0xb0 on its own 16-byte alignment, and Drawable uses 0x14. The last member, mMultiMeshCursor at +0x13c, ends exactly on the virtual base subobject, so the non-virtual part needs no padding.
Four vtables belong to the class, each identified by a GetTypeInfo slot addressing 0x0045db10 and by an adjustment matching its subobject offset. The Drawable table at 0x0081c508 adjusts by -0xd0 and overrides only DrawShowing(). The Transformable table at 0x0081c530 adjusts by -0x20 and overrides nothing. The Animatable table at 0x0081c550 has a zero adjustment and overrides only SetFrameSelf(). The Object subobject table at 0x0081c578 adjusts by -0x140 and stores the seven Object virtuals. Every table ends in an all-zero entry, which is the terminator rather than a null slot. No table gains a slot past the own count of its base. This class therefore declares no virtual of its own.
Every member title below comes from the text DumpText() writes, so each one is recovered rather than inferred: "path:", " mesh:", " birthFrontOnly:", "birthSquareDist:", " birthCam:", "rateGenLow:", " rateGenHigh:", "scaleGenLow:", " scaleGenHigh:", "pathVarMax:(", "view:", " animateFromStart:", "multiMesh:", " particleSys:", "instances:", "pathEndFrame:", and " pathStartFrame:". The names of the two members the dump omits but SetFrameSelf() uses follow what SetFrameSelf() does with them, and each one records that inference. The two the dump omits and no routine uses are named after their offsets.
The concrete type of each of the six object references comes from the narrowing cast Load() performs through the dynamic_cast helper at 0x005570e0, whose target type function identifies the class in every case.
SetFrameSelf() expires the instances whose age passed the path span, then spawns instances while the next spawn frame has not passed the current one, culling against mBirthCam and mBirthSquareDist first and giving each instance a random rotation drawn from mPathVarMax and a random uniform scale drawn from mScaleGenLow and mScaleGenHigh. DrawShowing() selects one of four draw paths from the table of pointers to member functions at 0x0081c448, DrawInstanceView(), DrawInstanceMesh(), DrawInstanceMultiMesh(), and DrawInstanceParticle(), preferring mView, then mMesh, then mMultiMesh, then mParticleSys.
The accessors between 0x0045dbb8 and 0x0045dca0 are inline, and each out-of-line copy has no callers.
|
explicit |
Construct an emitter with no instances and no subject.
mAnimateFromStart starts at 1, the next spawn frame at the sentinel -9999999.0, both rateGen bounds at 100.0, both scaleGen bounds at 1.0, and every other member at zero.
| name | The registry key for this object. |
|
virtual |
|
virtual |
Write the emitter to the engine text sink.
The three base dumps run unconditionally and the block below them only while the dump level of the sink is positive. The instance list and the two path frames need level two.
| sink | The text sink. |
Reimplemented from Rnd::Animatable.
|
virtual |
Write revision 7 of the emitter to stream.
The instance list is not written. A reloaded emitter starts empty, and Load() repopulates it through Regenerate().
| stream | The stream to write to. |
Reimplemented from Rnd::Animatable.
Replace one object reference with another.
| 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, "Generator".
Implements Rnd::Object.
|
virtual |
Copy another emitter over this one.
The narrowing cast is not tested, so a source that is not an emitter is read through null.
| pSource | The source object, which has to be an emitter. |
| nFlags | The copy flags. |
Reimplemented from Rnd::Animatable.
|
virtual |
Read the emitter from stream.
Rejects revision 8 and above, reporting "Can't load new Generator". Revision 7 is the only one this build writes, and every earlier revision is still read.
| stream | The stream to read from. |
Reimplemented from Rnd::Animatable.
| void Rnd::Generator::Regenerate | ( | ) |
Give every live instance a fresh particle from mParticleSys.
Does nothing while mParticleSys is null. Otherwise it releases every live particle, then allocates one particle per live instance and randomises the colour and the size of each one. Only the instance count is read. The loop never visits an instance, and an allocation that fails skips the randomisation at 0x0045aa0c and continues rather than ending the loop. mParticleCursor receives the allocation result whether or not it succeeded, because that store sits in the delay slot of the test.
| std::list< Instance > & Rnd::Generator::Instances | ( | ) |
Report the live instance list.
The routine is two instructions that return the address of the member. It is compiled out of line here, so it exists as a function rather than as an accessor this reconstruction added.
|
static |
Register the class with Rnd::TheManager under the key "Generator".
The class installs no creator hook, unlike Rnd::Blur and Rnd::Tex, so the thunk the registry stores calls the constructor directly.
Rnd::Manager::Init() also expands this inline.
|
static |
Allocate an emitter under the tag "Rnd::Generator".
| nSize | The object size the compiler supplies. |
|
static |
Release an emitter under the tag "Rnd::Generator".
| pBlock | The block. |
| int Rnd::Generator::NumInstances | ( | ) |
Count the live instances.
The image has no caller.
| void Rnd::Generator::SetMesh | ( | Mesh * | pMesh | ) |
Make a mesh the drawn subject.
Releases the reference on the previous mesh, takes one on the new one, and clears mView, mMultiMesh, and mParticleSys, releasing each. The image has no caller, and the title is inferred.
| pMesh | The mesh, which may be null. |
| void Rnd::Generator::SetView | ( | View * | pView | ) |
Make a view the drawn subject, clearing mMesh, mMultiMesh, and mParticleSys.
The image has no caller, and the title is inferred.
| pView | The view, which may be null. |
| void Rnd::Generator::SetMultiMesh | ( | MultiMesh * | pMultiMesh | ) |
Make a multi-mesh the drawn subject, clearing mMesh, mView, and mParticleSys.
The image has no caller, and the title is inferred.
| pMultiMesh | The multi-mesh, which may be null. |
| void Rnd::Generator::SetParticleSys | ( | ParticleSys * | pParticleSys | ) |
Make a particle system the drawn subject, clearing mMesh, mView, and mMultiMesh.
Calls Regenerate() afterwards. Every live instance then gains a particle. The image has no caller, and the title is inferred.
| pParticleSys | The particle system, which may be null. |
| void Rnd::Generator::SetBirthCamera | ( | Cam * | pCam | ) |
Set the camera the birth culling measures against.
The image has no caller, and the title is inferred.
| pCam | The camera, which may be null. |
| void Rnd::Generator::SetPath | ( | TransAnim * | pPath, |
| float | flStartFrame, | ||
| float | flEndFrame ) |
Replace the path and set the frame span the instances travel.
Moves the reference from the previous path to the new one. A bound of -1 takes the matching end of the path's keyframe range, from TransAnim::StartFrame() or TransAnim::FilteredFrameEnd(), and any other value is stored as given. AppTunnel calls it.
| pPath | The path, or null. |
| flStartFrame | The path frame an instance starts at, or -1. |
| flEndFrame | The path frame an instance ends at, or -1. |
|
inline |
Report the path.
|
inline |
Report the path frame an instance starts at.
|
inline |
Report the path frame an instance ends at.
|
inline |
Report the mesh subject.
|
inline |
Report the view subject.
|
inline |
Report the multi-mesh subject.
|
inline |
Report the particle system subject.
|
inline |
Set mAnimateFromStart.
| nAnimateFromStart | Non-zero to drive mView to each instance's age. |
|
inline |
Report mAnimateFromStart.
|
inline |
Set mBirthFrontOnly.
| nBirthFrontOnly | Non-zero to spawn only in front of mBirthCam. |
|
inline |
Report mBirthFrontOnly.
|
inline |
Set mBirthSquareDistCull.
| nCull | Non-zero to apply the mBirthSquareDist cull. |
|
inline |
Report mBirthSquareDistCull.
|
inline |
Set mBirthSquareDist.
| flSquareDist | The squared distance from mBirthCam beyond which nothing spawns. |
|
inline |
Report mBirthSquareDist.
|
inline |
Report the birth camera.
|
inline |
Set mNextSpawnFrame.
| flFrame | The frame the next instance spawns on. |
|
inline |
Set the bounds of the random spawn interval.
| flLow | The low bound. |
| flHigh | The high bound. |
|
inline |
Report the bounds of the random spawn interval.
| flLow | Receives the low bound. |
| flHigh | Receives the high bound. |
|
inline |
Set the bounds of the random instance scale.
| flLow | The low bound. |
| flHigh | The high bound. |
|
inline |
Report the bounds of the random instance scale.
| flLow | Receives the low bound. |
| flHigh | Receives the high bound. |
|
inline |
Set the largest random rotation about each axis, in degrees.
| flX | The bound about x. |
| flY | The bound about y. |
| flZ | The bound about z. |
|
inline |
Report the largest random rotation about each axis, in degrees.
| flX | Receives the bound about x. |
| flY | Receives the bound about y. |
| flZ | Receives the bound about z. |
|
protectedvirtual |
Draw every live instance.
Rnd::Drawable vtable slot 3. Nothing is drawn without a path or a subject. Each instance is placed on the path at its age, scaled, and composed with its mXfmMod, then drawn through the selected path. A multi-mesh or particle system subject then draws once for all instances.
Reimplemented from Rnd::Drawable.
|
protectedvirtual |
Expire and spawn instances for a frame.
Rnd::Animatable vtable slot 3. The first call only records the frame. A spawn that the birth camera culls ends the call, leaving later spawns for the next frame.
| flFrame | The filtered frame to animate to. |
Reimplemented from Rnd::Animatable.
| float Rnd::Generator::mNextSpawnFrame |
Frame the next instance is spawned on.
The constructor writes the sentinel -9999999.0, and the first SetFrameSelf() replaces it with the frame it receives. The dump omits it, so the title is inferred from SetFrameSelf(). Public because TnlBumpFX::Start() at 0x0043dea8 zeroes it, and the image has no accessor. +0x108