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

The model of one part of an avatar that an Avatar draws. More...

#include <avatarpart.h>

Inheritance diagram for AvatarPart:
Collaboration diagram for AvatarPart:

Classes

class  Callback
 The callback of the loads of the files of a part. More...

Public Member Functions

 AvatarPart (int nPart, int nParent, Avatar *pAvatar)
 Construct the model of a part from its entry of the parts array of the avatar entry of the "db" section.
virtual ~AvatarPart ()
 Delete the animations and the loaders of the model.
virtual void SetFrame (float fFrame)
 Pose the model at one frame of its animations.
virtual void SetFrames (float fFrom, float fTo, float fBlend)
 Pose the model between two frames of its animations.
virtual void Update ()
 Hang the model from the joint of its parent.
virtual void SetType (const char *pszType)
 Start loading the files of a choice of the part.
virtual bool Rebuild ()
 Build the meshes of the model once the files SetType() started loading have loaded.
virtual void ReleaseType ()
 Abandon the loads SetType() started and return to the choice the meshes show.
void Draw ()
 Draw the model, when it has a mesh.
void SetBlend (float fBlend)
 Set the alpha of the material of the model, when it has one.
void SetColor (const Color *pColor)
 Colour the model.
const char * GetType () const
const char * GetPendingType () const
void SetPendingType (const char *pszType)
 Set the choice SetType() last requested.
void SetMat (RndMat *pMat)
 Set the material of the model.
RndMesh * GetTransRoot ()
const std::vector< std::unique_ptr< RndTransAnim > > & GetAnims () const

Protected Member Functions

void SetMatTree (RndMesh *pMesh)
 Give a mesh and every mesh drawn under it the material of the model.
void FindJoint ()
 Find the joint mesh the model hangs from, avatar<n>_<trans_root>_joint.mesh.

Static Protected Member Functions

static void RotationAt (const RndTransAnim *pAnim, float fFrame, Quat &out)
 Interpolate the rotation keys of an animation at a frame.
static void BlendRotation (const RndTransAnim *pAnim, float fFrom, float fTo, float fBlend, Quat &out)
 Blend the rotations of an animation at two frames.
static void BlendTranslation (const RndTransAnim *pAnim, float fFrom, float fTo, float fBlend, Vector3 &out)
 Blend the translations of an animation at two frames.
static RndMesh * FindMesh (const char *pszName)
 Find a mesh by name.
static void ResetLocalXfm (RndMesh *pMesh)
 Set the local transform of a mesh to the identity and mark it out of date.

Protected Attributes

Callback mCallback
DataArray * mData
const char * mType
const char * mPendingType
Color mColor
RndMesh * mMesh
RndMesh * mTransRoot
RndMesh * mJoint
RndMat * mMat
std::vector< std::unique_ptr< RndTransAnim > > mAnims
 The animations of the bones the anims array lists, in its order, deleted with the part.
AvatarPart * mParent
Avatar * mAvatar
std::unique_ptr< RndLoader > mLoader
std::unique_ptr< RndLoader > mPendingLoader
 The load of the first file of mPendingType, or null.
std::unique_ptr< RndLoader > mPendingExtraLoader
 The load of the second file of mPendingType, or null.

Detailed Description

The model of one part of an avatar that an Avatar draws.

The RTTI includes the name. The object is 0x70 bytes, and the vptr follows the data members at +0x64. TorsoPart, InstrPart, and ArmPart derive from it. The part comes from its entry of the parts array of the avatar entry of the "db" section. Each choice of the types array of that entry names one or two .rnd files under rnd_dir, and the anims array names the meshes the shared fbase_*.tnm animations drive.

Constructor & Destructor Documentation

◆ AvatarPart()

AvatarPart::AvatarPart ( int nPart,
int nParent,
Avatar * pAvatar )

Construct the model of a part from its entry of the parts array of the avatar entry of the "db" section.

Each name of the anims array of the entry gets an animation avatar<n>_<name>.tnm that shares the keys of fbase_<name>.tnm. Only the pelvis and the arm bones retain the translation keys.

Parameters
nPartThe part, one of AvatarPartSet::Part.
nParentThe part the model hangs from, or AvatarPartSet::kNumParts for none.
pAvatarThe avatar the part belongs to.
Ghidra address:
NTSC-U/C: 0x00272cf8
Ghidra address:
PAL: 0x0027c818

