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

Mix-in for an object with a local transform and a world transform derived from its parent's. More...

#include <rndtransformable.h>

Inheritance diagram for RndTransformable:
Collaboration diagram for RndTransformable:

Public Types

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

 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 RndObject
 RndObject (const char *pszName)
 Construct an object and register it under a name.
virtual ~RndObject ()
 Notify every referrer, then erase the registration.
virtual const char * ClassName () const =0
 Report the name of the object's most derived class.
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 void CollectChildren (std::list< RndObject * > &objects, RndTransformable *pTransformable)
 Append every transform descendant of a transformable, depth first, each before its descendants.

Static Public Attributes

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 ReleaseTransRefs ()
 Drop the reference on every child without emptying the list.
void AcquireTransRefs ()
 Take a reference on every child.

Protected Attributes

std::list< RndTransformable * > mTransList
Transform mLocalXfm
Transform mWorldXfm
Vector3 mOrigin
int mDirty
int mBillboard
Protected Attributes inherited from RndObject
std::list< RndObject * > mRefs
String mName

Detailed Description

Mix-in for an object with a local transform and a world transform derived from its parent's.

The RTTI includes the class name and records RndObject as a virtual base. Every entry of mTransList registers this object as a referrer through RndObject::AddRef().

Member Enumeration Documentation

◆ Billboard

How the world transform turns to face the current camera.

Enumerator
kBillboardNone 

No billboarding.

kBillboardX 

Face the camera about x.

kBillboardY 

Face the camera about y.

kBillboardZ 

Face the camera about z.

kBillboardXZ 

Face the camera about x and z.

kBillboardXYZ 

Face the camera about all three axes.

kBillboardSimpleXYZ 

Take the camera's orientation.

kBillboardLocalRotate 

Keep the local rotation and move with the parent.

kBillboardScale 

Flag that preserves the scale of the world transform.

kBillboardScaleX 

kBillboardX with the scale preserved.

kBillboardScaleY 

kBillboardY with the scale preserved.

kBillboardScaleZ 

kBillboardZ with the scale preserved.

kBillboardScaleXZ 

kBillboardXZ with the scale preserved.

kBillboardScaleXYZ 

kBillboardXYZ with the scale preserved.

kBillboardScaleSimpleXYZ 

kBillboardSimpleXYZ with the scale preserved.

Constructor & Destructor Documentation

◆ RndTransformable()

RndTransformable::RndTransformable ( )

Construct a transformable with identity transforms, no origin offset, and no billboard.

The world transform starts dirty. The constructor has no out-of-line copy.

◆ ~RndTransformable()

RndTransformable::~RndTransformable ( )
override

Drop the references on the children.

Ghidra address:
NTSC-U/C: 0x00391e90
Ghidra address:
PAL: 0x00400598

Member Function Documentation

◆ SetBillboard()

virtual void RndTransformable::SetBillboard ( int nBillboard)
virtual

Set the billboard mode.

Parameters
nBillboardA Billboard.
Ghidra address:
NTSC-U/C: 0x00243c28
Ghidra address:
PAL: 0x0024c700

Reimplemented in RndText.

◆ UpdateWorldXfm()

virtual int RndTransformable::UpdateWorldXfm ( RndTransformable * pParent,
int bForce )
virtual

Recompute the world transform when it, or the parent's, changed, and then the children's.

Without a billboard, the origin is subtracted before the transform applies.

Parameters
pParentThe parent, or null for a root.
bForceNon-zero to recompute even when nothing changed.
Returns
Non-zero when the world transform was recomputed.
Ghidra address:
NTSC-U/C: 0x00243f98
Ghidra address:
PAL: 0x0024ca70

Reimplemented in RndArena, RndCam, RndText, and RndView.

◆ DumpText()

void RndTransformable::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the transformable.

Nothing is written unless the dump level of the stream is above 0.

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

Reimplemented from RndObject.

Reimplemented in RndView.

◆ Save()

void RndTransformable::Save ( BinStream & stream)
overridevirtual

Write the transforms, the names of the children, the billboard mode, and the origin.

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

Implements RndObject.

Reimplemented in RndView.

◆ Replace()

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

Replace a child with another object.

A replacement that is not a transformable, or null, removes the child.

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

Implements RndObject.

Reimplemented in RndView.

◆ Copy()

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

Copy the transforms, the billboard mode, the origin, and the children when the flags request them.

Parameters
pSourceThe transformable to copy from.
nFlagsThe set of fields to copy. RndObject::kCopyChildLists copies the children.
Ghidra address:
NTSC-U/C: 0x002448c8
Ghidra address:
PAL: 0x0024d3a0

Implements RndObject.

Reimplemented in RndView.

◆ Load()

void RndTransformable::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: 0x00244e18
Ghidra address:
PAL: 0x0024d8f0

Implements RndObject.

Reimplemented in RndView.

◆ SetOrigin()

void RndTransformable::SetOrigin ( const Vector3 & origin)

Set the point the world transform subtracts first when there is no billboard.

Parameters
originThe point.
Ghidra address:
NTSC-U/C: 0x00243c38
Ghidra address:
PAL: 0x0024c710

◆ Parent()

RndTransformable * RndTransformable::Parent ( )

Find the transformable whose children include this object.

Returns
The parent, or null.
Ghidra address:
NTSC-U/C: 0x00243c50
Ghidra address:
PAL: 0x0024c728

◆ AddTrans()

bool RndTransformable::AddTrans ( RndTransformable * pTrans)

Append a child and mark its world transform dirty.

A transformable already among the children is not added again.

Parameters
pTransThe new child.
Returns
Whether the child was added.
Ghidra address:
NTSC-U/C: 0x00243d18
Ghidra address:
PAL: 0x0024c7f0

◆ RemoveTrans()

void RndTransformable::RemoveTrans ( RndTransformable * pTrans)

Remove a child.

Parameters
pTransThe child.
Ghidra address:
NTSC-U/C: 0x00243e20
Ghidra address:
PAL: 0x0024c8f8

◆ ClearTrans()

void RndTransformable::ClearTrans ( )

Remove every child.

Ghidra address:
NTSC-U/C: 0x00243ef0
Ghidra address:
PAL: 0x0024c9c8

◆ BillboardXfm()

const Transform & RndTransformable::BillboardXfm ( )

Report the world transform turned to face the current camera.

Without a billboard the world transform itself is reported. Otherwise the result is built in one shared transform that the next call replaces.

Returns
The transform.
Ghidra address:
NTSC-U/C: 0x00244148
Ghidra address:
PAL: 0x0024cc20

◆ CollectChildren()

void RndTransformable::CollectChildren ( std::list< RndObject * > & objects,
RndTransformable * pTransformable )
inlinestatic

Append every transform descendant of a transformable, depth first, each before its descendants.

Each unit that uses the inline routine emits a copy. The first address is the copy of RndManager, and the second the copy of UIList.

Parameters
objectsThe list to append to.
pTransformableThe transformable to start from, or null.
Ghidra address:
NTSC-U/C: 0x002381b0
Ghidra address:
PAL: 0x00240d30
Ghidra address:
NTSC-U/C: 0x00205730
Ghidra address:
PAL: 0x0020e4e8

◆ GetLocalXfm() [1/2]

const Transform & RndTransformable::GetLocalXfm ( ) const
inline
Returns
The transform relative to the parent.

◆ GetLocalXfm() [2/2]

Transform & RndTransformable::GetLocalXfm ( )
inline
Returns
The transform relative to the parent, for writing.

◆ SetLocalXfm()

void RndTransformable::SetLocalXfm ( const Transform & xfm)
inline
Parameters
xfmThe transform relative to the parent.

◆ GetWorldXfm() [1/2]

const Transform & RndTransformable::GetWorldXfm ( ) const
inline
Returns
The transform relative to the world.

◆ GetWorldXfm() [2/2]

Transform & RndTransformable::GetWorldXfm ( )
inline
Returns
The transform relative to the world, for writing.

◆ GetDirty()

int RndTransformable::GetDirty ( ) const
inline
Returns
Non-zero when mWorldXfm is out of date.

◆ SetDirty()

void RndTransformable::SetDirty ( int nDirty)
inline
Parameters
nDirtyNon-zero when mWorldXfm is out of date.

◆ GetTransList()

const std::list< RndTransformable * > & RndTransformable::GetTransList ( ) const
inline
Returns
The children. Each follows this object.

◆ ReleaseTransRefs()

void RndTransformable::ReleaseTransRefs ( )
protected

Drop the reference on every child without emptying the list.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00244d10
Ghidra address:
PAL: 0x0024d7e8

◆ AcquireTransRefs()

void RndTransformable::AcquireTransRefs ( )
protected

Take a reference on every child.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00244d90
Ghidra address:
PAL: 0x0024d868

Member Data Documentation

◆ sRev

int RndTransformable::sRev
static

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

Ghidra address:
NTSC-U/C: 0x003b0a58
Ghidra address:
PAL: 0x0042f8f0

◆ mTransList

std::list<RndTransformable *> RndTransformable::mTransList
protected

The children. Each follows this object.

◆ mLocalXfm

Transform RndTransformable::mLocalXfm
protected

The transform relative to the parent.

◆ mWorldXfm

Transform RndTransformable::mWorldXfm
protected

The transform relative to the world.

◆ mOrigin

Vector3 RndTransformable::mOrigin
protected

The point the world transform subtracts.

◆ mDirty

int RndTransformable::mDirty
protected

Non-zero when mWorldXfm is out of date.

◆ mBillboard

int RndTransformable::mBillboard
protected

The Billboard mode.


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