| 1 |
// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import Qt3D.Core 2.0 |
| 5 |
import Qt3D.Render 2.0 |
| 6 |
import Qt3D.Input 2.0 |
| 7 |
import Qt3D.Extras 2.0 |
| 8 |
|
| 9 |
Entity { |
| 10 |
id: root |
| 11 |
|
| 12 |
components: [ |
| 13 |
RenderSettings { |
| 14 |
ForwardRenderer { |
| 15 |
camera: basicCamera |
| 16 |
clearColor: "black" |
| 17 |
// Note: FrustumCulling should be disabled for proper rendering of the Skybox |
| 18 |
frustumCulling: false |
| 19 |
} |
| 20 |
}, |
| 21 |
// Event Source will be set by the Qt3DQuickWindow |
| 22 |
InputSettings { } |
| 23 |
] |
| 24 |
|
| 25 |
Camera { |
| 26 |
id: basicCamera |
| 27 |
projectionType: CameraLens.PerspectiveProjection |
| 28 |
fieldOfView: 60 |
| 29 |
aspectRatio: 16/9 |
| 30 |
nearPlane: 0.01 |
| 31 |
farPlane: 1000.0 |
| 32 |
position: Qt.vector3d( 0.0, 0.0, 40.0 ) |
| 33 |
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) |
| 34 |
upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) |
| 35 |
} |
| 36 |
|
| 37 |
// So that the camera is rendered always at the same position as the camera |
| 38 |
SkyboxEntity { |
| 39 |
baseName: "qrc:/assets/cubemaps/miramar/miramar" |
| 40 |
extension: ".webp" |
| 41 |
} |
| 42 |
|
| 43 |
FirstPersonCameraController { camera: basicCamera } |
| 44 |
|
| 45 |
Entity { |
| 46 |
components: [ |
| 47 |
SphereMesh { radius: 5 }, |
| 48 |
PhongMaterial { diffuse: "dodgerblue" } |
| 49 |
] |
| 50 |
} |
| 51 |
} |
| 52 |
|