CSEngine
Loading...
Searching...
No Matches
CSE::JointComponent Class Reference
Inheritance diagram for CSE::JointComponent:
CSE::SComponent CSE::SObject CSE::SISComponent CSE::VariableBinder

Public Member Functions

 COMPONENT_DEFINE_CONSTRUCTOR (JointComponent)
 
 JointComponent (const JointComponent &src)
 
void Exterminate () override
 
void Init () override
 
void Tick (float elapsedTime) override
 
SComponentClone (SGameObject *object) override
 
void SetValue (std::string name_str, Arguments value) override
 
std::string PrintValue () const override
 
void SetAnimationMatrix (mat4 &&animation)
 
mat4 GetAnimationMatrix () const
 
void SetID (int id)
 
int GetID () const
 
int GetAnimationJointId () const
 
void SetAnimationJointId (int animation_joint_id)
 
mat4 GetInverseTransformMatrix () const
 
void calcInverseBindTransform (const mat4 &parentTransform)
 
void SetBindLocalMatrix (const mat4 &mat)
 
- Public Member Functions inherited from CSE::SComponent
 SComponent (std::string classType, SGameObject *gameObject)
 
 SComponent (const SComponent &src)
 
void Start () override
 
virtual void CopyReference (SComponent *src, std::map< SGameObject *, SGameObject * > lists_obj, std::map< SComponent *, SComponent * > lists_comp)
 
virtual auto GetComponent () -> SObject *
 
void SetValue (std::string name_str, Arguments value) override
 
std::string PrintValue () const override
 
void SetGameObject (SGameObject *object)
 
virtual SGameObjectGetGameObject () const
 
virtual bool GetIsEnable () const
 
virtual void SetIsEnable (bool is_enable)
 
std::string GetClassType () const
 
void SetClassType (std::string type)
 
- Public Member Functions inherited from CSE::SObject
 SObject (bool isRegister)
 
virtual void SetUndestroyable (bool enable)
 
virtual void Destroy ()
 
virtual void __FORCE_DESTROY__ ()
 
virtual std::string GenerateMeta ()
 
std::string GetHash () const
 
virtual void SetHash (std::string &hash)
 
- Public Member Functions inherited from CSE::SISComponent
 SISComponent (const SISComponent &src)=default
 

Additional Inherited Members

- Protected Types inherited from CSE::VariableBinder
typedef std::vector< std::string > Arguments
 
- Protected Attributes inherited from CSE::SComponent
SGameObjectgameObject = nullptr
 
bool isEnable = true
 
std::string m_classType
 
- Protected Attributes inherited from CSE::SObject
std::string m_hash
 

Detailed Description

Definition at line 8 of file JointComponent.h.

Constructor & Destructor Documentation

◆ JointComponent()

JointComponent::JointComponent ( const JointComponent src)

Definition at line 11 of file JointComponent.cpp.

11 : SComponent(src) {
12 m_animatedMatrix = src.m_animatedMatrix;
13 m_id = src.m_id;
14 m_inverseTransformMatrix = src.m_inverseTransformMatrix;
15}

Member Function Documentation

◆ calcInverseBindTransform()

void JointComponent::calcInverseBindTransform ( const mat4 parentTransform)

Definition at line 36 of file JointComponent.cpp.

36 {
37 mat4 bindTransform = m_localBindMatrix * parentTransform;
38 m_inverseTransformMatrix = mat4::Invert(bindTransform);
39
40 auto children = gameObject->GetChildren();
41 for (const auto& child : children) {
42 auto child_comp = child->GetComponent<JointComponent>();
43
44 if(child_comp == nullptr) continue;
45
46 child_comp->calcInverseBindTransform(bindTransform);
47 }
48}

◆ Clone()

SComponent * JointComponent::Clone ( SGameObject object)
overridevirtual

Reimplemented from CSE::SComponent.

Definition at line 50 of file JointComponent.cpp.

50 {
51 INIT_COMPONENT_CLONE(JointComponent, clone);
52
53 clone->m_inverseTransformMatrix = mat4(m_inverseTransformMatrix);
54 clone->m_animatedMatrix = mat4(m_animatedMatrix);
55 clone->m_localBindMatrix = mat4(m_localBindMatrix);
56 clone->m_id = m_id;
57 clone->m_animationJointId = m_animationJointId;
58
59 return clone;
60}

◆ Exterminate()

void JointComponent::Exterminate ( )
overridevirtual

Implements CSE::SObject.

Definition at line 19 of file JointComponent.cpp.

19 {
20
21}

◆ GetAnimationJointId()

int CSE::JointComponent::GetAnimationJointId ( ) const
inline

Definition at line 42 of file JointComponent.h.

42 {
43 return m_animationJointId;
44 }

◆ GetAnimationMatrix()

mat4 CSE::JointComponent::GetAnimationMatrix ( ) const
inline

Definition at line 30 of file JointComponent.h.

30 {
31 return m_animatedMatrix;
32 }

◆ GetID()

int CSE::JointComponent::GetID ( ) const
inline

Definition at line 38 of file JointComponent.h.

38 {
39 return m_id;
40 }

◆ GetInverseTransformMatrix()

mat4 CSE::JointComponent::GetInverseTransformMatrix ( ) const
inline

Definition at line 50 of file JointComponent.h.

50 {
51 return m_inverseTransformMatrix;
52 }

◆ Init()

void JointComponent::Init ( )
overridevirtual

Implements CSE::SISComponent.

Definition at line 23 of file JointComponent.cpp.

23 {
24
25}

◆ PrintValue()

std::string JointComponent::PrintValue ( ) const
overridevirtual

Implements CSE::VariableBinder.

Definition at line 78 of file JointComponent.cpp.

78 {
79 PRINT_START("component");
80
81 PRINT_VALUE_MAT4(m_inverseTransformMatrix);
82 PRINT_VALUE_MAT4(m_animatedMatrix);
83 PRINT_VALUE_MAT4(m_localBindMatrix);
84
85 PRINT_END("component");
86}

◆ SetAnimationJointId()

void CSE::JointComponent::SetAnimationJointId ( int  animation_joint_id)
inline

Definition at line 46 of file JointComponent.h.

46 {
47 m_animationJointId = animation_joint_id;
48 }

◆ SetAnimationMatrix()

void JointComponent::SetAnimationMatrix ( mat4 &&  animation)

Definition at line 32 of file JointComponent.cpp.

32 {
33 m_animatedMatrix = animation;
34}

◆ SetBindLocalMatrix()

void JointComponent::SetBindLocalMatrix ( const mat4 mat)

Definition at line 62 of file JointComponent.cpp.

62 {
63 m_localBindMatrix = mat;
64}

◆ SetID()

void CSE::JointComponent::SetID ( int  id)
inline

Definition at line 34 of file JointComponent.h.

34 {
35 m_id = id;
36 }

◆ SetValue()

void JointComponent::SetValue ( std::string  name_str,
VariableBinder::Arguments  value 
)
overridevirtual

Implements CSE::VariableBinder.

Definition at line 66 of file JointComponent.cpp.

66 {
67 if(name_str == "m_inverseTransformMatrix") {
68 SET_MAT4(m_inverseTransformMatrix)
69 }
70 else if(name_str == "m_animatedMatrix") {
71 SET_MAT4(m_animatedMatrix)
72 }
73 else if(name_str == "m_localBindMatrix") {
74 SET_MAT4(m_localBindMatrix)
75 }
76}

◆ Tick()

void JointComponent::Tick ( float  elapsedTime)
overridevirtual

Implements CSE::SISComponent.

Definition at line 27 of file JointComponent.cpp.

27 {
28
29}

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