wavelength 1.0.0
Loading...
Searching...
No Matches
RndGenerator Class Reference

Emitter of instances that each follow a path animation from the frame they are born at. More...

#include <rndgenerator.h>

Inheritance diagram for RndGenerator:
Collaboration diagram for RndGenerator:

Classes

struct  Instance
 One generated instance. More...

Public Types

typedef void(RndGenerator::* DrawInstanceFunc) (float fAge, const Transform &xfm)
 A routine that draws or places one instance's subject at a transform.
Public Types inherited from RndAnimatable
enum  FilterType {
  kFilterScaleOffset = 0 , kFilterMinMaxLoop = 1 , kFilterZeroOrder = 2 , kFilterFirstOrder = 3 ,
  kFilterSecondOrder = 4
}
 The type tags of the filters, as Save() writes them. More...
Public Types inherited from RndTransformable
enum  Billboard {
  kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 ,
  kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 ,
  kBillboardScale = 128 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 ,
  kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160
}
 How the world transform turns to face the current camera. More...

Public Member Functions

 RndGenerator (const char *pszName)
 Construct a generator without a path or a subject that generates every 100 frames.
 ~RndGenerator () override
 Drop the references and the instances.
void * operator new (size_t nSize)
 Allocate a generator, billed to the class name.
void operator delete (void *pBlock)
 Release a generator.
int SetFrameSelf (float fFrame) override
 Drop the instances whose path has run out, animate the view, and generate the instances due by a frame.
void ListDrawObjects (std::list< RndObject * > &objects) override
 Add the generator and the objects of the subjects to a list.
void ListDrawables (std::list< RndDrawable * > &drawables) override
 Add the generator, when a subject of an instance would draw, then the children, to a list.
int DrawShowing () override
 Draw the subject at each instance.
void DumpText (PrnStream &stream) override
 Write a description of the generator and its bases.
void Save (BinStream &stream) override
 Write the generator and its bases.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a referenced object with another in the bases and the subjects.
const char * ClassName () const override
 Report the class name.
void Copy (const RndObject *pSource, int nFlags) override
 Copy another generator and its bases.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void ReleaseRefs ()
 Drop the references on the subjects, the path, and the birth camera, and the instances.
void AcquireRefs ()
 Take the references on the subjects, the path, and the birth camera, then give each instance a particle.
void ResetParticles ()
 Free the particles of the particle system, then allocate one for each instance.
void SetPath (RndTransAnim *pPath, float fStart, float fEnd)
 Set the path and the frames of it the instances play.
void Generate (float fFrame)
 Add an instance born at a frame, unless the birth camera rules it out.
void DrawView (float fAge, const Transform &xfm)
 Move the view to a transform, animate it to an age when mAnimateFromStart is set, and draw it.
void DrawMesh (float fAge, const Transform &xfm)
 Move the mesh to a transform and draw it.
void SetMultiMeshXfm (float fAge, const Transform &xfm)
 Store a transform in the next transform of the multimesh.
void SetParticlePos (float fAge, const Transform &xfm)
 Move the next particle to the position of a transform.
const float * GetPathVarMax () const
void SetPathVarMax (int nIndex, float fDegrees)
 Set one entry of the most rotation about each axis, in degrees.
float GetRateGenHigh () const
void SetRateGenHigh (float fRateGenHigh)
float GetRateGenLow () const
void SetRateGenLow (float fRateGenLow)
float GetScaleGenHigh () const
void SetScaleGenHigh (float fScaleGenHigh)
float GetScaleGenLow () const
void SetScaleGenLow (float fScaleGenLow)
Public Member Functions inherited from RndAnimatable
 RndAnimatable ()
 Construct an animatable at frame 0 without children or filters.
 ~RndAnimatable () override
 Drop the references on the children and delete the filters.
virtual float EndFrame ()
 Report the frame at which the animation ends.
virtual void ListAnimObjects (std::list< RndObject * > &objects)
 Add the objects the animation uses to a list.
RndAnimatable * Parent ()
 Find the animatable whose children include this one.
