Skip to content

Commit

Permalink
UPBGE: Restore and move IsNegativeScaling in SG_Node.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Jun 22, 2018
1 parent b6123cc commit ed78298
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/gameengine/Ketsji/KX_FontObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void KX_FontObject::UpdateBuckets()
RAS_TextUser *textUser = (RAS_TextUser *)m_meshUser;

textUser->SetColor(mt::vec4(color));
textUser->SetFrontFace(!m_bIsNegativeScaling);
textUser->SetFrontFace(!IsNegativeScaling());
textUser->SetFontId(m_fontid);
textUser->SetSize(size);
textUser->SetDpi(m_dpi);
Expand Down
4 changes: 1 addition & 3 deletions source/gameengine/Ketsji/KX_GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ KX_GameObject::KX_GameObject(void *sgReplicationInfo,
m_currentLodLevel(0),
m_meshUser(nullptr),
m_convertInfo(nullptr),
m_bIsNegativeScaling(false),
m_objectColor(mt::one4),
m_bVisible(true),
m_bOccluder(false),
Expand Down Expand Up @@ -144,7 +143,6 @@ KX_GameObject::KX_GameObject(const KX_GameObject& other)
m_currentLodLevel(0),
m_meshUser(nullptr),
m_convertInfo(other.m_convertInfo),
m_bIsNegativeScaling(other.m_bIsNegativeScaling),
m_objectColor(other.m_objectColor),
m_bVisible(other.m_bVisible),
m_bOccluder(other.m_bOccluder),
Expand Down Expand Up @@ -707,7 +705,7 @@ void KX_GameObject::UpdateBuckets()
}

m_meshUser->SetColor(m_objectColor);
m_meshUser->SetFrontFace(!m_bIsNegativeScaling);
m_meshUser->SetFrontFace(!IsNegativeScaling());
m_meshUser->ActivateMeshSlots();
}

Expand Down
3 changes: 1 addition & 2 deletions source/gameengine/Ketsji/KX_GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class KX_GameObject : public SCA_IObject, public mt::SimdClassAllocator
/// Info about blender object convert from.
BL_ConvertObjectInfo *m_convertInfo;

bool m_bIsNegativeScaling;
mt::vec4 m_objectColor;

// visible = user setting
Expand Down Expand Up @@ -809,7 +808,7 @@ class KX_GameObject : public SCA_IObject, public mt::SimdClassAllocator
bool
IsNegativeScaling(
void
) { return m_bIsNegativeScaling; }
) { return m_sgNode->IsNegativeScaling(); }

/**
* \section Logic bubbling methods.
Expand Down
5 changes: 5 additions & 0 deletions source/gameengine/SceneGraph/SG_Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ mt::mat3x4 SG_Node::GetLocalTransform() const
return mt::mat3x4(m_localRotation, m_localPosition, m_localScaling);
}

bool SG_Node::IsNegativeScaling() const
{
return (m_worldScaling.x * m_worldScaling.y * m_worldScaling.z) < 0.0f;
}

bool SG_Node::ComputeWorldTransforms(const SG_Node *parent, bool& parentUpdated)
{
return m_parent_relation->UpdateChildCoordinates(this, parent, parentUpdated);
Expand Down
2 changes: 2 additions & 0 deletions source/gameengine/SceneGraph/SG_Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ class SG_Node : public SG_QList, public mt::SimdClassAllocator
mt::mat3x4 GetWorldTransform() const;
mt::mat3x4 GetLocalTransform() const;

bool IsNegativeScaling() const;

bool ComputeWorldTransforms(const SG_Node *parent, bool& parentUpdated);

const std::shared_ptr<SG_Familly>& GetFamilly() const;
Expand Down

0 comments on commit ed78298

Please sign in to comment.