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

Animation of a material's colours, alpha, and texture stages by keys. More...

#include <rndmatanim.h>

Inheritance diagram for RndMatAnim:
Collaboration diagram for RndMatAnim:

Classes

class  Stage
 The keys of one texture stage. More...

Public Member Functions

 RndMatAnim (const char *pszName)
 Construct an animation of nothing without keys.
 ~RndMatAnim () override
 Drop the references on the material, the keys owner, and the textures.
float EndFrame () override
 Report the last frame of any key.
void ListAnimObjects (std::list< RndObject * > &objects) override
 Add the material to a list, then the objects of the children.
int SetFrameSelf (float fFrame) override
 Apply a frame to the material.
void DumpText (PrnStream &stream) override
 Write a description of the animation and its base.
void Save (BinStream &stream) override
 Write the animation and its base.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a referenced object with another.
const char * ClassName () const override
 Report the class name.
void Copy (const RndObject *pSource, int nFlags) override
 Copy another animation and its base.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void SetMat (RndMat *pMat)
 Set the material the animation drives.
void ResizeStages (int nStages)
 Resize the stages of the keys owner.
const std::vector< Key< float > > & GetAlphaKeys () const
std::vector< Key< float > > & GetAlphaKeys ()
const std::vector< Key< Color > > & GetBaseKeys () const
std::vector< Key< Color > > & GetBaseKeys ()
RndMatAnim * GetKeysOwner () const
const std::vector< Stage > & GetStages () const
std::vector< Stage > & GetStages ()
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.
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)

Static Public Member Functions

static RndObject * New (const char *pszName)
 Create an animation.
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 Attributes

static constexpr int kCopyShareKeys = 4
 The bit of the Copy() flags that shares the source's keys rather than copying them.
static const char * sClassName
 The class name a .rnd file writes, MatAnim.
static int sRev
 The format version Save() writes and Load() accepts.
static int sLoadRev
 The version Load() read last, which Stage::Load() reads by.
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.

Protected Member Functions

void ReleaseRefs ()
 Drop the references on the material, the keys owner, and the textures of the stages.
void AcquireRefs ()
 Take references on the material, the keys owner, and the textures of the stages.
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.

Additional Inherited Members

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...
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

Detailed Description

Animation of a material's colours, alpha, and texture stages by keys.

The RTTI includes the class name and records RndAnimatable as the one base. The keys may be shared, in which case mKeysOwner identifies the animation that has them.

Constructor & Destructor Documentation

◆ RndMatAnim()

RndMatAnim::RndMatAnim ( const char * pszName)
explicit

Construct an animation of nothing without keys.

The animation is its own keys owner. The binary expands the constructor inline in New().

Parameters
pszNameThe registry key.

◆ ~RndMatAnim()

RndMatAnim::~RndMatAnim ( )
override

Drop the references on the material, the keys owner, and the textures.

Ghidra address:
NTSC-U/C: 0x003886b0
Ghidra address:
PAL: 0x003f6db8

Member Function Documentation

◆ EndFrame()

float RndMatAnim::EndFrame ( )
overridevirtual

Report the last frame of any key.

Returns
The frame.
Ghidra address:
NTSC-U/C: 0x00230a68
Ghidra address:
PAL: 0x00239630

Reimplemented from RndAnimatable.

◆ ListAnimObjects()

void RndMatAnim::ListAnimObjects ( std::list< RndObject * > & objects)
overridevirtual

Add the material to a list, then the objects of the children.

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

Reimplemented from RndAnimatable.

◆ SetFrameSelf()

int RndMatAnim::SetFrameSelf ( float fFrame)
overridevirtual

Apply a frame to the material.

Each channel with keys sets its part of the material. A stage scale multiplies the basis of the stage transform, which the rotation keys alone reset.

Parameters
fFrameThe frame.
Returns
1, to pass the frame on to the children.
Ghidra address:
NTSC-U/C: 0x00230cd8
Ghidra address:
PAL: 0x002398a0

Reimplemented from RndAnimatable.

◆ DumpText()

void RndMatAnim::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the animation and its base.

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

Reimplemented from RndAnimatable.

◆ Save()

void RndMatAnim::Save ( BinStream & stream)
overridevirtual

Write the animation and its base.

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

Reimplemented from RndAnimatable.

◆ Replace()

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

Replace a referenced object with another.