void SetFrame (float fFrame)
 Filter a frame, apply it, and pass the result on to the children.
float FilterFrame (float fValue)
 Run a frame through the filters.
float UnfilterFrame (float fValue)
 Run a filtered frame back through the filters, last first.
float ChildrenEndFrame ()
 Report the latest end frame of the children, unfiltered through this animatable.
bool AddAnim (RndAnimatable *pAnim)
 Append a child.
void RemoveAnim (RndAnimatable *pAnim)
 Remove a child.
void RemoveAllAnims ()
 Remove every child.
const std::list< Filter * > & GetFilters () const
float GetFrame () const
float GetFilteredFrame () const
const std::list< RndAnimatable * > & GetAnims () const
std::list< Filter * > & GetFilters ()
Public Member Functions inherited from RndObject
 RndObject (const char *pszName)
 Construct an object and register it under a name.
virtual ~RndObject ()
 Notify every referrer, then erase the registration.
void SetName (const char *pszName)
 Register the object under a different name.
void AddRef (RndObject *pReferrer)
 Register an object as a store of a pointer to this one.
void RemoveRef (RndObject *pReferrer)
 Drop the first registration AddRef() made for a referrer.
const char * GetName () const
const std::list< RndObject * > & GetRefs () const
int GetInternal () const
void SetInternal (int nInternal)
Public Member Functions inherited from RndTransformable
 RndTransformable ()
 Construct a transformable with identity transforms, no origin offset, and no billboard.
 ~RndTransformable () override
 Drop the references on the children.
virtual void SetBillboard (int nBillboard)
 Set the billboard mode.
virtual int UpdateWorldXfm (RndTransformable *pParent, int bForce)
 Recompute the world transform when it, or the parent's, changed, and then the children's.
void DumpText (PrnStream &stream) override
 Write a description of the transformable.
void Save (BinStream &stream) override
 Write the transforms, the names of the children, the billboard mode, and the origin.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a child with another object.
void Copy (const RndObject *pSource, int nFlags) override
 Copy the transforms, the billboard mode, the origin, and the children when the flags request them.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void SetOrigin (const Vector3 &origin)
 Set the point the world transform subtracts first when there is no billboard.
RndTransformable * Parent ()
 Find the transformable whose children include this object.
bool AddTrans (RndTransformable *pTrans)
 Append a child and mark its world transform dirty.
void RemoveTrans (RndTransformable *pTrans)
 Remove a child.
void ClearTrans ()
 Remove every child.
const Transform & BillboardXfm ()
 Report the world transform turned to face the current camera.
const Transform & GetLocalXfm () const
Transform & GetLocalXfm ()
void SetLocalXfm (const Transform &xfm)
const Transform & GetWorldXfm () const
Transform & GetWorldXfm ()
int GetDirty () const
void SetDirty (int nDirty)
const std::list< RndTransformable * > & GetTransList () const
Public Member Functions inherited from RndDrawable
 RndDrawable ()
 Construct a showing drawable without a highlight or children.
 ~RndDrawable () override
 Drop the references on the children.
virtual void SetShowing (int nShowing)
 Set whether the drawable draws at all.
virtual void SetHighlight (int nHighlight)
 Set whether the drawable draws with its highlight treatment.
RndDrawable * Parent ()
 Find the drawable whose children include this one.
void Draw ()
 Draw the drawable and then its children, when it is showing.
bool AddDraw (RndDrawable *pDraw, RndDrawable *pBefore)
 Add a child before another.
void RemoveDraw (RndDrawable *pDraw)
 Remove a child.
void ClearDraws ()
 Remove every child.
int GetShowing () const
const std::list< RndDrawable * > & GetDraws () const

Static Public Member Functions

static RndObject * New (const char *pszName)
 Create a generator.
Static Public Member Functions inherited from RndAnimatable
static Filter * NewFilter (int nType)
 Create a filter stage of a type, with its parameters unset.
static void CollectChildren (std::list< RndObject * > &objects, RndAnimatable *pAnimatable)
 Append every animation descendant of an animatable, depth first, each before its descendants.
