Kuesa Runtime

PlaceholderTracker QML Type

PlaceholderTracker allows watching a placeholder for changes and computing a screen position changes given a window size and a camera. More...

Since: Kuesa 1.3
Instantiates: PlaceholderTracker

Properties

Detailed Description

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::Placeholder facing the camera to screen space. setting the x, y, width and height properties of a target QObject to match the projected rectangle

 Item {
     id: uiTarget
 }

 ...

 SceneEntity {
     id: sceneEntity

     Camera {
         id: camera
     }

     PlaceholderTracker {
         name: "MyPlaceholder"
         camera: camera
         screenSize: Qt.size(512, 512)
         target: uiTarget
     }
 }

Read more about Kuesa Placeholders.

See also Kuesa::Placeholder.

Property Documentation

camera : Qt3DCore.Entity

Holds the camera the tracker is facing and which is used to project the plane to screen space.

 Rectangle {
     id: rect
 }

 Kuesa.Asset {
     id: mainCamera
     collection: scene.cameras
     name: "Camera_Orientation"
 }

 PlaceholderTracker {
     name: "MyPlaceholder"
     camera: camera
     screenSize: Qt.size(512, 512)
     target: uiTarget
 }

Note: using a camera for the tracker different than the one being used for the render might give unexpected results.


height : real

Holds the height in screen coordinates computed from the placeholder.


name : string

Holds the name of the Placeholder instance to retrieve from the SceneEntity.


screenPosition : real

Holds the screenPosition computed from the placeholder.


screenSize : size

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.


target : QtObject

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

 Rectangle {
     id: rect
 }

 PlaceholderTracker {
     name: "MyPlaceholder"
     camera: camera
     screenSize: Qt.size(512, 512)
     target: uiTarget
 }

viewportRect : rect

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


width : real

Holds the width in screen coordinates computed from the placeholder.


x : real

Holds the top left x screen position coordinate computed from the placeholder.


y : real

Holds the top left y screen position coordinate computed from the placeholder.