Skip to content

Kuesa::Qt3D::TransformTracker

#include <transformtracker.h>

Inherits from Kuesa::Qt3D::KuesaNode, Qt3DCore::QNode

Public Slots

Name
void setName(const QString & name)
void setCamera(Qt3DCore::QEntity * camera)
void setScreenSize(const QSize & screenSize)
void setViewportRect(const QRectF & viewportRect)
void setViewportRect(qreal x, qreal y, qreal width, qreal height)
void setMatrix(const QMatrix4x4 & matrix)
void setRotation(const QQuaternion & rotation)
void setRotationX(float rotationX)
void setRotationY(float rotationY)
void setRotationZ(float rotationZ)
void setScale(float scale)
void setScale3D(const QVector3D & scale3D)
void setTranslation(const QVector3D & translation)

Public Signals

Name
void nameChanged(const QString & name)
void cameraChanged(Qt3DCore::QEntity * camera)
void screenSizeChanged(const QSize & screenSize)
void scaleChanged(float scale)
void scale3DChanged(const QVector3D & scale)
void rotationChanged(const QQuaternion & rotation)
void translationChanged(const QVector3D & translation)
void matrixChanged(const QMatrix4x4 & matrix)
void rotationXChanged(float rotationX)
void rotationYChanged(float rotationY)
void rotationZChanged(float rotationZ)
void worldMatrixChanged(const QMatrix4x4 & worldMatrix)
void screenPositionChanged(const QPointF & screenPosition)
void viewportRectChanged(QRectF viewportRect)

Public Functions

Name
TransformTracker(Qt3DCore::QNode * parent =nullptr)
~TransformTracker()
Qt3DCore::QEntity * camera() const
QSize screenSize() const
QRectF viewportRect() const
QString name() const
QMatrix4x4 matrix() const
QMatrix4x4 worldMatrix() const
QQuaternion rotation() const
float rotationX() const
float rotationY() const
float rotationZ() const
float scale() const
QVector3D scale3D() const
QVector3D translation() const
QPointF screenPosition() const

Public Properties

Name
QString name
Qt3DCore::QEntity * camera
QSize screenSize
QRectF viewportRect
QMatrix4x4 matrix
QMatrix4x4 worldMatrix
QQuaternion rotation
float rotationX
float rotationY
float rotationZ
float scale
QVector3D scale3D
QVector3D translation
QPointF screenPosition

Additional inherited members

Public Slots inherited from Kuesa::Qt3D::KuesaNode

Name
void setSceneEntity(Kuesa::Qt3D::SceneEntity * sceneEntity)

Public Signals inherited from Kuesa::Qt3D::KuesaNode

Name
void sceneEntityChanged(Kuesa::Qt3D::SceneEntity * sceneEntity)

Public Functions inherited from Kuesa::Qt3D::KuesaNode

Name
KuesaNode(Qt3DCore::QNode * parent =nullptr)
SceneEntity * sceneEntity() const

Public Properties inherited from Kuesa::Qt3D::KuesaNode

Name
Kuesa::Qt3D::SceneEntity * sceneEntity

Protected Attributes inherited from Kuesa::Qt3D::KuesaNode

Name
SceneEntity * m_sceneEntity

Public Slots Documentation

slot setName

1
2
3
void setName(
    const QString & name
)

slot setCamera

1
2
3
void setCamera(
    Qt3DCore::QEntity * camera
)

slot setScreenSize

1
2
3
void setScreenSize(
    const QSize & screenSize
)

slot setViewportRect

1
2
3
void setViewportRect(
    const QRectF & viewportRect
)

slot setViewportRect

1
2
3
4
5
6
void setViewportRect(
    qreal x,
    qreal y,
    qreal width,
    qreal height
)

slot setMatrix

1
2
3
void setMatrix(
    const QMatrix4x4 & matrix
)

slot setRotation

1
2
3
void setRotation(
    const QQuaternion & rotation
)

slot setRotationX

1
2
3
void setRotationX(
    float rotationX
)

slot setRotationY

1
2
3
void setRotationY(
    float rotationY
)

slot setRotationZ

1
2
3
void setRotationZ(
    float rotationZ
)

slot setScale

1
2
3
void setScale(
    float scale
)

slot setScale3D

1
2
3
void setScale3D(
    const QVector3D & scale3D
)

slot setTranslation

1
2
3
void setTranslation(
    const QVector3D & translation
)

Public Signals Documentation

signal nameChanged

1
2
3
void nameChanged(
    const QString & name
)

signal cameraChanged

1
2
3
void cameraChanged(
    Qt3DCore::QEntity * camera
)

signal screenSizeChanged

1
2
3
void screenSizeChanged(
    const QSize & screenSize
)

signal scaleChanged

1
2
3
void scaleChanged(
    float scale
)

signal scale3DChanged

1
2
3
void scale3DChanged(
    const QVector3D & scale
)

signal rotationChanged

1
2
3
void rotationChanged(
    const QQuaternion & rotation
)

signal translationChanged

1
2
3
void translationChanged(
    const QVector3D & translation
)

signal matrixChanged

1
2
3
void matrixChanged(
    const QMatrix4x4 & matrix
)

signal rotationXChanged

1
2
3
void rotationXChanged(
    float rotationX
)

signal rotationYChanged

1
2
3
void rotationYChanged(
    float rotationY
)

signal rotationZChanged

1
2
3
void rotationZChanged(
    float rotationZ
)

signal worldMatrixChanged

1
2
3
void worldMatrixChanged(
    const QMatrix4x4 & worldMatrix
)

signal screenPositionChanged

1
2
3
void screenPositionChanged(
    const QPointF & screenPosition
)

signal viewportRectChanged

1
2
3
void viewportRectChanged(
    QRectF viewportRect
)

Public Functions Documentation

function TransformTracker

1
2
3
explicit TransformTracker(
    Qt3DCore::QNode * parent =nullptr
)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
\class Kuesa::Qt3D::TransformTracker
\ingroup KuesaQt3DAPI
\brief TransformTracker allows watching a transform for change and computing
a projected screen position given a window size and a camera.

\noop Kuesa
\since Kuesa 2.0
\noop Kuesa::Qt3D::KuesaNode

TransformTracker allows watching a transform for change and computing
a projected screen position given a window size and a camera.

This is especially useful to place 2D content based on a 3D position.
Kuesa::Qt3D::SceneEntity sceneEntity = new Kuesa::Qt3D::SceneEntity(); Kuesa::Qt3D::TransformTracker tracker = new Kuesa::Qt3D::TransformTracker(); Qt3DRender::QCamera *camera = new Qt3DRender::Camera();

tracker->setSceneEntity(sceneEntity); tracker->setName(QStringLiteral("MyTransform"); tracker->setCamera(camera); tracker->setScreenSize({512, 512});

QObject::connect(tracker, &Kuesa::Qt3D::TransformTracker::screenPositionChanged, this, [this] (const QPointF &screenPosition) {

1
2
3
4
5
6
7
 Reacts to new position .... }); ``` 


### function ~TransformTracker

```cpp
~TransformTracker()

function camera

1
Qt3DCore::QEntity * camera() const

function screenSize

1
QSize screenSize() const

function viewportRect

1
QRectF viewportRect() const

function name

1
QString name() const

function matrix

1
QMatrix4x4 matrix() const

function worldMatrix

1
QMatrix4x4 worldMatrix() const

function rotation

1
QQuaternion rotation() const

function rotationX

1
float rotationX() const

function rotationY

1
float rotationY() const

function rotationZ

1
float rotationZ() const

function scale

1
float scale() const

function scale3D

1
QVector3D scale3D() const

function translation

1
QVector3D translation() const

function screenPosition

1
QPointF screenPosition() const

Public Property Documentation

property name

1
QString name;

Holds the name of the Qt3DCore::QTransform instance to retrieve from the Kuesa::Qt3D::SceneEntity.

property camera

1
Qt3DCore::QEntity * camera;

Holds the camera entity from which we should compute the screen position.

property screenSize

1
QSize screenSize;

Holds the size of the area within which we should compute screen positions. This would usually be the size of the window or the size of the sub view within the window.

property viewportRect

1
QRectF viewportRect;

Holds the normalized viewport rectangle defining the area into which screen positions should be computed. If unspecified QRectF(0.0f, 0.0f, 1.0f, 1.0f) will be used.

property matrix

1
QMatrix4x4 matrix;

Holds the local transformation matrix associated to the tracker's referenced QTransform instance.

property worldMatrix

1
QMatrix4x4 worldMatrix;

Holds the world transformation matrix associated to the tracker's referenced QTransform instance.

This property is readonly.

property rotation

1
QQuaternion rotation;

Holds the local rotation associated to the tracker's referenced QTransform instance.

property rotationX

1
float rotationX;

Holds the local x rotation (euler angle) associated to the tracker's referenced QTransform instance.

property rotationY

1
float rotationY;

Holds the local y rotation (euler angle) associated to the tracker's referenced QTransform instance.

property rotationZ

1
float rotationZ;

Holds the local z rotation (euler angle) associated to the tracker's referenced QTransform instance.

property scale

1
float scale;

Holds the local uniform scale associated to the tracker's referenced QTransform instance.

property scale3D

1
QVector3D scale3D;

Holds the local 3D scale associated to the tracker's referenced QTransform instance.

property translation

1
QVector3D translation;

Holds the local translation associated to the tracker's referenced QTransform instance.

property screenPosition

1
QPointF screenPosition;

Holds the 2D screen position computed from the transformation in world space obtained from the tracker's referenced Transform, the camera, the sceneSize and viewportRect.


Updated on 2023-07-03 at 11:02:06 +0000