A keys owner replaced by null becomes the animation itself. A texture key whose texture becomes null, or was null, is erased.

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

Reimplemented from RndAnimatable.

◆ ClassName()

const char * RndMatAnim::ClassName ( ) const
inlineoverridevirtual

Report the class name.

Returns
sClassName.
Ghidra address:
NTSC-U/C: 0x00388ae8
Ghidra address:
PAL: 0x003f71f0

Implements RndObject.

◆ Copy()

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

Copy another animation and its base.

The keys are copied when the source has its own and the flags do not include kCopyShareKeys. Otherwise the source's keys owner becomes this one's.

Parameters
pSourceThe animation to copy from.
nFlagsThe set of fields to copy.
Ghidra address:
NTSC-U/C: 0x00230010
Ghidra address:
PAL: 0x00238bd8

Reimplemented from RndAnimatable.

◆ Load()

void RndMatAnim::Load ( BinStream & stream)
overridevirtual

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

An early version stores ambient colour keys, which become the base colour keys when there are none.

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

Reimplemented from RndAnimatable.

◆ SetMat()

void RndMatAnim::SetMat ( RndMat * pMat)

Set the material the animation drives.

Parameters
pMatThe material, or null.
Ghidra address:
NTSC-U/C: 0x0022f610
Ghidra address:
PAL: 0x002381d8

◆ ResizeStages()

void RndMatAnim::ResizeStages ( int nStages)

Resize the stages of the keys owner.

Removed stages drop their texture references. Every remaining stage of the keys owner then records this animation as its own. The name is inferred.

Parameters
nStagesThe stage count.
Ghidra address:
NTSC-U/C: 0x00230110
Ghidra address:
PAL: 0x00238cd8

◆ New()

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

Create an animation.

Parameters
pszNameThe registry key.
Returns
The animation.
Ghidra address:
NTSC-U/C: 0x00388b00
Ghidra address:
PAL: 0x003f7208

◆ GetAlphaKeys() [1/2]

const std::vector< Key< float > > & RndMatAnim::GetAlphaKeys ( ) const
inline
Returns
The alpha keys.

◆ GetAlphaKeys() [2/2]

std::vector< Key< float > > & RndMatAnim::GetAlphaKeys ( )
inline
Returns
The alpha keys, for writing.

◆ GetBaseKeys() [1/2]

const std::vector< Key< Color > > & RndMatAnim::GetBaseKeys ( ) const
inline
Returns
The base colour keys.

◆ GetBaseKeys() [2/2]

std::vector< Key< Color > > & RndMatAnim::GetBaseKeys ( )
inline
Returns
The base colour keys, for writing.

◆ GetKeysOwner()

RndMatAnim * RndMatAnim::GetKeysOwner ( ) const
inline
Returns
The animation that has the keys.

◆ GetStages() [1/2]

const std::vector< Stage > & RndMatAnim::GetStages ( ) const
inline
Returns
The keys of each texture stage.

◆ GetStages() [2/2]

std::vector< Stage > & RndMatAnim::GetStages ( )
inline
Returns
The keys of each texture stage, for writing.

◆ ReleaseRefs()

void RndMatAnim::ReleaseRefs ( )
protected

Drop the references on the material, the keys owner, and the textures of the stages.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x0022fb78
Ghidra address:
PAL: 0x00238740

◆ AcquireRefs()

void RndMatAnim::AcquireRefs ( )
protected

Take references on the material, the keys owner, and the textures of the stages.

Each stage records this animation as its own first. The name is inferred.

Ghidra address:
NTSC-U/C: 0x0022fc48
Ghidra address:
PAL: 0x00238810

Member Data Documentation

◆ kCopyShareKeys

int RndMatAnim::kCopyShareKeys = 4
staticconstexpr

The bit of the Copy() flags that shares the source's keys rather than copying them.

◆ sClassName

const char* RndMatAnim::sClassName
static

The class name a .rnd file writes, MatAnim.

Ghidra address:
NTSC-U/C: 0x003b09e4
Ghidra address:
PAL: 0x0042f87c

◆ sRev

int RndMatAnim::sRev
static

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

Ghidra address:
NTSC-U/C: 0x003b09e8
Ghidra address:
PAL: 0x0042f880

◆ sLoadRev

int RndMatAnim::sLoadRev
static

The version Load() read last, which Stage::Load() reads by.

Ghidra address:
NTSC-U/C: 0x0043c68c

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