summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-08-10 13:59:02 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-08-14 19:51:49 +0000
commitf452d7bb847388325a3f6830eb72c68bbd1a1f1c (patch)
tree2cddf0e24c1a24e02574d51ab1d63fd247925c2f /examples
parentf2dac6a0b0c4be1a95dca352a72844f649b934e4 (diff)
Introduce Studio3DEngine and Layer3D
...and the ImGui integration for Qt Quick since in the new world Qt 3D is not used to create the final, composited image and therefore the profile ui must be moved over to be rendered by Qt Quick. Each Layer3D has hard-coded content for now (a camera, a light, and a sphere model). The new types are marked as internal for the time being. Change-Id: I9cc7cff4d8252f6dbd344fc972fef31f0db6da73 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/3dstudioruntime2/3dstudioruntime2.pro3
-rw-r--r--examples/3dstudioruntime2/pureqml3d/main.cpp74
-rw-r--r--examples/3dstudioruntime2/pureqml3d/main.qml88
-rw-r--r--examples/3dstudioruntime2/pureqml3d/pureqml3d.pro14
-rw-r--r--examples/3dstudioruntime2/pureqml3d/pureqml3d.qrc5
5 files changed, 183 insertions, 1 deletions
diff --git a/examples/3dstudioruntime2/3dstudioruntime2.pro b/examples/3dstudioruntime2/3dstudioruntime2.pro
index 37e384d..71cf65c 100644
--- a/examples/3dstudioruntime2/3dstudioruntime2.pro
+++ b/examples/3dstudioruntime2/3dstudioruntime2.pro
@@ -7,7 +7,8 @@ SUBDIRS += \
qtHaveModule(quick) {
SUBDIRS += simpleqml \
qmldatainput \
- layersinquick
+ layersinquick \
+ pureqml3d
}
qtHaveModule(widgets) {
diff --git a/examples/3dstudioruntime2/pureqml3d/main.cpp b/examples/3dstudioruntime2/pureqml3d/main.cpp
new file mode 100644
index 0000000..38f98e0
--- /dev/null
+++ b/examples/3dstudioruntime2/pureqml3d/main.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQuickView>
+#include <q3dsruntimeglobal.h>
+
+int main(int argc, char *argv[])
+{
+ qputenv("QSG_INFO", "1");
+ QGuiApplication app(argc, argv);
+
+ // Use the ideal format (i.e. OpenGL version and profile) recommended by
+ // the Qt 3D Studio runtime. Without this the format set on the QQuickView
+ // would be used instead.
+ QSurfaceFormat::setDefaultFormat(Q3DS::surfaceFormat());
+
+ QQuickView viewer;
+ viewer.setSource(QUrl("qrc:/main.qml"));
+
+ viewer.setTitle(QStringLiteral("Qt 3D Studio Pure QML Example"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.resize(1280, 720);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/3dstudioruntime2/pureqml3d/main.qml b/examples/3dstudioruntime2/pureqml3d/main.qml
new file mode 100644
index 0000000..c747d9f
--- /dev/null
+++ b/examples/3dstudioruntime2/pureqml3d/main.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtStudio3D 2.1
+import QtQuick.Controls 2.2
+import QtQuick.Layouts 1.0
+
+Rectangle {
+ id: root
+ color: "lightGray"
+
+ Studio3DEngine {
+ id: s3d
+ }
+
+ RowLayout {
+ width: parent.width
+ Repeater {
+ model: 4
+ Rectangle {
+ border.color: "black"
+ border.width: 4
+ color: "transparent"
+ width: 320
+ height: 200
+
+ Layer3D {
+ engine: s3d
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+
+
+ Studio3DProfiler {
+ anchors.fill: parent
+ focus: true
+ }
+}
diff --git a/examples/3dstudioruntime2/pureqml3d/pureqml3d.pro b/examples/3dstudioruntime2/pureqml3d/pureqml3d.pro
new file mode 100644
index 0000000..fcc798b
--- /dev/null
+++ b/examples/3dstudioruntime2/pureqml3d/pureqml3d.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+
+QT += quick 3dstudioruntime2
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += pureqml3d.qrc
+
+OTHER_FILES += \
+ main.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/3dstudioruntime2/$$TARGET
+INSTALLS += target
diff --git a/examples/3dstudioruntime2/pureqml3d/pureqml3d.qrc b/examples/3dstudioruntime2/pureqml3d/pureqml3d.qrc
new file mode 100644
index 0000000..5f6483a
--- /dev/null
+++ b/examples/3dstudioruntime2/pureqml3d/pureqml3d.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>