Static Public Member Functions inherited from RndTransformable
static void CollectChildren (std::list< RndObject * > &objects, RndTransformable *pTransformable)
 Append every transform descendant of a transformable, depth first, each before its descendants.
Static Public Member Functions inherited from RndDrawable
static void CollectChildren (std::list< RndObject * > &objects, RndDrawable *pDrawable)
 Append every draw descendant of a drawable, depth first, each before its descendants.

Static Public Attributes

static const char * sClassName
 The class name a .rnd file writes, Generator.
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndAnimatable
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndObject
static constexpr int kCopyChildLists = 0x200
 The bit of the Copy() flags that copies the child lists of the mix-ins.
Static Public Attributes inherited from RndTransformable
static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndDrawable
static int sRev
 The format version Save() writes and Load() accepts.

Additional Inherited Members

Protected Member Functions inherited from RndAnimatable
void ReleaseObjects ()
 Drop the references on the children without emptying the list, and delete the filters.
void AcquireAnimRefs ()
 Take a reference on every child.
Protected Member Functions inherited from RndTransformable
void ReleaseTransRefs ()
 Drop the reference on every child without emptying the list.
void AcquireTransRefs ()
 Take a reference on every child.
Protected Member Functions inherited from RndDrawable
void ReleaseDrawRefs ()
 Drop the reference on every child without emptying the list.
void AcquireDrawRefs ()
 Take a reference on every child.
Protected Attributes inherited from RndAnimatable
std::list< RndAnimatable * > mAnims
std::list< Filter * > mFilters
float mFrame
float mFilteredFrame
Protected Attributes inherited from RndObject
std::list< RndObject * > mRefs
String mName
Protected Attributes inherited from RndTransformable
std::list< RndTransformable * > mTransList
Transform mLocalXfm
Transform mWorldXfm
Vector3 mOrigin
int mDirty
int mBillboard
Protected Attributes inherited from RndDrawable
int mShowing

Detailed Description

Emitter of instances that each follow a path animation from the frame they are born at.

The RTTI includes the class name and records RndAnimatable, RndTransformable, and RndDrawable as bases. Instances are born at a random interval between mRateGenLow and mRateGenHigh frames, each with a random rotation within mPathVarMax degrees and a random scale, and live as long as the path lasts. Each instance draws one subject, the first of mView, mMesh, mMultiMesh, and mParticleSys that is set, at the transform the path gives for the instance's age.

Member Typedef Documentation

◆ DrawInstanceFunc

typedef void(RndGenerator::* RndGenerator::DrawInstanceFunc) (float fAge, const Transform &xfm)

A routine that draws or places one instance's subject at a transform.

Constructor & Destructor Documentation

◆ RndGenerator()

RndGenerator::RndGenerator ( const char * pszName)
explicit

Construct a generator without a path or a subject that generates every 100 frames.

Parameters
pszNameThe registry key.
Ghidra address:
NTSC-U/C: 0x00226980
Ghidra address:
PAL: 0x0022f730

◆ ~RndGenerator()

RndGenerator::~RndGenerator ( )
override

Drop the references and the instances.

Ghidra address:
NTSC-U/C: 0x00382708
Ghidra address:
PAL: 0x003f0e10

Member Function Documentation

◆ operator new()

void * RndGenerator::operator new ( size_t nSize)
inline

Allocate a generator, billed to the class name.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.

◆ operator delete()

void RndGenerator::operator delete ( void * pBlock)
inline

Release a generator.

Parameters
pBlockThe block.

◆ SetFrameSelf()

int RndGenerator::SetFrameSelf ( float fFrame)
overridevirtual

Drop the instances whose path has run out, animate the view, and generate the instances due by a frame.

The first call only records the frame. A negative mRateGenLow generates nothing.

Parameters
fFrameThe frame.
Returns
1.
Ghidra address:
NTSC-U/C: 0x002287e8
Ghidra address:
PAL: 0x00231558

Reimplemented from RndAnimatable.

◆ ListDrawObjects()

void RndGenerator::ListDrawObjects ( std::list< RndObject * > & objects)
overridevirtual

