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

Animation of a transformable's local transform by rotation, translation, and scale keys. More...

#include <rndtransanim.h>

Inheritance diagram for RndTransAnim:
Collaboration diagram for RndTransAnim:

Public Types

enum  Interp { kInterpLinear = 0 , kInterpSpline = 1 }
 How the translation and scale keys interpolate. More...
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 Member Functions

 RndTransAnim (const char *pszName)
 Construct an animation of nothing with spline translation, linear scale, and no keys.
 ~RndTransAnim () override
 Drop the references on the target and the frames owner.
float EndFrame () override
 Report the last frame of any key.
void ListAnimObjects (std::list< RndObject * > &objects) override
 Add the target to a list, then the objects of the children.
int SetFrameSelf (float fFrame) override
 Apply a frame to the target's local transform.
virtual float StartFrame ()
 Report the first frame of any key.
void DumpText (PrnStream &stream) override
 Write a description of the animation and its bases.
void Save (BinStream &stream) override
 Write the animation and its bases.
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 bases.
void Load (BinStream &stream) override
 Read what Save() wrote, or an earlier version of it.
void SetTrans (RndTransformable *pTrans)
 Set the transformable the animation drives.
void SetFramesOwner (RndTransAnim *pOwner)
 Take the keys from another animation.
void MakeTransform (float fFrame, Transform &xfm, int bWhole)
 Build the transform at a frame.
float PathLength (float fStart, float fEnd)
 Measure the length of the translation path between two frames.
RndTransAnim * GetFramesOwner () const
const std::vector< Key< Quat > > & GetRotKeys () const
std::vector< Key< Quat > > & GetRotKeys ()
void SetRotKeys (const std::vector< Key< Quat > > &keys)
const std::vector< Key< Vector3 > > & GetScaleKeys () const
std::vector< Key< Vector3 > > & GetScaleKeys ()
void SetScaleKeys (const std::vector< Key< Vector3 > > &keys)
RndTransformable * GetTrans () const
int GetTransInterp () const
void SetTransInterp (int nTransInterp)
const std::vector< Key< Vector3 > > & GetTransKeys () const
std::vector< Key< Vector3 > > & GetTransKeys ()
void SetTransKeys (const std::vector< Key< Vector3 > > &keys)
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)
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 ListDrawObjects (std::list< RndObject * > &objects)
 Add the objects the drawable uses to a list.
virtual void ListDrawables (std::list< RndDrawable * > &drawables)
 Add the drawables to draw this frame to a list.
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.
virtual int DrawShowing ()
 Draw the drawable alone.
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 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 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 constexpr int kCopyShareKeys = 0x100
 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, TransAnim.
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 RndDrawable
static int sRev
 The format version Save() writes and Load() accepts.

Protected Member Functions

void ReleaseRefs ()
 Drop the references on the target and the frames owner.
void AcquireRefs ()
 Take references on the target and the frames owner.
float SegmentLength (int nFrom, int nTo, float fStep, float fStart, float fEnd)
 Measure the translation path between two keys, from one position to another.
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 RndDrawable
void ReleaseDrawRefs ()
 Drop the reference on every child without emptying the list.
void AcquireDrawRefs ()
 Take a reference on every child.

Additional Inherited Members

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 RndDrawable
int mShowing

Detailed Description

Animation of a transformable's local transform by rotation, translation, and scale keys.

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

Member Enumeration Documentation

◆ Interp

How the translation and scale keys interpolate.

Enumerator
kInterpLinear 

Straight lines between keys.

kInterpSpline 

Hermite splines through the keys.

Constructor & Destructor Documentation

◆ RndTransAnim()

RndTransAnim::RndTransAnim ( const char * pszName)
explicit

Construct an animation of nothing with spline translation, linear scale, and no keys.

The animation is its own frames owner.

Parameters
pszNameThe registry key.
Ghidra address:
NTSC-U/C: 0x00392ec0
Ghidra address:
PAL: 0x004015c8

◆ ~RndTransAnim()

RndTransAnim::~RndTransAnim ( )
override

Drop the references on the target and the frames owner.

Ghidra address:
NTSC-U/C: 0x00392a18
Ghidra address:
PAL: 0x00401120

Member Function Documentation

◆ EndFrame()

float RndTransAnim::EndFrame ( )
overridevirtual

Report the last frame of any key.

Returns
The frame.
Ghidra address:
NTSC-U/C: 0x002464c0
Ghidra address:
PAL: 0x0024ef60

Reimplemented from RndAnimatable.

◆ ListAnimObjects()

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

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

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

Reimplemented from RndAnimatable.

◆ SetFrameSelf()

int RndTransAnim::SetFrameSelf ( float fFrame)
overridevirtual

Apply a frame to the target's local transform.

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

Reimplemented from RndAnimatable.

◆ StartFrame()

virtual float RndTransAnim::StartFrame ( )
virtual

Report the first frame of any key.

The name is inferred.

Returns
The frame.
Ghidra address:
NTSC-U/C: 0x00246578
Ghidra address:
PAL: 0x0024f018

◆ DumpText()

void RndTransAnim::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the animation and its bases.

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

Reimplemented from RndAnimatable.

◆ Save()

void RndTransAnim::Save ( BinStream & stream)
overridevirtual

Write the animation and its bases.

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

Reimplemented from RndAnimatable.

◆ Replace()

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

Replace a referenced object with another.

A frames owner replaced by null becomes the animation itself.

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

Reimplemented from RndAnimatable.

◆ ClassName()

const char * RndTransAnim::ClassName ( ) const
inlineoverridevirtual

Report the class name.

Returns
sClassName.
Ghidra address:
NTSC-U/C: 0x00392e68
Ghidra address:
PAL: 0x00401570

Implements RndObject.

◆ Copy()

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

Copy another animation and its bases.

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

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

Reimplemented from RndAnimatable.

◆ Load()

void RndTransAnim::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: 0x00245ae0
Ghidra address:
PAL: 0x0024e598

Reimplemented from RndAnimatable.

◆ SetTrans()

void RndTransAnim::SetTrans ( RndTransformable * pTrans)

Set the transformable the animation drives.

Parameters
pTransThe target, or null.
Ghidra address:
NTSC-U/C: 0x002454c0
Ghidra address:
PAL: 0x0024df90

◆ SetFramesOwner()

void RndTransAnim::SetFramesOwner ( RndTransAnim * pOwner)

Take the keys from another animation.

Parameters
pOwnerThe animation that has the keys, or null.
Ghidra address:
NTSC-U/C: 0x00245518
Ghidra address:
PAL: 0x0024dfe8

◆ MakeTransform()

void RndTransAnim::MakeTransform ( float fFrame,
Transform & xfm,
int bWhole )

Build the transform at a frame.

A repeating translation adds the distance of each completed pass. A path-following animation turns the basis along the path. A channel without keys leaves its part of the transform unchanged, or sets it to the identity when asked to.

Parameters
fFrameThe frame.
xfmReceives the transform.
bWholeNon-zero to set the parts that have no keys to the identity.
Ghidra address:
NTSC-U/C: 0x00246ee0
Ghidra address:
PAL: 0x0024f980

◆ PathLength()

float RndTransAnim::PathLength ( float fStart,
float fEnd )

Measure the length of the translation path between two frames.

The name is inferred.

Parameters
fStartThe first frame.
fEndThe last frame.
Returns
The length, or 0 with fewer than two translation keys.
Ghidra address:
NTSC-U/C: 0x00247630
Ghidra address:
PAL: 0x002500d0

◆ New()

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

Create an animation.

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

◆ GetFramesOwner()

RndTransAnim * RndTransAnim::GetFramesOwner ( ) const
inline
Returns
The animation that has the keys.

◆ GetRotKeys() [1/2]

const std::vector< Key< Quat > > & RndTransAnim::GetRotKeys ( ) const
inline
Returns
The rotation keys.

◆ GetRotKeys() [2/2]

std::vector< Key< Quat > > & RndTransAnim::GetRotKeys ( )
inline
Returns
The rotation keys, for writing.

◆ SetRotKeys()

void RndTransAnim::SetRotKeys ( const std::vector< Key< Quat > > & keys)
inline
Parameters
keysThe rotation keys.

◆ GetScaleKeys() [1/2]

const std::vector< Key< Vector3 > > & RndTransAnim::GetScaleKeys ( ) const
inline
Returns
The scale keys.

◆ GetScaleKeys() [2/2]

std::vector< Key< Vector3 > > & RndTransAnim::GetScaleKeys ( )
inline
Returns
The scale keys, for writing.

◆ SetScaleKeys()

void RndTransAnim::SetScaleKeys ( const std::vector< Key< Vector3 > > & keys)
inline
Parameters
keysThe scale keys.

◆ GetTrans()

RndTransformable * RndTransAnim::GetTrans ( ) const
inline
Returns
The transformable the animation drives.

◆ GetTransInterp()

int RndTransAnim::GetTransInterp ( ) const
inline
Returns
The Interp of the translation keys.

◆ SetTransInterp()

void RndTransAnim::SetTransInterp ( int nTransInterp)
inline
Parameters
nTransInterpThe Interp of the translation keys.

◆ GetTransKeys() [1/2]

const std::vector< Key< Vector3 > > & RndTransAnim::GetTransKeys ( ) const
inline
Returns
The translation keys.

◆ GetTransKeys() [2/2]

std::vector< Key< Vector3 > > & RndTransAnim::GetTransKeys ( )
inline
Returns
The translation keys, for writing.

◆ SetTransKeys()

void RndTransAnim::SetTransKeys ( const std::vector< Key< Vector3 > > & keys)
inline
Parameters
keysThe translation keys.

◆ ReleaseRefs()

void RndTransAnim::ReleaseRefs ( )
protected

Drop the references on the target and the frames owner.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00245a40
Ghidra address:
PAL: 0x0024e4f8

◆ AcquireRefs()

void RndTransAnim::AcquireRefs ( )
protected

Take references on the target and the frames owner.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00245a90
Ghidra address:
PAL: 0x0024e548

◆ SegmentLength()

float RndTransAnim::SegmentLength ( int nFrom,
int nTo,
float fStep,
float fStart,
float fEnd )
protected

Measure the translation path between two keys, from one position to another.

A linear path is measured as the straight distance between the keys whatever the positions. The name is inferred.

Parameters
nFromThe first key.
nToThe second key.
fStepThe step a spline path is sampled at.
fStartThe position to start at, from 0 to 1.
fEndThe position to stop at, from 0 to 1.
Returns
The length.
Ghidra address:
NTSC-U/C: 0x002474a8
Ghidra address:
PAL: 0x0024ff48

Member Data Documentation

◆ kCopyShareKeys

int RndTransAnim::kCopyShareKeys = 0x100
staticconstexpr

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

◆ sClassName

const char* RndTransAnim::sClassName
static

The class name a .rnd file writes, TransAnim.

Ghidra address:
NTSC-U/C: 0x003b0a5c
Ghidra address:
PAL: 0x0042f8f4

◆ sRev

int RndTransAnim::sRev
static

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

Ghidra address:
NTSC-U/C: 0x003b0a60

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