summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWieland Hagen <wieland.hagen@kdab.com>2017-02-01 22:31:56 +0700
committerWieland Hagen <wieland.hagen@kdab.com>2017-07-06 16:08:42 +0000
commit3c8d12a6aa46d49f4210ad3645da2b32901705fc (patch)
tree7dfbc399ba123eaf84344eb093df22864b4e3578
parent17977c51d765978cf3ae9fe71cf10b718b9f17be (diff)
Add manual test for QPointSize and QLineSize
Change-Id: I9db51044e5b166230602b9f67ca8b21a82c1b206 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--tests/manual/manual.pro1
-rw-r--r--tests/manual/pointlinesize/Scene.qml138
-rw-r--r--tests/manual/pointlinesize/main.cpp72
-rw-r--r--tests/manual/pointlinesize/main.qml107
-rw-r--r--tests/manual/pointlinesize/pointlinesize.pro15
-rw-r--r--tests/manual/pointlinesize/pointlinesize.qrc6
6 files changed, 339 insertions, 0 deletions
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 1dd418500..e2040d4db 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -29,6 +29,7 @@ SUBDIRS += \
multiplewindows-qml \
picking-qml \
plasma \
+ pointlinesize \
scene3d-loader \
simple-shaders-qml \
skybox \
diff --git a/tests/manual/pointlinesize/Scene.qml b/tests/manual/pointlinesize/Scene.qml
new file mode 100644
index 000000000..94f3bf351
--- /dev/null
+++ b/tests/manual/pointlinesize/Scene.qml
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.10
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+import QtQuick 2.0 as QQ2;
+
+Entity {
+ id: sceneRoot
+
+ property real width : 1
+ property alias smooth : lineWidth.smooth
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 2.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController {
+ camera: camera
+ linearSpeed: 1.0
+ }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph : RenderStateSet {
+ renderStates: [
+ PointSize {
+ value: sceneRoot.width
+ sizeMode: PointSize.Fixed
+ },
+ LineWidth {
+ id: lineWidth
+ value: sceneRoot.width / 3.0
+ }
+
+ ]
+
+ ForwardRenderer {
+ camera: camera
+ clearColor: "black"
+ }
+ }
+ },
+ InputSettings {
+ }
+ ]
+
+ SphereGeometry {
+ id: sphere
+ rings: 4
+ slices: 4
+ radius: 1
+ }
+
+ Entity {
+ components: [
+ GeometryRenderer {
+ // abuse PlaneGeometry to give us some lines
+ geometry: sphere
+ primitiveType: GeometryRenderer.LineStrip
+ },
+ PhongMaterial {
+ ambient: "white"
+ }
+ ]
+ }
+
+ Entity {
+ components: [
+ GeometryRenderer {
+ // abuse PlaneGeometry to give us some points
+ geometry: sphere
+ primitiveType: GeometryRenderer.Points
+ },
+ PhongMaterial {
+ ambient: "red"
+ }
+ ]
+ }
+
+}
diff --git a/tests/manual/pointlinesize/main.cpp b/tests/manual/pointlinesize/main.cpp
new file mode 100644
index 000000000..5ede02f15
--- /dev/null
+++ b/tests/manual/pointlinesize/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 <QQuickView>
+#include <QOpenGLContext>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QSurfaceFormat format;
+ format.setVersion(2, 0);
+ format.setProfile(QSurfaceFormat::CompatibilityProfile);
+ format.setDepthBufferSize(24);
+
+ QQuickView view;
+ view.setFormat(format);
+ view.resize(1200, 600);
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/pointlinesize/main.qml b/tests/manual/pointlinesize/main.qml
new file mode 100644
index 000000000..a0180391f
--- /dev/null
+++ b/tests/manual/pointlinesize/main.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles 1.4
+
+Item {
+ id: root
+
+ Scene3D {
+ anchors.fill: parent
+ focus: true
+ aspects: ["input", "logic", "render"]
+ cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
+
+ Scene {
+ id: scene
+ width : root.lineWidth
+ }
+ }
+
+ property real wMin : 0.5
+ property real wMax : 64.0
+ property real lineWidth : wMin * Math.exp(Math.log(wMax / wMin) * slider.value)
+
+ Text {
+ id: sliderLabel
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 20
+ font.pixelSize: 20
+ color: "white"
+ text: "width = " + lineWidth.toFixed(2)
+ }
+
+ Slider {
+ id: slider
+ anchors.top: sliderLabel.bottom
+ anchors.right: parent.right
+ anchors.margins: 20
+ width: 200
+ value: 0.0
+ }
+
+ Text {
+ anchors.top: slider.bottom
+ anchors.right: parent.right
+ anchors.margins: 20
+ color: scene.smooth ? "white" : "lightgray"
+ text: scene.smooth ? "Line Smoothing enabled" : "Line Smoothing disabled"
+ font.pixelSize: 20
+ MouseArea {
+ anchors.fill: parent
+ onClicked: scene.smooth = !scene.smooth
+ }
+ }
+}
diff --git a/tests/manual/pointlinesize/pointlinesize.pro b/tests/manual/pointlinesize/pointlinesize.pro
new file mode 100644
index 000000000..7ebde2e11
--- /dev/null
+++ b/tests/manual/pointlinesize/pointlinesize.pro
@@ -0,0 +1,15 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ Scene.qml \
+ main.qml
+
+RESOURCES += \
+ pointlinesize.qrc
diff --git a/tests/manual/pointlinesize/pointlinesize.qrc b/tests/manual/pointlinesize/pointlinesize.qrc
new file mode 100644
index 000000000..72868031a
--- /dev/null
+++ b/tests/manual/pointlinesize/pointlinesize.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>Scene.qml</file>
+ </qresource>
+</RCC>