diff options
author | Kaj Grönholm <kaj.gronholm@qt.io> | 2018-11-22 10:59:44 +0200 |
---|---|---|
committer | Kaj Grönholm <kaj.gronholm@qt.io> | 2018-12-07 05:49:40 +0000 |
commit | bfc9ea8f4e33702ed6af46b74621c75258b66ce8 (patch) | |
tree | 2c183d8e41ae085181721ad6509c3c8096a363a6 /examples | |
parent | c0c4f8f4dfc39ca76b314ee19ff22a1166379daa (diff) |
Add stereoscopic QML example
This example demonstrates stereoscopic QML API using
ViewerSettings. It contains simple presentation, optimal for
stereoscopic viewing and allows opening also other uip files.
Task-number: QT3DS-2695
Change-Id: I3003b312e2da23a83076f930227006d1e28724ef
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/3dstudioruntime2/3dstudioruntime2.pro | 3 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/SettingsPanel.qml | 211 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/StereoTester/StereoTester.uip | 93 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/arrow.png | bin | 0 -> 829 bytes | |||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/doc/images/stereoscopicqml.png | bin | 0 -> 129657 bytes | |||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/doc/src/stereoscopicqml.qdoc | 47 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/main.cpp | 69 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/main.qml | 117 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.pro | 15 | ||||
-rw-r--r-- | examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.qrc | 8 |
10 files changed, 562 insertions, 1 deletions
diff --git a/examples/3dstudioruntime2/3dstudioruntime2.pro b/examples/3dstudioruntime2/3dstudioruntime2.pro index d03ce05..d30bbc0 100644 --- a/examples/3dstudioruntime2/3dstudioruntime2.pro +++ b/examples/3dstudioruntime2/3dstudioruntime2.pro @@ -8,7 +8,8 @@ qtHaveModule(quick) { SUBDIRS += simpleqml \ qmldatainput \ layersinquick \ - scenemanip + scenemanip \ + stereoscopicqml } qtHaveModule(widgets) { diff --git a/examples/3dstudioruntime2/stereoscopicqml/SettingsPanel.qml b/examples/3dstudioruntime2/stereoscopicqml/SettingsPanel.qml new file mode 100644 index 0000000..2350448 --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/SettingsPanel.qml @@ -0,0 +1,211 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtStudio3D 2.0 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +Item { + id: rootItem + + property bool isOpen: true + property real isOpenState: isOpen + + width: 250 + height: parent.height + x: parent.width - (isOpenState * width) + opacity: 0.4 + isOpenState * 0.6 + + Behavior on isOpenState { + NumberAnimation { + duration: 500 + easing.type: Easing.InOutQuad + } + } + + Item { + width: 60 + height: 60 + anchors.right: parent.left + Image { + anchors.centerIn: parent + source: "arrow.png" + width: 16 + height: width + rotation: isOpenState * 180 + } + + MouseArea { + anchors.fill: parent + anchors.margins: -20 + onClicked: { + rootItem.isOpen = !rootItem.isOpen + } + } + } + + Rectangle { + anchors.fill: parent + color: "#404040" + border.width: 1 + border.color: "#e0e0e0" + opacity: 0.6 + } + + Column { + width: parent.width - 32 + anchors.horizontalCenter: parent.horizontalCenter + y: 16 + spacing: 16 + visible: isOpenState > 0 + Text { + id: fpsCount + anchors.horizontalCenter: parent.horizontalCenter + color: "#ffffff" + text: " " + Timer { + running: true + repeat: true + interval: 2000 + onTriggered: { + fpsCount.text = "~" + (mainView.frameCount/2).toFixed(1) + " FPS"; + mainView.frameCount = 0; + } + } + } + ComboBox { + id: stereoModeComboBox + property var modesModel: [ + "StereoModeMono", + "StereoModeTopBottom", + "StereoModeLeftRight", + "StereoModeAnaglyphRedCyan", + "StereoModeAnaglyphGreenMagenta"] + width: parent.width + model: modesModel + currentIndex: 1 + onCurrentTextChanged: { + viewSettings.stereoMode = stereoModeComboBox.currentText; + } + } + Slider { + id: eyeSeparationSlider + width: parent.width + from: 0 + to: 15.0 + value: mainView.eyeSeparation + focusPolicy: Qt.NoFocus + enabled: stereoModeComboBox.currentIndex != 0 + opacity: enabled ? 1.0: 0.2 + onValueChanged: { + mainView.eyeSeparation = value; + } + Text { + anchors.horizontalCenter: parent.horizontalCenter + y: -8 + z: 10 + text: "EYE SEPARATION: " + mainView.eyeSeparation.toFixed(2) + color: "#ffffff" + } + } + Item { + width: 1 + height: 1 + } + Button { + width: parent.width + text: "RELOAD" + onClicked: s3dpres.reload() + focusPolicy: Qt.NoFocus + } + Button { + width: parent.width + text: "OPEN" + onClicked: openDialog.open() + focusPolicy: Qt.NoFocus + } + Button { + width: parent.width + text: "FULLSCREEN" + onClicked: mainView.toggleFullscreen(); + focusPolicy: Qt.NoFocus + } + Item { + width: 1 + height: 1 + } + Button { + id: profTogBtn + width: parent.width + text: "PROFILE UI" + focusPolicy: Qt.NoFocus + onClicked: s3dpres.profileUiVisible = !s3dpres.profileUiVisible + } + Slider { + id: profScaleSlider + width: parent.width + from: 50 + to: 400 + value: 100 + focusPolicy: Qt.NoFocus + enabled: s3dpres.profileUiVisible + opacity: enabled ? 1.0: 0.2 + onValueChanged: s3dpres.profileUiScale = value/100 + Text { + anchors.horizontalCenter: parent.horizontalCenter + y: -8 + z: 10 + text: "PROFILE UI SCALE: " + s3dpres.profileUiScale.toFixed(2) + color: "#ffffff" + } + } + } +} diff --git a/examples/3dstudioruntime2/stereoscopicqml/StereoTester/StereoTester.uip b/examples/3dstudioruntime2/stereoscopicqml/StereoTester/StereoTester.uip new file mode 100644 index 0000000..0bd5b0e --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/StereoTester/StereoTester.uip @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP version="5" > + <Project > + <ProjectSettings author="" company="" presentationWidth="1280" presentationHeight="720" maintainAspect="False" preferKtx="False" > + <CustomColors count="16" >#7391ff #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" /> + <Light id="Light2" /> + <Model id="Cylinder" > + <Text id="Text_003" /> + <ReferencedMaterial id="Default" name="Default" /> + </Model> + <Model id="Cube" > + <Text id="Text" /> + <ReferencedMaterial id="Default_001" name="Default" /> + </Model> + <Model id="Cube2" > + <Text id="Text_001" /> + <ReferencedMaterial id="Default_002" name="Default" /> + </Model> + <Model id="Cube3" > + <Text id="Text_002" /> + <ReferencedMaterial id="Default_003" name="Default" /> + </Model> + <Model id="Sphere" > + <ReferencedMaterial id="Default_004" name="Default" /> + <Text id="Text_004" /> + </Model> + </Layer> + <Material id="__Container" > + <Material id="materials//Default" /> + </Material> + </Scene> + </Graph> + <Logic > + <State name="Master Slide" component="#Scene" > + <Add ref="#Layer" /> + <Add ref="#Camera" /> + <Add ref="#Light" brightness="30" lightambient="0.14902 0.152941 0.0509804" lightdiffuse="1 1 1" position="0 0 1200" scale="1 1 1" shdwfactor="10" shdwfilter="35" /> + <Add ref="#__Container" name="__Container" /> + <Add ref="#materials//Default" name="materials//Default" /> + <State id="Scene-Slide1" name="Slide1" playmode="Looping" > + <Add ref="#Light2" name="Light2" brightness="100" lightambient="0.184314 0.184314 0.145098" lightdiffuse="0.988235 1 0.843137" lighttype="Area" position="400 200 -800" rotation="70 -60 0" scale="10 10 10" /> + <Add ref="#Cylinder" name="Cylinder" pivot="0 0 0" position="-400 200 0" scale="1 1.5 1" sourcepath="#Cylinder" > + <AnimationTrack property="position.x" type="EaseInOut" >0 -400 100 100 4 -100 100 100 6 0 100 100 10 -400 100 100</AnimationTrack> + <AnimationTrack property="position.y" type="EaseInOut" >0 200 100 100 4 -40 100 100 6 40 100 100 10 200 100 100</AnimationTrack> + <AnimationTrack property="position.z" type="EaseInOut" >0 0 100 100 4 -300 100 100 6 -360 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 -80 100 100 4 50 100 100 10 -80 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 4 50 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 4 50 100 100 10 0 100 100</AnimationTrack> + </Add> + <Add ref="#Text_003" name="Text" dropshadow="True" dropshadowoffset="30" font="TitilliumWeb-Regular" position="0 -52 0" rotation="-90 0 0" scale="0.2 0.2 1" size="96" textcolor="1 1 1" textstring="BOOM!" /> + <Add ref="#Default" name="Default" referencedmaterial="#materials//Default" sourcepath="/Default" /> + <Add ref="#Cube" name="Cube" position="0 0 -300" rotation="-20 -20 0" sourcepath="#Cube" > + <AnimationTrack property="position.x" type="EaseInOut" >0 0 100 100 5 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="position.y" type="EaseInOut" >0 0 100 100 5 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="position.z" type="EaseInOut" >0 -400 100 100 5 100 100 100 10 -400 100 100</AnimationTrack> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 -20 100 100 5 -20 100 100 10 -20 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 -20 100 100 5 -20 100 100 10 -20 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 5 360 100 100 10 0 100 100</AnimationTrack> + </Add> + <Add ref="#Text" name="Text" dropshadow="True" dropshadowoffset="30" font="TitilliumWeb-Regular" position="0 0 -52" rotation="0 0 0" scale="0.35 0.35 1" size="96" textcolor="1 1 1" textstring="Qt 3D Studio" /> + <Add ref="#Default_001" name="Default" referencedmaterial="#materials//Default" sourcepath="/Default" /> + <Add ref="#Cube2" name="Cube2" pivot="0 0 0" position="180 -50 -320" rotation="0 0 10" scale="1 1 0.1" sourcepath="#Cube" > + <AnimationTrack property="rotation.x" type="EaseInOut" >0 30 100 100 2.5 -20 100 100 5 30 100 100 7.5 -20 100 100 10 30 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 2.5 0 100 100 5 0 100 100 7.5 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 10 100 100 2.5 -10 100 100 5 10 100 100 7.5 -10 100 100 10 10 100 100</AnimationTrack> + </Add> + <Add ref="#Text_001" name="Text" dropshadow="True" dropshadowoffset="30" font="TitilliumWeb-Regular" position="0 0 -52" rotation="0 0 0" scale="0.35 0.35 1" size="96" textcolor="1 1 1" textstring="NEAR" /> + <Add ref="#Default_002" name="Default" referencedmaterial="#materials//Default" sourcepath="/Default" /> + <Add ref="#Cube3" name="Cube3" pivot="0 0 0" position="500 200 100" rotation="0 0 10" scale="1 1 0.1" sourcepath="#Cube" > + <AnimationTrack property="rotation.x" type="EaseInOut" >0 30 100 100 2.5 -20 100 100 5 30 100 100 7.5 -20 100 100 10 30 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 2.5 0 100 100 5 0 100 100 7.5 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 10 100 100 2.5 -10 100 100 5 10 100 100 7.5 -10 100 100 10 10 100 100</AnimationTrack> + </Add> + <Add ref="#Text_002" name="Text" dropshadow="True" dropshadowoffset="30" font="TitilliumWeb-Regular" position="0 0 -52" rotation="0 0 0" scale="0.35 0.35 1" size="96" textcolor="1 1 1" textstring="FAR" /> + <Add ref="#Default_003" name="Default" referencedmaterial="#materials//Default" sourcepath="/Default" /> + <Add ref="#Sphere" name="Sphere" position="0 600 2000" rotation="0 0 0" scale="10 10 10" sourcepath="#Sphere" > + <AnimationTrack property="rotation.x" type="EaseInOut" >0 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 10 360 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 -10 100 100 10 -10 100 100</AnimationTrack> + </Add> + <Add ref="#Default_004" name="Default" referencedmaterial="#materials//Default" sourcepath="/Default" /> + <Add ref="#Text_004" name="Text" dropshadow="True" dropshadowoffset="30" font="TitilliumWeb-Regular" opacity="40" position="0 0 -50" rotation="0 0 0" scale="0.1 0.1 1" size="64" textcolor="1 1 1" textstring="DISTANT PLANET" /> + </State> + </State> + </Logic> + </Project> +</UIP> diff --git a/examples/3dstudioruntime2/stereoscopicqml/arrow.png b/examples/3dstudioruntime2/stereoscopicqml/arrow.png Binary files differnew file mode 100644 index 0000000..5ae608b --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/arrow.png diff --git a/examples/3dstudioruntime2/stereoscopicqml/doc/images/stereoscopicqml.png b/examples/3dstudioruntime2/stereoscopicqml/doc/images/stereoscopicqml.png Binary files differnew file mode 100644 index 0000000..cf656c7 --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/doc/images/stereoscopicqml.png diff --git a/examples/3dstudioruntime2/stereoscopicqml/doc/src/stereoscopicqml.qdoc b/examples/3dstudioruntime2/stereoscopicqml/doc/src/stereoscopicqml.qdoc new file mode 100644 index 0000000..4fc7c22 --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/doc/src/stereoscopicqml.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2018 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 stereoscopicqml + \title Qt 3D Studio Runtime: Stereoscopic QML Example + \ingroup qt3dstudioruntime2-examples-qml + \brief Demonstrates using the stereoscopic QML API of Studio3D ViewerSettings + + \image stereoscopicqml.png + + \e {This example demonstrates stereoscopic QML API of Studio3D ViewerSettings} + + \include examples-run.qdocinc + + \section1 Description + + This example demonstrates usage of \l Studio3D, \l Presentation and + \l ViewerSettings to adjust the stereoscopic mode (mono, top-bottom, + left-right, anaglyph) and eye separation value. Sample Qt 3D Studio + presentation is provided, but it is also possible to open other + uip presentation files. +*/ diff --git a/examples/3dstudioruntime2/stereoscopicqml/main.cpp b/examples/3dstudioruntime2/stereoscopicqml/main.cpp new file mode 100644 index 0000000..85afad1 --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/main.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtWidgets/QApplication> // for MessageDialog +#include <QQmlApplicationEngine> +#include <q3dsruntimeglobal.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()); + + QQmlApplicationEngine engine; + engine.load("qrc:/main.qml"); + return app.exec(); +} diff --git a/examples/3dstudioruntime2/stereoscopicqml/main.qml b/examples/3dstudioruntime2/stereoscopicqml/main.qml new file mode 100644 index 0000000..b347208 --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/main.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtStudio3D 2.3 +import QtQuick.Window 2.3 +import QtQuick.Controls 2.2 +import Qt.labs.platform 1.0 + +Window { + id: mainView + + property int frameCount: 0 + property real eyeSeparation: 4.0 + + title: qsTr("Qt 3D Studio Stereoscopic Tester") + color: "#000000" + width: 1280 + height: 720 + visible: true + + function toggleFullscreen() { + if (mainView.visibility == Window.FullScreen) + mainView.showNormal(); + else + mainView.showFullScreen(); + } + + Studio3D { + id: s3d + focus: true + anchors.fill: parent + + onFrameUpdate: frameCount += 1 + + ViewerSettings { + id: viewSettings + stereoMode: ViewerSettings.StereoModeTopBottom + stereoEyeSeparation: mainView.eyeSeparation + } + + Presentation { + id: s3dpres + source: "qrc:/StereoTester/StereoTester.uip" + profilingEnabled: true + } + + onErrorChanged: { + if (s3d.error !== "") { + errorDialog.text = s3d.error; + errorDialog.open(); + } + } + } + + SettingsPanel { + id: settingsPanel + } + + MessageDialog { + id: errorDialog + } + + FileDialog { + id: openDialog + fileMode: FileDialog.OpenFile + nameFilters: ["UIP files (*.uip)", "UIA files (*.uia)", "All files (*)"] + onAccepted: s3dpres.source = file + } +} diff --git a/examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.pro b/examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.pro new file mode 100644 index 0000000..6e50c4a --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.pro @@ -0,0 +1,15 @@ +TEMPLATE = app + +QT += widgets qml quick 3dstudioruntime2 + +SOURCES += \ + main.cpp + +RESOURCES += stereoscopicqml.qrc + +OTHER_FILES += \ + main.qml \ + SettingsPanel.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/3dstudioruntime2/$$TARGET +INSTALLS += target diff --git a/examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.qrc b/examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.qrc new file mode 100644 index 0000000..378f012 --- /dev/null +++ b/examples/3dstudioruntime2/stereoscopicqml/stereoscopicqml.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>SettingsPanel.qml</file> + <file>arrow.png</file> + <file>StereoTester/StereoTester.uip</file> + </qresource> +</RCC> |