QTransform Class

class Qt3DCore::QTransform

Used to perform transforms on meshes. More...

Header: #include <QTransform>
qmake: QT += 3dcore
Since: Qt 5.6
Instantiated By: Transform
Inherits: Qt3DCore::QComponent

This class was introduced in Qt 5.6.

Public Functions

QTransform(Qt3DCore::QNode *parent = nullptr)
QMatrix4x4 worldMatrix() const

Static Public Members

QQuaternion fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis)
QQuaternion fromAxesAndAngles(const QVector3D &axis1, float angle1, const QVector3D &axis2, float angle2)
QQuaternion fromAxesAndAngles(const QVector3D &axis1, float angle1, const QVector3D &axis2, float angle2, const QVector3D &axis3, float angle3)
QQuaternion fromAxisAndAngle(const QVector3D &axis, float angle)
QQuaternion fromAxisAndAngle(float x, float y, float z, float angle)
QQuaternion fromEulerAngles(const QVector3D &eulerAngles)
QQuaternion fromEulerAngles(float pitch, float yaw, float roll)
QMatrix4x4 rotateAround(const QVector3D &point, float angle, const QVector3D &axis)
QMatrix4x4 rotateFromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis)

Detailed Description

The QTransform component is not shareable between multiple QEntity's. The transformation is held as QVector3D scale, QQuaternion rotation and QVector3D translation components. The transformations are applied to the mesh in that order. When QTransform::matrix property is set, it is decomposed to these transform components and corresponding signals are emitted.

Several helper functions are provided to set up the QTransform; fromAxisAndAngle and fromAxesAndAngles can be used to set the rotation around specific axes, fromEulerAngles can be used to set the rotation based on euler angles and rotateAround can be used to rotate the object around specific point relative to local origin.

Member Function Documentation

QTransform::QTransform(Qt3DCore::QNode *parent = nullptr)

Constructs a new QTransform with parent.

[static] QQuaternion QTransform::fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis)

Creates a QQuaterniom definining a rotation from the axes xAxis, yAxis and zAxis.

This function was introduced in Qt 5.11.

[static] QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1, const QVector3D &axis2, float angle2)

Creates a QQuaternion from axis1, angle1, axis2, and angle2. Returns the resulting QQuaternion.

[static] QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1, const QVector3D &axis2, float angle2, const QVector3D &axis3, float angle3)

Creates a QQuaternion from axis1, angle1, axis2, angle2, axis3, and angle3. Returns the resulting QQuaternion.

[static] QQuaternion QTransform::fromAxisAndAngle(const QVector3D &axis, float angle)

Creates a QQuaternion from axis and angle. Returns the resulting QQuaternion.

[static] QQuaternion QTransform::fromAxisAndAngle(float x, float y, float z, float angle)

Creates a QQuaternion from x, y, z, and angle. Returns the resulting QQuaternion.

[static] QQuaternion QTransform::fromEulerAngles(const QVector3D &eulerAngles)

Creates a QQuaternion from eulerAngles. Returns the resulting QQuaternion.

[static] QQuaternion QTransform::fromEulerAngles(float pitch, float yaw, float roll)

Creates a QQuaternion from pitch, yaw, and roll. Returns the resulting QQuaternion.

[static] QMatrix4x4 QTransform::rotateAround(const QVector3D &point, float angle, const QVector3D &axis)

Creates a rotation matrix from axis and angle around point. Returns the resulting QMatrix4x4.

[static] QMatrix4x4 QTransform::rotateFromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis)

Returns a rotation matrix defined from the axes xAxis, yAxis, zAxis.

This function was introduced in Qt 5.11.

QMatrix4x4 QTransform::worldMatrix() const

Returns the world transformation matrix associated to the QTransform when referenced by a QEntity which may be part of a QEntity hierarchy.

This function was introduced in Qt 5.14.