 
					简单 演示如何在 Qt 3D 渲染场景。
要运行范例从 Qt Creator ,打开 欢迎 模式,然后选择范例从 范例 。更多信息,拜访 构建和运行范例 .
我们设置整个场景在 main.qml 文件。
To be able to use the types in the Q3D and Q3D Render modules, we must import the modules:
import Qt3D.Core 2.0 import Qt3D.Render 2.0
创建第一个实体 Camera , which represents the camera used for the final rendering, and a camera controller, which allows us to control this camera using the keyboard or the mouse:
    Camera {
        id: camera
        projectionType: CameraLens.PerspectiveProjection
        fieldOfView: 45
        aspectRatio: 16/9
        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 )
    }
    OrbitCameraController {
        camera: camera
    }
					
					A RenderSettings entity specifies a ForwardRenderer as the active framegraph:
    components: [
        RenderSettings {
            activeFrameGraph: ForwardRenderer {
                clearColor: Qt.rgba(0, 0.5, 1, 1)
                camera: camera
            }
        },
					
					The event source is set by the Qt3DQuickWindow:
        InputSettings { }
					
					
					
					在 CameraController.qml file, we use the LogicalDevice type to define a set of actions and axes to use within the application:
    LogicalDevice {
        id: cameraControlDevice
        actions: [
            Action {
                name: "LMB"
                inputs: [
                    ActionInput {
                        sourceDevice: mouseSourceDevice
                        buttons: [MouseEvent.LeftButton]
    ...
        axes: [
            // Rotation
            Axis {
                name: "RX"
                inputs: [
                    AnalogAxisInput {
                        sourceDevice: mouseSourceDevice
                        axis: MouseDevice.X
                    }
                ]
    ...
					
					文件: