summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/bigscene-cpp/main.cpp46
-rw-r--r--tests/manual/manual.pro137
-rw-r--r--tests/manual/quickwidget-switch/main.cpp125
-rw-r--r--tests/manual/quickwidget-switch/main.qml152
-rw-r--r--tests/manual/quickwidget-switch/quickwidget-switch.pro13
-rw-r--r--tests/manual/quickwidget-switch/quickwidget-switch.qrc5
-rw-r--r--tests/manual/quickwindow-switch/main.cpp68
-rw-r--r--tests/manual/quickwindow-switch/main.qml181
-rw-r--r--tests/manual/quickwindow-switch/quickwindow-switch.pro13
-rw-r--r--tests/manual/quickwindow-switch/quickwindow-switch.qrc5
-rw-r--r--tests/manual/rendercapture-cpp/mycapture.h2
-rw-r--r--tests/manual/rhi/main.cpp445
-rw-r--r--tests/manual/rhi/qtlogo.pngbin0 -> 11386 bytes
-rw-r--r--tests/manual/rhi/rhi.pro10
14 files changed, 1137 insertions, 65 deletions
diff --git a/tests/manual/bigscene-cpp/main.cpp b/tests/manual/bigscene-cpp/main.cpp
index 5e61758db..5a66cb213 100644
--- a/tests/manual/bigscene-cpp/main.cpp
+++ b/tests/manual/bigscene-cpp/main.cpp
@@ -70,6 +70,11 @@
#include <qmath.h>
#include <Qt3DExtras/qt3dwindow.h>
#include <Qt3DExtras/qfirstpersoncameracontroller.h>
+#include <Qt3DRender/QRenderSurfaceSelector>
+#include <Qt3DRender/QCameraSelector>
+#include <Qt3DRender/QViewport>
+#include <Qt3DRender/QNoDraw>
+#include <Qt3DRender/QDebugOverlay>
using namespace Qt3DCore;
using namespace Qt3DRender;
@@ -78,7 +83,46 @@ int main(int ac, char **av)
{
QGuiApplication app(ac, av);
Qt3DExtras::Qt3DWindow view;
- view.defaultFrameGraph()->setClearColor(Qt::black);
+
+ // FrameGraph
+ {
+ QRenderSurfaceSelector *surfaceSelector = new QRenderSurfaceSelector();
+ QCameraSelector *cameraSelector = new Qt3DRender::QCameraSelector(surfaceSelector);
+ cameraSelector->setCamera(view.camera());
+ QClearBuffers *clearBuffers = new Qt3DRender::QClearBuffers(cameraSelector);
+ clearBuffers->setClearColor(QColor(Qt::gray));
+ clearBuffers->setBuffers(QClearBuffers::ColorDepthBuffer);
+ new QNoDraw(clearBuffers);
+
+ const QRectF viewports[] = {
+ {0.0f, 0.0f, 0.25f, 0.25f},
+ {0.25f, 0.0f, 0.25f, 0.25f},
+ {0.5f, 0.0f, 0.25f, 0.25f},
+ {0.75f, 0.0f, 0.25f, 0.25f},
+ {0.0f, 0.25f, 0.25f, 0.25f},
+ {0.25f, 0.25f, 0.25f, 0.25f},
+ {0.5f, 0.25f, 0.25f, 0.25f},
+ {0.75f, 0.25f, 0.25f, 0.25f},
+ {0.0f, 0.5f, 0.25f, 0.25f},
+ {0.25f, 0.5f, 0.25f, 0.25f},
+ {0.5f, 0.5f, 0.25f, 0.25f},
+ {0.75f, 0.5f, 0.25f, 0.25f},
+ {0.0f, 0.75f, 0.25f, 0.25f},
+ {0.25f, 0.75f, 0.25f, 0.25f},
+ {0.5f, 0.75f, 0.25f, 0.25f},
+ {0.75f, 0.75f, 0.25f, 0.25f},
+ };
+
+ for (const QRectF &vp : viewports) {
+ QViewport *viewport = new Qt3DRender::QViewport(cameraSelector);
+ viewport->setNormalizedRect(vp);
+ }
+
+ new QDebugOverlay(qobject_cast<Qt3DCore::QNode *>(cameraSelector->children().last()));
+
+ view.setActiveFrameGraph(surfaceSelector);
+ }
+
QEntity *root = new QEntity();
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 2a639afdb..c64044464 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -1,85 +1,29 @@
TEMPLATE = subdirs
SUBDIRS += \
- assimp \
bigscene-cpp \
- bigmodel-qml \
- bigscene-instanced-qml \
- clip-planes-qml \
component-changes \
custom-mesh-cpp \
custom-mesh-cpp-indirect \
- custom-mesh-qml \
custom-mesh-update-data-cpp \
- custom-mesh-update-data-qml \
cylinder-cpp \
cylinder-parent-test \
- cylinder-qml \
deferred-renderer-cpp \
- deferred-renderer-qml \
- downloading \
- dragging \
- dynamicscene-cpp \
- enabled-qml \
- gltf \
- gooch-qml \
- keyboardinput-qml \
- loader-qml \
- lod \
- mouseinput-qml \
- multiplewindows-qml \
- picking-qml \
- plasma \
- pointlinesize \
- scene3d-loader \
- simple-shaders-qml \
- skybox \
- tessellation-modes \
- transforms-qml \
- spritegrid \
- transparency-qml \
- transparency-qml-scene3d \
- rendercapture-qml \
- additional-attributes-qml \
- dynamic-model-loader-qml \
- buffercapture-qml \
- render-qml-to-texture \
- render-qml-to-texture-qml \
- video-texture-qml \
- animation-keyframe-simple \
- animation-keyframe-blendtree \
- distancefieldtext \
- mesh-morphing \
- anim-viewer \
- animation-keyframe-programmatic \
- layerfilter-qml \
- skinned-mesh \
- rigged-simple \
- proximityfilter \
- rendercapture-qml-fbo \
- blitframebuffer-qml \
- raycasting-qml \
- shared_texture_image \
- texture_property_updates \
raster-cpp \
- raster-qml \
qtbug-72236 \
- qtbug-76766 \
- shader-image-qml \
- scene3d-in-sync \
- compressed_textures \
- subtree-enabler-qml \
- scene3d-visibility \
manual-renderloop \
+ rhi \
boundingvolumes
-!macos:!uikit: SUBDIRS += compute-manual
-
qtHaveModule(multimedia): {
SUBDIRS += \
- sharedtexture \
- sharedtextureqml
+ sharedtexture
+
+ qtHaveModule(quick) {
+ SUBDIRS += \
+ sharedtextureqml
+ }
}
qtHaveModule(widgets): {
@@ -89,3 +33,70 @@ qtHaveModule(widgets): {
rendercapture-cpp \
texture-updates-cpp
}
+
+qtHaveModule(quick) {
+ !macos:!uikit: SUBDIRS += compute-manual
+
+ SUBDIRS += \
+ assimp \
+ animation-keyframe-simple \
+ animation-keyframe-blendtree \
+ animation-keyframe-programmatic \
+ bigmodel-qml \
+ bigscene-instanced-qml \
+ clip-planes-qml \
+ custom-mesh-qml \
+ custom-mesh-update-data-qml \
+ cylinder-qml \
+ deferred-renderer-qml \
+ downloading \
+ dynamicscene-cpp \
+ dragging \
+ enabled-qml \
+ gltf \
+ gooch-qml \
+ keyboardinput-qml \
+ lod \
+ loader-qml \
+ mouseinput-qml \
+ multiplewindows-qml \
+ plasma \
+ pointlinesize \
+ scene3d-loader \
+ picking-qml \
+ skybox \
+ simple-shaders-qml \
+ transparency-qml \
+ transparency-qml-scene3d \
+ rendercapture-qml \
+ additional-attributes-qml \
+ dynamic-model-loader-qml \
+ buffercapture-qml \
+ render-qml-to-texture \
+ render-qml-to-texture-qml \
+ video-texture-qml \
+ transforms-qml \
+ layerfilter-qml \
+ tessellation-modes \
+ rendercapture-qml-fbo \
+ blitframebuffer-qml \
+ raycasting-qml \
+ raster-qml \
+ shader-image-qml \
+ spritegrid \
+ subtree-enabler-qml \
+ distancefieldtext \
+ mesh-morphing \
+ anim-viewer \
+ skinned-mesh \
+ rigged-simple \
+ proximityfilter \
+ scene3d-visibility \
+ shared_texture_image \
+ texture_property_updates \
+ qtbug-76766 \
+ scene3d-in-sync \
+ compressed_textures \
+}
+
+qtHaveModule(quickwidgets): SUBDIRS += quickwidget-switch
diff --git a/tests/manual/quickwidget-switch/main.cpp b/tests/manual/quickwidget-switch/main.cpp
new file mode 100644
index 000000000..ebadc458d
--- /dev/null
+++ b/tests/manual/quickwidget-switch/main.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $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 <QDesktopWidget>
+#include <QScreen>
+#include <QApplication>
+#include <QMainWindow>
+#include <QMdiArea>
+#include <QMdiSubWindow>
+#include <QQuickWidget>
+#include <QVBoxLayout>
+#include <QPushButton>
+
+void configureMainWindow(QMainWindow *w, QMdiArea *mdiArea, QPushButton *button)
+{
+ auto widget = new QWidget;
+ auto layout = new QVBoxLayout;
+ layout->addWidget(mdiArea);
+ layout->addWidget(button);
+ widget->setLayout(layout);
+ w->setCentralWidget(widget);
+}
+
+int main(int argc, char* argv[])
+{
+ QApplication app(argc, argv);
+
+ QMainWindow w1;
+ w1.winId();
+ w1.windowHandle()->setScreen(QGuiApplication::screens().at(0));
+ auto mdiArea1 = new QMdiArea;
+ auto button1 = new QPushButton("Switch to this window");
+ configureMainWindow(&w1, mdiArea1, button1);
+ w1.setGeometry(0, 0, 800, 800);
+ w1.show();
+
+ QMainWindow w2;
+ w2.winId();
+ w2.windowHandle()->setScreen(QGuiApplication::screens().at(1));
+ auto mdiArea2 = new QMdiArea;
+ auto button2 = new QPushButton("Switch to this window");
+ configureMainWindow(&w2, mdiArea2, button2);
+ w2.setGeometry(0, 0, 800, 800);
+ w2.show();
+
+ QMdiSubWindow* subWindow = new QMdiSubWindow();
+
+ QQuickWidget *quickWidget = new QQuickWidget();
+ quickWidget->resize(QSize(400, 400));
+ quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ quickWidget->setSource(QUrl("qrc:/main.qml"));
+
+ subWindow->setWidget(quickWidget);
+
+ QObject::connect(button1, &QPushButton::clicked,
+ [mdiArea1, mdiArea2, subWindow, button1, button2]() {
+ mdiArea2->removeSubWindow(subWindow);
+ mdiArea1->addSubWindow(subWindow);
+ subWindow->show();
+ button1->setEnabled(false);
+ button2->setEnabled(true);
+ });
+
+ QObject::connect(button2, &QPushButton::clicked,
+ [mdiArea1, mdiArea2, subWindow, button1, button2]() {
+ mdiArea1->removeSubWindow(subWindow);
+ mdiArea2->addSubWindow(subWindow);
+ subWindow->show();
+ button1->setEnabled(true);
+ button2->setEnabled(false);
+ });
+
+ mdiArea2->addSubWindow(subWindow);
+ button2->setEnabled(false);
+ subWindow->show();
+
+ return app.exec();
+}
diff --git a/tests/manual/quickwidget-switch/main.qml b/tests/manual/quickwidget-switch/main.qml
new file mode 100644
index 000000000..d4bce020c
--- /dev/null
+++ b/tests/manual/quickwidget-switch/main.qml
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $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.2 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+import QtQuick.Scene3D 2.0
+
+QQ2.Item {
+ id: mioitem
+ width: 300
+ height: 300
+ Scene3D {
+ id: scene3d
+ anchors.fill: parent
+ Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, -40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController {
+ camera: camera
+ }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ PhongMaterial {
+ id: material
+ }
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: torusTransform
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, material, torusTransform ]
+ }
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ Transform {
+ id: sphereTransform
+ property real userAngle: 0.0
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(userAngle, Qt.vector3d(0, 1, 0));
+ m.translate(Qt.vector3d(20, 0, 0));
+ return m;
+ }
+ }
+
+ QQ2.NumberAnimation {
+ target: sphereTransform
+ property: "userAngle"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ sphereMesh, material, sphereTransform ]
+ }
+ }
+ }
+}
diff --git a/tests/manual/quickwidget-switch/quickwidget-switch.pro b/tests/manual/quickwidget-switch/quickwidget-switch.pro
new file mode 100644
index 000000000..2f1cb98f5
--- /dev/null
+++ b/tests/manual/quickwidget-switch/quickwidget-switch.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+
+QT += 3dextras
+CONFIG += resources_big
+
+QT += 3dcore 3drender 3dinput 3dquick 3dlogic qml quick 3dquickextras widgets quickwidgets
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ quickwidget-switch.qrc
+
diff --git a/tests/manual/quickwidget-switch/quickwidget-switch.qrc b/tests/manual/quickwidget-switch/quickwidget-switch.qrc
new file mode 100644
index 000000000..5f6483ac3
--- /dev/null
+++ b/tests/manual/quickwidget-switch/quickwidget-switch.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/quickwindow-switch/main.cpp b/tests/manual/quickwindow-switch/main.cpp
new file mode 100644
index 000000000..7bebe0c75
--- /dev/null
+++ b/tests/manual/quickwindow-switch/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ const QUrl url(QStringLiteral("qrc:/main.qml"));
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
+ &app, [url](QObject *obj, const QUrl &objUrl) {
+ if (!obj && url == objUrl)
+ QCoreApplication::exit(-1);
+ }, Qt::QueuedConnection);
+ engine.load(url);
+
+ return app.exec();
+}
diff --git a/tests/manual/quickwindow-switch/main.qml b/tests/manual/quickwindow-switch/main.qml
new file mode 100644
index 000000000..4b474bd11
--- /dev/null
+++ b/tests/manual/quickwindow-switch/main.qml
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $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.2
+import QtQuick.Window 2.12 as Win
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+import QtQuick.Scene3D 2.0
+
+Win.Window {
+ id: win
+ width: 300
+ height: 350
+ visible: true
+ x: Win.Screen.width / 2 - width / 2
+ y: Win.Screen.height / 2 - height / 2
+ Item {
+ id: mioitem
+ width: 300
+ height: 300
+ Scene3D {
+ id: scene3d
+ anchors.fill: parent
+ Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, -40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController {
+ camera: camera
+ }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ PhongMaterial {
+ id: material
+ }
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: torusTransform
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, material, torusTransform ]
+ }
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ Transform {
+ id: sphereTransform
+ property real userAngle: 0.0
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(userAngle, Qt.vector3d(0, 1, 0));
+ m.translate(Qt.vector3d(20, 0, 0));
+ return m;
+ }
+ }
+
+ NumberAnimation {
+ target: sphereTransform
+ property: "userAngle"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: Animation.Infinite
+ running: true
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ sphereMesh, material, sphereTransform ]
+ }
+ }
+ }
+ }
+ Rectangle {
+ height: 50
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ color: "yellow"
+ MouseArea {
+ anchors.fill: parent
+ z: 5
+ onClicked: {
+ win.screen = (win.screen === Qt.application.screens[0] ? Qt.application.screens[1] : Qt.application.screens[0])
+ }
+ }
+ Text {
+ anchors.centerIn: parent
+ minimumPointSize: 12
+ fontSizeMode: Text.Fit
+ text: "Move to the other screen"
+ }
+ }
+}
diff --git a/tests/manual/quickwindow-switch/quickwindow-switch.pro b/tests/manual/quickwindow-switch/quickwindow-switch.pro
new file mode 100644
index 000000000..2f338d36d
--- /dev/null
+++ b/tests/manual/quickwindow-switch/quickwindow-switch.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+
+QT += 3dextras
+CONFIG += resources_big
+
+QT += 3dcore 3drender 3dinput 3dquick 3dlogic qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ quickwindow-switch.qrc
+
diff --git a/tests/manual/quickwindow-switch/quickwindow-switch.qrc b/tests/manual/quickwindow-switch/quickwindow-switch.qrc
new file mode 100644
index 000000000..5f6483ac3
--- /dev/null
+++ b/tests/manual/quickwindow-switch/quickwindow-switch.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/rendercapture-cpp/mycapture.h b/tests/manual/rendercapture-cpp/mycapture.h
index fea1abe46..f7893c8ad 100644
--- a/tests/manual/rendercapture-cpp/mycapture.h
+++ b/tests/manual/rendercapture-cpp/mycapture.h
@@ -75,7 +75,7 @@ public slots:
m_reply->saveImage("capture.bmp");
- delete m_reply;
+ m_reply->deleteLater();
m_reply = nullptr;
if (m_continuous)
diff --git a/tests/manual/rhi/main.cpp b/tests/manual/rhi/main.cpp
new file mode 100644
index 000000000..62ea0ab93
--- /dev/null
+++ b/tests/manual/rhi/main.cpp
@@ -0,0 +1,445 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <Qt3DCore/QEntity>
+#include <Qt3DRender/QCamera>
+#include <Qt3DRender/QCameraLens>
+#include <Qt3DCore/QTransform>
+#include <Qt3DCore/QAspectEngine>
+#include <Qt3DCore/QGeometry>
+#include <Qt3DCore/QAttribute>
+#include <Qt3DCore/QBuffer>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DRender/QRenderStateSet>
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DExtras/QPerVertexColorMaterial>
+
+#include <Qt3DRender/QGeometryRenderer>
+
+#include <QPropertyAnimation>
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qorbitcameracontroller.h>
+#include <Qt3DRender/QParameter>
+#include <Qt3DRender/QEffect>
+#include <Qt3DRender/QTechnique>
+#include <Qt3DRender/QAbstractTexture>
+#include <Qt3DRender/QShaderProgram>
+#include <Qt3DRender/QRenderPass>
+#include <Qt3DRender/QBlendEquation>
+#include <Qt3DRender/QBlendEquationArguments>
+#include <Qt3DRender/QFilterKey>
+#include <Qt3DRender/QGraphicsApiFilter>
+#include <Qt3DRender/QRenderSurfaceSelector>
+#include <Qt3DRender/QViewport>
+#include <Qt3DRender/QCameraSelector>
+#include <Qt3DRender/QNoDraw>
+#include <QColor>
+#include <QVector2D>
+#include <QUrl>
+#include <QTimer>
+#include <Qt3DRender/QMaterial>
+#include <Qt3DRender/QFilterKey>
+#include <Qt3DRender/QTechnique>
+#include <Qt3DRender/QMaterial>
+#include <Qt3DRender/QTexture>
+#include <qmath.h>
+
+static const constexpr auto vertex_shader = R"_(#version 450
+
+layout(location = 0) in vec3 vertexPosition;
+layout(location = 1) in vec3 vertexColor;
+layout(location = 0) out vec3 color;
+
+layout(std140, binding = 0) uniform qt3d_render_view_uniforms {
+ mat4 viewMatrix;
+ mat4 projectionMatrix;
+ mat4 viewProjectionMatrix;
+ mat4 inverseViewMatrix;
+ mat4 inverseProjectionMatrix;
+ mat4 inverseViewProjectionMatrix;
+ mat4 viewportMatrix;
+ mat4 inverseViewportMatrix;
+ vec4 textureTransformMatrix;
+ vec3 eyePosition;
+ float aspectRatio;
+ float gamma;
+ float exposure;
+ float time;
+};
+layout(std140, binding = 1) uniform qt3d_command_uniforms {
+ mat4 modelMatrix;
+ mat4 inverseModelMatrix;
+ mat4 modelViewMatrix;
+ mat3 modelNormalMatrix;
+ mat4 inverseModelViewMatrix;
+ mat4 mvp;
+ mat4 inverseModelViewProjectionMatrix;
+};
+void main()
+{
+ color = vertexColor;
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
+)_";
+
+static const constexpr auto fragment_shader = R"_(#version 450
+
+layout(location = 0) out vec4 fragColor;
+layout(location = 0) in vec3 color;
+
+layout(std140, binding = 0) uniform qt3d_render_view_uniforms {
+ mat4 viewMatrix;
+ mat4 projectionMatrix;
+ mat4 viewProjectionMatrix;
+ mat4 inverseViewMatrix;
+ mat4 inverseProjectionMatrix;
+ mat4 inverseViewProjectionMatrix;
+ mat4 viewportMatrix;
+ mat4 inverseViewportMatrix;
+ vec4 textureTransformMatrix;
+ vec3 eyePosition;
+ float aspectRatio;
+ float gamma;
+ float exposure;
+ float time;
+};
+layout(std140, binding = 1) uniform qt3d_command_uniforms {
+ mat4 modelMatrix;
+ mat4 inverseModelMatrix;
+ mat4 modelViewMatrix;
+ mat3 modelNormalMatrix;
+ mat4 inverseModelViewMatrix;
+ mat4 mvp;
+ mat4 inverseModelViewProjectionMatrix;
+};
+layout(std140, binding = 2) uniform custom_ubo {
+ vec3 colorFactor;
+};
+
+layout(binding = 3) uniform sampler2D myTexture;
+void main()
+{
+ vec2 texCoord = color.xz;
+ vec2 rhiTexCoord = textureTransformMatrix.xy * texCoord+ textureTransformMatrix.zw;
+ fragColor = vec4(color * colorFactor, 1.0);
+
+ fragColor *= texture(myTexture, rhiTexCoord);
+}
+
+)_";
+
+class Material : public Qt3DRender::QMaterial
+{
+public:
+ explicit Material(Qt3DCore::QNode *parent = nullptr)
+ : QMaterial(parent)
+ , m_effect(new Qt3DRender::QEffect(this))
+{
+ setEffect(m_effect);
+
+ m_testParam = new Qt3DRender::QParameter(QStringLiteral("example"), float(0.5));
+
+ m_effect->addParameter(m_testParam);
+
+ m_filter = new Qt3DRender::QFilterKey(this);
+ m_filter->setName(QStringLiteral("renderingStyle"));
+ m_filter->setValue(QStringLiteral("forward"));
+
+ m_technique = new Qt3DRender::QTechnique(m_effect);
+ m_technique->addFilterKey(m_filter);
+
+ m_effect->addTechnique(m_technique);
+
+ m_program = new Qt3DRender::QShaderProgram(m_effect);
+ m_program->setVertexShaderCode(vertex_shader);
+ m_program->setFragmentShaderCode(fragment_shader);
+
+ m_renderPass = new Qt3DRender::QRenderPass(m_effect);
+
+ m_renderPass->setShaderProgram(m_program);
+
+ m_technique->addRenderPass(m_renderPass);
+
+ m_technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::RHI);
+}
+private:
+ Qt3DRender::QEffect *m_effect{};
+ Qt3DRender::QParameter *m_testParam{};
+ Qt3DRender::QFilterKey *m_filter{};
+ Qt3DRender::QTechnique *m_technique{};
+ Qt3DRender::QShaderProgram *m_program{};
+ Qt3DRender::QRenderPass *m_renderPass{};
+};
+
+int main(int argc, char* argv[])
+{
+ qputenv("QT3D_RENDERER", "rhi");
+ QGuiApplication app(argc, argv);
+
+ auto api = Qt3DRender::API::OpenGL;
+ if (argc >= 2) {
+
+#ifdef Q_OS_WIN
+ if (argv[1] == QByteArrayLiteral("--d3d11")) api = Qt3DRender::API::DirectX;
+#endif
+
+#if QT_CONFIG(vulkan)
+ if (argv[1] == QByteArrayLiteral("--vulkan")) api = Qt3DRender::API::Vulkan;
+#endif
+
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+ if (argv[1] == QByteArrayLiteral("--metal")) api = Qt3DRender::API::Metal;
+#endif
+ }
+
+ Qt3DExtras::Qt3DWindow view{nullptr, api};
+
+ // Root entity
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
+
+ // Camera
+ Qt3DRender::QCamera *topViewCamera = new Qt3DRender::QCamera(rootEntity);
+ topViewCamera->setPosition(QVector3D(0, 40, 0));
+ topViewCamera->setViewCenter(QVector3D(0, 0, 0));
+ topViewCamera->setUpVector(QVector3D(0, 0, 1));
+ topViewCamera->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+
+ Qt3DRender::QCamera *cameraEntity = view.camera();
+ cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+ cameraEntity->setPosition(QVector3D(0, 0, 40.0f));
+ cameraEntity->setUpVector(QVector3D(0, 1, 0));
+ cameraEntity->setViewCenter(QVector3D(0, 0, 0));
+
+ {
+ // Custom FG
+ auto *surfaceSelector = new Qt3DRender::QRenderSurfaceSelector();
+ surfaceSelector->setSurface(&view);
+
+ // RV 1
+ auto *clearBuffer = new Qt3DRender::QClearBuffers(surfaceSelector);
+ clearBuffer->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer);
+ clearBuffer->setClearColor(QColor::fromRgbF(0.1, 0.5, 0.0, 1.0));
+ auto *noDraw = new Qt3DRender::QNoDraw(clearBuffer);
+
+ // RV 2
+ auto *cameraSelector1 = new Qt3DRender::QCameraSelector(surfaceSelector);
+ cameraSelector1->setCamera(view.camera());
+ auto *viewport1 = new Qt3DRender::QViewport(cameraSelector1);
+ viewport1->setNormalizedRect(QRectF(0.0f, 0.0f, 0.5f, 0.5f));
+
+ // RV3
+ auto *cameraSelector2 = new Qt3DRender::QCameraSelector(surfaceSelector);
+ cameraSelector2->setCamera(topViewCamera);
+ auto *viewport2 = new Qt3DRender::QViewport(cameraSelector2);
+ viewport2->setNormalizedRect(QRectF(0.5f, 0.5f, 0.5f, 0.5f));
+
+ view.setActiveFrameGraph(surfaceSelector);
+ }
+
+ QTimer *cameraAnimationTimer = new QTimer(&view);
+ QObject::connect(cameraAnimationTimer, &QTimer::timeout,
+ [cameraEntity] {
+ static int angle = 0;
+ const float radius = 40.0f;
+ const float anglef = qDegreesToRadians(float(angle));
+ cameraEntity->setPosition(QVector3D(qSin(anglef), 0.0f, qCos(anglef)) * radius);
+ angle += 1;
+ });
+ cameraAnimationTimer->start(16);
+
+ // For camera controls
+ Qt3DExtras::QOrbitCameraController *camController = new Qt3DExtras::QOrbitCameraController(rootEntity);
+ camController->setCamera(cameraEntity);
+
+ // Material
+ Qt3DRender::QMaterial *material = new Material(rootEntity);
+ Qt3DRender::QParameter *parameter = new Qt3DRender::QParameter(QStringLiteral("colorFactor"), QColor(Qt::white));
+ material->addParameter(parameter);
+
+ Qt3DRender::QTextureLoader *textureLoader = new Qt3DRender::QTextureLoader{};
+ textureLoader->setSource(QUrl{QStringLiteral("qrc:///qtlogo.png")});
+ Qt3DRender::QParameter *texture = new Qt3DRender::QParameter(QStringLiteral("myTexture"), textureLoader);
+ material->addParameter(texture);
+
+ QTimer *parameterAnimationTimer = new QTimer(&view);
+ QObject::connect(parameterAnimationTimer, &QTimer::timeout,
+ [parameter] {
+ static int angle = 0;
+ const float anglef = qDegreesToRadians(float(angle));
+ parameter->setValue(QColor::fromRgbF(fabs(qCos(anglef)), fabs(qSin(anglef)), 1.0f));
+ angle += 10;
+ });
+ parameterAnimationTimer->start(16);
+
+ // Torus
+ Qt3DCore::QEntity *customMeshEntity = new Qt3DCore::QEntity(rootEntity);
+
+ // Transform
+ Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
+ transform->setScale(8.0f);
+
+ // Custom Mesh (TetraHedron)
+ Qt3DRender::QGeometryRenderer *customMeshRenderer = new Qt3DRender::QGeometryRenderer;
+ Qt3DCore::QGeometryView *customMeshView = new Qt3DCore::QGeometryView;
+ Qt3DCore::QGeometry *customGeometry = new Qt3DCore::QGeometry;
+
+ Qt3DCore::QBuffer *vertexDataBuffer = new Qt3DCore::QBuffer(customGeometry);
+ Qt3DCore::QBuffer *indexDataBuffer = new Qt3DCore::QBuffer(customGeometry);
+
+ // 5 vertices of 3 vertices + 3 colors
+ QByteArray vertexBufferData;
+ vertexBufferData.resize(5 * (3 + 3) * sizeof(float));
+
+ // Vertices
+ QVector3D v0(-1.0f, 0.0f, -1.0f);
+ QVector3D v1(1.0f, 0.0f, -1.0f);
+ QVector3D v2(-1.0f, 0.0f, 1.0f);
+ QVector3D v3(1.0f, 0.0f, 1.0f);
+ QVector3D v4(0.0f, 2.0f, 0.0f);
+
+ QVector3D red(1.0f, 0.0f, 0.0f);
+ QVector3D green(0.0f, 1.0f, 0.0f);
+ QVector3D blue(0.0f, 0.0f, 1.0f);
+ QVector3D white(1.0f, 1.0f, 1.0f);
+ QVector3D grey(0.5f, 0.5f, 0.5f);
+
+ const QVector<QVector3D> vertices = QVector<QVector3D>()
+ << v0 << red
+ << v1 << green
+ << v2 << blue
+ << v3 << grey
+ << v4 << white;
+
+ memcpy(vertexBufferData.data(), vertices.constData(), vertices.size() * sizeof(QVector3D));
+ vertexDataBuffer->setData(vertexBufferData);
+
+ QByteArray indexBufferData;
+ // 6 triangle faces
+ indexBufferData.resize(6 * 3 * sizeof(ushort));
+ ushort *rawIndexArray = reinterpret_cast<ushort *>(indexBufferData.data());
+
+ rawIndexArray[0] = 0;
+ rawIndexArray[1] = 1;
+ rawIndexArray[2] = 2;
+
+ rawIndexArray[3] = 2;
+ rawIndexArray[4] = 1;
+ rawIndexArray[5] = 3;
+
+ rawIndexArray[6] = 2;
+ rawIndexArray[7] = 3;
+ rawIndexArray[8] = 4;
+
+ rawIndexArray[9] = 3;
+ rawIndexArray[10] = 1;
+ rawIndexArray[11] = 4;
+
+ rawIndexArray[12] = 1;
+ rawIndexArray[13] = 0;
+ rawIndexArray[14] = 4;
+
+ rawIndexArray[15] = 0;
+ rawIndexArray[16] = 2;
+ rawIndexArray[17] = 4;
+
+ indexDataBuffer->setData(indexBufferData);
+
+ // Attributes
+ Qt3DCore::QAttribute *positionAttribute = new Qt3DCore::QAttribute();
+ positionAttribute->setAttributeType(Qt3DCore::QAttribute::VertexAttribute);
+ positionAttribute->setBuffer(vertexDataBuffer);
+ positionAttribute->setVertexBaseType(Qt3DCore::QAttribute::Float);
+ positionAttribute->setVertexSize(3);
+ positionAttribute->setByteOffset(0);
+ positionAttribute->setByteStride(6 * sizeof(float));
+ positionAttribute->setCount(5);
+ positionAttribute->setName(Qt3DCore::QAttribute::defaultPositionAttributeName());
+
+ Qt3DCore::QAttribute *colorAttribute = new Qt3DCore::QAttribute();
+ colorAttribute->setAttributeType(Qt3DCore::QAttribute::VertexAttribute);
+ colorAttribute->setBuffer(vertexDataBuffer);
+ colorAttribute->setVertexBaseType(Qt3DCore::QAttribute::Float);
+ colorAttribute->setVertexSize(3);
+ colorAttribute->setByteOffset(3 * sizeof(float));
+ colorAttribute->setByteStride(6 * sizeof(float));
+ colorAttribute->setCount(5);
+ colorAttribute->setName(Qt3DCore::QAttribute::defaultColorAttributeName());
+
+ Qt3DCore::QAttribute *indexAttribute = new Qt3DCore::QAttribute();
+ indexAttribute->setAttributeType(Qt3DCore::QAttribute::IndexAttribute);
+ indexAttribute->setBuffer(indexDataBuffer);
+ indexAttribute->setVertexBaseType(Qt3DCore::QAttribute::UnsignedShort);
+ indexAttribute->setVertexSize(1);
+ indexAttribute->setByteOffset(0);
+ indexAttribute->setByteStride(0);
+ indexAttribute->setCount(18);
+
+ customGeometry->addAttribute(positionAttribute);
+ customGeometry->addAttribute(colorAttribute);
+ customGeometry->addAttribute(indexAttribute);
+
+ customMeshView->setPrimitiveType(Qt3DCore::QGeometryView::Triangles);
+ customMeshView->setGeometry(customGeometry);
+ customMeshRenderer->setView(customMeshView);
+
+ customMeshEntity->addComponent(customMeshRenderer);
+ customMeshEntity->addComponent(transform);
+ customMeshEntity->addComponent(material);
+
+ view.setRootEntity(rootEntity);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/rhi/qtlogo.png b/tests/manual/rhi/qtlogo.png
new file mode 100644
index 000000000..19eecfabf
--- /dev/null
+++ b/tests/manual/rhi/qtlogo.png
Binary files differ
diff --git a/tests/manual/rhi/rhi.pro b/tests/manual/rhi/rhi.pro
new file mode 100644
index 000000000..94e560391
--- /dev/null
+++ b/tests/manual/rhi/rhi.pro
@@ -0,0 +1,10 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += qtlogo.png