◆ ~AvatarPart()

virtual AvatarPart::~AvatarPart ( )
virtual

Delete the animations and the loaders of the model.

Ghidra address:
NTSC-U/C: 0x00273108
Ghidra address:
PAL: 0x0027cc28

Member Function Documentation

◆ SetFrame()

virtual void AvatarPart::SetFrame ( float fFrame)
virtual

Pose the model at one frame of its animations.

The name is inferred.

Parameters
fFrameThe frame.
Ghidra address:
NTSC-U/C: 0x00273350
Ghidra address:
PAL: 0x0027ce70

Reimplemented in ArmPart.

◆ SetFrames()

virtual void AvatarPart::SetFrames ( float fFrom,
float fTo,
float fBlend )
virtual

Pose the model between two frames of its animations.

The translation of a bone without translation keys is not changed. The name is inferred.

Parameters
fFromThe frame blended from.
fToThe frame blended to.
fBlendThe weight of fTo, 0 to 1.
Ghidra address:
NTSC-U/C: 0x002733d0
Ghidra address:
PAL: 0x0027cef0

Reimplemented in ArmPart.

◆ Update()

virtual void AvatarPart::Update ( )
virtual

Hang the model from the joint of its parent.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00274358
Ghidra address:
PAL: 0x0027de78

Reimplemented in ArmPart.

◆ SetType()

virtual void AvatarPart::SetType ( const char * pszType)
virtual

Start loading the files of a choice of the part.

The loads replace any load in progress. The name is inferred.

Parameters
pszTypeThe choice, a symbol.
Ghidra address:
NTSC-U/C: 0x00272b48
Ghidra address:
PAL: 0x0027c668

Reimplemented in ArmPart, and InstrPart.

◆ Rebuild()

virtual bool AvatarPart::Rebuild ( )
virtual

Build the meshes of the model once the files SetType() started loading have loaded.

The name is inferred.

Returns
False while a file is still loading, otherwise true.
Ghidra address:
NTSC-U/C: 0x00273e70
Ghidra address:
PAL: 0x0027d990

Reimplemented in ArmPart, InstrPart, and TorsoPart.

◆ ReleaseType()

virtual void AvatarPart::ReleaseType ( )
virtual

Abandon the loads SetType() started and return to the choice the meshes show.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00272ca0
Ghidra address:
PAL: 0x0027c7c0

Reimplemented in InstrPart, and TorsoPart.

◆ Draw()

void AvatarPart::Draw ( )

Draw the model, when it has a mesh.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x002732f0
Ghidra address:
PAL: 0x0027ce10

◆ SetBlend()

void AvatarPart::SetBlend ( float fBlend)

Set the alpha of the material of the model, when it has one.

The name is inferred.

Parameters
fBlendThe alpha, 0 to 1.
Ghidra address:
NTSC-U/C: 0x00273318
Ghidra address:
PAL: 0x0027ce38

◆ SetColor()

void AvatarPart::SetColor ( const Color * pColor)

Colour the model.

The colour becomes the light colour of the material.

Parameters
pColorThe colour. Its alpha is ignored.
Ghidra address:
NTSC-U/C: 0x00274448
Ghidra address:
PAL: 0x0027df68

◆ GetType()

const char * AvatarPart::GetType ( ) const
inline
Returns
The choice the meshes show, or null before the first.

◆ GetPendingType()

const char * AvatarPart::GetPendingType ( ) const
inline
Returns
The choice SetType() last requested, or null.

◆ SetPendingType()

void AvatarPart::SetPendingType ( const char * pszType)
inline

Set the choice SetType() last requested.

Parameters
pszTypeThe choice, or null.

◆ SetMat()

void AvatarPart::SetMat ( RndMat * pMat)
inline

Set the material of the model.

Parameters
pMatThe material, or null. Borrowed.

◆ GetTransRoot()

RndMesh * AvatarPart::GetTransRoot ( )
inline
Returns
The trans_root mesh the model hangs from, or null. Borrowed.

◆ GetAnims()

const std::vector< std::unique_ptr< RndTransAnim > > & AvatarPart::GetAnims ( ) const
inline
Returns
The animations of the bones the anims array lists, in its order.

◆ SetMatTree()

void AvatarPart::SetMatTree ( RndMesh * pMesh)
protected

