From b4e3be3f03c00cced348cd33541ab50d71495aaf Mon Sep 17 00:00:00 2001 From: Robert Brock Date: Mon, 9 May 2016 12:12:04 +0100 Subject: Moved simple-shaders-qml example to manual test Part of an examples cleanup Change-Id: I2f23a68dcc712b9dcf2c3448e8e3ad258ed88b3e Reviewed-by: Sean Harmer --- examples/qt3d/qt3d.pro | 1 - examples/qt3d/simple-shaders-qml/main.cpp | 63 ------ examples/qt3d/simple-shaders-qml/main.qml | 214 --------------------- .../qt3d/simple-shaders-qml/simple-shader.frag | 29 --- .../qt3d/simple-shaders-qml/simple-shader.vert | 21 -- .../qt3d/simple-shaders-qml/simple-shaders-qml.pro | 16 -- .../qt3d/simple-shaders-qml/simple-shaders-qml.qrc | 7 - 7 files changed, 351 deletions(-) delete mode 100644 examples/qt3d/simple-shaders-qml/main.cpp delete mode 100644 examples/qt3d/simple-shaders-qml/main.qml delete mode 100644 examples/qt3d/simple-shaders-qml/simple-shader.frag delete mode 100644 examples/qt3d/simple-shaders-qml/simple-shader.vert delete mode 100644 examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro delete mode 100644 examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc (limited to 'examples/qt3d') diff --git a/examples/qt3d/qt3d.pro b/examples/qt3d/qt3d.pro index 1164ac16a..746f7c050 100644 --- a/examples/qt3d/qt3d.pro +++ b/examples/qt3d/qt3d.pro @@ -14,7 +14,6 @@ SUBDIRS += \ skybox \ controls \ anaglyph-rendering \ - simple-shaders-qml \ planets-qml \ transparency-qml \ transparency-qml-scene3d \ diff --git a/examples/qt3d/simple-shaders-qml/main.cpp b/examples/qt3d/simple-shaders-qml/main.cpp deleted file mode 100644 index 41d2f08a5..000000000 --- a/examples/qt3d/simple-shaders-qml/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 -#include - -int main(int argc, char* argv[]) -{ - QGuiApplication app(argc, argv); - Qt3DExtras::Quick::Qt3DQuickWindow view; - - view.setSource(QUrl("qrc:/main.qml")); - view.show(); - - return app.exec(); -} diff --git a/examples/qt3d/simple-shaders-qml/main.qml b/examples/qt3d/simple-shaders-qml/main.qml deleted file mode 100644 index ae3e948e3..000000000 --- a/examples/qt3d/simple-shaders-qml/main.qml +++ /dev/null @@ -1,214 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 as QQ2 -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 -import Qt3D.Input 2.0 -import Qt3D.Extras 2.0 - -Entity { - id: sceneRoot - - Camera { - id: camera - projectionType: CameraLens.PerspectiveProjection - fieldOfView: 45 - aspectRatio: 16/9 - nearPlane : 0.1 - farPlane : 1000.0 - position: Qt.vector3d( 0.0, 0.0, 40.0 ) - upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) - viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) - } - - OrbitCameraController { camera: camera } - - components: [ - RenderSettings { - activeFrameGraph: ForwardRenderer { - clearColor: Qt.rgba(0, 0.5, 1, 1) - camera: camera - } - }, - // Event Source will be set by the Qt3DQuickWindow - InputSettings { } - ] - - TorusMesh { - id: torusMesh - radius: 5 - minorRadius: 1 - rings: 100 - slices: 20 - } - - Entity { - id: torusEntityInlineShader - - property Transform transform: Transform { - matrix: { - var m = Qt.matrix4x4(); - m.rotate(45, Qt.vector3d(1, 0, 0)); - m.translate(Qt.vector3d(-2.0, 0.0, 0.0)); - return m; - } - } - - // Shader defined inline - property Material material: Material { - - parameters: Parameter { name: "finalColor"; value: "#e76140" /* Inferno Orange */ } - - effect: Effect { - techniques: [ - Technique { - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - majorVersion: 3 - minorVersion: 2 - profile: GraphicsApiFilter.CoreProfile - } - - renderPasses: RenderPass { - shaderProgram: ShaderProgram { - - vertexShaderCode: " - #version 150 - - in vec3 vertexPosition; - in vec3 vertexNormal; - - out vec3 position; - out vec3 normal; - - uniform mat4 modelView; - uniform mat3 modelViewNormal; - uniform mat4 mvp; - - void main() - { - normal = normalize(modelViewNormal * vertexNormal); - position = vec3(modelView * vec4(vertexPosition, 1.0)); - gl_Position = mvp * vec4(vertexPosition, 1.0); - } - " - - fragmentShaderCode: " - #version 150 - - in vec3 normal; - in vec3 position; - - uniform vec3 finalColor; - - out vec4 fragColor; - - void main() - { - vec3 n = normalize(normal); - vec3 s = normalize(vec3(1.0, 0.0, 1.0) - position); - vec3 v = normalize(-position); - float diffuse = max(dot(s, n), 0.0); - fragColor = vec4(diffuse * finalColor, 1.0); - } - " - - } // ShaderProgram - } // RenderPass - } // Technique - ] // techniques - } // Effect - } // Material - - components: [ torusMesh, material, transform ] - } - - Entity { - id: torusEntitySeparateShader - - property Transform transform: Transform { - matrix: { - var m = Qt.matrix4x4(); - m.rotate(15, Qt.vector3d(1, 0, 0)); - m.translate(Qt.vector3d(2.0, 0.0, 0.0)); - return m; - } - } - - // Shader defined in a separate file - property Material material: Material { - - parameters: Parameter { name: "finalColor"; value: "yellow" } - - effect: Effect { - techniques: [ - Technique { - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - majorVersion: 3 - minorVersion: 2 - profile: GraphicsApiFilter.CoreProfile - } - - renderPasses: RenderPass { - shaderProgram: ShaderProgram { - vertexShaderCode: loadSource("qrc:/simple-shader.vert") - fragmentShaderCode: loadSource("qrc:/simple-shader.frag") - } // ShaderProgram - } // namespace RenderPass - } // Technique - ] // techniques - } // Effect - } // Material - - components: [ torusMesh, material, transform ] - } -} diff --git a/examples/qt3d/simple-shaders-qml/simple-shader.frag b/examples/qt3d/simple-shaders-qml/simple-shader.frag deleted file mode 100644 index 330899070..000000000 --- a/examples/qt3d/simple-shaders-qml/simple-shader.frag +++ /dev/null @@ -1,29 +0,0 @@ -#version 150 - -in vec3 normal; -in vec3 position; -in vec2 texCoord; - -uniform vec3 finalColor; - -out vec4 fragColor; - -void main() -{ - vec3 n = normalize(normal); - vec3 s = normalize(vec3(1.0, 0.0, 1.0) - position); - vec3 v = normalize(-position); - - float diffuse = max(dot(s, n), 0.0); - - if (diffuse > 0.95) - diffuse = 1.0; - else if (diffuse > 0.5) - diffuse = 0.5; - else if (diffuse > 0.25) - diffuse = 0.25; - else - diffuse = 0.1; - - fragColor = vec4(diffuse * finalColor, 1.0); -} diff --git a/examples/qt3d/simple-shaders-qml/simple-shader.vert b/examples/qt3d/simple-shaders-qml/simple-shader.vert deleted file mode 100644 index ab8e4a0af..000000000 --- a/examples/qt3d/simple-shaders-qml/simple-shader.vert +++ /dev/null @@ -1,21 +0,0 @@ -#version 150 - -in vec3 vertexPosition; -in vec3 vertexNormal; -in vec2 vertexTexCoord; - -out vec3 position; -out vec3 normal; -out vec2 texCoord; - -uniform mat4 modelView; -uniform mat3 modelViewNormal; -uniform mat4 mvp; - -void main() -{ - normal = normalize(modelViewNormal * vertexNormal); - position = vec3(modelView * vec4(vertexPosition, 1.0)); - texCoord = vertexTexCoord; - gl_Position = mvp * vec4(vertexPosition, 1.0); -} diff --git a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro b/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro deleted file mode 100644 index e7c398b4b..000000000 --- a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro +++ /dev/null @@ -1,16 +0,0 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras - -SOURCES += \ - main.cpp - -OTHER_FILES += \ - main.qml \ - simple-shader.vert \ - simple-shader.frag - -RESOURCES += \ - simple-shaders-qml.qrc diff --git a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc b/examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc deleted file mode 100644 index d0469bcb4..000000000 --- a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - main.qml - simple-shader.frag - simple-shader.vert - - -- cgit v1.2.3