Add the generator and the objects of the subjects to a list.

Parameters
objectsThe list to add to.
Ghidra address:
NTSC-U/C: 0x00228a40
Ghidra address:
PAL: 0x002317b0

Reimplemented from RndDrawable.

◆ ListDrawables()

void RndGenerator::ListDrawables ( std::list< RndDrawable * > & drawables)
overridevirtual

Add the generator, when a subject of an instance would draw, then the children, to a list.

Only a generator without a path, or with a path and no subject, tests its instances. The subject is moved to each instance in turn until one would draw.

Parameters
drawablesThe list to add to.
Ghidra address:
NTSC-U/C: 0x00228b60
Ghidra address:
PAL: 0x002318d0

Reimplemented from RndDrawable.

◆ DrawShowing()

int RndGenerator::DrawShowing ( )
overridevirtual

Draw the subject at each instance.

A multimesh receives one transform for each instance and draws once, and a particle system moves one particle to each instance and draws once.

Returns
1.
Ghidra address:
NTSC-U/C: 0x002290f8
Ghidra address:
PAL: 0x00231e68

Reimplemented from RndDrawable.

◆ DumpText()

void RndGenerator::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the generator and its bases.

The instances and the path frames are listed at a dump level of 2 and above.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00227398
Ghidra address:
PAL: 0x00230148

Reimplemented from RndAnimatable.

◆ Save()

void RndGenerator::Save ( BinStream & stream)
overridevirtual

Write the generator and its bases.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x002279c0
Ghidra address:
PAL: 0x00230770

Reimplemented from RndAnimatable.

◆ Replace()

void RndGenerator::Replace ( RndObject * pFrom,
RndObject * pTo )
overridevirtual

Replace a referenced object with another in the bases and the subjects.

Parameters
pFromThe object being replaced.
pToThe replacement, or null.
Ghidra address:
NTSC-U/C: 0x00226fa0
Ghidra address:
PAL: 0x0022fd50

Reimplemented from RndAnimatable.

◆ ClassName()

const char * RndGenerator::ClassName ( ) const
inlineoverridevirtual

Report the class name.

Returns
sClassName.
Ghidra address:
NTSC-U/C: 0x00382b68
Ghidra address:
PAL: 0x003f1270

Implements RndObject.

◆ Copy()

void RndGenerator::Copy ( const RndObject * pSource,
int nFlags )
overridevirtual

Copy another generator and its bases.

Parameters
pSourceThe generator to copy from.
nFlagsThe set of fields to copy.
Ghidra address:
NTSC-U/C: 0x00227700
Ghidra address:
PAL: 0x002304b0

Reimplemented from RndAnimatable.

◆ Load()

void RndGenerator::Load ( BinStream & stream)
overridevirtual

Read what Save() wrote, or an earlier version of it.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x00227cb8
Ghidra address:
PAL: 0x00230a50

Reimplemented from RndAnimatable.

◆ ReleaseRefs()

void RndGenerator::ReleaseRefs ( )

Drop the references on the subjects, the path, and the birth camera, and the instances.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00227850
Ghidra address:
PAL: 0x00230600

◆ AcquireRefs()

void RndGenerator::AcquireRefs ( )

Take the references on the subjects, the path, and the birth camera, then give each instance a particle.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00227908
Ghidra address:
PAL: 0x002306b8

◆ ResetParticles()

void RndGenerator::ResetParticles ( )

Free the particles of the particle system, then allocate one for each instance.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00228368
Ghidra address:
PAL: 0x002310d8

◆ SetPath()

void RndGenerator::SetPath ( RndTransAnim * pPath,
float fStart,
float fEnd )

Set the path and the frames of it the instances play.

A frame of -1 takes the start or the end of the path.

Parameters
pPathThe path, or null.
fStartThe first frame.
fEndThe last frame.
Ghidra address:
NTSC-U/C: 0x00228420
Ghidra address:
PAL: 0x00231190

◆ Generate()

void RndGenerator::Generate ( float fFrame)

Add an instance born at a frame, unless the birth camera rules it out.

