OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
StdMeshInstance::AttachedMesh Class Reference

#include <StdMesh.h>

Collaboration diagram for StdMeshInstance::AttachedMesh:
[legend]

Classes

class  Denumerator
 

Public Types

typedef Denumerator *(* DenumeratorFactoryFunc )()
 

Public Member Functions

 AttachedMesh ()
 
 AttachedMesh (unsigned int number, StdMeshInstance *parent, StdMeshInstance *child, bool own_child, Denumerator *denumerator, unsigned int parent_bone, unsigned int child_bone, const StdMeshMatrix &transform, uint32_t flags)
 
 ~AttachedMesh ()
 
bool SetParentBone (const StdStrBuf &bone)
 
bool SetChildBone (const StdStrBuf &bone)
 
void SetAttachTransformation (const StdMeshMatrix &transformation)
 
const StdMeshMatrix & GetFinalTransformation () const
 
uint32_t GetFlags () const
 
void CompileFunc (StdCompiler *pComp, DenumeratorFactoryFunc Factory)
 
void DenumeratePointers ()
 
bool ClearPointers (class C4Object *pObj)
 
unsigned int GetParentBone () const
 
unsigned int GetChildBone () const
 

Static Public Member Functions

template<typename T >
static DenumeratorDenumeratorFactory ()
 

Public Attributes

uint32_t Number
 
StdMeshInstanceParent
 
StdMeshInstanceChild
 
bool OwnChild
 
DenumeratorChildDenumerator
 

Friends

class StdMeshInstance
 
class StdMeshUpdate
 

Detailed Description

Definition at line 485 of file StdMesh.h.

Member Typedef Documentation

typedef Denumerator*(* StdMeshInstance::AttachedMesh::DenumeratorFactoryFunc)()

Definition at line 501 of file StdMesh.h.

Constructor & Destructor Documentation

StdMeshInstance::AttachedMesh::AttachedMesh ( )

Definition at line 983 of file StdMesh.cpp.

983  :
984  Number(0), Parent(nullptr), Child(nullptr), OwnChild(true), ChildDenumerator(nullptr), ParentBone(0), ChildBone(0), FinalTransformDirty(false)
985 {
986 }
Denumerator * ChildDenumerator
Definition: StdMesh.h:515
StdMeshInstance * Child
Definition: StdMesh.h:513
StdMeshInstance * Parent
Definition: StdMesh.h:512
StdMeshInstance::AttachedMesh::AttachedMesh ( unsigned int  number,
StdMeshInstance parent,
StdMeshInstance child,
bool  own_child,
Denumerator denumerator,
unsigned int  parent_bone,
unsigned int  child_bone,
const StdMeshMatrix &  transform,
uint32_t  flags 
)

Definition at line 988 of file StdMesh.cpp.

References StdMeshInstance::GetMesh(), and StdMesh::GetSkeleton().

989  :
990  Number(number), Parent(parent), Child(child), OwnChild(own_child), ChildDenumerator(denumerator),
991  ParentBone(parent_bone), ChildBone(child_bone), AttachTrans(transform), Flags(flags),
992  FinalTransformDirty(true)
993 {
994  MapBonesOfChildToParent(parent->GetMesh().GetSkeleton(), child->GetMesh().GetSkeleton());
995 }
Denumerator * ChildDenumerator
Definition: StdMesh.h:515
const StdMeshSkeleton & GetSkeleton() const
Definition: StdMesh.h:205
StdMeshInstance * Child
Definition: StdMesh.h:513
const StdMesh & GetMesh() const
Definition: StdMesh.h:624
StdMeshInstance * Parent
Definition: StdMesh.h:512

Here is the call graph for this function:

StdMeshInstance::AttachedMesh::~AttachedMesh ( )

Definition at line 997 of file StdMesh.cpp.

998 {
999  if (OwnChild)
1000  delete Child;
1001  delete ChildDenumerator;
1002 }
Denumerator * ChildDenumerator
Definition: StdMesh.h:515
StdMeshInstance * Child
Definition: StdMesh.h:513

Member Function Documentation

bool StdMeshInstance::AttachedMesh::ClearPointers ( class C4Object pObj)

Definition at line 1070 of file StdMesh.cpp.

1071 {
1072  return ChildDenumerator->ClearPointers(pObj);
1073 }
virtual bool ClearPointers(class C4Object *pObj)
Definition: StdMesh.h:498
Denumerator * ChildDenumerator
Definition: StdMesh.h:515
void StdMeshInstance::AttachedMesh::CompileFunc ( StdCompiler pComp,
DenumeratorFactoryFunc  Factory 
)

Definition at line 1030 of file StdMesh.cpp.

References StdMeshInstance::AM_DrawBefore, StdMeshInstance::AM_MatchSkeleton, StdCompiler::isDeserializer(), mkBitfieldAdapt(), mkNamingAdapt(), mkParAdapt(), and StdCompiler::Value().

