IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Qt 3D: Scene3D QML Example

A QML application that demonstrates visualizing a 3D scene.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Qt 3D: Scene3D QML Example▲

Image non disponible

This example demonstrates visualizing a 3D scene from a Qt Quick application. The 3D scene contains a single active camera and a single active light source. Visualized data is assumed to be at a fixed location.

Running the Example▲

To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.

Visualizing 3D Scenes▲

We set up the 3D scene and specify the entity to animate in main.qml:

 
Sélectionnez
        Scene3D {
            id: scene3d
            anchors.fill: parent
            anchors.margins: 10
            focus: true
            aspects: ["input", "logic"]
            cameraAspectRatioMode: Scene3D.AutomaticAspectRatio

            AnimatedEntity {
                id: rootEntity
            }
        }

We specify the active camera in scene3d/AnimatedEntity.qml:

 
Sélectionnez
    Camera {
        id: camera
        projectionType: CameraLens.PerspectiveProjection
        fieldOfView: 45
        nearPlane : 0.1
        farPlane : 1000.0
        position: Qt.vector3d( 0.0, 0.0, 40.0 )
        upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
        viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
    }

Example project▲

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+