The birth camera rules out an instance behind it when mBirthFrontOnly is set, and one further than mBirthSquareDist when mBirthCheckDist is set.

Parameters
fFrameThe frame.
Ghidra address:
NTSC-U/C: 0x00228520
Ghidra address:
PAL: 0x00231290

◆ DrawView()

void RndGenerator::DrawView ( float fAge,
const Transform & xfm )

Move the view to a transform, animate it to an age when mAnimateFromStart is set, and draw it.

The name is inferred.

Parameters
fAgeThe age of the instance.
xfmThe transform.
Ghidra address:
NTSC-U/C: 0x00228f70
Ghidra address:
PAL: 0x00231ce0

◆ DrawMesh()

void RndGenerator::DrawMesh ( float fAge,
const Transform & xfm )

Move the mesh to a transform and draw it.

The name is inferred.

Parameters
fAgeThe age of the instance.
xfmThe transform.
Ghidra address:
NTSC-U/C: 0x00229008
Ghidra address:
PAL: 0x00231d78

◆ SetMultiMeshXfm()

void RndGenerator::SetMultiMeshXfm ( float fAge,
const Transform & xfm )

Store a transform in the next transform of the multimesh.

The name is inferred.

Parameters
fAgeThe age of the instance.
xfmThe transform.
Ghidra address:
NTSC-U/C: 0x00229088
Ghidra address:
PAL: 0x00231df8

◆ SetParticlePos()

void RndGenerator::SetParticlePos ( float fAge,
const Transform & xfm )

Move the next particle to the position of a transform.

The name is inferred.

Parameters
fAgeThe age of the instance.
xfmThe transform.
Ghidra address:
NTSC-U/C: 0x002290d0
Ghidra address:
PAL: 0x00231e40

◆ New()

RndObject * RndGenerator::New ( const char * pszName)
inlinestatic

Create a generator.

Parameters
pszNameThe registry key.
Returns
The generator.
Ghidra address:
NTSC-U/C: 0x00382b78
Ghidra address:
PAL: 0x003f1280

◆ GetPathVarMax()

const float * RndGenerator::GetPathVarMax ( ) const
inline
Returns
The most rotation about each axis, in degrees.

◆ SetPathVarMax()

void RndGenerator::SetPathVarMax ( int nIndex,
float fDegrees )
inline

Set one entry of the most rotation about each axis, in degrees.

Parameters
nIndexThe entry.
fDegreesThe value.

◆ GetRateGenHigh()

float RndGenerator::GetRateGenHigh ( ) const
inline
Returns
The most number of frames between births.

◆ SetRateGenHigh()

void RndGenerator::SetRateGenHigh ( float fRateGenHigh)
inline
Parameters
fRateGenHighThe most number of frames between births.

◆ GetRateGenLow()

float RndGenerator::GetRateGenLow ( ) const
inline
Returns
The least number of frames between births.

◆ SetRateGenLow()

void RndGenerator::SetRateGenLow ( float fRateGenLow)
inline
Parameters
fRateGenLowThe least number of frames between births.

◆ GetScaleGenHigh()

float RndGenerator::GetScaleGenHigh ( ) const
inline
Returns
The most scale of an instance.

◆ SetScaleGenHigh()

void RndGenerator::SetScaleGenHigh ( float fScaleGenHigh)
inline
Parameters
fScaleGenHighThe most scale of an instance.

◆ GetScaleGenLow()

float RndGenerator::GetScaleGenLow ( ) const
inline
Returns
The least scale of an instance.

◆ SetScaleGenLow()

void RndGenerator::SetScaleGenLow ( float fScaleGenLow)
inline
Parameters
fScaleGenLowThe least scale of an instance.

Member Data Documentation

◆ sClassName

const char* RndGenerator::sClassName
static

The class name a .rnd file writes, Generator.

Ghidra address:
NTSC-U/C: 0x003b09c0
Ghidra address:
PAL: 0x0042f858

◆ sRev

int RndGenerator::sRev
static

The format version Save() writes and Load() accepts.

Ghidra address:
NTSC-U/C: 0x003b09c4

The documentation for this class was generated from the following file: