Commit 97594df8 authored by Richard Gustavsen's avatar Richard Gustavsen

QQuick3DNode: use mat44 versions of getPosition() et.al

parent 038986be
......@@ -261,8 +261,7 @@ QVector3D QQuick3DNode::right() const
*/
QVector3D QQuick3DNode::globalPosition() const
{
const QMatrix4x4 transform = globalTransform();
return QVector3D(transform(0, 3), transform(1, 3), transform(2, 3));
return mat44::getPosition(globalTransform());
}
/*!
......@@ -272,12 +271,7 @@ QVector3D QQuick3DNode::globalPosition() const
*/
QVector3D QQuick3DNode::globalRotation() const
{
const QMatrix3x3 rotationMatrix = mat44::getUpper3x3(globalTransform());
const QVector3D radians = QSSGEulerAngleConverter::calculateRotationVector(rotationMatrix, false, m_rotationorder);
const float angleX = qRadiansToDegrees(radians.x());
const float angleY = qRadiansToDegrees(radians.y());
const float angleZ = qRadiansToDegrees(radians.z());
return QVector3D(angleX, angleY, angleZ);
return mat44::getRotation(globalTransform(), m_rotationorder);
}
/*!
......@@ -287,11 +281,7 @@ QVector3D QQuick3DNode::globalRotation() const
*/
QVector3D QQuick3DNode::globalScale() const
{
const QMatrix4x4 transform = globalTransform();
const float scaleX = transform.column(0).length();
const float scaleY = transform.column(1).length();
const float scaleZ = transform.column(2).length();
return QVector3D(scaleX, scaleY, scaleZ);
return mat44::getScale(globalTransform());
}
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment