diff options
author | Pasi Keränen <pasi.keranen@qt.io> | 2019-06-06 16:22:02 +0300 |
---|---|---|
committer | Pasi Keränen <pasi.keranen@qt.io> | 2019-06-07 13:52:44 +0300 |
commit | b4954701093739e7a4e54a0669f306922d0d4605 (patch) | |
tree | 73d71319a921234f6b507c9098fdc842f7fe06dc /examples | |
parent | 8548a5f5579e3eee7e5ae6b1f6901dcc8bfee19e (diff) |
Long live the slayer!
Initial commit of OpenGL Runtime to repository.
Based on SHA1 61823aaccc6510699a54b34a2fe3f7523dab3b4e
of qt3dstudio repository.
Task-number: QT3DS-3600
Change-Id: Iaeb80237399f0e5656a19ebec9d1ab3a681d8832
Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
Diffstat (limited to 'examples')
33 files changed, 1277 insertions, 0 deletions
diff --git a/examples/examples.pro b/examples/examples.pro new file mode 100644 index 0000000..cf3793d --- /dev/null +++ b/examples/examples.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS += \ + studio3d diff --git a/examples/studio3d/cppdatainput/cppdatainput.pro b/examples/studio3d/cppdatainput/cppdatainput.pro new file mode 100644 index 0000000..20b5c68 --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/cppdatainput/main.cpp b/examples/studio3d/cppdatainput/main.cpp new file mode 100644 index 0000000..d966a3a --- /dev/null +++ b/examples/studio3d/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 <qstudio3dglobal.h> +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <Q3DSSurfaceViewer> +#include <QWindow> +#include <QSurface> +#include <Q3DSPresentation> +#include <QOpenGLContext> +#include <Q3DSDataInput> +#include <QVector3D> +#include <QTimer> +#include <QDebug> +// Required for Ubuntu build +#include <cmath> + +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/examples/studio3d/cppdatainput/presentation/datainput.uia b/examples/studio3d/cppdatainput/presentation/datainput.uia new file mode 100644 index 0000000..0c89121 --- /dev/null +++ b/examples/studio3d/cppdatainput/presentation/datainput.uia @@ -0,0 +1,17 @@ +<?xml version='1.0' encoding='UTF-8'?> +<application> + <assets initial="datainput"> + <presentation id="datainput" src="datainput.uip"/> + <dataInput name="colorInput" type="Vector3"/> + <dataInput metadata="metadata1$Controls rotation" max="360" name="rangeInput" min="0" type="Ranged Number"/> + </assets> + <statemachine ref="#logic"> + <visual-states> + <state ref="Initial"> + <enter> + <goto-slide element="main:Scene" rel="next"/> + </enter> + </state> + </visual-states> + </statemachine> +</application> diff --git a/examples/studio3d/cppdatainput/presentation/datainput.uip b/examples/studio3d/cppdatainput/presentation/datainput.uip new file mode 100644 index 0000000..2dc8545 --- /dev/null +++ b/examples/studio3d/cppdatainput/presentation/datainput.uip @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP version="6" > + <Project > + <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" preferKtx="False" > + <CustomColors count="16" >#ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff</CustomColors> + </ProjectSettings> + <Graph > + <Scene id="Scene" controlledproperty="$rangeInput @timeline" > + <Layer id="Layer" > + <Camera id="Camera" /> + <Light id="Light" /> + <Text id="Text" /> + <Text id="Text2" /> + <Model id="Cylinder" > + <Material id="Default_002" name="Default" /> + </Model> + <Text id="Text4" /> + <Model id="Rectangle" > + <Material id="Default_001" name="Default" /> + </Model> + </Layer> + </Scene> + </Graph> + <Logic > + <State name="Master Slide" component="#Scene" > + <Add ref="#Layer" multisampleaa="SSAA" progressiveaa="8x" /> + <Add ref="#Camera" controlledproperty="" pivot="0 0 0" position="0 0 -800" rotation="0 0 0" /> + <Add ref="#Light" castshadow="True" controlledproperty="$colorInput lightdiffuse" lightdiffuse="1 0 0" lighttype="Point" position="-300.444 70.829 -30" shdwfactor="11.89" shdwfilter="6.94" shdwmapres="11" /> + <State id="Scene-Slide1" name="Slide1" initialplaystate="Pause" > + <Add ref="#Text" name="Text" controlledproperty="$rangeInput textstring" font="TitilliumWeb-Regular" position="216.513 76.6172 -113.498" scale="1 1 1" size="24" textstring="0" > + <AnimationTrack property="rotation.x" type="EaseInOut" >0 0 0 0 10 0 0 0</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 0 0 10 0 0 0</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 0 0 10 -360 0 0</AnimationTrack> + </Add> + <Add ref="#Text2" name="Text2" controlledproperty="" font="TitilliumWeb-Regular" position="259.808 217.95 0" scale="1 1 1" size="16" textstring="Text control Rotation animation control via datainput timeline control" /> + <Add ref="#Cylinder" name="Cylinder" controlledproperty="" position="15.877 -141.932 0" sourcepath="#Cylinder" /> + <Add ref="#Default_002" diffuse="0.666667 1 0.498039" /> + <Add ref="#Text4" name="Text4" font="TitilliumWeb-Regular" position="-373.353 201.004 0" size="18" textstring="Directional light color control" /> + <Add ref="#Rectangle" name="Rectangle" position="0 -400 20" rotation="90.5 0 0" scale="11.0468 7.99191 9.12813" sourcepath="#Rectangle" /> + <Add ref="#Default_001" diffuse="0.623529 0.623529 0.623529" /> + </State> + </State> + </Logic> + </Project> +</UIP> diff --git a/examples/studio3d/cppdatainput/res.qrc b/examples/studio3d/cppdatainput/res.qrc new file mode 100644 index 0000000..9beb456 --- /dev/null +++ b/examples/studio3d/cppdatainput/res.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>presentation/datainput.uia</file> + <file>presentation/datainput.uip</file> + </qresource> +</RCC> diff --git a/examples/studio3d/qmldatainput/doc/images/qmldatainput.png b/examples/studio3d/qmldatainput/doc/images/qmldatainput.png Binary files differnew file mode 100644 index 0000000..e0567ee --- /dev/null +++ b/examples/studio3d/qmldatainput/doc/images/qmldatainput.png diff --git a/examples/studio3d/qmldatainput/doc/src/qmldatainput.qdoc b/examples/studio3d/qmldatainput/doc/src/qmldatainput.qdoc new file mode 100644 index 0000000..21eae9e --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/qmldatainput/main.cpp b/examples/studio3d/qmldatainput/main.cpp new file mode 100644 index 0000000..165cd89 --- /dev/null +++ b/examples/studio3d/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 <QtWidgets/QApplication> +#include <QtQuick/QQuickView> +#include <qstudio3dglobal.h> +#ifdef USE_EMBEDDED_FONTS +#include <QtGui/QFontDatabase> +#include <QtCore/QDebug> +#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/examples/studio3d/qmldatainput/presentation/Paper05.png b/examples/studio3d/qmldatainput/presentation/Paper05.png Binary files differnew file mode 100644 index 0000000..e70749d --- /dev/null +++ b/examples/studio3d/qmldatainput/presentation/Paper05.png diff --git a/examples/studio3d/qmldatainput/presentation/datainput.uia b/examples/studio3d/qmldatainput/presentation/datainput.uia new file mode 100644 index 0000000..30d0084 --- /dev/null +++ b/examples/studio3d/qmldatainput/presentation/datainput.uia @@ -0,0 +1,22 @@ +<?xml version='1.0' encoding='UTF-8'?> +<application> + <assets initial="datainput"> + <presentation id="datainput" src="datainput.uip"/> + <dataInput name="cameraRotInput" type="Vector3"/> + <dataInput name="colorInput" type="Vector3"/> + <dataInput name="queriedInput" type="String"/> + <dataInput name="rangeInput" type="Ranged Number" min="0" max="360"/> + <dataInput name="scaleInput" type="Vector3"/> + <dataInput name="stringInput" type="String"/> + <dataInput name="variantInput" type="Variant" metadata="usage$opacity$datasource$speedgauge_visibility"/> + </assets> + <statemachine ref="#logic"> + <visual-states> + <state ref="Initial"> + <enter> + <goto-slide rel="next" element="main:Scene"/> + </enter> + </state> + </visual-states> + </statemachine> +</application> diff --git a/examples/studio3d/qmldatainput/presentation/datainput.uip b/examples/studio3d/qmldatainput/presentation/datainput.uip new file mode 100644 index 0000000..008f456 --- /dev/null +++ b/examples/studio3d/qmldatainput/presentation/datainput.uip @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP version="6" > + <Project > + <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" preferKtx="False" > + <CustomColors count="16" >#ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff</CustomColors> + </ProjectSettings> + <Graph > + <Scene id="Scene" controlledproperty="$rangeInput @timeline" > + <Layer id="Layer" > + <Camera id="Camera" /> + <Light id="Light" /> + <Text id="Text" /> + <Text id="Text2" /> + <Model id="Cone" > + <Material id="Default" name="Default" /> + </Model> + <Model id="Cylinder" > + <Material id="Default_002" name="Default" /> + </Model> + <Text id="Text6" /> + <Text id="Text8" /> + <Model id="Cube2" > + <Material id="Default_003" name="Default" /> + </Model> + <Text id="Text3" /> + <Text id="Text4" /> + <Model id="Rectangle" > + <Material id="Default_001" name="Default" > + <Image id="Default_001_diffusemap" /> + </Material> + </Model> + <Text id="Text5" /> + </Layer> + </Scene> + </Graph> + <Logic > + <State name="Master Slide" component="#Scene" > + <Add ref="#Layer" multisampleaa="SSAA" progressiveaa="8x" /> + <Add ref="#Camera" controlledproperty="$cameraRotInput rotation" pivot="0 0 0" position="0 0 -800" rotation="0 0 0" /> + <Add ref="#Light" castshadow="True" controlledproperty="$colorInput lightdiffuse" lightdiffuse="1 0 0" lighttype="Point" position="-300.444 70.829 -30" shdwfactor="11.89" shdwfilter="6.94" shdwmapres="11" /> + <State id="Scene-Slide1" name="Slide1" initialplaystate="Pause" > + <Add ref="#Text" name="Text" controlledproperty="$stringInput textstring" font="TitilliumWeb-Regular" position="216.513 76.6172 -113.498" scale="1 1 1" size="24" textstring="0" > + <AnimationTrack property="rotation.x" type="EaseInOut" >0 0 0 0 10 0 0 0</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 0 0 10 0 0 0</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 0 0 10 -360 0 0</AnimationTrack> + </Add> + <Add ref="#Text2" name="Text2" controlledproperty="" font="TitilliumWeb-Regular" position="259.808 217.95 0" scale="1 1 1" size="16" textstring="Text control Rotation animation control via datainput timeline control" /> + <Add ref="#Cone" name="Cone" controlledproperty="$scaleInput scale" position="-417.135 -225.166 0" sourcepath="#Cone" /> + <Add ref="#Default" /> + <Add ref="#Cylinder" name="Cylinder" controlledproperty="$variantInput opacity" position="131.347 -180.422 0" sourcepath="#Cylinder" /> + <Add ref="#Default_002" diffuse="0.666667 1 0.498039" /> + <Add ref="#Text6" name="Text6" font="TitilliumWeb-Regular" position="135.678 -300.019 -8.28656" size="16" textstring="Opacity control (Variant type)" /> + <Add ref="#Text8" name="Text8" font="TitilliumWeb-Regular" position="-428.683 -290.118 0" size="16" textstring="Scale control" /> + <Add ref="#Cube2" name="Cube2" controlledproperty="$cameraRotInput rotation" position="409.919 -177.535 0" sourcepath="#Cube" /> + <Add ref="#Default_003" controlledproperty="" /> + <Add ref="#Text3" name="Text3" font="TitilliumWeb-Regular" position="434.456 -304.552 0" size="16" textstring="Rotation control Diffuse color control" /> + <Add ref="#Text4" name="Text4" font="TitilliumWeb-Regular" position="-381.051 290.118 0" size="18" textstring="Directional light color control Camera xy rotation control" /> + <Add ref="#Rectangle" name="Rectangle" position="0 -400 20" rotation="90.5 0 0" scale="11.0468 7.99191 9.12813" sourcepath="#Rectangle" /> + <Add ref="#Default_001" diffuse="0.623529 0.623529 0.623529" diffusemap="#Default_001_diffusemap" /> + <Add ref="#Default_001_diffusemap" sourcepath="Paper05.png" /> + <Add ref="#Text5" name="Text5" controlledproperty="$queriedInput textstring" font="TitilliumWeb-Regular" position="-57.7348 3.84888 0" textstring="Text from queried QML Datainput" /> + </State> + </State> + </Logic> + </Project> +</UIP> diff --git a/examples/studio3d/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf b/examples/studio3d/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf Binary files differnew file mode 100644 index 0000000..6da8219 --- /dev/null +++ b/examples/studio3d/qmldatainput/presentation/fonts/TitilliumWeb-Regular.ttf diff --git a/examples/studio3d/qmldatainput/qml/qmldatainput/main.qml b/examples/studio3d/qmldatainput/qml/qmldatainput/main.qml new file mode 100644 index 0000000..ab50796 --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/qmldatainput/qmldatainput.pro b/examples/studio3d/qmldatainput/qmldatainput.pro new file mode 100644 index 0000000..9bafed5 --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/qmldatainput/qmldatainput.qrc b/examples/studio3d/qmldatainput/qmldatainput.qrc new file mode 100644 index 0000000..97aaeaa --- /dev/null +++ b/examples/studio3d/qmldatainput/qmldatainput.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/"> + <file>qml/qmldatainput/main.qml</file> + <file>presentation/datainput.uia</file> + <file>presentation/datainput.uip</file> + <file>presentation/Paper05.png</file> + </qresource> +</RCC> diff --git a/examples/studio3d/simpleqml/doc/images/simpleqml.png b/examples/studio3d/simpleqml/doc/images/simpleqml.png Binary files differnew file mode 100644 index 0000000..73d9207 --- /dev/null +++ b/examples/studio3d/simpleqml/doc/images/simpleqml.png diff --git a/examples/studio3d/simpleqml/doc/src/simpleqml.qdoc b/examples/studio3d/simpleqml/doc/src/simpleqml.qdoc new file mode 100644 index 0000000..a7dcec7 --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/simpleqml/main.cpp b/examples/studio3d/simpleqml/main.cpp new file mode 100644 index 0000000..f2640b5 --- /dev/null +++ b/examples/studio3d/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 <QtWidgets/QApplication> // for MessageDialog +#include <QtQuick/QQuickView> +#include <qstudio3dglobal.h> + +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/examples/studio3d/simpleqml/main.qml b/examples/studio3d/simpleqml/main.qml new file mode 100644 index 0000000..06321a7 --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/simpleqml/presentation/barrel.uia b/examples/studio3d/simpleqml/presentation/barrel.uia new file mode 100644 index 0000000..d936e42 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/barrel.uia @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<application> + <assets initial="barrel"> + <dataInput name="di_text" type="String"/> + <presentation id="barrel" src="barrel.uip"/> + </assets> + <statemachine ref="#logic"> + <visual-states> + <state ref="Initial"> + <enter> + <goto-slide element="main:Scene" rel="next"/> + </enter> + </state> + </visual-states> + </statemachine> +</application> diff --git a/examples/studio3d/simpleqml/presentation/barrel.uip b/examples/studio3d/simpleqml/presentation/barrel.uip new file mode 100644 index 0000000..48b4edc --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/barrel.uip @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP version="6" > + <Project > + <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" > + <CustomColors count="16" >#ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff</CustomColors> + </ProjectSettings> + <Graph > + <Scene id="Scene" > + <Layer id="Layer" > + <Camera id="Camera" /> + <Light id="Light" /> + <Model id="Barrel" > + <Material id="Material" > + <Image id="Material_diffusemap" /> + <Image id="Material_normalmap" /> + <Image id="Material_emissivemap" /> + <Image id="Material_specularmap" /> + </Material> + </Model> + <Text id="Text" /> + <Text id="Text2" /> + </Layer> + </Scene> + </Graph> + <Logic > + <State name="Master Slide" component="#Scene" > + <Add ref="#Layer" /> + <Add ref="#Camera" /> + <Add ref="#Light" /> + <State id="Scene-Slide1" name="Slide1" playmode="Looping" > + <Add ref="#Barrel" name="Barrel" position="0 -42 -483" rotation="90 0 0" scale="100 100 100" sourcepath=".\barrel\meshes\Barrel.mesh#1" > + <AnimationTrack property="opacity" type="EaseInOut" /> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 90 100 100 5 64 100 100 10 90 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 5 -302 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 5 0 100 100 10 0 100 100</AnimationTrack> + </Add> + <Add ref="#Material" bumpamount="0" diffuse="1 1 1" diffusemap="#Material_diffusemap" emissivemap="#Material_emissivemap" fresnelPower="25" normalmap="#Material_normalmap" specularamount="4" specularmap="#Material_specularmap" specularmodel="Default" specularroughness="0.001" > + <AnimationTrack property="bumpamount" type="EaseInOut" >0 0 100 100 5 1 100 100</AnimationTrack> + </Add> + <Add ref="#Material_diffusemap" sourcepath=".\maps\barrel_barrel_Diffuse.png" /> + <Add ref="#Material_normalmap" sourcepath=".\maps\barrel_barrel_Normal.png" /> + <Add ref="#Material_emissivemap" sourcepath=".\maps\barrel_barrel_Emissive.png" /> + <Add ref="#Material_specularmap" sourcepath=".\maps\barrel_barrel_Specular.png" /> + <Add ref="#Text" name="Text" font="Arimo-Regular" position="-486.418 297.128 50.5569" textcolor="0 1 0" textstring="Barrel!" tracking="0" > + <AnimationTrack property="opacity" type="EaseInOut" >0 100 100 100 5.009 43.75 100 100 10 100 100 100</AnimationTrack> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 360 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="textcolor.x" type="EaseInOut" >0 0 100 100 5.009 0.501961 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="textcolor.y" type="EaseInOut" >0 1 100 100 5.009 0.235294 100 100 10 1 100 100</AnimationTrack> + <AnimationTrack property="textcolor.z" type="EaseInOut" >0 0 100 100 5.009 0.333333 100 100 10 0 100 100</AnimationTrack> + </Add> + <Add ref="#Text2" name="Text2" controlledproperty="di_text textstring" font="Arimo-Regular" position="435.899 267.025 0" /> + </State> + </State> + </Logic> + </Project> +</UIP> diff --git a/examples/studio3d/simpleqml/presentation/barrel/barrel.import b/examples/studio3d/simpleqml/presentation/barrel/barrel.import new file mode 100644 index 0000000..cf56bb4 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/barrel/barrel.import @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP Version="1" > + <Project Revision="1" > + <Graph > + <Group id="__import__root__" > + <Model id="Barrel" name="Barrel" orientation="Right Handed" position="0 0 -0" rotation="-90 -0 0" rotationorder="XYZr" scale="100 100 100" sourcepath=".\meshes\Barrel.mesh#1" > + <Material id="Barrel_0001" name="Barrel" blendmode="Normal" diffuse="0.64 0.64 0.64" emissivepower="0" opacity="100" specularamount="0" specularroughness="9.60784" /> + </Model> + </Group> + </Graph> + <Import SrcFile="..\..\..\barrel.fbx" ImageDir="Images" MeshDir="Meshes" > + <Mesh > + <Source >Barrel</Source> + <Dest >.\meshes\Barrel.mesh</Dest> + </Mesh> + </Import> + </Project> +</UIP> diff --git a/examples/studio3d/simpleqml/presentation/barrel/meshes/Barrel.mesh b/examples/studio3d/simpleqml/presentation/barrel/meshes/Barrel.mesh Binary files differnew file mode 100644 index 0000000..1d935a4 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/barrel/meshes/Barrel.mesh diff --git a/examples/studio3d/simpleqml/presentation/barrel_no_background.uip b/examples/studio3d/simpleqml/presentation/barrel_no_background.uip new file mode 100644 index 0000000..aef5ddb --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/barrel_no_background.uip @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP version="4" > + <Project > + <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" > + <CustomColors count="16" >#ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff #ffffff</CustomColors> + </ProjectSettings> + <Graph > + <Scene id="Scene" bgcolorenable="False" > + <Layer id="Layer" > + <Camera id="Camera" /> + <Light id="Light" /> + <Model id="Barrel" > + <Material id="Material" > + <Image id="Material_diffusemap" /> + <Image id="Material_normalmap" /> + <Image id="Material_emissivemap" /> + <Image id="Material_specularmap" /> + </Material> + </Model> + <Text id="Text" /> + </Layer> + </Scene> + </Graph> + <Logic > + <State name="Master Slide" component="#Scene" > + <Add ref="#Layer" /> + <Add ref="#Camera" /> + <Add ref="#Light" /> + <State id="Scene-Slide1" name="Slide1" playmode="Looping" > + <Add ref="#Barrel" name="Barrel" position="0 -42 -483" rotation="90 0 0" scale="100 100 100" sourcepath=".\barrel\meshes\Barrel.mesh#1" > + <AnimationTrack property="opacity" type="EaseInOut" /> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 90 100 100 5 64 100 100 10 90 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 5 -302 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 5 0 100 100 10 0 100 100</AnimationTrack> + </Add> + <Add ref="#Material" bumpamount="0" diffusemap="#Material_diffusemap" emissivemap="#Material_emissivemap" fresnelPower="25" normalmap="#Material_normalmap" specularamount="4" specularmap="#Material_specularmap" specularmodel="Default" specularroughness="0.001" > + <AnimationTrack property="bumpamount" type="EaseInOut" >0 0 100 100 5 1 100 100</AnimationTrack> + </Add> + <Add ref="#Material_diffusemap" sourcepath=".\maps\barrel_barrel_Diffuse.png" /> + <Add ref="#Material_normalmap" sourcepath=".\maps\barrel_barrel_Normal.png" /> + <Add ref="#Material_emissivemap" sourcepath=".\maps\barrel_barrel_Emissive.png" /> + <Add ref="#Material_specularmap" sourcepath=".\maps\barrel_barrel_Specular.png" /> + <Add ref="#Text" name="Text" font="Arimo-Regular" position="-486.418 297.128 50.5569" textcolor="0 1 0" textstring="Barrel!" tracking="0" > + <AnimationTrack property="opacity" type="EaseInOut" >0 100 100 100 5.009 43.75 100 100 10 100 100 100</AnimationTrack> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 360 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="textcolor.x" type="EaseInOut" >0 0 100 100 5.009 0.501961 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="textcolor.y" type="EaseInOut" >0 1 100 100 5.009 0.235294 100 100 10 1 100 100</AnimationTrack> + <AnimationTrack property="textcolor.z" type="EaseInOut" >0 0 100 100 5.009 0.333333 100 100 10 0 100 100</AnimationTrack> + </Add> + </State> + </State> + </Logic> + </Project> +</UIP> diff --git a/examples/studio3d/simpleqml/presentation/fonts/Arimo-Regular.ttf b/examples/studio3d/simpleqml/presentation/fonts/Arimo-Regular.ttf Binary files differnew file mode 100644 index 0000000..720d419 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/fonts/Arimo-Regular.ttf diff --git a/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Diffuse.png b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Diffuse.png Binary files differnew file mode 100644 index 0000000..426f129 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Diffuse.png diff --git a/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Emissive.png b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Emissive.png Binary files differnew file mode 100644 index 0000000..b6be9f3 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Emissive.png diff --git a/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Normal.png b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Normal.png Binary files differnew file mode 100644 index 0000000..4e16c47 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Normal.png diff --git a/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Specular.png b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Specular.png Binary files differnew file mode 100644 index 0000000..1882559 --- /dev/null +++ b/examples/studio3d/simpleqml/presentation/maps/barrel_barrel_Specular.png diff --git a/examples/studio3d/simpleqml/simpleqml.pro b/examples/studio3d/simpleqml/simpleqml.pro new file mode 100644 index 0000000..62afa78 --- /dev/null +++ b/examples/studio3d/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/examples/studio3d/simpleqml/simpleqml.qrc b/examples/studio3d/simpleqml/simpleqml.qrc new file mode 100644 index 0000000..bc843a9 --- /dev/null +++ b/examples/studio3d/simpleqml/simpleqml.qrc @@ -0,0 +1,14 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>presentation/barrel.uip</file> + <file>presentation/barrel.uia</file> + <file>presentation/barrel_no_background.uip</file> + <file>presentation/barrel/meshes/Barrel.mesh</file> + <file>presentation/fonts/Arimo-Regular.ttf</file> + <file>presentation/maps/barrel_barrel_Diffuse.png</file> + <file>presentation/maps/barrel_barrel_Emissive.png</file> + <file>presentation/maps/barrel_barrel_Normal.png</file> + <file>presentation/maps/barrel_barrel_Specular.png</file> + </qresource> +</RCC> diff --git a/examples/studio3d/studio3d.pro b/examples/studio3d/studio3d.pro new file mode 100644 index 0000000..f51add1 --- /dev/null +++ b/examples/studio3d/studio3d.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + cppdatainput + +qtHaveModule(quick) { + SUBDIRS += simpleqml \ + qmldatainput +} |