From e3c70ea206eaef9fe310ebc880070b173977530e Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 17 Nov 2016 08:22:02 +0200 Subject: Remove old deferred-renderer-cpp deferred-renderer-cpp example has been moved under tests/manual/, but old example was not completely removed. Task-number: QTBUG-55659 Change-Id: Ic8e934092879b05c4e04c5f70f0f3632cc8c3ec3 Reviewed-by: Paul Lemire --- .../deferred-renderer-cpp.pro | 33 ------- .../deferred-renderer-cpp.qrc | 12 --- .../doc/src/deferred-renderer-cpp.qdoc | 53 ----------- examples/qt3d/deferred-renderer-cpp/final_gl2.frag | 36 ------- examples/qt3d/deferred-renderer-cpp/final_gl2.vert | 9 -- examples/qt3d/deferred-renderer-cpp/final_gl3.frag | 37 ------- examples/qt3d/deferred-renderer-cpp/final_gl3.vert | 9 -- .../qt3d/deferred-renderer-cpp/finaleffect.cpp | 101 -------------------- examples/qt3d/deferred-renderer-cpp/finaleffect.h | 74 -------------- examples/qt3d/deferred-renderer-cpp/gbuffer.cpp | 106 --------------------- examples/qt3d/deferred-renderer-cpp/gbuffer.h | 81 ---------------- .../qt3d/deferred-renderer-cpp/geometry_gl2.frag | 12 --- .../qt3d/deferred-renderer-cpp/geometry_gl2.vert | 21 ---- .../qt3d/deferred-renderer-cpp/geometry_gl3.frag | 16 ---- .../qt3d/deferred-renderer-cpp/geometry_gl3.vert | 21 ---- .../qt3d/deferred-renderer-cpp/pointlightblock.cpp | 73 -------------- .../qt3d/deferred-renderer-cpp/pointlightblock.h | 75 --------------- .../qt3d/deferred-renderer-cpp/sceneeffect.cpp | 103 -------------------- examples/qt3d/deferred-renderer-cpp/sceneeffect.h | 72 -------------- 19 files changed, 944 deletions(-) delete mode 100644 examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro delete mode 100644 examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.qrc delete mode 100644 examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc delete mode 100644 examples/qt3d/deferred-renderer-cpp/final_gl2.frag delete mode 100644 examples/qt3d/deferred-renderer-cpp/final_gl2.vert delete mode 100644 examples/qt3d/deferred-renderer-cpp/final_gl3.frag delete mode 100644 examples/qt3d/deferred-renderer-cpp/final_gl3.vert delete mode 100644 examples/qt3d/deferred-renderer-cpp/finaleffect.cpp delete mode 100644 examples/qt3d/deferred-renderer-cpp/finaleffect.h delete mode 100644 examples/qt3d/deferred-renderer-cpp/gbuffer.cpp delete mode 100644 examples/qt3d/deferred-renderer-cpp/gbuffer.h delete mode 100644 examples/qt3d/deferred-renderer-cpp/geometry_gl2.frag delete mode 100644 examples/qt3d/deferred-renderer-cpp/geometry_gl2.vert delete mode 100644 examples/qt3d/deferred-renderer-cpp/geometry_gl3.frag delete mode 100644 examples/qt3d/deferred-renderer-cpp/geometry_gl3.vert delete mode 100644 examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp delete mode 100644 examples/qt3d/deferred-renderer-cpp/pointlightblock.h delete mode 100644 examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp delete mode 100644 examples/qt3d/deferred-renderer-cpp/sceneeffect.h diff --git a/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro b/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro deleted file mode 100644 index f9f239f24..000000000 --- a/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro +++ /dev/null @@ -1,33 +0,0 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -QT += 3dcore 3drender 3dinput 3dextras - -HEADERS += \ - gbuffer.h \ - deferredrenderer.h \ - finaleffect.h \ - sceneeffect.h \ - pointlightblock.h - -SOURCES += \ - main.cpp \ - gbuffer.cpp \ - deferredrenderer.cpp \ - finaleffect.cpp \ - sceneeffect.cpp \ - pointlightblock.cpp - -RESOURCES += \ - deferred-renderer-cpp.qrc - -OTHER_FILES += \ - geometry_gl2.vert \ - geometry_gl2.frag \ - geometry_gl3.frag \ - geometry_gl3.vert \ - final_gl2.vert \ - final_gl2.frag \ - final_gl3.frag \ - final_gl3.vert diff --git a/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.qrc b/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.qrc deleted file mode 100644 index 0e38e39ca..000000000 --- a/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.qrc +++ /dev/null @@ -1,12 +0,0 @@ - - - geometry_gl2.frag - geometry_gl2.vert - geometry_gl3.frag - geometry_gl3.vert - final_gl2.frag - final_gl2.vert - final_gl3.frag - final_gl3.vert - - diff --git a/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc b/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc deleted file mode 100644 index 610270316..000000000 --- a/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -/*! - \example deferred-renderer-cpp - \title Qt 3D: Deferred Renderer C++ Example - \ingroup qt3d-examples-cpp - \brief A C++ application that demonstrates rendering to an intermediate - G-buffer. - - \e {Deferred Renderer} demonstrates using a two pass rendering method. - First, all the meshes in the scene are drawn using the same shader that will - output the following values for each fragment: world normal vector, color, - depth, and world position vector. - - Each of these values will be stored in a texture, which together form what - is called the G-buffer. Nothing is drawn onscreen during the first pass, but - rather drawn into the G-buffer ready for later use. - - Once all the meshes have been drawn, the G-buffer is filled with all the - meshes that can currently be seen by the camera. The second render pass is - then used to render the scene to the back buffer with the final color - shading by reading the values from the G-buffer textures and outputting a - color onto a full screen quad. - - For more information, see \l{Deferred Renderer}. - - \include examples-run.qdocinc -*/ diff --git a/examples/qt3d/deferred-renderer-cpp/final_gl2.frag b/examples/qt3d/deferred-renderer-cpp/final_gl2.frag deleted file mode 100644 index f384a2df4..000000000 --- a/examples/qt3d/deferred-renderer-cpp/final_gl2.frag +++ /dev/null @@ -1,36 +0,0 @@ -#version 110 - -uniform sampler2D color; -uniform sampler2D position; -uniform sampler2D normal; -uniform vec2 winSize; - -struct PointLight -{ - vec3 position; - vec3 direction; - vec4 color; - float intensity; -}; - -const int lightCount = 3; -uniform struct -{ - PointLight lights[lightCount]; -} pointLights; - -void main() -{ - vec2 texCoord = gl_FragCoord.xy / winSize; - vec4 col = texture2D(color, texCoord); - vec3 pos = texture2D(position, texCoord).xyz; - vec3 norm = texture2D(normal, texCoord).xyz; - - vec4 lightColor; - for (int i = 0; i < 3; i++) { - vec3 s = normalize(pointLights.lights[i].position - pos); - lightColor += pointLights.lights[i].color * (pointLights.lights[i].intensity * max(dot(s, norm), 0.0)); - } - lightColor /= float(lightCount); - gl_FragColor = col * lightColor; -} diff --git a/examples/qt3d/deferred-renderer-cpp/final_gl2.vert b/examples/qt3d/deferred-renderer-cpp/final_gl2.vert deleted file mode 100644 index a907e10ca..000000000 --- a/examples/qt3d/deferred-renderer-cpp/final_gl2.vert +++ /dev/null @@ -1,9 +0,0 @@ -#version 110 - -attribute vec4 vertexPosition; -uniform mat4 modelMatrix; - -void main() -{ - gl_Position = modelMatrix * vertexPosition; -} diff --git a/examples/qt3d/deferred-renderer-cpp/final_gl3.frag b/examples/qt3d/deferred-renderer-cpp/final_gl3.frag deleted file mode 100644 index 88abd5cb1..000000000 --- a/examples/qt3d/deferred-renderer-cpp/final_gl3.frag +++ /dev/null @@ -1,37 +0,0 @@ -#version 140 - -uniform sampler2D color; -uniform sampler2D position; -uniform sampler2D normal; -uniform vec2 winSize; - -out vec4 fragColor; - -struct PointLight -{ - vec3 position; - vec3 direction; - vec4 color; - float intensity; -}; - -const int lightCount = 3; -uniform PointLightBlock { - PointLight lights[lightCount]; -}; - -void main() -{ - vec2 texCoord = gl_FragCoord.xy / winSize; - vec4 col = texture(color, texCoord); - vec3 pos = texture(position, texCoord).xyz; - vec3 norm = texture(normal, texCoord).xyz; - - vec4 lightColor; - for (int i = 0; i < 3; i++) { - vec3 s = normalize(lights[i].position - pos); - lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0)); - } - lightColor /= float(lightCount); - fragColor = col * lightColor; -} diff --git a/examples/qt3d/deferred-renderer-cpp/final_gl3.vert b/examples/qt3d/deferred-renderer-cpp/final_gl3.vert deleted file mode 100644 index 60410d34d..000000000 --- a/examples/qt3d/deferred-renderer-cpp/final_gl3.vert +++ /dev/null @@ -1,9 +0,0 @@ -#version 140 - -in vec4 vertexPosition; -uniform mat4 modelMatrix; - -void main() -{ - gl_Position = modelMatrix * vertexPosition; -} diff --git a/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp b/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp deleted file mode 100644 index 63c821caa..000000000 --- a/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "finaleffect.h" - -#include -#include -#include - -FinalEffect::FinalEffect(Qt3DCore::QNode *parent) - : Qt3DRender::QEffect(parent) - , m_gl3Technique(new Qt3DRender::QTechnique()) - , m_gl2Technique(new Qt3DRender::QTechnique()) - , m_gl2Pass(new Qt3DRender::QRenderPass()) - , m_gl3Pass(new Qt3DRender::QRenderPass()) - , m_passCriterion(new Qt3DRender::QFilterKey(this)) -{ - m_gl3Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL); - m_gl3Technique->graphicsApiFilter()->setMajorVersion(3); - m_gl3Technique->graphicsApiFilter()->setMinorVersion(1); - m_gl3Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile); - - m_gl2Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL); - m_gl2Technique->graphicsApiFilter()->setMajorVersion(2); - m_gl2Technique->graphicsApiFilter()->setMinorVersion(0); - m_gl2Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile); - - m_passCriterion->setName(QStringLiteral("pass")); - m_passCriterion->setValue(QStringLiteral("final")); - - Qt3DRender::QShaderProgram *gl3Shader = new Qt3DRender::QShaderProgram(); - gl3Shader->setVertexShaderCode(gl3Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl3.vert")))); - gl3Shader->setFragmentShaderCode(gl3Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl3.frag")))); - - m_gl3Pass->addFilterKey(m_passCriterion); - m_gl3Pass->setShaderProgram(gl3Shader); - m_gl3Technique->addRenderPass(m_gl3Pass); - - Qt3DRender::QShaderProgram *gl2Shader = new Qt3DRender::QShaderProgram(); - gl2Shader->setVertexShaderCode(gl2Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl2.vert")))); - gl2Shader->setFragmentShaderCode(gl2Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl2.frag")))); - - m_gl2Pass->addFilterKey(m_passCriterion); - m_gl2Pass->setShaderProgram(gl2Shader); - m_gl2Technique->addRenderPass(m_gl2Pass); - - addTechnique(m_gl3Technique); - addTechnique(m_gl2Technique); -} - -QList FinalEffect::passCriteria() const -{ - return QList() << m_passCriterion; -} diff --git a/examples/qt3d/deferred-renderer-cpp/finaleffect.h b/examples/qt3d/deferred-renderer-cpp/finaleffect.h deleted file mode 100644 index 69a1b126c..000000000 --- a/examples/qt3d/deferred-renderer-cpp/finaleffect.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FINALEFFECT_H -#define FINALEFFECT_H - -#include -#include - -class FinalEffect : public Qt3DRender::QEffect -{ -public: - explicit FinalEffect(Qt3DCore::QNode *parent = 0); - - QList passCriteria() const; - inline Qt3DRender::QTechnique *gl3Technique() const { return m_gl3Technique; } - inline Qt3DRender::QTechnique *gl2Technique() const { return m_gl2Technique; } - -private : - Qt3DRender::QTechnique *m_gl3Technique; - Qt3DRender::QTechnique *m_gl2Technique; - Qt3DRender::QRenderPass *m_gl2Pass; - Qt3DRender::QRenderPass *m_gl3Pass; - Qt3DRender::QFilterKey *m_passCriterion; -}; - -#endif // FINALEFFECT_H diff --git a/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp b/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp deleted file mode 100644 index 984dbb1f2..000000000 --- a/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "gbuffer.h" - -GBuffer::GBuffer(Qt3DCore::QNode *parent) - : Qt3DRender::QRenderTarget(parent) -{ - const Qt3DRender::QAbstractTexture::TextureFormat formats[AttachmentsCount] = { - Qt3DRender::QAbstractTexture::RGBA32F, - Qt3DRender::QAbstractTexture::RGB32F, - Qt3DRender::QAbstractTexture::RGB16F, - Qt3DRender::QAbstractTexture::D32F - }; - - const Qt3DRender::QRenderTargetOutput::AttachmentPoint attachmentPoints[AttachmentsCount] = { - Qt3DRender::QRenderTargetOutput::Color0, - Qt3DRender::QRenderTargetOutput::Color1, - Qt3DRender::QRenderTargetOutput::Color2, - Qt3DRender::QRenderTargetOutput::Depth - }; - - for (int i = 0; i < AttachmentsCount; i++) { - Qt3DRender::QRenderTargetOutput *output = new Qt3DRender::QRenderTargetOutput(this); - - m_textures[i] = new Qt3DRender::QTexture2D(); - m_textures[i]->setFormat(formats[i]); - m_textures[i]->setWidth(1024); - m_textures[i]->setHeight(1024); - m_textures[i]->setGenerateMipMaps(false); - m_textures[i]->setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToEdge)); - m_textures[i]->setMinificationFilter(Qt3DRender::QAbstractTexture::Linear); - m_textures[i]->setMagnificationFilter(Qt3DRender::QAbstractTexture::Linear); - - output->setTexture(m_textures[i]); - output->setAttachmentPoint(attachmentPoints[i]); - addOutput(output); - } -} - -Qt3DRender::QAbstractTexture *GBuffer::colorTexture() const -{ - return m_textures[Color]; -} - -Qt3DRender::QAbstractTexture *GBuffer::positionTexture() const -{ - return m_textures[Position]; -} - -Qt3DRender::QAbstractTexture *GBuffer::normalTexture() const -{ - return m_textures[Normal]; -} - -Qt3DRender::QAbstractTexture *GBuffer::depthTexture() const -{ - return m_textures[Depth]; -} diff --git a/examples/qt3d/deferred-renderer-cpp/gbuffer.h b/examples/qt3d/deferred-renderer-cpp/gbuffer.h deleted file mode 100644 index dab8b6752..000000000 --- a/examples/qt3d/deferred-renderer-cpp/gbuffer.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GBUFFER_H -#define GBUFFER_H - -#include -#include -#include - -class GBuffer : public Qt3DRender::QRenderTarget -{ -public: - explicit GBuffer(Qt3DCore::QNode *parent = 0); - - enum Attachments { - Color = 0, - Position, - Normal, - Depth, - AttachmentsCount - }; - - Qt3DRender::QAbstractTexture *colorTexture() const; - Qt3DRender::QAbstractTexture *positionTexture() const; - Qt3DRender::QAbstractTexture *normalTexture() const; - Qt3DRender::QAbstractTexture *depthTexture() const; - -private: - Qt3DRender::QAbstractTexture *m_textures[AttachmentsCount]; - Qt3DRender::QRenderTargetOutput *m_attachments[AttachmentsCount]; -}; - -#endif // GBUFFER_H diff --git a/examples/qt3d/deferred-renderer-cpp/geometry_gl2.frag b/examples/qt3d/deferred-renderer-cpp/geometry_gl2.frag deleted file mode 100644 index 0e7776f15..000000000 --- a/examples/qt3d/deferred-renderer-cpp/geometry_gl2.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 110 - -varying vec4 color0; -varying vec3 position0; -varying vec3 normal0; - -void main() -{ - gl_FragData[0] = color0; - gl_FragData[1] = vec4(position0, 0); - gl_FragData[2] = vec4(normal0, 0); -} diff --git a/examples/qt3d/deferred-renderer-cpp/geometry_gl2.vert b/examples/qt3d/deferred-renderer-cpp/geometry_gl2.vert deleted file mode 100644 index 72d5345f1..000000000 --- a/examples/qt3d/deferred-renderer-cpp/geometry_gl2.vert +++ /dev/null @@ -1,21 +0,0 @@ -#version 110 - -attribute vec4 vertexPosition; -attribute vec3 vertexNormal; - -varying vec4 color0; -varying vec3 position0; -varying vec3 normal0; - -uniform mat4 mvp; -uniform mat4 modelView; -uniform mat3 modelViewNormal; -uniform vec4 meshColor; - -void main() -{ - color0 = meshColor; - position0 = vec3(modelView * vertexPosition); - normal0 = normalize(modelViewNormal * vertexNormal); - gl_Position = mvp * vertexPosition; -} diff --git a/examples/qt3d/deferred-renderer-cpp/geometry_gl3.frag b/examples/qt3d/deferred-renderer-cpp/geometry_gl3.frag deleted file mode 100644 index 7d9c7d64e..000000000 --- a/examples/qt3d/deferred-renderer-cpp/geometry_gl3.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 140 - -in vec4 color0; -in vec3 position0; -in vec3 normal0; - -out vec4 color; -out vec3 position; -out vec3 normal; - -void main() -{ - color = color0; - position = position0; - normal = normal0; -} diff --git a/examples/qt3d/deferred-renderer-cpp/geometry_gl3.vert b/examples/qt3d/deferred-renderer-cpp/geometry_gl3.vert deleted file mode 100644 index d3e302d16..000000000 --- a/examples/qt3d/deferred-renderer-cpp/geometry_gl3.vert +++ /dev/null @@ -1,21 +0,0 @@ -#version 140 - -in vec4 vertexPosition; -in vec3 vertexNormal; - -out vec4 color0; -out vec3 position0; -out vec3 normal0; - -uniform mat4 mvp; -uniform mat4 modelView; -uniform mat3 modelViewNormal; -uniform vec4 meshColor; - -void main() -{ - color0 = meshColor; - position0 = vec3(modelView * vertexPosition); - normal0 = normalize(modelViewNormal * vertexNormal); - gl_Position = mvp * vertexPosition; -} diff --git a/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp b/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp deleted file mode 100644 index 36bab9966..000000000 --- a/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pointlightblock.h" - -PointLightBlock::PointLightBlock(Qt3DCore::QNode *parent) - : Qt3DRender::QShaderData(parent) -{ - -} - -PointLightBlock::~PointLightBlock() -{ -} - -QVector PointLightBlock::lights() const -{ - return m_lights; -} - -void PointLightBlock::addLight(Qt3DRender::QAbstractLight *light) -{ - m_lights.append(light); - emit lightsChanged(); -} - diff --git a/examples/qt3d/deferred-renderer-cpp/pointlightblock.h b/examples/qt3d/deferred-renderer-cpp/pointlightblock.h deleted file mode 100644 index 9c93528c8..000000000 --- a/examples/qt3d/deferred-renderer-cpp/pointlightblock.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef POINTLIGHTBLOCK_H -#define POINTLIGHTBLOCK_H - -#include -#include - -class PointLightBlock : public Qt3DRender::QShaderData -{ - Q_OBJECT - Q_PROPERTY(QVector lights READ lights NOTIFY lightsChanged) -public: - explicit PointLightBlock(Qt3DCore::QNode *parent = 0); - ~PointLightBlock(); - - QVector lights() const; - void addLight(Qt3DRender::QAbstractLight *light); - -Q_SIGNALS: - void lightsChanged(); - -private: - QVector m_lights; -}; - -#endif // POINTLIGHTBLOCK_H diff --git a/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp b/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp deleted file mode 100644 index bdb6ea76e..000000000 --- a/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "sceneeffect.h" - -#include -#include -#include - -SceneEffect::SceneEffect(Qt3DCore::QNode *parent) - : Qt3DRender::QEffect(parent) - , m_gl3Technique(new Qt3DRender::QTechnique()) - , m_gl2Technique(new Qt3DRender::QTechnique()) - , m_gl2Pass(new Qt3DRender::QRenderPass()) - , m_gl3Pass(new Qt3DRender::QRenderPass()) - , m_passCriterion(new Qt3DRender::QFilterKey(this)) -{ - - m_gl3Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile); - m_gl3Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL); - m_gl3Technique->graphicsApiFilter()->setMajorVersion(3); - m_gl3Technique->graphicsApiFilter()->setMinorVersion(3); - - m_gl2Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL); - m_gl2Technique->graphicsApiFilter()->setMajorVersion(2); - m_gl2Technique->graphicsApiFilter()->setMinorVersion(0); - m_gl2Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile); - - - m_passCriterion->setName(QStringLiteral("pass")); - m_passCriterion->setValue(QStringLiteral("geometry")); - - Qt3DRender::QShaderProgram *gl3Shader = new Qt3DRender::QShaderProgram(); - gl3Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl3.vert")))); - gl3Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl3.frag")))); - - m_gl3Pass->addFilterKey(m_passCriterion); - m_gl3Pass->setShaderProgram(gl3Shader); - m_gl3Technique->addRenderPass(m_gl3Pass); - - Qt3DRender::QShaderProgram *gl2Shader = new Qt3DRender::QShaderProgram(); - gl2Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl2.vert")))); - gl2Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl2.frag")))); - - m_gl2Pass->addFilterKey(m_passCriterion); - m_gl2Pass->setShaderProgram(gl2Shader); - m_gl2Technique->addRenderPass(m_gl2Pass); - - addTechnique(m_gl3Technique); - addTechnique(m_gl2Technique); -} - -QList SceneEffect::passCriteria() const -{ - return QList() << m_passCriterion; -} diff --git a/examples/qt3d/deferred-renderer-cpp/sceneeffect.h b/examples/qt3d/deferred-renderer-cpp/sceneeffect.h deleted file mode 100644 index eb361c273..000000000 --- a/examples/qt3d/deferred-renderer-cpp/sceneeffect.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SCENEEFFECT_H -#define SCENEEFFECT_H - -#include -#include - -class SceneEffect : public Qt3DRender::QEffect -{ -public: - explicit SceneEffect(Qt3DCore::QNode *parent = 0); - - QList passCriteria() const; - -private: - Qt3DRender::QTechnique *m_gl3Technique; - Qt3DRender::QTechnique *m_gl2Technique; - Qt3DRender::QRenderPass *m_gl2Pass; - Qt3DRender::QRenderPass *m_gl3Pass; - Qt3DRender::QFilterKey *m_passCriterion; -}; - -#endif // SCENEEFFECT_H -- cgit v1.2.3