Added Node::SetTransformMatrix
Former-commit-id: ca5c457f48b12b5603ee6a7629159a74388a9b42
This commit is contained in:
parent
3df00608b5
commit
40bf1723f5
|
|
@ -70,6 +70,7 @@ class NAZARA_API NzNode
|
|||
void SetScale(const NzVector3f& scale, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetScale(float scale, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetScale(float scaleX, float scaleY, float scaleZ, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetTransformMatrix(const NzMatrix4f& matrix);
|
||||
|
||||
// Local -> global
|
||||
NzVector3f ToGlobalPosition(const NzVector3f& localPosition) const;
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ NzNode& NzNode::Scale(float scaleX, float scaleY, float scaleZ)
|
|||
|
||||
void NzNode::SetInheritPosition(bool inheritPosition)
|
||||
{
|
||||
///DOC: Un appel redondant est sans effet
|
||||
if (m_inheritPosition != inheritPosition)
|
||||
{
|
||||
m_inheritPosition = inheritPosition;
|
||||
|
|
@ -460,10 +461,9 @@ void NzNode::SetRotation(const NzQuaternionf& rotation, nzCoordSys coordSys)
|
|||
case nzCoordSys_Global:
|
||||
if (m_parent && m_inheritRotation)
|
||||
{
|
||||
NzQuaternionf rot(m_initialRotation * m_parent->GetRotation());
|
||||
NzQuaternionf rot(m_parent->GetRotation() * m_initialRotation);
|
||||
|
||||
m_rotation = rot.GetInverse() * q; ///FIXME: Vérifier si le résultat est correct
|
||||
m_rotation.Normalize();
|
||||
m_rotation = rot.GetConjugate() * q;
|
||||
}
|
||||
else
|
||||
m_rotation = q;
|
||||
|
|
@ -507,6 +507,16 @@ void NzNode::SetScale(float scaleX, float scaleY, float scaleZ, nzCoordSys coord
|
|||
SetScale(NzVector3f(scaleX, scaleY, scaleZ), coordSys);
|
||||
}
|
||||
|
||||
void NzNode::SetTransformMatrix(const NzMatrix4f& matrix)
|
||||
{
|
||||
SetPosition(matrix.GetTranslation(), nzCoordSys_Global);
|
||||
SetRotation(matrix.GetRotation(), nzCoordSys_Global);
|
||||
SetScale(matrix.GetScale(), nzCoordSys_Global);
|
||||
|
||||
m_transformMatrix = matrix;
|
||||
m_transformMatrixUpdated = true;
|
||||
}
|
||||
|
||||
NzVector3f NzNode::ToGlobalPosition(const NzVector3f& localPosition) const
|
||||
{
|
||||
if (!m_derivedUpdated)
|
||||
|
|
|
|||
Loading…
Reference in New Issue