From cf414143caa139d43940da0d36290b1f3e8c52cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Kera=CC=88nen?= Date: Tue, 4 Jun 2019 07:44:46 +0300 Subject: Add examples from runtime 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QT3DS-3599 Change-Id: I6339156f184c9f34f461bb0097404f4e680d1c7d Reviewed-by: Miikka Heikkinen Reviewed-by: Janne Kangas Reviewed-by: Tomi Korpipää --- .../examples/cppdatainput/cppdatainput.pro | 11 + .../ogl-runtime/examples/cppdatainput/main.cpp | 137 ++++++++++ .../cppdatainput/presentation/datainput.uia | 17 ++ .../cppdatainput/presentation/datainput.uip | 45 ++++ .../ogl-runtime/examples/cppdatainput/res.qrc | 6 + src/Runtime/ogl-runtime/examples/examples.pro | 9 + .../qmldatainput/doc/images/qmldatainput.png | Bin 0 -> 163178 bytes .../qmldatainput/doc/src/qmldatainput.qdoc | 55 ++++ .../ogl-runtime/examples/qmldatainput/main.cpp | 79 ++++++ .../examples/qmldatainput/presentation/Paper05.png | Bin 0 -> 321820 bytes .../qmldatainput/presentation/datainput.uia | 22 ++ .../qmldatainput/presentation/datainput.uip | 66 +++++ .../presentation/fonts/TitilliumWeb-Regular.ttf | Bin 0 -> 63752 bytes .../qmldatainput/qml/qmldatainput/main.qml | 211 +++++++++++++++ .../examples/qmldatainput/qmldatainput.pro | 20 ++ .../examples/qmldatainput/qmldatainput.qrc | 8 + .../examples/simpleqml/doc/images/simpleqml.png | Bin 0 -> 405882 bytes .../examples/simpleqml/doc/src/simpleqml.qdoc | 51 ++++ .../ogl-runtime/examples/simpleqml/main.cpp | 75 ++++++ .../ogl-runtime/examples/simpleqml/main.qml | 284 +++++++++++++++++++++ .../examples/simpleqml/presentation/barrel.uia | 16 ++ .../examples/simpleqml/presentation/barrel.uip | 58 +++++ .../simpleqml/presentation/barrel/barrel.import | 18 ++ .../presentation/barrel/meshes/Barrel.mesh | Bin 0 -> 280864 bytes .../presentation/barrel_no_background.uip | 56 ++++ .../simpleqml/presentation/fonts/Arimo-Regular.ttf | Bin 0 -> 43616 bytes .../presentation/maps/barrel_barrel_Diffuse.png | Bin 0 -> 789475 bytes .../presentation/maps/barrel_barrel_Emissive.png | Bin 0 -> 3150 bytes .../presentation/maps/barrel_barrel_Normal.png | Bin 0 -> 721686 bytes .../presentation/maps/barrel_barrel_Specular.png | Bin 0 -> 195862 bytes .../ogl-runtime/examples/simpleqml/simpleqml.pro | 16 ++ .../ogl-runtime/examples/simpleqml/simpleqml.qrc | 14 + src/Runtime/ogl-runtime/ogl-runtime.pro | 3 +- 33 files changed, 1276 insertions(+), 1 deletion(-) create mode 100644 src/Runtime/ogl-runtime/examples/cppdatainput/cppdatainput.pro create mode 100644 src/Runtime/ogl-runtime/examples/cppdatainput/main.cpp create mode 100644 src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uia create mode 100644 src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uip create mode 100644 src/Runtime/ogl-runtime/examples/cppdatainput/res.qrc create mode 100644 src/Runtime/ogl-runtime/examples/examples.pro create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/doc/images/qmldatainput.png create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/doc/src/qmldatainput.qdoc create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/main.cpp create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/presentation/Paper05.png create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uia create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uip create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/qml/qmldatainput/main.qml create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.pro create mode 100644 src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.qrc create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/doc/images/simpleqml.png create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/doc/src/simpleqml.qdoc create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/main.cpp create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/main.qml create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uia create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uip create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/barrel.import create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/meshes/Barrel.mesh create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel_no_background.uip create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/fonts/Arimo-Regular.ttf create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Diffuse.png create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Emissive.png create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Normal.png create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Specular.png create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.pro create mode 100644 src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.qrc diff --git a/src/Runtime/ogl-runtime/examples/cppdatainput/cppdatainput.pro b/src/Runtime/ogl-runtime/examples/cppdatainput/cppdatainput.pro new file mode 100644 index 00000000..20b5c685 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/cppdatainput/cppdatainput.pro @@ -0,0 +1,11 @@ +CONFIG += c++11 +QT += widgets qml quick studio3d + +target.path = $$[QT_INSTALL_EXAMPLES]/studio3d/$$TARGET +INSTALLS += target + +SOURCES += \ + main.cpp + +RESOURCES += \ + res.qrc diff --git a/src/Runtime/ogl-runtime/examples/cppdatainput/main.cpp b/src/Runtime/ogl-runtime/examples/cppdatainput/main.cpp new file mode 100644 index 00000000..d966a3a0 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/cppdatainput/main.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// Required for Ubuntu build +#include + +int main(int argc, char *argv[]) +{ + float colorRed = 0.0f; + int range = 0; + + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + 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()); + + QOpenGLContext context; + if (!context.create()) + qFatal("Failed to create OpenGL context"); + + QWindow window; + window.setSurfaceType(QSurface::OpenGLSurface); + window.setFormat(context.format()); + window.create(); + + Q3DSSurfaceViewer viewer; + QObject::connect(&viewer, &Q3DSSurfaceViewer::presentationLoaded, &viewer, [&] { + qDebug() << "Presentation loaded"; + }); + + QObject::connect(&viewer, &Q3DSSurfaceViewer::presentationReady, &viewer, [&] { + qDebug() << "Presentation ready"; + const auto diList = viewer.presentation()->dataInputs(); + for (const auto &it : diList) { + Q3DSDataInput *dynDi = it; + qDebug() << "Processing data input " << dynDi->name(); + if (dynDi->name().contains(QLatin1String("color"))) { + if (dynDi->isValid()) { + // Access metadata. + qDebug() << "Metadata: " << dynDi->metadata("metadata1"); + + QObject::connect(&viewer, &Q3DSSurfaceViewer::frameUpdate, + [&colorRed, dynDi] { + dynDi->setValue(QVector3D(colorRed, 0.5, 0.5)); + colorRed = std::fmod(colorRed + 0.001f, 1.0f); + }); + } + } else if (dynDi->name().contains(QLatin1String("range"))) { + qDebug() << "Found dynamic data input for range " << dynDi; + if (dynDi->isValid()) { + QObject::connect(&viewer, &Q3DSSurfaceViewer::frameUpdate, [&range, dynDi] { + dynDi->setValue((float)range); + range = (range + 1) % 360; + }); + } + } + } + auto diWithMetadata = viewer.presentation()->dataInputs("metadata1"); + qDebug() << "Datainputs with metadatakey metadata1: "; + for (auto &it : diWithMetadata) + qDebug() << it->name(); + }); + + viewer.presentation()->setSource(QUrl(QStringLiteral("qrc:presentation/datainput.uia"))); + viewer.setUpdateInterval(0); // enable automatic updates + + viewer.create(&window, &context); + + window.setTitle(QStringLiteral("Qt 3D Studio Example")); + window.resize(800, 480); + window.show(); + + return app.exec(); +} diff --git a/src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uia b/src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uia new file mode 100644 index 00000000..0c891219 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uia @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uip b/src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uip new file mode 100644 index 00000000..2dc85459 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/cppdatainput/presentation/datainput.uip @@ -0,0 +1,45 @@ + + + + + #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff + + + + + + + + + + + + + + + + + + + + + + + + + + 0 0 0 0 10 0 0 0 + 0 0 0 0 10 0 0 0 + 0 0 0 0 10 -360 0 0 + + + + + + + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/cppdatainput/res.qrc b/src/Runtime/ogl-runtime/examples/cppdatainput/res.qrc new file mode 100644 index 00000000..9beb456d --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/cppdatainput/res.qrc @@ -0,0 +1,6 @@ + + + presentation/datainput.uia + presentation/datainput.uip + + diff --git a/src/Runtime/ogl-runtime/examples/examples.pro b/src/Runtime/ogl-runtime/examples/examples.pro new file mode 100644 index 00000000..f51add1f --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/examples.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + cppdatainput + +qtHaveModule(quick) { + SUBDIRS += simpleqml \ + qmldatainput +} diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/doc/images/qmldatainput.png b/src/Runtime/ogl-runtime/examples/qmldatainput/doc/images/qmldatainput.png new file mode 100644 index 00000000..e0567ee2 Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/qmldatainput/doc/images/qmldatainput.png differ diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/doc/src/qmldatainput.qdoc b/src/Runtime/ogl-runtime/examples/qmldatainput/doc/src/qmldatainput.qdoc new file mode 100644 index 00000000..21eae9e3 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/doc/src/qmldatainput.qdoc @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qmldatainput + \title Qt 3D Studio Runtime: QML DataInput Example + \ingroup OpenGLRuntime-examples-qml + \brief Demonstrates using DataInput elements in QML. + + \image qmldatainput.png + + \e {This example demonstrates using DataInput elements with QML in Studio} + + \include examples-run.qdocinc + + \section1 Description + + The presentation consists of a static text element serving as a label and a rotating text + element for showing the input data as text. There is also a data input of type \e{Ranged Number} + in the presentation. This data input is used to control both the rotation animation time and + the text shown on the second text element. + The range is specified as [0 .. 360] in the presentation, where zero maps + to the beginning of the animation and 360 maps to the end of the animation. + + The \l {qmldatainput/qml/qmldatainput/main.qml}{qml main} loads the presentation and animates + a number property. The value of the animated property is bound to the + \l{DataInput::value}{value} property of the DataInput element, making the value show up in the + linked text element in the presentation. The same value is used to control the animation time: + + \snippet qmldatainput/qml/qmldatainput/main.qml 1 +*/ diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/main.cpp b/src/Runtime/ogl-runtime/examples/qmldatainput/main.cpp new file mode 100644 index 00000000..165cd89e --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/main.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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 +#include +#include +#ifdef USE_EMBEDDED_FONTS +#include +#include +#endif + +int main(int argc, char *argv[]) +{ + qputenv("QSG_INFO", "1"); + + QApplication 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:/qml/qmldatainput/main.qml")); + + viewer.setTitle(QStringLiteral("Qt 3D Studio Example")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.resize(1280, 720); + viewer.show(); + + return app.exec(); +} diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/Paper05.png b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/Paper05.png new file mode 100644 index 00000000..e70749db Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/Paper05.png differ diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uia b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uia new file mode 100644 index 00000000..30d0084c --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uia @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uip b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uip new file mode 100644 index 00000000..008f4562 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/datainput.uip @@ -0,0 +1,66 @@ + + + + + #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 0 0 0 10 0 0 0 + 0 0 0 0 10 0 0 0 + 0 0 0 0 10 -360 0 0 + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf new file mode 100644 index 00000000..6da82193 Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf differ diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/qml/qmldatainput/main.qml b/src/Runtime/ogl-runtime/examples/qmldatainput/qml/qmldatainput/main.qml new file mode 100644 index 00000000..ab50796d --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/qml/qmldatainput/main.qml @@ -0,0 +1,211 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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.7 +import QtStudio3D.OpenGL 2.4 + +Item { + id: mainview + width: 1280 + height: 768 + visible: true + + // Show the list of datainputs queried by Q3DSPresentation queried from Presentation + Column { + id : diColumn + opacity: 50 + z: 1 + + Text { text: "Datainputs"; color: "red"; bottomPadding: 5; } + + Repeater { + id: diList + height: childrenRect.height + + property var diObjList + + model: diObjList + + function updateModel() { + diObjList = studio3D.presentation.getDataInputs(); + + for (var i = 0; i < count; ++i) { + // Use dynamically queried datainput to set value. + if (diObjList[i].name === "queriedInput") { + console.log("Updating " + diObjList[i].name); + diObjList[i].value = "This text is controlled by " + diObjList[i].name; + } + } + } + + Text { + id: diItem + color: "white" + // Show the metadata keys available for this datainput and + // min-max range for datainput type Ranged Number + text: "name: " + modelData.name + + (modelData.max !== 0 ? "\n range min: " + modelData.min + + "\n range max: " + modelData.max + : "") + + " \n metadata keys: [" + modelData.metadataKeys() + "]" + font.pointSize: 6 + } + } + } + + Studio3D { + id: studio3D + anchors.fill: parent + height: 900 + width: 1280 + + property real inputNumber: 0 + property vector3d inputColorVec3: Qt.vector3d(0, 0, 0) + property vector3d inputCamRotVec3: Qt.vector3d(0, 0, 0) + property vector3d inputScaleVec3: Qt.vector3d(0, 0, 0) + property string inputString: "" + property variant inputVariant: 0 + + onPresentationLoaded: { + diList.updateModel(); + } + + // A changing property to demonstrate DataInput + NumberAnimation { + target: studio3D + property: "inputNumber" + duration: 20000 + from: 0 + to: 360 + loops: Animation.Infinite + running: true + } + Vector3dAnimation { + target: studio3D + property: "inputScaleVec3" + duration: 12000 + from: Qt.vector3d(0.3, 0.5, 0.5) + to: Qt.vector3d(4.0, 4.0, 1.0) + loops: Animation.Infinite + running: true + } + Vector3dAnimation { + target: studio3D + property: "inputColorVec3" + duration: 6000 + from: Qt.vector3d(0.1, 0.1, 0.3) + to: Qt.vector3d(1.0, 0.5, 1.0) + loops: Animation.Infinite + running: true + } + Vector3dAnimation { + target: studio3D + property: "inputCamRotVec3" + duration: 20000 + from: Qt.vector3d(-5, -5, 0.0) + to: Qt.vector3d(10.0, 10.1, 10.0) + loops: Animation.Infinite + running: true + } + NumberAnimation { + target: studio3D + property: "inputString" + duration: 20000 + from: 0 + to: 1 + loops: Animation.Infinite + running: true + } + NumberAnimation { + target: studio3D + property: "inputVariant" + duration: 5000 + from: 20 + to: 100 + loops: Animation.Infinite + running: true + } + + // Presentation item is used to control the presentation. + //![1] + Presentation { + id: presentation + + source: "qrc:/presentation/datainput.uia" + DataInput { + // Name must match the data input name specified in the presentation + name: "rangeInput" + value: studio3D.inputNumber + } + DataInput { + name: "scaleInput" + value: studio3D.inputScaleVec3 + } + DataInput { + name: "colorInput" + value: studio3D.inputColorVec3 + } + DataInput { + name: "cameraRotInput" + value: studio3D.inputCamRotVec3 + } + DataInput { + name: "stringInput" + value: studio3D.inputString + } + DataInput { + name: "variantInput" + value: studio3D.inputVariant + } + } + //![1] + } + +} diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.pro b/src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.pro new file mode 100644 index 00000000..9bafed53 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.pro @@ -0,0 +1,20 @@ +TEMPLATE = app + +QT += widgets qml quick studio3d + +integrity: DEFINES += USE_EMBEDDED_FONTS + +target.path = $$[QT_INSTALL_EXAMPLES]/studio3d/$$TARGET +INSTALLS += target + +SOURCES += main.cpp + +RESOURCES += \ + qmldatainput.qrc + +OTHER_FILES += qml/qmldatainput/* \ + doc/src/* \ + doc/images/* + +# Icon in case example is included in installer +exists(example.ico): RC_ICONS = example.ico diff --git a/src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.qrc b/src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.qrc new file mode 100644 index 00000000..97aaeaa1 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/qmldatainput/qmldatainput.qrc @@ -0,0 +1,8 @@ + + + qml/qmldatainput/main.qml + presentation/datainput.uia + presentation/datainput.uip + presentation/Paper05.png + + diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/doc/images/simpleqml.png b/src/Runtime/ogl-runtime/examples/simpleqml/doc/images/simpleqml.png new file mode 100644 index 00000000..73d92075 Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/doc/images/simpleqml.png differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/doc/src/simpleqml.qdoc b/src/Runtime/ogl-runtime/examples/simpleqml/doc/src/simpleqml.qdoc new file mode 100644 index 00000000..a7dcec74 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/doc/src/simpleqml.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example simpleqml + \title Qt 3D Studio Runtime: Simple QML Example + \ingroup OpenGLRuntime-examples-qml + \brief Demonstrates using the Studio3D element in a Qt Quick application. + + \image simpleqml.png + + \e {This example demonstrates basic usage of the Studio3D element in Qt Quick applications} + + \include examples-run.qdocinc + + \section1 Description + + This example consists of a simple C++ main() function that sets up + a QQuickView and a QML scene demonstrating the usage of the \l + Studio3D, \l Presentation, \l DataInput, \l SceneElement, and \l + Element QML types. + + Besides displaying the presentation designed in the Qt 3D Studio + application, a few simple cases of interacting with the scene + (such as, changing 3D object properties via data input, changing + slides, controlling the timeline) are also demonstrated. +*/ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/main.cpp b/src/Runtime/ogl-runtime/examples/simpleqml/main.cpp new file mode 100644 index 00000000..f2640b52 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/main.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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 // for MessageDialog +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + qputenv("QSG_INFO", "1"); + QApplication 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 Example")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.resize(1280, 720); + viewer.show(); + + return app.exec(); +} diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/main.qml b/src/Runtime/ogl-runtime/examples/simpleqml/main.qml new file mode 100644 index 00000000..06321a7c --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/main.qml @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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.OpenGL 2.4 +import QtQuick.Window 2.3 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import Qt.labs.platform 1.0 + +Rectangle { + id: root + color: "lightGray" + + MessageDialog { + id: errorDialog + } + + Studio3D { + id: s3d + focus: true + anchors.margins: 60 + anchors.fill: parent + property string textValue: "hello world" + + Presentation { + id: s3dpres + source: "qrc:/presentation/barrel.uip" + onCustomSignalEmitted: customSignalName.text = Date.now() + ": " + name + onSlideEntered: slideEnter.text = "Entered slide " + name + "(index " + index + ") on " + elementPath + onSlideExited: slideExit.text = "Exited slide " + name + "(index " + index + ") on " + elementPath + + DataInput { + name: "di_text" + value: s3d.textValue + } + + SceneElement { + id: sceneElementForScene + elementPath: "Scene" // could also refer to a Component node instead + onCurrentSlideIndexChanged: console.log("Current slide index for 'Scene': " + currentSlideIndex) + onCurrentSlideNameChanged: console.log("Current slide name for 'Scene': " + currentSlideName) + } + + // Exercise Element a bit. This is no different from using the + // functions on Presentations, just avoids the need to specify the + // name/path repeatedly. + Element { + id: barrelRef + elementPath: "Barrel" // or Scene.Layer.Barrel but as long as it's unique the name's good enough + } + } + ignoredEvents: mouseEvCb.checked ? Studio3D.EnableAllEvents : (Studio3D.IgnoreMouseEvents | Studio3D.IgnoreWheelEvents) + onRunningChanged: console.log("running: " + s3d.running) + onPresentationReady: console.log("presentationReady") + onErrorChanged: { + if (s3d.error !== "") { + errorDialog.text = s3d.error; + errorDialog.open(); + } + } + + property int frameCount: 0 + onFrameUpdate: frameCount += 1 + + Timer { + running: true + repeat: true + interval: 1000 + onTriggered: { + fpsCount.text = "~" + s3d.frameCount + " FPS"; + s3d.frameCount = 0; + } + } + + Timer { + interval: 2000 + running: true + repeat: true + } + + NumberAnimation on opacity { + id: opacityAnimation + from: 1 + to: 0 + duration: 5000 + running: false + onStopped: s3d.opacity = 1 + } + } + + Window { + id: w + visible: false + width: 500 + height: 500 + Item { + id: wroot + anchors.fill: parent + } + title: "Second window" + } + + RowLayout { + Button { + text: "Move to other window" + onClicked: { + w.visible = true; + if (s3d.parent === wroot) s3d.parent = root; else s3d.parent = wroot; + } + focusPolicy: Qt.NoFocus + } + Button { + text: "Open barrel without background" + onClicked: s3dpres.source = "qrc:/presentation/barrel_no_background.uip" + focusPolicy: Qt.NoFocus + } + Button { + text: "Animate opacity" + onClicked: opacityAnimation.running = true + focusPolicy: Qt.NoFocus + } + Button { + text: "Reload" + onClicked: s3dpres.reload() + focusPolicy: Qt.NoFocus + } + Button { + text: "Open" + onClicked: openDialog.open() + focusPolicy: Qt.NoFocus + } + CheckBox { + id: mouseEvCb + text: "Let mouse events through" + checked: true + focusPolicy: Qt.NoFocus + } + Button { + text: "Toggle camera" + onClicked: { + var v = s3dpres.getAttribute("Scene.Layer.Camera", "eyeball") + s3dpres.setAttribute("Scene.Layer.Camera", "eyeball", !v) + } + focusPolicy: Qt.NoFocus + } + Button { + text: "Send new data input value" + property int invocationCount: 0 + onClicked: s3d.textValue = "Data input value " + (++invocationCount) + focusPolicy: Qt.NoFocus + } + } + + Text { + id: fpsCount + text: "0 FPS" + anchors.bottom: parent.bottom + anchors.left: parent.left + } + Text { + id: customSignalName + anchors.bottom: parent.bottom + anchors.left: fpsCount.right + anchors.leftMargin: 8 + } + Text { + id: slideEnter + anchors.bottom: parent.bottom + anchors.left: customSignalName.right + anchors.leftMargin: 8 + } + Text { + id: slideExit + anchors.bottom: parent.bottom + anchors.left: slideEnter.right + anchors.leftMargin: 8 + } + Button { + id: nextSlideByIndex + text: "Next slide (via pres., wrap)" + anchors.left: parent.left + anchors.bottom: fpsCount.top + onClicked: s3dpres.goToSlide("Scene", true, true) + focusPolicy: Qt.NoFocus + } + Button { + id: seekBtn + text: "Seek to 5 seconds (via pres.)" + anchors.left: nextSlideByIndex.right + anchors.bottom: fpsCount.top + onClicked: s3dpres.goToTime("Scene", 5) + focusPolicy: Qt.NoFocus + } + Button { + id: nextSlideViaSceneElement + text: "Next slide (via SceneElement, no wrap)" + anchors.left: seekBtn.right + anchors.bottom: fpsCount.top + onClicked: sceneElementForScene.currentSlideIndex += 1 + focusPolicy: Qt.NoFocus + } + Button { + id: seekBtn2 + text: "Seek to 5 seconds (via SceneElement)" + anchors.left: nextSlideViaSceneElement.right + anchors.bottom: fpsCount.top + onClicked: sceneElementForScene.goToTime(5) + focusPolicy: Qt.NoFocus + } + + Button { + id: profTogBtn + text: "Toggle profile UI" + anchors.right: parent.right + anchors.bottom: parent.bottom + focusPolicy: Qt.NoFocus + onClicked: s3dpres.profileUiVisible = !s3dpres.profileUiVisible + } + Slider { + id: profUiScale + width: profTogBtn.width + anchors.right: profTogBtn.left + anchors.bottom: parent.bottom + from: 50 + to: 400 + value: 100 + focusPolicy: Qt.NoFocus + } + + FileDialog { + id: openDialog + fileMode: FileDialog.OpenFile + nameFilters: ["UIP files (*.uip)", "UIA files (*.uia)", "All files (*)"] + onAccepted: s3dpres.source = file + } +} diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uia b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uia new file mode 100644 index 00000000..d936e429 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uia @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uip b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uip new file mode 100644 index 00000000..48b4edcd --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel.uip @@ -0,0 +1,58 @@ + + + + + #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 90 100 100 5 64 100 100 10 90 100 100 + 0 0 100 100 5 -302 100 100 10 0 100 100 + 0 0 100 100 5 0 100 100 10 0 100 100 + + + 0 0 100 100 5 1 100 100 + + + + + + + 0 100 100 100 5.009 43.75 100 100 10 100 100 100 + 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100 + 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 360 100 100 + 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100 + 0 0 100 100 5.009 0.501961 100 100 10 0 100 100 + 0 1 100 100 5.009 0.235294 100 100 10 1 100 100 + 0 0 100 100 5.009 0.333333 100 100 10 0 100 100 + + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/barrel.import b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/barrel.import new file mode 100644 index 00000000..cf56bb4e --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/barrel.import @@ -0,0 +1,18 @@ + + + + + + + + + + + + + Barrel + .\meshes\Barrel.mesh + + + + diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/meshes/Barrel.mesh b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/meshes/Barrel.mesh new file mode 100644 index 00000000..1d935a4e Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel/meshes/Barrel.mesh differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel_no_background.uip b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel_no_background.uip new file mode 100644 index 00000000..aef5ddb3 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/barrel_no_background.uip @@ -0,0 +1,56 @@ + + + + + #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 90 100 100 5 64 100 100 10 90 100 100 + 0 0 100 100 5 -302 100 100 10 0 100 100 + 0 0 100 100 5 0 100 100 10 0 100 100 + + + 0 0 100 100 5 1 100 100 + + + + + + + 0 100 100 100 5.009 43.75 100 100 10 100 100 100 + 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100 + 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 360 100 100 + 0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100 + 0 0 100 100 5.009 0.501961 100 100 10 0 100 100 + 0 1 100 100 5.009 0.235294 100 100 10 1 100 100 + 0 0 100 100 5.009 0.333333 100 100 10 0 100 100 + + + + + + diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/fonts/Arimo-Regular.ttf b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/fonts/Arimo-Regular.ttf new file mode 100644 index 00000000..720d4198 Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/fonts/Arimo-Regular.ttf differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Diffuse.png b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Diffuse.png new file mode 100644 index 00000000..426f1299 Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Diffuse.png differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Emissive.png b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Emissive.png new file mode 100644 index 00000000..b6be9f3e Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Emissive.png differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Normal.png b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Normal.png new file mode 100644 index 00000000..4e16c47a Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Normal.png differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Specular.png b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Specular.png new file mode 100644 index 00000000..18825599 Binary files /dev/null and b/src/Runtime/ogl-runtime/examples/simpleqml/presentation/maps/barrel_barrel_Specular.png differ diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.pro b/src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.pro new file mode 100644 index 00000000..62afa78e --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.pro @@ -0,0 +1,16 @@ +TEMPLATE = app + +QT += widgets qml quick studio3d + +SOURCES += \ + main.cpp + +RESOURCES += simpleqml.qrc + +OTHER_FILES += \ + main.qml \ + doc/src/* \ + doc/images/* + +target.path = $$[QT_INSTALL_EXAMPLES]/studio3d/$$TARGET +INSTALLS += target diff --git a/src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.qrc b/src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.qrc new file mode 100644 index 00000000..bc843a90 --- /dev/null +++ b/src/Runtime/ogl-runtime/examples/simpleqml/simpleqml.qrc @@ -0,0 +1,14 @@ + + + main.qml + presentation/barrel.uip + presentation/barrel.uia + presentation/barrel_no_background.uip + presentation/barrel/meshes/Barrel.mesh + presentation/fonts/Arimo-Regular.ttf + presentation/maps/barrel_barrel_Diffuse.png + presentation/maps/barrel_barrel_Emissive.png + presentation/maps/barrel_barrel_Normal.png + presentation/maps/barrel_barrel_Specular.png + + diff --git a/src/Runtime/ogl-runtime/ogl-runtime.pro b/src/Runtime/ogl-runtime/ogl-runtime.pro index 6bb3d181..b4ab51dc 100644 --- a/src/Runtime/ogl-runtime/ogl-runtime.pro +++ b/src/Runtime/ogl-runtime/ogl-runtime.pro @@ -3,4 +3,5 @@ CONFIG += ordered SUBDIRS += \ src \ - tools + tools \ + examples -- cgit v1.2.3