diff options
Diffstat (limited to 'tests/manual/nodetypes_ng')
42 files changed, 2476 insertions, 0 deletions
diff --git a/tests/manual/nodetypes_ng/AtlasedImages.qml b/tests/manual/nodetypes_ng/AtlasedImages.qml new file mode 100644 index 0000000000..5cb5451dfd --- /dev/null +++ b/tests/manual/nodetypes_ng/AtlasedImages.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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.8 + +// The images here should result in a single draw call that uses an atlas +// texture. The ShaderEffect is then another one (and exercises having an +// effect on an Image backed by an atlased texture). + +Item { + Row { + Image { + source: "qrc:/qt.png" + sourceSize: Qt.size(64, 64) + } + Image { + source: "qrc:/face-smile.png" + } + Image { + source: "qrc:/arrow-down.png" + } + Image { + source: "qrc:/arrow-up.png" + NumberAnimation on rotation { + from: 0; to: 360; duration: 3000 + loops: Animation.Infinite + } + } + Image { + id: minusSign + source: "qrc:/minus-sign.png" + } + // Using a ShaderEffectSource would go through an extra render target + // texture. By specifying the Image directly as the source, no extra + // texture is created. However, when the source Image is atlased, extra + // steps are taken internally to create a non-atlased texture for the + // effect. + ShaderEffect { + id: eff + width: minusSign.width + height: minusSign.height + property variant source: minusSign + property real amplitude: 0.05 + property real frequency: 20 + property real time: 0 + NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } + vertexShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/wobble_legacy_gl.vert" : "qrc:/wobble.vert.qsb" + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/wobble_legacy_gl.frag" : "qrc:/wobble.frag.qsb" + } + Image { + source: "qrc:/plus-sign.png" + } + } +} diff --git a/tests/manual/nodetypes_ng/CompressedImages.qml b/tests/manual/nodetypes_ng/CompressedImages.qml new file mode 100644 index 0000000000..b05baf8ccb --- /dev/null +++ b/tests/manual/nodetypes_ng/CompressedImages.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Rectangle { + border.color: "red" + border.width: 4 + width: im1.sourceSize.width + 8 + height: im1.sourceSize.height + 8 + Image { + id: im1 + source: "qrc:/car_etc2_nomips.ktx" + anchors.centerIn: parent + } + } + + Rectangle { + anchors.centerIn: parent + border.color: "red" + border.width: 4 + width: im2.sourceSize.width + 8 + height: im2.sourceSize.height + 8 + Image { + id: im2 + source: "qrc:/qt_bc1_10mips.ktx" + anchors.centerIn: parent + } + } +} diff --git a/tests/manual/nodetypes_ng/DistanceFieldText.qml b/tests/manual/nodetypes_ng/DistanceFieldText.qml new file mode 100644 index 0000000000..3a6eb4186e --- /dev/null +++ b/tests/manual/nodetypes_ng/DistanceFieldText.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Text { + id: text1 + renderType: Text.QtRendering + anchors.top: parent.top + text: "árvíztűrő tükörfúrógép\nÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP" + } + Text { + renderType: Text.QtRendering + anchors.bottom: parent.bottom + text: "the quick brown fox jumps over the lazy dog\nTHE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" + color: "red" + } + Text { + renderType: Text.QtRendering + anchors.centerIn: parent + text: "rotate rotate rotate" + font.bold: true + font.pointSize: 20 + color: "green" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + + Row { + anchors.top: text1.bottom + anchors.margins: 10 + Text { renderType: Text.QtRendering; font.pointSize: 24; text: "Normal" } + Text { renderType: Text.QtRendering; font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } + Text { renderType: Text.QtRendering; font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" } + Text { renderType: Text.QtRendering; font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } + } +} diff --git a/tests/manual/nodetypes_ng/Images.qml b/tests/manual/nodetypes_ng/Images.qml new file mode 100644 index 0000000000..809a6dc74d --- /dev/null +++ b/tests/manual/nodetypes_ng/Images.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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.3 + +Item { + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + color: "red" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + + Image { + id: im + source: "qrc:/qt.png" + mipmap: true + + // Changing the mipmap property results in...nothing but a warning, but + // regardless, enable the following to test. +// Timer { +// interval: 5000 +// onTriggered: { +// if (im.mipmap) { +// console.log("disabling mipmap"); +// im.mipmap = false; +// } else { +// console.log("enabling mipmap"); +// im.mipmap = true; +// } +// } +// running: true +// repeat: true +// } + + SequentialAnimation on scale { + loops: Animation.Infinite + NumberAnimation { + from: 1.0 + to: 4.0 + duration: 2000 + } + NumberAnimation { + from: 4.0 + to: 0.1 + duration: 3000 + } + NumberAnimation { + from: 0.1 + to: 1.0 + duration: 1000 + } + } + + Image { + anchors.centerIn: parent + source: "qrc:/face-smile.png" + } + } + + Image { + source: "qrc:/face-smile.png" + anchors.bottom: parent.bottom + anchors.right: parent.right + antialiasing: true // trigger smooth texture material + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + + Item { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + scale: 20 + width: 20 + Image { x: 0; source: "blacknwhite.png"; smooth: false } // solid black + Image { x: 2; source: "blacknwhite.png"; smooth: true } // fade to white on right + Image { x: 4; source: "blacknwhite.png"; smooth: false } // solid black + Image { x: 6; source: "blacknwhite.png"; smooth: true } // fade to white on right + } +} diff --git a/tests/manual/nodetypes_ng/Layers.qml b/tests/manual/nodetypes_ng/Layers.qml new file mode 100644 index 0000000000..defab85f7e --- /dev/null +++ b/tests/manual/nodetypes_ng/Layers.qml @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Rectangle { + color: "lightGray" + anchors.fill: parent + anchors.margins: 10 + + Column { + anchors.fill: parent + spacing: 10 + + Row { + width: parent.width + Rectangle { + color: "red" + width: 300 + height: 100 + layer.enabled: true + Text { text: "this is in a layer, going through an offscreen render target" } + clip: true + Rectangle { + color: "lightGreen" + width: 50 + height: 50 + x: 275 + y: 75 + } + } + Rectangle { + color: "white" + width: 300 + height: 100 + Text { text: "this is not a layer" } + } + Rectangle { + color: "green" + width: 300 + height: 100 + layer.enabled: true + Text { text: "this is another layer" } + Rectangle { + border.width: 4 + border.color: "black" + anchors.centerIn: parent + width: 150 + height: 50 + layer.enabled: true + Text { + anchors.centerIn: parent + text: "layer in a layer" + } + } + Image { + source: "qrc:/face-smile.png" + anchors.bottom: parent.bottom + anchors.right: parent.right + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + } + } + + Row { + width: parent.width + Rectangle { + color: "white" + border.color: "black" + border.width: 4 + width: 300 + height: 100 + layer.enabled: true + layer.smooth: true // sets min/mag filter in the sampler to Linear + layer.textureSize: Qt.size(width * 2, height * 2) + Text { x: 10; y: 10; text: "supersampled layer\n(rendered at 2x, sampled with linear min/mag)" } + Rectangle { + width: 30 + height: 30 + anchors.centerIn: parent + color: "red" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + } + Rectangle { + color: "white" + border.color: "black" + border.width: 4 + width: 300 + height: 100 + layer.enabled: true + layer.samples: 4 // 4x MSAA + Text { x: 10; y: 10; text: "4x MSAA layer\n(rendered into multisample texture/renderbuffer,\nthen resolved into non-msaa texture)" } + Rectangle { + width: 30 + height: 30 + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 10 + color: "red" + NumberAnimation on rotation { from: 360; to: 0; duration: 2000; loops: Animation.Infinite; } + } + } + Rectangle { + color: "white" + border.color: "black" + border.width: 4 + width: 300 + height: 100 + layer.enabled: true + layer.mipmap: true + Text { x: 10; y: 10; text: "Mipmapped layer" } + Rectangle { + width: 30 + height: 30 + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 10 + color: "red" + NumberAnimation on rotation { from: 360; to: 0; duration: 2000; loops: Animation.Infinite; } + } + } + } + } + } +} diff --git a/tests/manual/nodetypes_ng/LotsOfNodes.qml b/tests/manual/nodetypes_ng/LotsOfNodes.qml new file mode 100644 index 0000000000..eee1828b96 --- /dev/null +++ b/tests/manual/nodetypes_ng/LotsOfNodes.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 Stuff 1.0 + +Item { + id: root + + Column { + width: 100 + clip: true + PerPixelRect { width: 100; height: 100; color: "red" } + PerPixelRect { width: 100; height: 100; color: "blue" } + } + + Column { + x: 100 + width: 100 + PerPixelRect { width: 100; height: 100; color: "black" } + PerPixelRect { width: 100; height: 100; color: "#00ff00" } + } +} diff --git a/tests/manual/nodetypes_ng/LotsOfRects.qml b/tests/manual/nodetypes_ng/LotsOfRects.qml new file mode 100644 index 0000000000..f20839d6c3 --- /dev/null +++ b/tests/manual/nodetypes_ng/LotsOfRects.qml @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Rectangle { + anchors.margins: 4 + anchors.fill: parent + + // Background + gradient: Gradient { + GradientStop { position: 0; color: "steelblue" } + GradientStop { position: 1; color: "black" } + } + + // Animated gradient stops. + // NB! Causes a full buffer rebuild on every animated change due to the geometry change! + Row { + spacing: 10 + Repeater { + model: 20 + Rectangle { + width: 20 + height: 20 + gradient: Gradient { + GradientStop { position: 0.0; color: "red" } + GradientStop { NumberAnimation on position { from: 0.01; to: 0.99; duration: 5000; loops: Animation.Infinite } color: "yellow" } + GradientStop { position: 1.0; color: "green" } + } + } + } + } + + // Rounded rects with border (smooth material) + Row { + spacing: 10 + Repeater { + model: 5 + Rectangle { + color: "blue" + width: 100 + height: 50 + y: 50 + radius: 16 + border.color: "red" + border.width: 4 + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { + from: 50 + to: 150 + duration: 7000 + } + NumberAnimation { + from: 150 + to: 50 + duration: 3000 + } + } + } + } + } + + // Clip using scissor + Row { + spacing: 10 + Repeater { + model: 5 + Rectangle { + color: "green" + width: 100 + height: 100 + y: 150 + NumberAnimation on y { + from: 150 + to: 200 + duration: 2000 + loops: Animation.Infinite + } + clip: true + Rectangle { + color: "lightGreen" + width: 50 + height: 50 + x: 75 + y: 75 + } + } + } + } + + // Clip using scissor + Row { + spacing: 10 + Repeater { + model: 5 + Rectangle { + color: "green" + width: 100 + height: 100 + y: 300 + NumberAnimation on y { + from: 300 + to: 400 + duration: 2000 + loops: Animation.Infinite + } + clip: true + Rectangle { + color: "lightGreen" + width: 50 + height: 50 + x: 75 + y: 75 + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + } + } + } + + // Clip using stencil + Row { + spacing: 10 + Repeater { + model: 5 + Rectangle { + color: "green" + width: 100 + height: 100 + y: 450 + NumberAnimation on y { + from: 450 + to: 550 + duration: 2000 + loops: Animation.Infinite + } + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + clip: true + Rectangle { + color: "lightGreen" + width: 50 + height: 50 + x: 75 + y: 75 + } + } + } + } + + // The signature red square with another item with animated opacity blended on top + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + color: "red" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + + Rectangle { + color: "gray" + width: 50 + height: 50 + anchors.centerIn: parent + + SequentialAnimation on opacity { + loops: Animation.Infinite + NumberAnimation { + from: 1.0 + to: 0.0 + duration: 4000 + } + NumberAnimation { + from: 0.0 + to: 1.0 + duration: 4000 + easing.type: Easing.InOutQuad + } + } + } + } + + // Animated size and color. + // NB! Causes a full buffer rebuild on every animated change due to the geometry change! + Rectangle { + anchors.right: parent.right + anchors.bottom: parent.bottom + width: 10 + height: 100 + ColorAnimation on color { + from: "blue" + to: "purple" + duration: 5000 + loops: Animation.Infinite + } + NumberAnimation on width { + from: 10 + to: 300 + duration: 5000 + loops: Animation.Infinite + } + } + + // Semi-transparent rect on top. + Rectangle { + anchors.centerIn: parent + opacity: 0.2 + color: "black" + anchors.fill: parent + anchors.margins: 10 + } + } +} diff --git a/tests/manual/nodetypes_ng/MoreWindows.qml b/tests/manual/nodetypes_ng/MoreWindows.qml new file mode 100644 index 0000000000..1144572ebe --- /dev/null +++ b/tests/manual/nodetypes_ng/MoreWindows.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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.Window 2.12 + +Item { + Rectangle { + x: 20 + y: 20 + width: 300 + height: 120 + color: "red" + border.color: "black" + border.width: 2 + Text { + text: "Click to toggle window visibility\n(switch to another test to destroy)" + font.bold: true + anchors.centerIn: parent + } + MouseArea { + anchors.fill: parent + onClicked: win.visible = !win.visible + } + } + + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + color: "green" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + + Window { + id: win + width: 640 + height: 480 + + Rectangle { + color: "lightGray" + anchors.fill: parent + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + color: "red" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + Text { + text: "Another QQuickWindow" + anchors.top: parent.top + anchors.margins: 20 + ColorAnimation on color { from: "red"; to: "green"; duration: 2000; loops: Animation.Infinite } + } + } + } +} diff --git a/tests/manual/nodetypes_ng/MultiClipRects.qml b/tests/manual/nodetypes_ng/MultiClipRects.qml new file mode 100644 index 0000000000..793ebeae93 --- /dev/null +++ b/tests/manual/nodetypes_ng/MultiClipRects.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Rectangle { + anchors.margins: 4 + anchors.fill: parent + + // Background + gradient: Gradient { + GradientStop { position: 0; color: "steelblue" } + GradientStop { position: 1; color: "black" } + } + + // Clip using scissor, 2 levels. + // This means that the lightGreen-yellow-blue batch's clip list will have two clips. + Row { + spacing: 10 + Repeater { + model: 5 + Rectangle { + color: "green" + width: 150 + height: 150 + y: 200 + clip: true + Rectangle { + color: "lightGreen" + width: 150 + height: 150 + x: 25 + y: 25 + clip: true + + Rectangle { + color: "yellow" + width: 50 + height: 50 + x: 100 + y: 100 + NumberAnimation on rotation { from: 360; to: 0; duration: 5000; loops: Animation.Infinite; } + } + + Rectangle { + color: "blue" + width: 50 + height: 50 + x: -25 + y: 100 + NumberAnimation on rotation { from: 360; to: 0; duration: 5000; loops: Animation.Infinite; } + } + } + } + } + } + + // Clip using stencil, 2 levels. + // This means that the lightGreen-yellow batch's clip list will have two clips + // and so two stencil draw calls before drawing the actual content. + Row { + spacing: 10 + Repeater { + model: 5 + Rectangle { + color: "green" + width: 200 + height: 200 + y: 450 + NumberAnimation on rotation { from: 0; to: 360; duration: 5000; loops: Animation.Infinite; } + clip: true + Rectangle { + color: "lightGreen" + width: 150 + height: 150 + x: 50 + y: 50 + rotation: 30 + clip: true + + Rectangle { + color: "yellow" + width: 100 + height: 100 + x: 75 + y: 75 + NumberAnimation on rotation { from: 360; to: 0; duration: 5000; loops: Animation.Infinite; } + } + } + } + } + } + } +} diff --git a/tests/manual/nodetypes_ng/Painter.qml b/tests/manual/nodetypes_ng/Painter.qml new file mode 100644 index 0000000000..c5db3496f8 --- /dev/null +++ b/tests/manual/nodetypes_ng/Painter.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 Stuff 1.0 + +Item { + ListModel { + id: balloonModel + ListElement { + balloonWidth: 200 + } + ListElement { + balloonWidth: 120 + } + ListElement { + balloonWidth: 120 + } + ListElement { + balloonWidth: 120 + } + ListElement { + balloonWidth: 120 + } + } + + ListView { + anchors.fill: parent + anchors.margins: 10 + id: balloonView + model: balloonModel + spacing: 5 + delegate: TextBalloon { + anchors.right: index % 2 == 0 ? undefined : parent.right + height: 60 + rightAligned: index % 2 == 0 ? false : true + width: balloonWidth + innerAnim: model.index === 1 + NumberAnimation on width { + from: 200 + to: 300 + duration: 5000 + running: model.index === 0 + } + } + } +} diff --git a/tests/manual/nodetypes_ng/Rects.qml b/tests/manual/nodetypes_ng/Rects.qml new file mode 100644 index 0000000000..b370fc7b27 --- /dev/null +++ b/tests/manual/nodetypes_ng/Rects.qml @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + color: "red" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + + Rectangle { + color: "gray" + width: 50 + height: 50 + anchors.centerIn: parent + + SequentialAnimation on opacity { + loops: Animation.Infinite + NumberAnimation { + from: 1.0 + to: 0.0 + duration: 4000 + } + NumberAnimation { + from: 0.0 + to: 1.0 + duration: 4000 + easing.type: Easing.InOutQuad + } + } + } + } + + Rectangle { + color: "green" + width: 100 + height: 200 + x: 0 + y: 0 + + NumberAnimation on x { + from: 0 + to: 300 + duration: 5000 + } + NumberAnimation on y { + from: 0 + to: 50 + duration: 2000 + } + + clip: true // scissor + Rectangle { + color: "lightGreen" + width: 50 + height: 50 + x: 75 + y: 175 + } + } + + Rectangle { + color: "blue" + width: 200 + height: 100 + x: 100 + y: 300 + radius: 16 + border.color: "red" + border.width: 4 + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { + from: 300 + to: 500 + duration: 7000 + } + NumberAnimation { + from: 500 + to: 300 + duration: 3000 + } + } + } + + Rectangle { + anchors.right: parent.right + width: 100 + height: 100 + gradient: Gradient { + GradientStop { position: 0.0; color: "red" } + GradientStop { position: 0.33; color: "yellow" } + GradientStop { position: 1.0; color: "green" } + } + } +} diff --git a/tests/manual/nodetypes_ng/ShaderEffect.qml b/tests/manual/nodetypes_ng/ShaderEffect.qml new file mode 100644 index 0000000000..cb2caf61a9 --- /dev/null +++ b/tests/manual/nodetypes_ng/ShaderEffect.qml @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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$ +** +****************************************************************************/ + +// Use QtQuick 2.8 to get GraphicsInfo and others +import QtQuick 2.8 + +Item { + Rectangle { + color: "gray" + anchors.margins: 10 + anchors.fill: parent + Image { + id: image1 + source: "qrc:/qt.png" + } + ShaderEffectSource { + id: effectSource1 + sourceItem: image1 + hideSource: true + } + ShaderEffect { // wobble + id: eff + width: image1.width + height: image1.height + anchors.centerIn: parent + + property variant source: effectSource1 + property real amplitude: 0.04 * 0.2 + property real frequency: 20 + property real time: 0 + + NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } + + vertexShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/wobble_legacy_gl.vert" : "qrc:/wobble.vert.qsb" + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/wobble_legacy_gl.frag" : "qrc:/wobble.frag.qsb" + } + + Image { + id: image2 + source: "qrc:/face-smile.png" + } + ShaderEffectSource { + id: effectSource2 + sourceItem: image2 + hideSource: true + } + ShaderEffect { // dropshadow + id: eff2 + width: image2.width + height: image2.height + scale: 2 + x: 40 + y: 40 + + property variant source: effectSource2 + + property variant shadow: ShaderEffectSource { + sourceItem: ShaderEffect { + width: eff2.width + height: eff2.height + property variant delta: Qt.size(0.0, 1.0 / height) + property variant source: ShaderEffectSource { + sourceItem: ShaderEffect { + id: innerEff + width: eff2.width + height: eff2.height + property variant delta: Qt.size(1.0 / width, 0.0) + property variant source: effectSource2 + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/shadow_pass1_legacy_gl.frag" : "qrc:/shadow_pass1.frag.qsb" + } + } + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/shadow_pass1_legacy_gl.frag" : "qrc:/shadow_pass1.frag.qsb" + } + } + property real angle: 0 + property variant offset: Qt.point(5.0 * Math.cos(angle), 5.0 * Math.sin(angle)) + NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } + property variant delta: Qt.size(offset.x / width, offset.y / height) + property real darkness: 0.5 + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/shadow_pass2_legacy_gl.frag" : "qrc:/shadow_pass2.frag.qsb" + } + + Column { + anchors.bottom: parent.bottom + Text { + color: "yellow" + font.pointSize: 24 + text: { + if (GraphicsInfo.api === GraphicsInfo.OpenGL) + "OpenGL"; + else if (GraphicsInfo.api === GraphicsInfo.Software) + "Software"; + else if (GraphicsInfo.api === GraphicsInfo.Direct3D12) + "D3D12"; + else if (GraphicsInfo.api === GraphicsInfo.OpenVG) + "OpenVG"; + else if (GraphicsInfo.api === GraphicsInfo.OpenGLRhi) + "OpenGL via QRhi"; + else if (GraphicsInfo.api === GraphicsInfo.Direct3D11Rhi) + "D3D11 via QRhi"; + else if (GraphicsInfo.api === GraphicsInfo.VulkanRhi) + "Vulkan via QRhi"; + else if (GraphicsInfo.api === GraphicsInfo.MetalRhi) + "Metal via QRhi"; + else if (GraphicsInfo.api === GraphicsInfo.Null) + "Null via QRhi"; + else + "Unknown API"; + } + } + Text { + color: "yellow" + font.pointSize: 24 + text: "Shader effect is " + (GraphicsInfo.shaderType === GraphicsInfo.HLSL + ? "HLSL" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL + ? "GLSL" : (GraphicsInfo.shaderType === GraphicsInfo.RhiShader + ? "QRhiShader" : "UNKNOWN"))) + " based"; + } + Text { + text: GraphicsInfo.shaderType + " " + GraphicsInfo.shaderCompilationType + " " + GraphicsInfo.shaderSourceType + } + Text { + //text: eff.status + " " + eff.log + } + } + } +} diff --git a/tests/manual/nodetypes_ng/ShaderEffectNoAnim.qml b/tests/manual/nodetypes_ng/ShaderEffectNoAnim.qml new file mode 100644 index 0000000000..638775bd2a --- /dev/null +++ b/tests/manual/nodetypes_ng/ShaderEffectNoAnim.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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.8 + +Item { + // make sure we render the scene continuously + Rectangle { color: "red"; width: 10; height: 10; NumberAnimation on rotation { from: 0; to: 360; loops: -1 } } + + Rectangle { + color: "gray" + anchors.margins: 10 + anchors.fill: parent + Image { + id: image1 + source: "qrc:/qt.png" + } + ShaderEffectSource { + id: effectSource1 + sourceItem: image1 + hideSource: true + } + ShaderEffect { // wobble, no animation -> should not cause re-rendering into the texture + id: eff + width: image1.width + height: image1.height + anchors.centerIn: parent + + property variant source: effectSource1 + property real amplitude: 0.04 * 0.2 + property real frequency: 20 + property real time: 0 + + vertexShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/wobble_legacy_gl.vert" : "qrc:/wobble.vert.qsb" + fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "qrc:/wobble_legacy_gl.frag" : "qrc:/wobble.frag.qsb" + } + } +} diff --git a/tests/manual/nodetypes_ng/ShaderEffectSource.qml b/tests/manual/nodetypes_ng/ShaderEffectSource.qml new file mode 100644 index 0000000000..dee9477336 --- /dev/null +++ b/tests/manual/nodetypes_ng/ShaderEffectSource.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Rectangle { + width: 200 + height: 100 + gradient: Gradient { + GradientStop { position: 0; color: "white" } + GradientStop { position: 1; color: "black" } + } + Row { + opacity: 0.5 + Item { + id: foo + width: 100; height: 100 + Rectangle { x: 5; y: 5; width: 60; height: 60; color: "red" } + Rectangle { x: 20; y: 20; width: 60; height: 60; color: "orange" } + Rectangle { x: 35; y: 35; width: 60; height: 60; color: "yellow" } + } + ShaderEffectSource { + width: 100; height: 100 + sourceItem: foo + } + ShaderEffectSource { + width: 100; height: 100 + sourceItem: foo + recursive: true + live: true + } + } +} diff --git a/tests/manual/nodetypes_ng/SimpleRect.qml b/tests/manual/nodetypes_ng/SimpleRect.qml new file mode 100644 index 0000000000..d4aa3434ba --- /dev/null +++ b/tests/manual/nodetypes_ng/SimpleRect.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + color: "red" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + + Rectangle { + color: "gray" + width: 50 + height: 50 + anchors.centerIn: parent + } + } +} diff --git a/tests/manual/nodetypes_ng/Text.qml b/tests/manual/nodetypes_ng/Text.qml new file mode 100644 index 0000000000..1741f7e5ab --- /dev/null +++ b/tests/manual/nodetypes_ng/Text.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + Text { + id: text1 + renderType: Text.NativeRendering + anchors.top: parent.top + text: "árvíztűrő tükörfúrógép\nÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP" + } + Text { + renderType: Text.NativeRendering + anchors.bottom: parent.bottom + text: "the quick brown fox jumps over the lazy dog\nTHE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" + color: "red" + } + Text { + renderType: Text.NativeRendering + anchors.centerIn: parent + text: "rotate rotate rotate" + font.bold: true + font.pointSize: 20 + color: "green" + NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } + } + + Row { + anchors.top: text1.bottom + anchors.margins: 10 + Text { renderType: Text.NativeRendering; font.pointSize: 24; text: "Normal" } + Text { renderType: Text.NativeRendering; font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } + Text { renderType: Text.NativeRendering; font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" } + Text { renderType: Text.NativeRendering; font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } + } +} diff --git a/tests/manual/nodetypes_ng/arrow-down.png b/tests/manual/nodetypes_ng/arrow-down.png Binary files differnew file mode 100644 index 0000000000..29d1d4439a --- /dev/null +++ b/tests/manual/nodetypes_ng/arrow-down.png diff --git a/tests/manual/nodetypes_ng/arrow-up.png b/tests/manual/nodetypes_ng/arrow-up.png Binary files differnew file mode 100644 index 0000000000..e437312217 --- /dev/null +++ b/tests/manual/nodetypes_ng/arrow-up.png diff --git a/tests/manual/nodetypes_ng/blacknwhite.png b/tests/manual/nodetypes_ng/blacknwhite.png Binary files differnew file mode 100644 index 0000000000..efbc61e79d --- /dev/null +++ b/tests/manual/nodetypes_ng/blacknwhite.png diff --git a/tests/manual/nodetypes_ng/buildshaders.bat b/tests/manual/nodetypes_ng/buildshaders.bat new file mode 100755 index 0000000000..328b216c07 --- /dev/null +++ b/tests/manual/nodetypes_ng/buildshaders.bat @@ -0,0 +1,4 @@ +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o wobble.vert.qsb wobble.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o wobble.frag.qsb wobble.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o shadow_pass1.frag.qsb shadow_pass1.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o shadow_pass2.frag.qsb shadow_pass2.frag diff --git a/tests/manual/nodetypes_ng/car_etc2_nomips.ktx b/tests/manual/nodetypes_ng/car_etc2_nomips.ktx Binary files differnew file mode 100644 index 0000000000..2aefdd306b --- /dev/null +++ b/tests/manual/nodetypes_ng/car_etc2_nomips.ktx diff --git a/tests/manual/nodetypes_ng/face-smile.png b/tests/manual/nodetypes_ng/face-smile.png Binary files differnew file mode 100644 index 0000000000..3d66d72578 --- /dev/null +++ b/tests/manual/nodetypes_ng/face-smile.png diff --git a/tests/manual/nodetypes_ng/main.qml b/tests/manual/nodetypes_ng/main.qml new file mode 100644 index 0000000000..938ae02c8f --- /dev/null +++ b/tests/manual/nodetypes_ng/main.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 + +Item { + focus: true + + Loader { + anchors.fill: parent + id: loader + } + + Keys.onPressed: { + if (event.key === Qt.Key_S) + loader.source = ""; + + if (event.key === Qt.Key_R) + loader.source = "qrc:/SimpleRect.qml"; + if (event.key === Qt.Key_3) + loader.source = "qrc:/Rects.qml"; + if (event.key === Qt.Key_4) + loader.source = "qrc:/LotsOfRects.qml"; + if (event.key === Qt.Key_5) + loader.source = "qrc:/MultiClipRects.qml"; + if (event.key === Qt.Key_I) + loader.source = "qrc:/Images.qml"; + if (event.key === Qt.Key_A) + loader.source = "qrc:/AtlasedImages.qml"; + if (event.key === Qt.Key_P) + loader.source = "qrc:/Painter.qml"; + if (event.key === Qt.Key_C) + loader.source = "qrc:/CompressedImages.qml"; + if (event.key === Qt.Key_T) + loader.source = "qrc:/Text.qml"; + if (event.key === Qt.Key_D) + loader.source = "qrc:/DistanceFieldText.qml"; + if (event.key === Qt.Key_L) + loader.source = "qrc:/Layers.qml"; + if (event.key === Qt.Key_6) + loader.source = "qrc:/ShaderEffectSource.qml"; + if (event.key === Qt.Key_E) + loader.source = "qrc:/ShaderEffect.qml"; + if (event.key === Qt.Key_Z) + loader.source = "qrc:/ShaderEffectNoAnim.qml"; + if (event.key === Qt.Key_G) + helper.testGrabWindow() + if (event.key === Qt.Key_F) + helper.testGrabItem(loader.item) + if (event.key === Qt.Key_W) + loader.source = "qrc:/MoreWindows.qml"; + if (event.key === Qt.Key_N) + loader.source = "qrc:/LotsOfNodes.qml"; + } +} diff --git a/tests/manual/nodetypes_ng/minus-sign.png b/tests/manual/nodetypes_ng/minus-sign.png Binary files differnew file mode 100644 index 0000000000..d6f233d739 --- /dev/null +++ b/tests/manual/nodetypes_ng/minus-sign.png diff --git a/tests/manual/nodetypes_ng/nodetypes_ng.cpp b/tests/manual/nodetypes_ng/nodetypes_ng.cpp new file mode 100644 index 0000000000..829002b538 --- /dev/null +++ b/tests/manual/nodetypes_ng/nodetypes_ng.cpp @@ -0,0 +1,318 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the demonstration applications 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 <QThread> +#include <QQuickView> +#include <QQmlEngine> +#include <QQmlContext> +#include <QQuickPaintedItem> +#include <QPainter> +#include <QTimer> +#include <QQuickItemGrabResult> +#include <QSGRectangleNode> + +class Helper : public QObject +{ + Q_OBJECT + +public: + Helper(QQuickWindow *w) : m_window(w) { } + + Q_INVOKABLE void sleep(int ms) { + QThread::msleep(ms); + } + + Q_INVOKABLE void testGrabWindow() { + QImage img = m_window->grabWindow(); + qDebug() << "Saving image to grab_window_result.png" << img; + img.save("grab_window_result.png"); + } + + Q_INVOKABLE void testGrabItem(QQuickItem *item) { + qDebug() << item; + if (!item) + return; + + QSharedPointer<QQuickItemGrabResult> result = item->grabToImage(); + if (!result) + return; + + auto f = [](const QImage &image) { + qDebug() << "Saving image to grab_item_result.png" << image; + image.save("grab_item_result.png"); + }; + if (result->image().isNull()) { + connect(result.data(), &QQuickItemGrabResult::ready, [f, result] { + f(result->image()); + }); + } else { + f(result->image()); + } + } + + QQuickWindow *m_window; +}; + +class TextBalloon : public QQuickPaintedItem +{ + Q_OBJECT + Q_PROPERTY(bool rightAligned READ isRightAligned WRITE setRightAligned NOTIFY rightAlignedChanged) + Q_PROPERTY(bool innerAnim READ innerAnimEnabled WRITE setInnerAnimEnabled NOTIFY innerAnimChanged) + +public: + TextBalloon(QQuickItem *parent = nullptr) : QQuickPaintedItem(parent) { + connect(&m_timer, &QTimer::timeout, this, &TextBalloon::onAnim); + m_timer.setInterval(500); + } + void paint(QPainter *painter); + + bool isRightAligned() { return m_rightAligned; } + void setRightAligned(bool rightAligned); + + bool innerAnimEnabled() const { return m_innerAnim; } + void setInnerAnimEnabled(bool b); + +signals: + void rightAlignedChanged(); + void innerAnimChanged(); + +private slots: + void onAnim(); + +private: + bool m_rightAligned = false; + bool m_innerAnim = false; + QTimer m_timer; + QRect m_animRect = QRect(10, 10, 50, 20); + int m_anim = 0; +}; + +void TextBalloon::paint(QPainter *painter) +{ + QBrush brush(QColor("#007430")); + + painter->setBrush(brush); + painter->setPen(Qt::NoPen); + painter->setRenderHint(QPainter::Antialiasing); + + painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height() - 10, 10, 10); + + if (m_rightAligned) { + const QPointF points[3] = { + QPointF(boundingRect().width() - 10.0, boundingRect().height() - 10.0), + QPointF(boundingRect().width() - 20.0, boundingRect().height()), + QPointF(boundingRect().width() - 30.0, boundingRect().height() - 10.0), + }; + painter->drawConvexPolygon(points, 3); + } else { + const QPointF points[3] = { + QPointF(10.0, boundingRect().height() - 10.0), + QPointF(20.0, boundingRect().height()), + QPointF(30.0, boundingRect().height() - 10.0), + }; + painter->drawConvexPolygon(points, 3); + } + + if (m_innerAnim) { + painter->fillRect(m_animRect, Qt::lightGray); + const int x = m_animRect.x() + m_anim; + const int y = m_animRect.y() + m_animRect.height() / 2; + painter->setPen(QPen(QBrush(Qt::SolidLine), 4)); + painter->drawLine(x + 4, y, x + 10, y); + m_anim += 10; + if (m_anim > m_animRect.width()) + m_anim = 0; + } +} + +void TextBalloon::setRightAligned(bool rightAligned) +{ + if (m_rightAligned == rightAligned) + return; + + m_rightAligned = rightAligned; + emit rightAlignedChanged(); +} + +void TextBalloon::setInnerAnimEnabled(bool b) +{ + if (m_innerAnim == b) + return; + + m_innerAnim = b; + if (!b) + m_timer.stop(); + else + m_timer.start(); + emit innerAnimChanged(); +} + +void TextBalloon::onAnim() +{ + update(m_animRect); +} + +class PerPixelRect : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + +public: + PerPixelRect(); + void setColor(const QColor &c); + QColor color() const { return m_color; } + QSGNode *updatePaintNode(QSGNode *old, UpdatePaintNodeData *); + +signals: + void colorChanged(const QColor &c); + +private: + QColor m_color; +}; + +PerPixelRect::PerPixelRect() +{ + setFlag(ItemHasContents); +} + +void PerPixelRect::setColor(const QColor &c) +{ + if (c == m_color) + return; + m_color = c; + emit colorChanged(c); +} + +QSGNode *PerPixelRect::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) +{ + delete node; + node = new QSGNode; + + const int w = width(); + const int h = height(); + QQuickWindow *win = window(); + for (int y = 0; y < h; ++y) { + for (int x = 0; x < w; ++x) { + QSGRectangleNode *rn = win->createRectangleNode(); + rn->setRect(x, y, 1, 1); + rn->setColor(m_color); + node->appendChildNode(rn); + } + } + + return node; +} + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + qDebug("Available tests:"); + qDebug(" [R] - Simple rectangle (vertexcolor material)"); + qDebug(" [3] - Rectangles (incl. smoothcolor material, scissor)"); + qDebug(" [4] - A lot of rectangles (incl. stencil and scissor)"); + qDebug(" [5] - Rectangles with multiple clip list entries"); + qDebug(" [I] - Images"); + qDebug(" [A] - Atlased images"); + qDebug(" [P] - QQuickPaintedItem"); + qDebug(" [C] - Compressed textures"); + qDebug(" [T] - Text (native)"); + qDebug(" [D] - Text (distance field)"); + qDebug(" [L] - Layers"); + qDebug(" [6] - ShaderEffectSource without ShaderEffect"); + qDebug(" [E] - ShaderEffect (and GraphicsInfo)"); + qDebug(" [Z] - ShaderEffect without animated properties"); + qDebug(" [G] - Grab current window"); + qDebug(" [F] - Grab item"); + qDebug(" [W] - Multiple windows"); + qDebug(" [N] - Lots of rectangle nodes"); + qDebug("\nPress S to stop the currently running test\n"); + + QQuickView view; + Helper helper(&view); + + const bool usingRhi = qEnvironmentVariableIntValue("QSG_RHI") != 0; + const QString rhiBackend = QString::fromLatin1(qgetenv("QSG_RHI_BACKEND")); + if (usingRhi) + view.setTitle(QLatin1String("RHI: ") + (rhiBackend.isEmpty() ? QLatin1String("default") : rhiBackend)); + else + view.setTitle(QLatin1String("legacy OpenGL")); + + if (app.arguments().contains(QLatin1String("--multisample"))) { + qDebug("Requesting sample count 4"); + QSurfaceFormat fmt = view.format(); + fmt.setSamples(4); + fmt.setDepthBufferSize(24); + fmt.setStencilBufferSize(8); + view.setFormat(fmt); + } + if (app.arguments().contains(QLatin1String("--coreprofile"))) { + qDebug("Requesting core profile (applicable only with OpenGL)"); + QSurfaceFormat fmt = view.format(); + fmt.setVersion(3, 2); + fmt.setProfile(QSurfaceFormat::CoreProfile); + view.setFormat(fmt); + } + + view.engine()->rootContext()->setContextProperty(QLatin1String("helper"), &helper); + + qmlRegisterType<TextBalloon>("Stuff", 1, 0, "TextBalloon"); + qmlRegisterType<PerPixelRect>("Stuff", 1, 0, "PerPixelRect"); + + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.resize(1024, 768); + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + + return app.exec(); +} + +#include "nodetypes_ng.moc" diff --git a/tests/manual/nodetypes_ng/nodetypes_ng.pro b/tests/manual/nodetypes_ng/nodetypes_ng.pro new file mode 100644 index 0000000000..68b9211c4f --- /dev/null +++ b/tests/manual/nodetypes_ng/nodetypes_ng.pro @@ -0,0 +1,11 @@ +QT += qml quick + +SOURCES += nodetypes_ng.cpp + +RESOURCES += nodetypes_ng.qrc + +OTHER_FILES += \ + main.qml \ + SimpleRect.qml \ + Rects.qml \ + LotsOfRects.qml diff --git a/tests/manual/nodetypes_ng/nodetypes_ng.qrc b/tests/manual/nodetypes_ng/nodetypes_ng.qrc new file mode 100644 index 0000000000..47ad8d2677 --- /dev/null +++ b/tests/manual/nodetypes_ng/nodetypes_ng.qrc @@ -0,0 +1,38 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>SimpleRect.qml</file> + <file>Rects.qml</file> + <file>LotsOfRects.qml</file> + <file>MultiClipRects.qml</file> + <file>Images.qml</file> + <file>Painter.qml</file> + <file>CompressedImages.qml</file> + <file>Text.qml</file> + <file>DistanceFieldText.qml</file> + <file>Layers.qml</file> + <file>ShaderEffectSource.qml</file> + <file>AtlasedImages.qml</file> + <file>ShaderEffect.qml</file> + <file>ShaderEffectNoAnim.qml</file> + <file>MoreWindows.qml</file> + <file>LotsOfNodes.qml</file> + <file>qt.png</file> + <file>face-smile.png</file> + <file>car_etc2_nomips.ktx</file> + <file>qt_bc1_10mips.ktx</file> + <file>arrow-down.png</file> + <file>arrow-up.png</file> + <file>minus-sign.png</file> + <file>plus-sign.png</file> + <file>blacknwhite.png</file> + <file>wobble.vert.qsb</file> + <file>wobble.frag.qsb</file> + <file>shadow_pass1.frag.qsb</file> + <file>shadow_pass2.frag.qsb</file> + <file>wobble_legacy_gl.vert</file> + <file>wobble_legacy_gl.frag</file> + <file>shadow_pass1_legacy_gl.frag</file> + <file>shadow_pass2_legacy_gl.frag</file> + </qresource> +</RCC> diff --git a/tests/manual/nodetypes_ng/plus-sign.png b/tests/manual/nodetypes_ng/plus-sign.png Binary files differnew file mode 100644 index 0000000000..40df1134f8 --- /dev/null +++ b/tests/manual/nodetypes_ng/plus-sign.png diff --git a/tests/manual/nodetypes_ng/qt.png b/tests/manual/nodetypes_ng/qt.png Binary files differnew file mode 100644 index 0000000000..f30eec0d4d --- /dev/null +++ b/tests/manual/nodetypes_ng/qt.png diff --git a/tests/manual/nodetypes_ng/qt_bc1_10mips.ktx b/tests/manual/nodetypes_ng/qt_bc1_10mips.ktx Binary files differnew file mode 100644 index 0000000000..32c31bf6dc --- /dev/null +++ b/tests/manual/nodetypes_ng/qt_bc1_10mips.ktx diff --git a/tests/manual/nodetypes_ng/shadow_pass1.frag b/tests/manual/nodetypes_ng/shadow_pass1.frag new file mode 100644 index 0000000000..14581eb80e --- /dev/null +++ b/tests/manual/nodetypes_ng/shadow_pass1.frag @@ -0,0 +1,23 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +layout(std140, binding = 0) uniform buf { + // The built-in vertex shader assumes the first 68 bytes are matrix and + // opacity so have them there even though the matrix is not used here. + mat4 qt_Matrix; + float qt_Opacity; + vec2 delta; +} ubuf; + +void main() +{ + fragColor = (0.0538 * texture(source, qt_TexCoord0 - 3.182 * ubuf.delta) + + 0.3229 * texture(source, qt_TexCoord0 - 1.364 * ubuf.delta) + + 0.2466 * texture(source, qt_TexCoord0) + + 0.3229 * texture(source, qt_TexCoord0 + 1.364 * ubuf.delta) + + 0.0538 * texture(source, qt_TexCoord0 + 3.182 * ubuf.delta)) * ubuf.qt_Opacity; +} diff --git a/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb b/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb Binary files differnew file mode 100644 index 0000000000..f3370caee2 --- /dev/null +++ b/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb diff --git a/tests/manual/nodetypes_ng/shadow_pass1_legacy_gl.frag b/tests/manual/nodetypes_ng/shadow_pass1_legacy_gl.frag new file mode 100644 index 0000000000..65ce0d956c --- /dev/null +++ b/tests/manual/nodetypes_ng/shadow_pass1_legacy_gl.frag @@ -0,0 +1,11 @@ +uniform lowp float qt_Opacity; +uniform sampler2D source; +uniform highp vec2 delta; +varying highp vec2 qt_TexCoord0; +void main() { + gl_FragColor = (0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; +} diff --git a/tests/manual/nodetypes_ng/shadow_pass2.frag b/tests/manual/nodetypes_ng/shadow_pass2.frag new file mode 100644 index 0000000000..fa11f873bb --- /dev/null +++ b/tests/manual/nodetypes_ng/shadow_pass2.frag @@ -0,0 +1,23 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; +layout(binding = 2) uniform sampler2D shadow; + +layout(std140, binding = 0) uniform buf { + // The built-in vertex shader assumes the first 68 bytes are matrix and + // opacity so have them there even though the matrix is not used here. + mat4 qt_Matrix; + float qt_Opacity; + vec2 delta; + float darkness; +} ubuf; + +void main() +{ + vec4 fg = texture(source, qt_TexCoord0); + vec4 bg = texture(shadow, qt_TexCoord0 + ubuf.delta); + fragColor = (fg + vec4(0., 0., 0., ubuf.darkness * bg.a) * (1. - fg.a)) * ubuf.qt_Opacity; +} diff --git a/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb b/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb Binary files differnew file mode 100644 index 0000000000..cbf9569373 --- /dev/null +++ b/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb diff --git a/tests/manual/nodetypes_ng/shadow_pass2_legacy_gl.frag b/tests/manual/nodetypes_ng/shadow_pass2_legacy_gl.frag new file mode 100644 index 0000000000..2ea4cc8d89 --- /dev/null +++ b/tests/manual/nodetypes_ng/shadow_pass2_legacy_gl.frag @@ -0,0 +1,12 @@ +uniform lowp float qt_Opacity; +uniform highp vec2 offset; +uniform sampler2D source; +uniform sampler2D shadow; +uniform highp float darkness; +uniform highp vec2 delta; +varying highp vec2 qt_TexCoord0; +void main() { + lowp vec4 fg = texture2D(source, qt_TexCoord0); + lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); + gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity; +} diff --git a/tests/manual/nodetypes_ng/wobble.frag b/tests/manual/nodetypes_ng/wobble.frag new file mode 100644 index 0000000000..a34481c2f2 --- /dev/null +++ b/tests/manual/nodetypes_ng/wobble.frag @@ -0,0 +1,20 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + float amplitude; + float frequency; + float time; +} ubuf; + +void main() +{ + vec2 p = sin(ubuf.time + ubuf.frequency * qt_TexCoord0); + fragColor = texture(source, qt_TexCoord0 + ubuf.amplitude * vec2(p.y, -p.x)) * ubuf.qt_Opacity; +} diff --git a/tests/manual/nodetypes_ng/wobble.frag.qsb b/tests/manual/nodetypes_ng/wobble.frag.qsb Binary files differnew file mode 100644 index 0000000000..9d3b80fad8 --- /dev/null +++ b/tests/manual/nodetypes_ng/wobble.frag.qsb diff --git a/tests/manual/nodetypes_ng/wobble.vert b/tests/manual/nodetypes_ng/wobble.vert new file mode 100644 index 0000000000..a49b2d9a9f --- /dev/null +++ b/tests/manual/nodetypes_ng/wobble.vert @@ -0,0 +1,22 @@ +#version 440 + +layout(location = 0) in vec4 qt_Vertex; +layout(location = 1) in vec2 qt_MultiTexCoord0; + +layout(location = 0) out vec2 qt_TexCoord0; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + float amplitude; + float frequency; + float time; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + qt_TexCoord0 = qt_MultiTexCoord0; + gl_Position = ubuf.qt_Matrix * qt_Vertex; +} diff --git a/tests/manual/nodetypes_ng/wobble.vert.qsb b/tests/manual/nodetypes_ng/wobble.vert.qsb Binary files differnew file mode 100644 index 0000000000..0f44e87feb --- /dev/null +++ b/tests/manual/nodetypes_ng/wobble.vert.qsb diff --git a/tests/manual/nodetypes_ng/wobble_legacy_gl.frag b/tests/manual/nodetypes_ng/wobble_legacy_gl.frag new file mode 100644 index 0000000000..2961ca5f50 --- /dev/null +++ b/tests/manual/nodetypes_ng/wobble_legacy_gl.frag @@ -0,0 +1,10 @@ +uniform sampler2D source; +uniform highp float amplitude; +uniform highp float frequency; +uniform highp float time; +uniform lowp float qt_Opacity; +varying highp vec2 qt_TexCoord0; +void main() { + highp vec2 p = sin(time + frequency * qt_TexCoord0); + gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity; +} diff --git a/tests/manual/nodetypes_ng/wobble_legacy_gl.vert b/tests/manual/nodetypes_ng/wobble_legacy_gl.vert new file mode 100644 index 0000000000..b2f33ab402 --- /dev/null +++ b/tests/manual/nodetypes_ng/wobble_legacy_gl.vert @@ -0,0 +1,8 @@ +uniform highp mat4 qt_Matrix; +attribute highp vec4 qt_Vertex; +attribute highp vec2 qt_MultiTexCoord0; +varying highp vec2 qt_TexCoord0; +void main() { + qt_TexCoord0 = qt_MultiTexCoord0; + gl_Position = qt_Matrix * qt_Vertex; +} |