Give a mesh and every mesh drawn under it the material of the model.

The name is inferred.

Parameters
pMeshThe mesh.
Ghidra address:
NTSC-U/C: 0x00273238
Ghidra address:
PAL: 0x0027cd58

◆ FindJoint()

void AvatarPart::FindJoint ( )
protected

Find the joint mesh the model hangs from, avatar<n>_<trans_root>_joint.mesh.

The parent calls it once its meshes are built. The name is inferred.

Ghidra address:
NTSC-U/C: 0x002743a0
Ghidra address:
PAL: 0x0027dec0

◆ RotationAt()

void AvatarPart::RotationAt ( const RndTransAnim * pAnim,
float fFrame,
Quat & out )
inlinestaticprotected

Interpolate the rotation keys of an animation at a frame.

The binary expands the routine inline. Nothing is written for no keys.

Parameters
pAnimThe animation. Its frames owner has the keys.
fFrameThe frame.
outReceives the rotation.

◆ BlendRotation()

void AvatarPart::BlendRotation ( const RndTransAnim * pAnim,
float fFrom,
float fTo,
float fBlend,
Quat & out )
inlinestaticprotected

Blend the rotations of an animation at two frames.

The binary expands the routine inline.

Parameters
pAnimThe animation.
fFromThe frame blended from.
fToThe frame blended to.
fBlendThe weight of fTo.
outReceives the rotation.

◆ BlendTranslation()

void AvatarPart::BlendTranslation ( const RndTransAnim * pAnim,
float fFrom,
float fTo,
float fBlend,
Vector3 & out )
inlinestaticprotected

Blend the translations of an animation at two frames.

The binary expands the routine inline.

Parameters
pAnimThe animation.
fFromThe frame blended from.
fToThe frame blended to.
fBlendThe weight of fTo.
outReceives the translation.

◆ FindMesh()

RndMesh * AvatarPart::FindMesh ( const char * pszName)
inlinestaticprotected

Find a mesh by name.

The binary expands the routine inline.

Parameters
pszNameThe name.
Returns
The mesh, or null when no mesh has the name.

◆ ResetLocalXfm()

void AvatarPart::ResetLocalXfm ( RndMesh * pMesh)
inlinestaticprotected

Set the local transform of a mesh to the identity and mark it out of date.

The binary expands the routine inline.

Parameters
pMeshThe mesh.

Member Data Documentation

◆ mCallback

Callback AvatarPart::mCallback
protected

The callback of the loads of the part.

◆ mData

DataArray* AvatarPart::mData
protected

The entry of the part in the parts array. Borrowed.

◆ mType

const char* AvatarPart::mType
protected

The choice the meshes show, or null before the first.

◆ mPendingType

const char* AvatarPart::mPendingType
protected

The choice SetType() last requested, or null.

◆ mColor

Color AvatarPart::mColor
protected

The colour, opaque white until SetColor(). +0x20

◆ mMesh

RndMesh* AvatarPart::mMesh
protected

The draw_root mesh drawn, or null. Borrowed.

◆ mTransRoot

RndMesh* AvatarPart::mTransRoot
protected

The trans_root mesh the model hangs from, or null. Borrowed.

◆ mJoint

RndMesh* AvatarPart::mJoint
protected

The joint mesh of the parent the model hangs from, or null. Borrowed.

◆ mMat

RndMat* AvatarPart::mMat
protected

The material of the model, or null. Borrowed.

◆ mAnims

std::vector<std::unique_ptr<RndTransAnim> > AvatarPart::mAnims
protected

The animations of the bones the anims array lists, in its order, deleted with the part.

◆ mParent

AvatarPart* AvatarPart::mParent
protected

The part the model hangs from, or null. Borrowed.

◆ mAvatar

Avatar* AvatarPart::mAvatar
protected

The avatar the part belongs to. Borrowed.

◆ mLoader

std::unique_ptr<RndLoader> AvatarPart::mLoader
protected

The load of the files the meshes come from, or null.

◆ mPendingLoader

std::unique_ptr<RndLoader> AvatarPart::mPendingLoader
protected

The load of the first file of mPendingType, or null.

◆ mPendingExtraLoader

std::unique_ptr<RndLoader> AvatarPart::mPendingExtraLoader
protected

The load of the second file of mPendingType, or null.


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