summaryrefslogtreecommitdiffstats
path: root/examples/skybox/main.qml
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-01-27 15:49:53 +0100
committerPaul Lemire <paul.lemire@kdab.com>2015-02-08 08:40:01 +0000
commitf49cabe35cbd89bd4e5a0e91100a96afdb5d8401 (patch)
treec14bd25c03032abca97c8f0a5bf794a8b014eb7c /examples/skybox/main.qml
parenta550af57b5ce066e257697a38dd5c2bac40f89d4 (diff)
Skybox example
Demonstrate the use of a CubeMapTexture Note: cubemap textures added to the example resources assets as webp Change-Id: I68256c204c3ccde7a4cc744238135dbd9b317198 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/skybox/main.qml')
-rw-r--r--examples/skybox/main.qml83
1 files changed, 83 insertions, 0 deletions
diff --git a/examples/skybox/main.qml b/examples/skybox/main.qml
new file mode 100644
index 000000000..c8e0e2ded
--- /dev/null
+++ b/examples/skybox/main.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ components: FrameGraph {
+ ForwardRenderer {
+ camera: basicCamera
+ clearColor: "black"
+ }
+ }
+
+ Camera {
+ id: basicCamera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 60
+ aspectRatio: 16/9
+ nearPlane: 0.01
+ farPlane: 1000.0
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ position: Qt.vector3d( 0.0, 0.0, -40.0 )
+ }
+
+ // So that the camera is rendered always at the same position as the camera
+ Skybox {
+ cameraPosition: basicCamera.position
+ }
+
+ Configuration {
+ controlledCamera: basicCamera
+ }
+
+ Entity {
+ components: [
+ SphereMesh { radius: 5 },
+ PhongMaterial { diffuse: "dodgerblue" }
+ ]
+ }
+}
+