From ff293f3afc0a9fe892124af4a10d29f2410569e4 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 28 May 2020 14:21:52 +0200 Subject: Remove CustomParticle The implementation is intertwined with the direct GL path and not really portable to RHI. Fixes: QTBUG-78574 Change-Id: I6ac8707544c19a24661f07e0e6d2fc405e49cbff Reviewed-by: Laszlo Agocs --- examples/quick/particles/.prev_CMakeLists.txt | 1 - examples/quick/particles/CMakeLists.txt | 1 - .../quick/particles/customparticle/CMakeLists.txt | 259 --------------------- .../customparticle/content/blurparticles.qml | 152 ------------ .../customparticle/content/fragmentshader.qml | 126 ---------- .../customparticle/content/imagecolors.qml | 136 ----------- .../particles/customparticle/customparticle.pro | 12 - .../particles/customparticle/customparticle.qml | 66 ------ .../customparticle/customparticle.qmlproject | 16 -- .../particles/customparticle/customparticle.qrc | 8 - .../doc/images/qml-customparticle-example.png | Bin 123781 -> 0 bytes .../customparticle/doc/src/customparticle.qdoc | 54 ----- examples/quick/particles/customparticle/main.cpp | 51 ---- examples/quick/particles/particles.pro | 1 - 14 files changed, 883 deletions(-) delete mode 100644 examples/quick/particles/customparticle/CMakeLists.txt delete mode 100644 examples/quick/particles/customparticle/content/blurparticles.qml delete mode 100644 examples/quick/particles/customparticle/content/fragmentshader.qml delete mode 100644 examples/quick/particles/customparticle/content/imagecolors.qml delete mode 100644 examples/quick/particles/customparticle/customparticle.pro delete mode 100644 examples/quick/particles/customparticle/customparticle.qml delete mode 100644 examples/quick/particles/customparticle/customparticle.qmlproject delete mode 100644 examples/quick/particles/customparticle/customparticle.qrc delete mode 100644 examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png delete mode 100644 examples/quick/particles/customparticle/doc/src/customparticle.qdoc delete mode 100644 examples/quick/particles/customparticle/main.cpp (limited to 'examples/quick') diff --git a/examples/quick/particles/.prev_CMakeLists.txt b/examples/quick/particles/.prev_CMakeLists.txt index 9bc4e894a5..1dbf49be21 100644 --- a/examples/quick/particles/.prev_CMakeLists.txt +++ b/examples/quick/particles/.prev_CMakeLists.txt @@ -1,7 +1,6 @@ # Generated from particles.pro. add_subdirectory(affectors) -add_subdirectory(customparticle) add_subdirectory(emitters) add_subdirectory(imageparticle) add_subdirectory(itemparticle) diff --git a/examples/quick/particles/CMakeLists.txt b/examples/quick/particles/CMakeLists.txt index 9bc4e894a5..1dbf49be21 100644 --- a/examples/quick/particles/CMakeLists.txt +++ b/examples/quick/particles/CMakeLists.txt @@ -1,7 +1,6 @@ # Generated from particles.pro. add_subdirectory(affectors) -add_subdirectory(customparticle) add_subdirectory(emitters) add_subdirectory(imageparticle) add_subdirectory(itemparticle) diff --git a/examples/quick/particles/customparticle/CMakeLists.txt b/examples/quick/particles/customparticle/CMakeLists.txt deleted file mode 100644 index 0a7ef103d4..0000000000 --- a/examples/quick/particles/customparticle/CMakeLists.txt +++ /dev/null @@ -1,259 +0,0 @@ -# Generated from customparticle.pro. - -cmake_minimum_required(VERSION 3.14) -project(customparticle LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/customparticle") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Quick) -find_package(Qt6 COMPONENTS Qml) - -add_qt_gui_executable(customparticle - main.cpp -) -target_link_libraries(customparticle PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - - -# Resources: -set(customparticle_resource_files - "content/blurparticles.qml" - "content/fragmentshader.qml" - "content/imagecolors.qml" - "customparticle.qml" -) - -qt6_add_resources(customparticle "customparticle" - PREFIX - "/particles/customparticle" - FILES - ${customparticle_resource_files} -) -set_source_files_properties("../images/_explo.png" - PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png" -) -set_source_files_properties("../images/backgroundLeaves.jpg" - PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg" -) -set_source_files_properties("../images/bear_tiles.png" - PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png" -) -set_source_files_properties("../images/candle.png" - PROPERTIES QT_RESOURCE_ALIAS "images/candle.png" -) -set_source_files_properties("../images/colortable.png" - PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png" -) -set_source_files_properties("../images/finalfrontier.png" - PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png" -) -set_source_files_properties("../images/flower.png" - PROPERTIES QT_RESOURCE_ALIAS "images/flower.png" -) -set_source_files_properties("../images/matchmask.png" - PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png" -) -set_source_files_properties("../images/meteor.png" - PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png" -) -set_source_files_properties("../images/meteor_explo.png" - PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png" -) -set_source_files_properties("../images/meteors.png" - PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png" -) -set_source_files_properties("../images/nullRock.png" - PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png" -) -set_source_files_properties("../images/particle2.png" - PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png" -) -set_source_files_properties("../images/particle3.png" - PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png" -) -set_source_files_properties("../images/particleA.png" - PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png" -) -set_source_files_properties("../images/portal_bg.png" - PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png" -) -set_source_files_properties("../images/realLeaf1.png" - PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png" -) -set_source_files_properties("../images/realLeaf2.png" - PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png" -) -set_source_files_properties("../images/realLeaf3.png" - PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png" -) -set_source_files_properties("../images/realLeaf4.png" - PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png" -) -set_source_files_properties("../images/rocket.png" - PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png" -) -set_source_files_properties("../images/rocket2.png" - PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png" -) -set_source_files_properties("../images/sizeInOut.png" - PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png" -) -set_source_files_properties("../images/snowflake.png" - PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png" -) -set_source_files_properties("../images/sparkleSize.png" - PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png" -) -set_source_files_properties("../images/starfish_0.png" - PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png" -) -set_source_files_properties("../images/starfish_1.png" - PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png" -) -set_source_files_properties("../images/starfish_2.png" - PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png" -) -set_source_files_properties("../images/starfish_3.png" - PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png" -) -set_source_files_properties("../images/starfish_4.png" - PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png" -) -set_source_files_properties("../images/starfish_mask.png" - PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png" -) -set(images_resource_files - "images/_explo.png" - "images/backgroundLeaves.jpg" - "images/bear_tiles.png" - "images/candle.png" - "images/colortable.png" - "images/finalfrontier.png" - "images/flower.png" - "images/matchmask.png" - "images/meteor.png" - "images/meteor_explo.png" - "images/meteors.png" - "images/nullRock.png" - "images/particle2.png" - "images/particle3.png" - "images/particleA.png" - "images/portal_bg.png" - "images/realLeaf1.png" - "images/realLeaf2.png" - "images/realLeaf3.png" - "images/realLeaf4.png" - "images/rocket.png" - "images/rocket2.png" - "images/sizeInOut.png" - "images/snowflake.png" - "images/sparkleSize.png" - "images/starfish_0.png" - "images/starfish_1.png" - "images/starfish_2.png" - "images/starfish_3.png" - "images/starfish_4.png" - "images/starfish_mask.png" -) - -qt6_add_resources(customparticle "images" - PREFIX - "/particles" - BASE - ".." - FILES - ${images_resource_files} -) -set_source_files_properties("../../shared/Button.qml" - PROPERTIES QT_RESOURCE_ALIAS "Button.qml" -) -set_source_files_properties("../../shared/CheckBox.qml" - PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml" -) -set_source_files_properties("../../shared/FlickrRssModel.qml" - PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml" -) -set_source_files_properties("../../shared/Label.qml" - PROPERTIES QT_RESOURCE_ALIAS "Label.qml" -) -set_source_files_properties("../../shared/LauncherList.qml" - PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml" -) -set_source_files_properties("../../shared/SimpleLauncherDelegate.qml" - PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml" -) -set_source_files_properties("../../shared/Slider.qml" - PROPERTIES QT_RESOURCE_ALIAS "Slider.qml" -) -set_source_files_properties("../../shared/TabSet.qml" - PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml" -) -set_source_files_properties("../../shared/TextField.qml" - PROPERTIES QT_RESOURCE_ALIAS "TextField.qml" -) -set_source_files_properties("../../shared/images/back.png" - PROPERTIES QT_RESOURCE_ALIAS "images/back.png" -) -set_source_files_properties("../../shared/images/checkmark.png" - PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png" -) -set_source_files_properties("../../shared/images/next.png" - PROPERTIES QT_RESOURCE_ALIAS "images/next.png" -) -set_source_files_properties("../../shared/images/qt-logo.png" - PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png" -) -set_source_files_properties("../../shared/images/slider_handle.png" - PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png" -) -set_source_files_properties("../../shared/images/tab.png" - PROPERTIES QT_RESOURCE_ALIAS "images/tab.png" -) -set(shared_resource_files - "Button.qml" - "CheckBox.qml" - "FlickrRssModel.qml" - "Label.qml" - "LauncherList.qml" - "SimpleLauncherDelegate.qml" - "Slider.qml" - "TabSet.qml" - "TextField.qml" - "images/back.png" - "images/checkmark.png" - "images/next.png" - "images/qt-logo.png" - "images/slider_handle.png" - "images/tab.png" -) - -qt6_add_resources(customparticle "shared" - PREFIX - "/shared" - BASE - "../../shared" - FILES - ${shared_resource_files} -) - -install(TARGETS customparticle - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/quick/particles/customparticle/content/blurparticles.qml b/examples/quick/particles/customparticle/content/blurparticles.qml deleted file mode 100644 index f72b858895..0000000000 --- a/examples/quick/particles/customparticle/content/blurparticles.qml +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples 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.Particles 2.0 - -Rectangle { - color: "white" - width: 240 - height: 360 - ParticleSystem { - id: sys - } - Emitter { - system:sys - height: parent.height - emitRate: 1 - lifeSpan: 12000 - velocity: PointDirection {x:20;} - size: 128 - } - ShaderEffectSource { - id: theSource - sourceItem: theItem - hideSource: true - } - Image { - id: theItem - source: "../../images/starfish_1.png" - } - - CustomParticle { - system: sys - //! [vertex] - vertexShader:" - uniform lowp float qt_Opacity; - varying lowp float fFade; - varying lowp float fBlur; - - void main() { - defaultMain(); - highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; - highp float fadeIn = min(t * 10., 1.); - highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); - - fFade = fadeIn * fadeOut * qt_Opacity; - fBlur = max(0.2 * t, t * qt_ParticleR); - } - " - //! [vertex] - property variant source: theSource - property variant blurred: ShaderEffectSource { - sourceItem: ShaderEffect { - width: theItem.width - height: theItem.height - property variant delta: Qt.size(0.0, 1.0 / height) - property variant source: ShaderEffectSource { - sourceItem: ShaderEffect { - width: theItem.width - height: theItem.height - property variant delta: Qt.size(1.0 / width, 0.0) - property variant source: theSource - fragmentShader: " - uniform sampler2D source; - uniform lowp float qt_Opacity; - 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; - }" - } - } - fragmentShader: " - uniform sampler2D source; - uniform lowp float qt_Opacity; - 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; - }" - } - } - //! [fragment] - fragmentShader: " - uniform sampler2D source; - uniform sampler2D blurred; - varying highp vec2 qt_TexCoord0; - varying highp float fBlur; - varying highp float fFade; - void main() { - gl_FragColor = mix(texture2D(source, qt_TexCoord0), texture2D(blurred, qt_TexCoord0), min(1.0,fBlur*3.0)) * fFade; - }" - //! [fragment] - - } -} - diff --git a/examples/quick/particles/customparticle/content/fragmentshader.qml b/examples/quick/particles/customparticle/content/fragmentshader.qml deleted file mode 100644 index 2b28da2ea1..0000000000 --- a/examples/quick/particles/customparticle/content/fragmentshader.qml +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples 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.Particles 2.0 - -ParticleSystem { - id: root - width: 320 - height: 480 - Rectangle { - z: -1 - anchors.fill: parent - color: "black" - Text { - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: 14 - color: "white" - text: "It's all in the fragment shader." - } - } - - Emitter { - emitRate: 400 - lifeSpan: 8000 - size: 24 - sizeVariation: 16 - velocity: PointDirection {x: root.width/10; y: root.height/10;} - acceleration: PointDirection {x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20} - } - - CustomParticle { - vertexShader:" - uniform lowp float qt_Opacity; - varying lowp float fFade; - varying highp vec2 fPos; - - void main() { - qt_TexCoord0 = qt_ParticleTex; - highp float size = qt_ParticleData.z; - highp float endSize = qt_ParticleData.w; - - highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; - - highp float currentSize = mix(size, endSize, t * t); - - if (t < 0. || t > 1.) - currentSize = 0.; - - highp vec2 pos = qt_ParticlePos - - currentSize / 2. + currentSize * qt_ParticleTex // adjust size - + qt_ParticleVec.xy * t * qt_ParticleData.y // apply velocity vector.. - + 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.); - - gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1); - - highp float fadeIn = min(t * 20., 1.); - highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.)); - - fFade = fadeIn * fadeOut * qt_Opacity; - fPos = vec2(pos.x/320., pos.y/480.); - } - " - //! [0] - fragmentShader: " - varying highp vec2 fPos; - varying lowp float fFade; - varying highp vec2 qt_TexCoord0; - void main() {//*2 because this generates dark colors mostly - highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0); - highp float dist = length(circlePos); - highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0); - gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade; - }" - //! [0] - - } -} diff --git a/examples/quick/particles/customparticle/content/imagecolors.qml b/examples/quick/particles/customparticle/content/imagecolors.qml deleted file mode 100644 index 4ce995b6b4..0000000000 --- a/examples/quick/particles/customparticle/content/imagecolors.qml +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples 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.Particles 2.0 - -Rectangle { - width: 400 - height: 400 - Rectangle { - id: root - color: "white" - width: 310 - height: 300 - anchors.centerIn: parent - ParticleSystem { id: sys } - CustomParticle { - system: sys - property real maxWidth: root.width - property real maxHeight: root.height - ShaderEffectSource { - id: pictureSource - sourceItem: picture - hideSource: true - } - Image { - id: picture - source: "../../images/starfish_3.png" - } - ShaderEffectSource { - id: particleSource - sourceItem: particle - hideSource: true - } - Image { - id: particle - source: "qrc:///particleresources/fuzzydot.png" - } - //! [vertex] - vertexShader:" - uniform highp float maxWidth; - uniform highp float maxHeight; - varying highp vec2 fTex2; - varying lowp float fFade; - uniform lowp float qt_Opacity; - - void main() { - - fTex2 = vec2(qt_ParticlePos.x, qt_ParticlePos.y); - //Uncomment this next line for each particle to use full texture, instead of the solid color at the center of the particle. - //fTex2 = fTex2 + ((- qt_ParticleData.z / 2. + qt_ParticleData.z) * qt_ParticleTex); //Adjusts size so it's like a chunk of image. - fTex2 = fTex2 / vec2(maxWidth, maxHeight); - highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; - fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity; - defaultMain(); - } - " - //! [vertex] - property variant particleTexture: particleSource - property variant pictureTexture: pictureSource - //! [fragment] - fragmentShader: " - uniform sampler2D particleTexture; - uniform sampler2D pictureTexture; - varying highp vec2 qt_TexCoord0; - varying highp vec2 fTex2; - varying lowp float fFade; - void main() { - gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, qt_TexCoord0).w * fFade; - }" - //! [fragment] - } - - Emitter { - id: emitter - system: sys - enabled: false - lifeSpan: 8000 - maximumEmitted: 4000 - anchors.fill: parent - size: 16 - acceleration: PointDirection { xVariation: 12; yVariation: 12 } - } - MouseArea { - anchors.fill: parent - onClicked: emitter.burst(4000); - } - } -} diff --git a/examples/quick/particles/customparticle/customparticle.pro b/examples/quick/particles/customparticle/customparticle.pro deleted file mode 100644 index 66a6895d00..0000000000 --- a/examples/quick/particles/customparticle/customparticle.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += \ - customparticle.qrc \ - ../images.qrc \ - ../../shared/shared.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/customparticle -INSTALLS += target - diff --git a/examples/quick/particles/customparticle/customparticle.qml b/examples/quick/particles/customparticle/customparticle.qml deleted file mode 100644 index bfa6de8b4a..0000000000 --- a/examples/quick/particles/customparticle/customparticle.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples 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 "../../shared" as Examples - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("Blur Particles", "Particles that get blurred over time", Qt.resolvedUrl("content/blurparticles.qml")); - addExample("Fragment Shader", "Particles drawn with a custom fragment shader", Qt.resolvedUrl("content/fragmentshader.qml")); - addExample("Image Colors", "An image explodes into colored particles", Qt.resolvedUrl("content/imagecolors.qml")); - } - } -} diff --git a/examples/quick/particles/customparticle/customparticle.qmlproject b/examples/quick/particles/customparticle/customparticle.qmlproject deleted file mode 100644 index 6ea1849e31..0000000000 --- a/examples/quick/particles/customparticle/customparticle.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "customparticle.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/particles/customparticle/customparticle.qrc b/examples/quick/particles/customparticle/customparticle.qrc deleted file mode 100644 index 8a4e087a12..0000000000 --- a/examples/quick/particles/customparticle/customparticle.qrc +++ /dev/null @@ -1,8 +0,0 @@ - - - customparticle.qml - content/blurparticles.qml - content/fragmentshader.qml - content/imagecolors.qml - - diff --git a/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png b/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png deleted file mode 100644 index e23c6c8efc..0000000000 Binary files a/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png and /dev/null differ diff --git a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc deleted file mode 100644 index a660d4b5a7..0000000000 --- a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Particles Examples - CustomParticle - \example particles/customparticle - \brief This is a collection of examples using CustomParticle in the QML particle system. - \image qml-customparticle-example.png - - This is a collection of small QML examples relating to using CustomParticle in the particle system. - Each example is a small QML file emphasizing a different way to use CustomParticle. - - Blur Particles adds a blur effect to the particles, which increases over the particle's life time. - It uses a custom vertex shader: - \snippet particles/customparticle/content/blurparticles.qml vertex - to propagate life time simulation to a custom fragment shader: - \snippet particles/customparticle/content/blurparticles.qml fragment - which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect. - - Fragment Shader just uses the particle system as a vertex delivery system. - \snippet particles/customparticle/content/fragmentshader.qml 0 - - Image Colors uses CustomParticle to assign colors to particles based on their location in a picture. - The vertex shader, - \snippet particles/customparticle/content/imagecolors.qml vertex - passes along the starting position for each vertex to the fragment shader, - \snippet particles/customparticle/content/imagecolors.qml fragment - which uses it to determine the color for that particle. - -*/ diff --git a/examples/quick/particles/customparticle/main.cpp b/examples/quick/particles/customparticle/main.cpp deleted file mode 100644 index bf7fb4f065..0000000000 --- a/examples/quick/particles/customparticle/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples 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 "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(particles/customparticle/customparticle) diff --git a/examples/quick/particles/particles.pro b/examples/quick/particles/particles.pro index db9033a961..5343fa00f1 100644 --- a/examples/quick/particles/particles.pro +++ b/examples/quick/particles/particles.pro @@ -1,6 +1,5 @@ TEMPLATE = subdirs SUBDIRS += affectors \ - customparticle \ emitters \ imageparticle \ itemparticle \ -- cgit v1.2.3