Improved Node interface

Former-commit-id: fdeb313d5e59e5b2f92f347370ee6b08572069b9
This commit is contained in:
Lynix 2013-03-02 00:23:49 +01:00
parent b4d7e16749
commit 7540fbf09c
1 changed files with 13 additions and 5 deletions

View File

@ -12,7 +12,7 @@
#include <Nazara/Math/Quaternion.hpp> #include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Vector3.hpp> #include <Nazara/Math/Vector3.hpp>
#include <Nazara/Utility/Enums.hpp> #include <Nazara/Utility/Enums.hpp>
#include <set> #include <vector>
class NAZARA_API NzNode class NAZARA_API NzNode
{ {
@ -21,18 +21,25 @@ class NAZARA_API NzNode
NzNode(const NzNode& node); NzNode(const NzNode& node);
virtual ~NzNode(); virtual ~NzNode();
void EnsureDerivedUpdate() const;
void EnsureTransformMatrixUpdate() const;
const std::vector<NzNode*>& GetChilds() const;
bool GetInheritPosition() const; bool GetInheritPosition() const;
bool GetInheritRotation() const; bool GetInheritRotation() const;
bool GetInheritScale() const; bool GetInheritScale() const;
NzVector3f GetInitialPosition() const; NzVector3f GetInitialPosition() const;
NzQuaternionf GetInitialRotation() const; NzQuaternionf GetInitialRotation() const;
NzVector3f GetInitialScale() const; NzVector3f GetInitialScale() const;
virtual nzNodeType GetNodeType() const;
const NzNode* GetParent() const; const NzNode* GetParent() const;
NzVector3f GetPosition(nzCoordSys coordSys = nzCoordSys_Global) const; NzVector3f GetPosition(nzCoordSys coordSys = nzCoordSys_Global) const;
NzQuaternionf GetRotation(nzCoordSys coordSys = nzCoordSys_Global) const; NzQuaternionf GetRotation(nzCoordSys coordSys = nzCoordSys_Global) const;
NzVector3f GetScale(nzCoordSys coordSys = nzCoordSys_Global) const; NzVector3f GetScale(nzCoordSys coordSys = nzCoordSys_Global) const;
const NzMatrix4f& GetTransformMatrix() const; const NzMatrix4f& GetTransformMatrix() const;
bool HasChilds() const;
NzNode& Interpolate(const NzNode& nodeA, const NzNode& nodeB, float interpolation); NzNode& Interpolate(const NzNode& nodeA, const NzNode& nodeB, float interpolation);
NzNode& Move(const NzVector3f& movement, nzCoordSys coordSys = nzCoordSys_Local); NzNode& Move(const NzVector3f& movement, nzCoordSys coordSys = nzCoordSys_Local);
@ -66,12 +73,13 @@ class NAZARA_API NzNode
protected: protected:
void AddChild(NzNode* node) const; void AddChild(NzNode* node) const;
void Invalidate(); virtual void Invalidate();
virtual void OnParenting(const NzNode* parent);
void RemoveChild(NzNode* node) const; void RemoveChild(NzNode* node) const;
void UpdateDerived() const; void UpdateDerived() const;
virtual void UpdateMatrix() const; virtual void UpdateTransformMatrix() const;
mutable std::set<NzNode*> m_childs; mutable std::vector<NzNode*> m_childs;
mutable NzMatrix4f m_transformMatrix; mutable NzMatrix4f m_transformMatrix;
mutable NzQuaternionf m_derivedRotation; mutable NzQuaternionf m_derivedRotation;
NzQuaternionf m_initialRotation; NzQuaternionf m_initialRotation;
@ -88,7 +96,7 @@ class NAZARA_API NzNode
bool m_inheritPosition; bool m_inheritPosition;
bool m_inheritRotation; bool m_inheritRotation;
bool m_inheritScale; bool m_inheritScale;
mutable bool m_matrixUpdated; mutable bool m_transformMatrixUpdated;
}; };
#endif // NAZARA_NODE_HPP #endif // NAZARA_NODE_HPP