1031 {
1032  if(pComp->isDeserializer())
1033  {
1034  FinalTransformDirty = true;
1035  ChildDenumerator = Factory();
1036  }
1037 
1038  const StdBitfieldEntry<uint8_t> AM_Entries[] =
1039  {
1040  { "MatchSkeleton", AM_MatchSkeleton },
1041  { "DrawBefore", AM_DrawBefore },
1042  { nullptr, 0 }
1043  };
1044 
1045  pComp->Value(mkNamingAdapt(Number, "Number"));
1046  pComp->Value(mkNamingAdapt(ParentBone, "ParentBone")); // TODO: Save as string
1047  pComp->Value(mkNamingAdapt(ChildBone, "ChildBone")); // TODO: Save as string (note we can only resolve this in DenumeratePointers then!)
1048  pComp->Value(mkNamingAdapt(mkMatrixAdapt(AttachTrans), "AttachTransformation"));
1049 
1050  uint8_t dwSyncFlags = static_cast<uint8_t>(Flags);
1051  pComp->Value(mkNamingAdapt(mkBitfieldAdapt(dwSyncFlags, AM_Entries), "Flags", 0u));
1052  if(pComp->isDeserializer()) Flags = dwSyncFlags;
1053 
1054  pComp->Value(mkParAdapt(*ChildDenumerator, this));
1055 }
Definition: StdAdaptors.h:851
Denumerator * ChildDenumerator
Definition: StdMesh.h:515
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
StdBitfieldAdapt< T > mkBitfieldAdapt(T &rVal, const StdBitfieldEntry< T > *pNames)
Definition: StdAdaptors.h:954
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:459

Here is the call graph for this function:

void StdMeshInstance::AttachedMesh::DenumeratePointers ( )

Definition at line 1057 of file StdMesh.cpp.

1058 {
1060 
1061  assert(Child != nullptr);
1062  Child->AttachParent = this;
1063 
1064  MapBonesOfChildToParent(Parent->GetMesh().GetSkeleton(), Child->GetMesh().GetSkeleton());
1065 
1066  if(OwnChild)
1068 }
Denumerator * ChildDenumerator
Definition: StdMesh.h:515
virtual void DenumeratePointers(AttachedMesh *attach)
Definition: StdMesh.h:497
const StdMeshSkeleton & GetSkeleton() const
Definition: StdMesh.h:205
StdMeshInstance * Child
Definition: StdMesh.h:513
void DenumeratePointers()
Definition: StdMesh.cpp:1685
AttachedMesh * AttachParent
Definition: StdMesh.h:663
const StdMesh & GetMesh() const
Definition: StdMesh.h:624
StdMeshInstance * Parent
Definition: StdMesh.h:512
template<typename T >
static Denumerator* StdMeshInstance::AttachedMesh::DenumeratorFactory ( )
inlinestatic

Definition at line 504 of file StdMesh.h.

504 { return new T; }
unsigned int StdMeshInstance::AttachedMesh::GetChildBone ( ) const
inline

Definition at line 528 of file StdMesh.h.

528 { return ChildBone; }
const StdMeshMatrix& StdMeshInstance::AttachedMesh::GetFinalTransformation ( ) const
inline

Definition at line 520 of file StdMesh.h.

520 { return FinalTrans; }
uint32_t StdMeshInstance::AttachedMesh::GetFlags ( ) const
inline

Definition at line 521 of file StdMesh.h.

Referenced by StdMeshInstance::GetBoneCount(), StdMeshInstance::GetBoneTransform(), and StdMeshInstance::SetBoneTransformsDirty().

521 { return Flags; }

Here is the caller graph for this function:

unsigned int StdMeshInstance::AttachedMesh::GetParentBone ( ) const
inline

Definition at line 527 of file StdMesh.h.

527 { return ParentBone; }
void StdMeshInstance::AttachedMesh::SetAttachTransformation ( const StdMeshMatrix &  transformation)

Definition at line 1024 of file StdMesh.cpp.

1025 {
1026  AttachTrans = transformation;
1027  FinalTransformDirty = true;
1028 }
bool StdMeshInstance::AttachedMesh::SetChildBone ( const StdStrBuf bone)

Definition at line 1014 of file StdMesh.cpp.

References StdMeshBone::Index.

Referenced by StdMeshUpdate::Update().

1015 {
1016  const StdMeshBone* bone_obj = Child->GetMesh().GetSkeleton().GetBoneByName(bone);
1017  if (!bone_obj) return false;
1018  ChildBone = bone_obj->Index;
1019 
1020  FinalTransformDirty = true;
1021  return true;
1022 }
const StdMeshSkeleton & GetSkeleton() const
Definition: StdMesh.h:205
StdMeshInstance * Child
Definition: StdMesh.h:513
const StdMeshBone * GetBoneByName(const StdStrBuf &name) const
Definition: StdMesh.cpp:388
unsigned int Index
Definition: StdMesh.h:34
const StdMesh & GetMesh() const
Definition: StdMesh.h:624

Here is the caller graph for this function:

bool StdMeshInstance::AttachedMesh::SetParentBone ( const StdStrBuf bone)

Definition at line 1004 of file StdMesh.cpp.

References StdMeshBone::Index.

1005 {
1006  const StdMeshBone* bone_obj = Parent->GetMesh().GetSkeleton().GetBoneByName(bone);
1007  if (!bone_obj) return false;
1008  ParentBone = bone_obj->Index;
1009 
1010  FinalTransformDirty = true;
1011  return true;
1012 }
const StdMeshSkeleton & GetSkeleton() const
Definition: StdMesh.h:205
const StdMeshBone * GetBoneByName(const StdStrBuf &name) const
Definition: StdMesh.cpp:388
unsigned int Index
Definition: StdMesh.h:34
const StdMesh & GetMesh() const
Definition: StdMesh.h:624
StdMeshInstance * Parent
Definition: StdMesh.h:512

Friends And Related Function Documentation

friend class StdMeshInstance
friend

Definition at line 487 of file StdMesh.h.

friend class StdMeshUpdate
friend

Definition at line 488 of file StdMesh.h.

Member Data Documentation

Denumerator* StdMeshInstance::AttachedMesh::ChildDenumerator

Definition at line 515 of file StdMesh.h.

uint32_t StdMeshInstance::AttachedMesh::Number
bool StdMeshInstance::AttachedMesh::OwnChild

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