summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/materials
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/materials')
-rw-r--r--examples/qt3d/materials/Barrel.qml72
-rw-r--r--examples/qt3d/materials/BasicCamera.qml52
-rw-r--r--examples/qt3d/materials/Chest.qml60
-rw-r--r--examples/qt3d/materials/HousePlant.qml82
-rw-r--r--examples/qt3d/materials/PlaneEntity.qml66
-rw-r--r--examples/qt3d/materials/RenderableEntity.qml64
-rw-r--r--examples/qt3d/materials/SortedForwardRenderer.qml72
-rw-r--r--examples/qt3d/materials/TrefoilKnot.qml65
-rw-r--r--examples/qt3d/materials/main.cpp70
-rw-r--r--examples/qt3d/materials/main.qml187
-rw-r--r--examples/qt3d/materials/materials.pro18
-rw-r--r--examples/qt3d/materials/materials.qrc13
12 files changed, 821 insertions, 0 deletions
diff --git a/examples/qt3d/materials/Barrel.qml b/examples/qt3d/materials/Barrel.qml
new file mode 100644
index 000000000..1dcec0ca1
--- /dev/null
+++ b/examples/qt3d/materials/Barrel.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property string diffuseColor: "red"
+ property string bump: "no_bumps"
+ property string specular: ""
+
+ property alias x: barrel.x
+ property alias y: barrel.y
+ property alias z: barrel.z
+ property alias shininess: material.shininess
+ property real scale: 1.0
+
+ RenderableEntity {
+ id: barrel
+ source: "assets/metalbarrel/metal_barrel.obj"
+ scale: 0.03 * root.scale
+
+ material: NormalDiffuseSpecularMapMaterial {
+ id: material
+ diffuse: "assets/metalbarrel/diffus_" + root.diffuseColor + ".webp"
+ normal: "assets/metalbarrel/normal_" + root.bump + ".webp"
+ specular: {
+ if (root.specular !== "" )
+ return "assets/metalbarrel/specular_" + root.specular + ".webp"
+ else
+ return "assets/metalbarrel/specular.webp"
+ }
+
+ shininess: 10.0
+ }
+ }
+}
diff --git a/examples/qt3d/materials/BasicCamera.qml b/examples/qt3d/materials/BasicCamera.qml
new file mode 100644
index 000000000..f96132416
--- /dev/null
+++ b/examples/qt3d/materials/BasicCamera.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Camera {
+ id: mainCamera
+ objectName: "mainCamera"
+
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 22.5
+ aspectRatio: _window.width / _window.height
+ onAspectRatioChanged: console.log( "aspectRatio = " + aspectRatio )
+ nearPlane: 0.01
+ farPlane: 1000.0
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+}
diff --git a/examples/qt3d/materials/Chest.qml b/examples/qt3d/materials/Chest.qml
new file mode 100644
index 000000000..1acd126ff
--- /dev/null
+++ b/examples/qt3d/materials/Chest.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property alias x: chest.x
+ property alias y: chest.y
+ property alias z: chest.z
+ property real scale: 1.0
+
+ RenderableEntity {
+ id: chest
+ source: "assets/chest/Chest.obj"
+ scale: 0.03 * root.scale
+
+ material: DiffuseMapMaterial {
+ id: material
+ diffuse: "assets/chest/diffuse.webp"
+ specular: Qt.rgba( 0.2, 0.2, 0.2, 1.0 )
+ shininess: 2.0
+ }
+ }
+}
diff --git a/examples/qt3d/materials/HousePlant.qml b/examples/qt3d/materials/HousePlant.qml
new file mode 100644
index 000000000..353a252d2
--- /dev/null
+++ b/examples/qt3d/materials/HousePlant.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property string potShape: "cross"
+ property string plantType: "bamboo"
+
+ property alias x: pot.x
+ property alias y: pot.y
+ property alias z: pot.z
+ property real scale: 1.0
+
+ RenderableEntity {
+ id: pot
+ source: "assets/houseplants/" + root.potShape + "-pot.obj"
+ scale: 0.03 * root.scale
+
+ material: NormalDiffuseMapMaterial {
+ diffuse: "assets/houseplants/pot.webp"
+ normal: "assets/houseplants/pot_normal.webp"
+ specular: Qt.rgba( 0.75, 0.75, 0.75, 1.0 )
+ shininess: 10.0
+ }
+
+ RenderableEntity {
+ source: "assets/houseplants/" + root.potShape + "-" + root.plantType + ".obj"
+ material: NormalDiffuseMapAlphaMaterial {
+ diffuse: "assets/houseplants/" + root.plantType + ".webp"
+ normal: "assets/houseplants/" + root.plantType + "_normal.webp"
+ shininess: 10.0
+ }
+ }
+
+ RenderableEntity {
+ source: "assets/houseplants/" + root.potShape + "-pot-cover.obj"
+ material: NormalDiffuseMapMaterial {
+ diffuse: "assets/houseplants/cover.webp"
+ normal: "assets/houseplants/cover_normal.webp"
+ specular: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ shininess: 5.0
+ }
+ }
+ }
+}
diff --git a/examples/qt3d/materials/PlaneEntity.qml b/examples/qt3d/materials/PlaneEntity.qml
new file mode 100644
index 000000000..222b5a33b
--- /dev/null
+++ b/examples/qt3d/materials/PlaneEntity.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property alias x: translateTransform.dx
+ property alias y: translateTransform.dy
+ property alias z: translateTransform.dz
+ property alias scale: scaleTransform.scale
+ property alias width: mesh.width
+ property alias height: mesh.height
+ property alias resolution: mesh.meshResolution
+ property Material material
+
+ components: [ transform, mesh, root.material ]
+
+ Transform {
+ id: transform
+ Translate { id: translateTransform }
+ Scale { id: scaleTransform }
+ }
+
+ PlaneMesh {
+ id: mesh
+ width: 1.0
+ height: 1.0
+ meshResolution: Qt.size(2, 2)
+ }
+}
diff --git a/examples/qt3d/materials/RenderableEntity.qml b/examples/qt3d/materials/RenderableEntity.qml
new file mode 100644
index 000000000..03119b713
--- /dev/null
+++ b/examples/qt3d/materials/RenderableEntity.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property alias x: translateTransform.dx
+ property alias y: translateTransform.dy
+ property alias z: translateTransform.dz
+ property alias scale: scaleTransform.scale
+ property alias rotationAngle: rotateTransform.angle
+ property alias rotationAxis: rotateTransform.axis
+ property alias source: mesh.source
+ property Material material
+
+ components: [ transform, mesh, root.material ]
+
+ Transform {
+ id: transform
+ Rotate { id: rotateTransform }
+ Scale { id: scaleTransform }
+ Translate { id: translateTransform }
+ }
+
+ Mesh {
+ id: mesh
+ }
+}
diff --git a/examples/qt3d/materials/SortedForwardRenderer.qml b/examples/qt3d/materials/SortedForwardRenderer.qml
new file mode 100644
index 000000000..0687785fb
--- /dev/null
+++ b/examples/qt3d/materials/SortedForwardRenderer.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+TechniqueFilter {
+ id: root
+ objectName : "techniqueFilter"
+
+ // Expose camera to allow user to choose which camera to use for rendering
+ property alias camera: cameraSelector.camera
+
+ // Select the forward rendering Technique of any used Effect
+ requires: [ Annotation { name: "renderingStyle"; value: "forward" } ]
+
+ // Use the whole viewport
+ Viewport {
+ id: viewport
+ objectName : "viewport"
+ rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+ clearColor: "white"
+
+ // Use the specified camera
+ CameraSelector {
+ id : cameraSelector
+ objectName : "cameraSelector"
+ ClearBuffer {
+ buffers : ClearBuffer.ColorDepthBuffer
+ SortMethod {
+ criteria: [
+ SortCriterion { sort: SortCriterion.StateChangeCost },
+ SortCriterion { sort: SortCriterion.Material }
+ ]
+ }
+ }
+ }
+ }
+}
diff --git a/examples/qt3d/materials/TrefoilKnot.qml b/examples/qt3d/materials/TrefoilKnot.qml
new file mode 100644
index 000000000..48b334ce0
--- /dev/null
+++ b/examples/qt3d/materials/TrefoilKnot.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property real x: 0.0
+ property real y: 0.0
+ property real z: 0.0
+ property real scale: 1.0
+ property real theta: 0.0
+ property real phi: 0.0
+ property Material material
+
+ components: [ transform, mesh, root.material ]
+
+ Transform {
+ id: transform
+ Scale { scale: root.scale }
+ Rotate{ angle: root.theta; axis: Qt.vector3d(1.0, 0.0, 0.0) }
+ Rotate{ angle: root.phi; axis: Qt.vector3d(0.0, 1.0, 0.0) }
+ Translate { dx: root.x; dy: root.y; dz: root.z }
+ }
+
+ Mesh {
+ id: mesh
+ source: "assets/obj/trefoil.obj"
+ }
+}
diff --git a/examples/qt3d/materials/main.cpp b/examples/qt3d/materials/main.cpp
new file mode 100644
index 000000000..20b518734
--- /dev/null
+++ b/examples/qt3d/materials/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DCore/window.h>
+#include <Qt3DRenderer/qrenderaspect.h>
+#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuick/QQmlAspectEngine>
+
+#include <exampleresources.h>
+
+#include <QGuiApplication>
+#include <QtQml>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ initializeAssetResources("../exampleresources/example-assets.qrb");
+
+ Qt3D::Window view;
+ Qt3D::Quick::QQmlAspectEngine engine;
+
+ engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect());
+ engine.aspectEngine()->registerAspect(new Qt3D::QInputAspect());
+ engine.aspectEngine()->initialize();
+ QVariantMap data;
+ data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
+ data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
+
+ engine.aspectEngine()->setData(data);
+ // Expose the window as a context property so we can set the aspect ratio
+ engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ engine.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/qt3d/materials/main.qml b/examples/qt3d/materials/main.qml
new file mode 100644
index 000000000..cceac110b
--- /dev/null
+++ b/examples/qt3d/materials/main.qml
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 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:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+import QtQuick 2.1 as QQ2
+
+Entity {
+ id: root
+ objectName: "root"
+
+ // Use the renderer configuration specified in ForwardRenderer.qml
+ // and render from the mainCamera
+ components: [
+ FrameGraph {
+ activeFrameGraph: SortedForwardRenderer {
+ id: renderer
+ camera: mainCamera
+ }
+ }
+ ]
+
+ BasicCamera {
+ id: mainCamera
+ position: Qt.vector3d( 0.0, 3.5, 25.0 )
+ viewCenter: Qt.vector3d( 0.0, 3.5, 0.0 )
+ }
+
+ Configuration {
+ controlledCamera: mainCamera
+ }
+
+ PhongMaterial {
+ id: redAdsMaterial
+ ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )
+ diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )
+ }
+
+ PlaneEntity {
+ id: floor
+
+ width: 100
+ height: 100
+ resolution: Qt.size(20, 20)
+
+ material: NormalDiffuseSpecularMapMaterial {
+ ambient: Qt.rgba( 0.2, 0.2, 0.2, 1.0 )
+ diffuse: "assets/textures/pattern_09/diffuse.webp"
+ specular: "assets/textures/pattern_09/specular.webp"
+ normal: "assets/textures/pattern_09/normal.webp"
+ textureScale: 10.0
+ shininess: 80.0
+ }
+ }
+
+ TrefoilKnot {
+ id: trefoilKnot
+ material: redAdsMaterial
+ y: 3.5
+ scale: 0.5
+
+ QQ2.ParallelAnimation {
+ loops: QQ2.Animation.Infinite
+ running: true
+
+ QQ2.NumberAnimation {
+ target: trefoilKnot
+ property: "theta"
+ from: 0; to: 360
+ duration: 2000
+ }
+
+ QQ2.NumberAnimation {
+ target: trefoilKnot
+ property: "phi"
+ from: 0; to: 360
+ duration: 2000
+ }
+ }
+ }
+
+ Chest {
+ x: -8
+ }
+
+ HousePlant {
+ x: 4
+ potShape: "square"
+ plantType: "bamboo"
+ }
+
+ HousePlant {
+ z: 4
+ potShape: "triangle"
+ plantType: "palm"
+ }
+
+ HousePlant {
+ x: -4
+ potShape: "sphere"
+ plantType: "pine"
+ }
+
+ HousePlant {
+ z: -4
+ potShape: "cross"
+ plantType: "spikes"
+ }
+
+ HousePlant {
+ z: -8
+ potShape: "cross"
+ plantType: "palm"
+ scale: 1.15
+ }
+
+ HousePlant {
+ z: 8
+ potShape: "cross"
+ plantType: "shrub"
+ scale: 1.15
+ }
+
+ Barrel {
+ x: 8
+ }
+
+ Barrel {
+ x: 10
+ diffuseColor: "rust"
+ bump: "hard_bumps"
+ specular: "rust"
+ }
+
+ Barrel {
+ x: 12
+ diffuseColor: "blue"
+ bump: "middle_bumps"
+ }
+
+ Barrel {
+ x: 14
+ diffuseColor: "green"
+ bump: "soft_bumps"
+ }
+
+ Barrel {
+ x: 16
+ diffuseColor: "stainless_steel"
+ bump: "no_bumps"
+ specular: "stainless_steel"
+ shininess: 150
+ }
+}
diff --git a/examples/qt3d/materials/materials.pro b/examples/qt3d/materials/materials.pro
new file mode 100644
index 000000000..23d4d38a8
--- /dev/null
+++ b/examples/qt3d/materials/materials.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+
+QT += 3dcore 3drenderer 3dinput 3dquick qml quick
+
+include("../exampleresources/exampleresources.pri")
+
+HEADERS += \
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ *.qml \
+ HousePlant.qml
+
+RESOURCES += \
+ materials.qrc
diff --git a/examples/qt3d/materials/materials.qrc b/examples/qt3d/materials/materials.qrc
new file mode 100644
index 000000000..417653df9
--- /dev/null
+++ b/examples/qt3d/materials/materials.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>BasicCamera.qml</file>
+ <file>TrefoilKnot.qml</file>
+ <file>PlaneEntity.qml</file>
+ <file>RenderableEntity.qml</file>
+ <file>HousePlant.qml</file>
+ <file>Barrel.qml</file>
+ <file>Chest.qml</file>
+ <file>SortedForwardRenderer.qml</file>
+ </qresource>
+</RCC>