Commit 10f50fbf authored by Richard Gustavsen's avatar Richard Gustavsen

QQuick3DNode: add mapToGlobalDirection() and vice-versa

parent 45fbd270
Pipeline #5394 passed with stage
in 5 minutes and 14 seconds
......@@ -696,4 +696,24 @@ QVector3D QQuick3DNode::mapFromNodePosition(const QQuick3DNode *node, const QVec
return mapFromGlobalPosition(node->mapToGlobalPosition(localPosition));
}
QVector3D QQuick3DNode::mapToGlobalDirection(const QVector3D localDirection) const
{
return mat33::transform(mat44::getUpper3x3(globalTransform()), localDirection);
}
QVector3D QQuick3DNode::mapFromGlobalDirection(const QVector3D globalDirection) const
{
return mat33::transform(mat33::getInverse(mat44::getUpper3x3(globalTransform())), globalDirection);
}
QVector3D QQuick3DNode::mapToNodeDirection(const QQuick3DNode *node, const QVector3D localDirection) const
{
return node->mapFromGlobalDirection(mapToGlobalDirection(localDirection));
}
QVector3D QQuick3DNode::mapFromNodeDirection(const QQuick3DNode *node, const QVector3D localDirection) const
{
return mapFromGlobalDirection(node->mapToGlobalDirection(localDirection));
}
QT_END_NAMESPACE
......@@ -127,6 +127,10 @@ public:
Q_INVOKABLE QVector3D mapFromGlobalPosition(const QVector3D globalPosition) const;
Q_INVOKABLE QVector3D mapToNodePosition(const QQuick3DNode *node, const QVector3D localPosition) const;
Q_INVOKABLE QVector3D mapFromNodePosition(const QQuick3DNode *node, const QVector3D localPosition) const;
Q_INVOKABLE QVector3D mapToGlobalDirection(const QVector3D localDirection) const;
Q_INVOKABLE QVector3D mapFromGlobalDirection(const QVector3D globalDirection) const;
Q_INVOKABLE QVector3D mapToNodeDirection(const QQuick3DNode *node, const QVector3D localDirection) const;
Q_INVOKABLE QVector3D mapFromNodeDirection(const QQuick3DNode *node, const QVector3D localDirection) const;
protected:
void connectNotify(const QMetaMethod &signal) override;
......
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