Kuesa::Qt3D::PlaceholderTracker
Module: Kuesa Qt 3D API
PlaceholderTracker allows watching a placeholder for changes and computing a screen position changes given a window size and a camera. More...
#include <placeholdertracker.h>
Inherits from Kuesa::Qt3D::KuesaNode, Qt3DCore::QNode
Public Slots
Public Signals
Public Functions
Public Properties
Additional inherited members
Public Slots inherited from Kuesa::Qt3D::KuesaNode
Public Signals inherited from Kuesa::Qt3D::KuesaNode
Public Functions inherited from Kuesa::Qt3D::KuesaNode
Public Properties inherited from Kuesa::Qt3D::KuesaNode
Protected Attributes inherited from Kuesa::Qt3D::KuesaNode
Detailed Description
| class Kuesa::Qt3D::PlaceholderTracker;
|
PlaceholderTracker allows watching a placeholder for changes and computing a screen position changes given a window size and a camera.
See: Kuesa::Qt3D::Placeholder
Since: Kuesa 2.0
PlaceholderTracker allows watching a placeholder for changes and computing a screen position changes given a window size and a camera.
This is especially useful to easily map 2D content based on a 3D placeholder. It does so by projecting a plane defined by the
| Kuesa::Qt3D::SceneEntity *sceneEntity = new Kuesa::Qt3D::SceneEntity();
Kuesa::Qt3D::PlaceholderTracker *tracker = new Kuesa::Qt3D::PlaceholderTracker();
Qt3DRender::QCamera *camera = new Qt3DRender::Camera();
QObject *target = new QObject(); // Our UI target
tracker->setSceneEntity(sceneEntity);
tracker->setName(QStringLiteral("MyPlaceholder");
tracker->setCamera(camera);
tracker->setScreenSize({512, 512});
tracker->setTarget(target);
|
Read more about
Public Slots Documentation
slot setName
| void setName(
const QString & name
)
|
slot setCamera
| void setCamera(
Qt3DCore::QEntity * camera
)
|
slot setScreenSize
| void setScreenSize(
const QSize & screenSize
)
|
slot setViewportRect
| void setViewportRect(
const QRectF & viewportRect
)
|
slot setViewportRect
| void setViewportRect(
qreal x,
qreal y,
qreal width,
qreal height
)
|
slot setTarget
| void setTarget(
QObject * target
)
|
Public Signals Documentation
signal nameChanged
| void nameChanged(
const QString & name
)
|
signal cameraChanged
| void cameraChanged(
Qt3DCore::QEntity * camera
)
|
signal screenSizeChanged
| void screenSizeChanged(
const QSize & screenSize
)
|
signal viewportRectChanged
| void viewportRectChanged(
QRectF viewportRect
)
|
signal targetChanged
| void targetChanged(
QObject * target
)
|
signal xChanged
signal yChanged
signal widthChanged
| void widthChanged(
int width
)
|
signal heightChanged
| void heightChanged(
int height
)
|
signal screenPositionChanged
| void screenPositionChanged(
const QPointF & screenPosition
)
|
Public Functions Documentation
function PlaceholderTracker
| explicit PlaceholderTracker(
Qt3DCore::QNode * parent =nullptr
)
|
function ~PlaceholderTracker
function name
function camera
| Qt3DCore::QEntity * camera() const
|
function screenSize
function viewportRect
| QRectF viewportRect() const
|
function target
function x
function y
function width
function height
function screenPosition
| QPointF screenPosition() const
|
Public Property Documentation
property name
Holds the name of the Placeholder instance to retrieve from the Kuesa::Qt3D::SceneEntity.
property camera
| Qt3DCore::QEntity * camera;
|
Note: using a Qt3DRender::QCamera for the placeholderTracker different than the one being used for the render might give unexpected results.
Holds the camera the placeholder is facing and which is used to project the plane to screen space.
| QQuickItem *target = view->rootItem();
Kuesa::Qt3D::PlaceholderTracker *placeholderTracker = new Kuesa::Qt3D::PlaceholderTracker();
placeholderTracker->setName(QStringLiteral("placeholder"));
Qt3DRender::QCamera *camera = sceneEntity->camera(QStringLiteral("Camera_Orientation"));
placeholderTracker->setSceneSize({view.width(), view.height()});
placeholderTracker->setTarget(target);
placeholderTracker->setCamera(camera);
|
property 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
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 target
Holds the target object on which to set x, y, width and height properties computed from the Placeholder and Camera transformations.
Commonly it would be a QtQuick element and should be used as
| QQuickItem *target = view->rootItem();
Kuesa::Qt3D::PlaceholderTracker *placeholderTracker = new Kuesa::Qt3D::PlaceholderTracker();
placeholder->setName(QStringLiteral("placeholder"));
placeholder->setScreenSize({view.width(), view.height()});
placeholder->setTarget(target);
|
property x
Holds the top left x screen position coordinate computed from the placeholder.
property y
Holds the top left y screen position coordinate computed from the placeholder.
property width
Holds the width in screen coordinates computed from the placeholder.
property height
Holds the height in screen coordinates computed from the placeholder.
property screenPosition
Holds the screenPosition computed from the placeholder.
Updated on 2023-07-03 at 11:02:09 +0000