Added Node::Get*Direction*

Former-commit-id: e9c4f04da7b92965dc1236313ddebf66d0eaad8d
This commit is contained in:
Lynix 2013-06-13 17:05:21 +02:00
parent 97b2e90fb9
commit 3294f18608
2 changed files with 54 additions and 0 deletions

View File

@ -24,20 +24,26 @@ class NAZARA_API NzNode
void EnsureDerivedUpdate() const;
void EnsureTransformMatrixUpdate() const;
NzVector3f GetBackward() const;
const std::vector<NzNode*>& GetChilds() const;
NzVector3f GetDown() const;
NzVector3f GetForward() const;
bool GetInheritPosition() const;
bool GetInheritRotation() const;
bool GetInheritScale() const;
NzVector3f GetInitialPosition() const;
NzQuaternionf GetInitialRotation() const;
NzVector3f GetInitialScale() const;
NzVector3f GetLeft() const;
const NzString& GetName() const;
virtual nzNodeType GetNodeType() const;
const NzNode* GetParent() const;
NzVector3f GetPosition(nzCoordSys coordSys = nzCoordSys_Global) const;
NzVector3f GetRight() const;
NzQuaternionf GetRotation(nzCoordSys coordSys = nzCoordSys_Global) const;
NzVector3f GetScale(nzCoordSys coordSys = nzCoordSys_Global) const;
const NzMatrix4f& GetTransformMatrix() const;
NzVector3f GetUp() const;
bool HasChilds() const;

View File

@ -60,11 +60,35 @@ void NzNode::EnsureTransformMatrixUpdate() const
UpdateTransformMatrix();
}
NzVector3f NzNode::GetBackward() const
{
if (!m_derivedUpdated)
UpdateDerived();
return m_derivedRotation * NzVector3f::Backward();
}
const std::vector<NzNode*>& NzNode::GetChilds() const
{
return m_childs;
}
NzVector3f NzNode::GetDown() const
{
if (!m_derivedUpdated)
UpdateDerived();
return m_derivedRotation * NzVector3f::Down();
}
NzVector3f NzNode::GetForward() const
{
if (!m_derivedUpdated)
UpdateDerived();
return m_derivedRotation * NzVector3f::Forward();
}
bool NzNode::GetInheritPosition() const
{
return m_inheritPosition;
@ -95,6 +119,14 @@ NzVector3f NzNode::GetInitialScale() const
return m_initialScale;
}
NzVector3f NzNode::GetLeft() const
{
if (!m_derivedUpdated)
UpdateDerived();
return m_derivedRotation * NzVector3f::Left();
}
const NzString& NzNode::GetName() const
{
return m_name;
@ -128,6 +160,14 @@ NzVector3f NzNode::GetPosition(nzCoordSys coordSys) const
return NzVector3f();
}
NzVector3f NzNode::GetRight() const
{
if (!m_derivedUpdated)
UpdateDerived();
return m_derivedRotation * NzVector3f::Right();
}
NzQuaternionf NzNode::GetRotation(nzCoordSys coordSys) const
{
switch (coordSys)
@ -172,6 +212,14 @@ const NzMatrix4f& NzNode::GetTransformMatrix() const
return m_transformMatrix;
}
NzVector3f NzNode::GetUp() const
{
if (!m_derivedUpdated)
UpdateDerived();
return m_derivedRotation * NzVector3f::Up();
}
bool NzNode::HasChilds() const
{
return !m_childs.empty();