Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

BillboardTransform

The BillboardTransform item implements a transformation that causes objects to face the camera. More...

Inherits QtObject

BillboardTransform instantiates the C++ class QGraphicsBillboardTransform

This type was introduced in Qt 4.8.

Properties

Detailed Description

Sometimes it can be useful to make an object face towards the camera no matter what orientation the scene is in. The common name for this technique is "billboarding".

When applied as a transformation, this class will replace the top-left 3x3 part of the transformation matrix with the identity. This has the effect of removing the rotation and scale components from the current world co-ordinate orientation. In QML, this can be used as follows to orient a pane to point towards the viewer:

 Item3D {
     mesh: Mesh { source: "pane.obj" }
     position: Qt.vector3d(2, 0, -20)
     transform: BillboardTransform {}
     effect: Effect { texture: "picture.jpg" }
 }

Because the billboard transformation will strip any further alterations to the matrix, it will usually be the last element in the transform list (transformations are applied to the matrix in reverse order of their appearance in transform):

 Item3D {
     mesh: Mesh { source: "pane.obj" }
     position: Qt.vector3d(2, 0, -20)
     transform: [
         Scale3D { scale: 0.5 },
         Rotation3D { angle: 30 },
         BillboardTransform {}
     ]
     effect: Effect { texture: "picture.jpg" }
 }

The scale property is applied to the matrix after transform has performed the billboard transformation, so the above can also be written as follows:

 Item3D {
     mesh: Mesh { source: "pane.obj" }
     position: Qt.vector3d(2, 0, -20)
     scale: 0.5
     transform: [
         Rotation3D { angle: 30 },
         BillboardTransform {}
     ]
     effect: Effect { texture: "picture.jpg" }
 }

By default the billboard transform will cause the object to face directly at the camera no matter how the world co-ordinate system is rotated. Sometimes the billboard needs to stay at right angles to the "ground plane" even if the user's viewpoint is elevated. This behavior can be enabled using the preserveUpVector property:

 Pane {
     position: Qt.vector3d(2, 0, -20)
     transform: BillboardTransform { preserveUpVector: true }
     effect: Effect { texture: "picture.jpg" }
 }

Property Documentation

preserveUpVector : bool

This property specifies whether the billboard transform should preserve the "up vector" so that objects stay at right angles to the ground plane in the scene.

The default value for this property is false, which indicates that the object being transformed should always face directly to the camera This is also known as a "spherical billboard".

If the value for this property is true, then the object will have its up orientation preserved. This is also known as a "cylindrical billboard".


Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web